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 47 48 49 50
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QIcon>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QString>
#include <KAboutData>
#include <KLocalizedString>
#include "settings.h"
#include "version.h"
using namespace Qt::Literals::StringLiterals;
QCommandLineParser *createParser()
{
QCommandLineParser *parser = new QCommandLineParser;
parser->addOption(QCommandLineOption(u"apply-settings"_s, u"Applies the correct system settings for the current environment."_s));
parser->addVersionOption();
parser->addHelpOption();
return parser;
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
// parse command
QScopedPointer<QCommandLineParser> parser{createParser()};
parser->process(app);
// start wizard
KLocalizedString::setApplicationDomain("plasma-mobile-envmanager");
QCoreApplication::setApplicationName(u"plasma-mobile-envmanager"_s);
QCoreApplication::setApplicationVersion(QStringLiteral(PLASMA_MOBILE_VERSION_STRING));
QCoreApplication::setOrganizationDomain(u"kde.org"_s);
// apply configuration
if (parser->isSet(u"apply-settings"_s)) {
Settings::self().applyConfiguration();
} else {
parser->showHelp();
}
return 0;
}
|