File indexing completed on 2024-05-12 05:36:15

0001 // SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #include <QCommandLineParser>
0005 #include <QCoreApplication>
0006 #include <QIcon>
0007 #include <QQmlApplicationEngine>
0008 #include <QQmlContext>
0009 #include <QString>
0010 
0011 #include <KAboutData>
0012 #include <KLocalizedString>
0013 
0014 #include "settings.h"
0015 #include "version.h"
0016 
0017 using namespace Qt::Literals::StringLiterals;
0018 
0019 QCommandLineParser *createParser()
0020 {
0021     QCommandLineParser *parser = new QCommandLineParser;
0022     parser->addOption(QCommandLineOption(u"apply-settings"_s, u"Applies the correct system settings for the current environment."_s));
0023     parser->addVersionOption();
0024     parser->addHelpOption();
0025     return parser;
0026 }
0027 
0028 int main(int argc, char *argv[])
0029 {
0030     QCoreApplication app(argc, argv);
0031 
0032     // parse command
0033     QScopedPointer<QCommandLineParser> parser{createParser()};
0034     parser->process(app);
0035 
0036     // start wizard
0037     KLocalizedString::setApplicationDomain("plasma-mobile-envmanager");
0038     QCoreApplication::setApplicationName(u"plasma-mobile-envmanager"_s);
0039     QCoreApplication::setApplicationVersion(QStringLiteral(PLASMA_MOBILE_VERSION_STRING));
0040     QCoreApplication::setOrganizationDomain(u"kde.org"_s);
0041 
0042     // apply configuration
0043     if (parser->isSet(u"apply-settings"_s)) {
0044         Settings::self().applyConfiguration();
0045     } else {
0046         parser->showHelp();
0047     }
0048 
0049     return 0;
0050 }