From 4fcedcbc46515ba7285f61d7a7b1f2065229fab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Fri, 23 Aug 2013 01:06:05 +0200 Subject: [PATCH] Port to QCommandLineParser --- src/shell/CMakeLists.txt | 1 + src/shell/main.cpp | 33 +++++++++++++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt index 883bf6161..14f67e519 100644 --- a/src/shell/CMakeLists.txt +++ b/src/shell/CMakeLists.txt @@ -86,6 +86,7 @@ target_link_libraries(plasma-shell kdeclarative KF5::KI18n KF5::XmlGui + kdeqt5staging ) diff --git a/src/shell/main.cpp b/src/shell/main.cpp index 7a399384e..e2c44e4c1 100644 --- a/src/shell/main.cpp +++ b/src/shell/main.cpp @@ -17,11 +17,9 @@ */ #include +#include -#include -#include #include - #include "desktopcorona.h" #include "shellpluginloader.h" @@ -33,25 +31,24 @@ static const char version[] = "2.0"; int main(int argc, char** argv) { - KAboutData aboutData("plasma-shell", QByteArray(), i18n("Plasma Shell"), - version, i18n(description), KAboutData::License_GPL, - i18n("Copyright 2012-2013, The KDE Team")); - aboutData.addAuthor(i18n("Marco Martin"), - i18n("Author and maintainer"), - "mart@kde.org"); - KCmdLineArgs::init(argc, argv, - "plasma-shell", "", - ki18n("Plasma Shell"), - version); + QApplication app(argc, argv); + app.setApplicationVersion(version); - //enable the QML debugger only if -qmljsdebugger is passed as a command line arg + QCommandLineOption dbg = QCommandLineOption(QStringList() << QStringLiteral("d") << QStringLiteral("qmljsdebugger"), + QStringLiteral("Enable QML Javascript debugger")); + + QCommandLineParser parser; + parser.addVersionOption(); + parser.addHelpOption(description); + parser.addOption(dbg); + parser.process(app); + + //enable the QML debugger only if --qmljsdebugger (or -d) is passed as a command line arg //this must be called before the QApplication constructor - if (KCmdLineArgs::parsedArgs("qt")->isSet("qmljsdebugger")) { + if (parser.isSet(dbg)) { QQmlDebuggingEnabler enabler; } - QApplication app(argc, argv); - Plasma::PluginLoader::setPluginLoader(new ShellPluginLoader); DesktopCorona *corona = new DesktopCorona(); corona->loadLayout(); @@ -60,6 +57,6 @@ int main(int argc, char** argv) } corona->processUpdateScripts(); corona->checkScreens(); - + return app.exec(); }