File indexing completed on 2024-04-28 05:27:35
0001 /* 0002 SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "RecordMe.h" 0008 #include <QCommandLineParser> 0009 #include <QGuiApplication> 0010 0011 int main(int argc, char **argv) 0012 { 0013 QGuiApplication app(argc, argv); 0014 0015 { 0016 QCommandLineParser parser; 0017 QCommandLineOption duration(QStringLiteral("duration"), QStringLiteral("seconds length of the video"), QStringLiteral("duration")); 0018 parser.addOption(duration); 0019 0020 QCommandLineOption persistMode(QStringLiteral("persistMode"), 0021 QStringLiteral("persistMode. Integer value as per the DBus specification"), 0022 QStringLiteral("persistMode")); 0023 parser.addOption(persistMode); 0024 0025 QCommandLineOption restoreToken(QStringLiteral("restoreToken"), QStringLiteral("Restore token"), QStringLiteral("restoreToken")); 0026 parser.addOption(restoreToken); 0027 0028 parser.addHelpOption(); 0029 parser.process(app); 0030 0031 RecordMe *me = new RecordMe(&app); 0032 if (parser.isSet(duration)) { 0033 me->setDuration(parser.value(duration).toInt() * 1000); 0034 } 0035 if (parser.isSet(persistMode)) { 0036 int rawPersitValue = parser.value(persistMode).toInt(); 0037 auto mode = static_cast<RecordMe::PersistMode>(rawPersitValue); 0038 me->setPersistMode(mode); 0039 } 0040 if (parser.isSet(restoreToken)) { 0041 me->setRestoreToken(parser.value(restoreToken)); 0042 } 0043 } 0044 0045 return app.exec(); 0046 }