File indexing completed on 2024-04-28 05:27:34

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 "PlasmaRecordMe.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         const QMap<QString, Screencasting::CursorMode> cursorOptions = {
0019             {QStringLiteral("hidden"), Screencasting::CursorMode::Hidden},
0020             {QStringLiteral("embedded"), Screencasting::CursorMode::Embedded},
0021             {QStringLiteral("metadata"), Screencasting::CursorMode::Metadata},
0022         };
0023 
0024         QCommandLineOption cursor(QStringLiteral("cursor"),
0025                                   QStringList(cursorOptions.keys()).join(QStringLiteral(", ")),
0026                                   QStringLiteral("mode"),
0027                                   QStringLiteral("metadata"));
0028 
0029         QCommandLineOption selection(QStringLiteral("selection"), QStringLiteral("Select a region to show"));
0030         parser.addPositionalArgument(QStringLiteral("source"), QStringLiteral("name of the output/window that you want to see"));
0031         parser.addOption(duration);
0032         parser.addOption(cursor);
0033         parser.addOption(selection);
0034         parser.addHelpOption();
0035         parser.process(app);
0036 
0037         PlasmaRecordMe *me = new PlasmaRecordMe(cursorOptions[parser.value(cursor).toLower()], parser.positionalArguments(), parser.isSet(selection), &app);
0038         if (parser.isSet(duration)) {
0039             me->setDuration(parser.value(duration).toInt() * 1000);
0040         }
0041     }
0042 
0043     return app.exec();
0044 }