File: xdp-main.cpp

package info (click to toggle)
kpipewire 6.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 996 kB
  • sloc: cpp: 6,204; xml: 133; makefile: 5; sh: 1
file content (46 lines) | stat: -rw-r--r-- 1,615 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
    SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#include "RecordMe.h"
#include <QCommandLineParser>
#include <QGuiApplication>

int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);

    {
        QCommandLineParser parser;
        QCommandLineOption duration(QStringLiteral("duration"), QStringLiteral("seconds length of the video"), QStringLiteral("duration"));
        parser.addOption(duration);

        QCommandLineOption persistMode(QStringLiteral("persistMode"),
                                       QStringLiteral("persistMode. Integer value as per the DBus specification"),
                                       QStringLiteral("persistMode"));
        parser.addOption(persistMode);

        QCommandLineOption restoreToken(QStringLiteral("restoreToken"), QStringLiteral("Restore token"), QStringLiteral("restoreToken"));
        parser.addOption(restoreToken);

        parser.addHelpOption();
        parser.process(app);

        RecordMe *me = new RecordMe(&app);
        if (parser.isSet(duration)) {
            me->setDuration(parser.value(duration).toInt() * 1000);
        }
        if (parser.isSet(persistMode)) {
            int rawPersitValue = parser.value(persistMode).toInt();
            auto mode = static_cast<RecordMe::PersistMode>(rawPersitValue);
            me->setPersistMode(mode);
        }
        if (parser.isSet(restoreToken)) {
            me->setRestoreToken(parser.value(restoreToken));
        }
    }

    return app.exec();
}