on xenial help sign in
Command line parser works for fullscreen option
commit2b30e6edd2f760f7b27588b052b7a6d7717b725c authorJosh Arenson <joshua.arenson@canonical.com> dateMon 21 Apr 2014, 16:05 (12 years ago) parenta07cba7
1 file changed+13−1
src/main.cpp+13−1
src/main.cpp+13−1
@@ -18,6 +18,7 @@
1818 */
1919
2020// Qt
21+#include <QCommandLineParser>
2122#include <QtQuick/QQuickView>
2223#include <QtGui/QGuiApplication>
2324#include <QtQml/QQmlEngine>
@@ -43,6 +44,15 @@ int startShell(int argc, const char** argv, void* server)
4344
4445 QGuiApplication::setApplicationName("Unity 8");
4546 QGuiApplication *application;
47+
48+ QCommandLineParser parser;
49+ parser.setApplicationDescription("Application Description Goes Here!");
50+ parser.addHelpOption();
51+
52+ QCommandLineOption fullscreenOption (QStringList() << "f" << "fullscreen",
53+ "Run in fullscreen");
54+ parser.addOption(fullscreenOption);
55+
4656 if (isUbuntuMirServer) {
4757 QLibrary unityMir("unity-mir", 1);
4858 unityMir.load();
@@ -58,6 +68,8 @@ int startShell(int argc, const char** argv, void* server)
5868 } else {
5969 application = new QGuiApplication(argc, (char**)argv);
6070 }
71+
72+ parser.process(*application);
6173
6274 QString indicatorProfile = qgetenv("UNITY_INDICATOR_PROFILE");
6375 if (indicatorProfile.isEmpty()) {
@@ -125,7 +137,7 @@ int startShell(int argc, const char** argv, void* server)
125137 view->setSource(source);
126138 view->setColor("transparent");
127139
128− if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || args.contains(QLatin1String("-fullscreen"))) {
140+ if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || parser.isSet(fullscreenOption)) {
129141 view->showFullScreen();
130142 } else {
131143 view->show();