on xenial help sign in
Command line parser works for fullscreen option
2b30e6eJosh Arenson
src/main.cpp+13−1
@@ -18,6 +18,7 @@
18 */
18 */
19
19
20// Qt
20// Qt
21+#include <QCommandLineParser>
21#include <QtQuick/QQuickView>
22#include <QtQuick/QQuickView>
22#include <QtGui/QGuiApplication>
23#include <QtGui/QGuiApplication>
23#include <QtQml/QQmlEngine>
24#include <QtQml/QQmlEngine>
@@ -43,6 +44,15 @@ int startShell(int argc, const char** argv, void* server)
43
44
44 QGuiApplication::setApplicationName("Unity 8");
45 QGuiApplication::setApplicationName("Unity 8");
45 QGuiApplication *application;
46 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+
46 if (isUbuntuMirServer) {
56 if (isUbuntuMirServer) {
47 QLibrary unityMir("unity-mir", 1);
57 QLibrary unityMir("unity-mir", 1);
48 unityMir.load();
58 unityMir.load();
@@ -58,6 +68,8 @@ int startShell(int argc, const char** argv, void* server)
58 } else {
68 } else {
59 application = new QGuiApplication(argc, (char**)argv);
69 application = new QGuiApplication(argc, (char**)argv);
60 }
70 }
71+
72+ parser.process(*application);
61
73
62 QString indicatorProfile = qgetenv("UNITY_INDICATOR_PROFILE");
74 QString indicatorProfile = qgetenv("UNITY_INDICATOR_PROFILE");
63 if (indicatorProfile.isEmpty()) {
75 if (indicatorProfile.isEmpty()) {
@@ -125,7 +137,7 @@ int startShell(int argc, const char** argv, void* server)
125 view->setSource(source);
137 view->setSource(source);
126 view->setColor("transparent");
138 view->setColor("transparent");
127
139
128− if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || args.contains(QLatin1String("-fullscreen"))) {
140+ if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || parser.isSet(fullscreenOption)) {
129 view->showFullScreen();
141 view->showFullScreen();
130 } else {
142 } else {
131 view->show();
143 view->show();