on xenial help sign in
Merge lp:~dandrader/unity8/unityCommandLineParser
d63d590Daniel d'Andrada
src/ApplicationArguments.h+3−3
@@ -31,9 +31,9 @@ public:
31 ApplicationArguments(QObject *parent = nullptr);
31 ApplicationArguments(QObject *parent = nullptr);
32
32
33 void setDeviceName(QString deviceName) { m_deviceName = deviceName; }
33 void setDeviceName(QString deviceName) { m_deviceName = deviceName; }
34+
34− void setSize(int width, int height) {
35+ void setSize(const QSize &size) {
35− m_size.rwidth() = width;
36+ m_size = size;
36− m_size.rheight() = height;
37 }
37 }
38
38
39 Q_INVOKABLE int width() const { return m_size.width(); }
39 Q_INVOKABLE int width() const { return m_size.width(); }
src/Dash/main.cpp+1−1
@@ -65,7 +65,7 @@ int main(int argc, const char *argv[])
65 parser.value(windowGeometryOption).split('x').size() == 2)
65 parser.value(windowGeometryOption).split('x').size() == 2)
66 {
66 {
67 QStringList geom = parser.value(windowGeometryOption).split('x');
67 QStringList geom = parser.value(windowGeometryOption).split('x');
68− qmlArgs.setSize(geom.at(0).toInt(), geom.at(1).toInt());
68+ qmlArgs.setSize(QSize(geom.at(0).toInt(), geom.at(1).toInt()));
69 }
69 }
70
70
71 if (getenv("QT_LOAD_TESTABILITY")) {
71 if (getenv("QT_LOAD_TESTABILITY")) {
src/UnityCommandLineParser.cpp−5
@@ -49,10 +49,6 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
49 "DISCOURAGED: Please set QT_LOAD_TESTABILITY instead.\nLoad the testability driver");
49 "DISCOURAGED: Please set QT_LOAD_TESTABILITY instead.\nLoad the testability driver");
50 parser.addOption(testabilityOption);
50 parser.addOption(testabilityOption);
51
51
52− QCommandLineOption devicenameOption(QStringList() << "devicename",
53− "Specify the device name instead of letting Unity 8 find it out", "devicename", "");
54− parser.addOption(devicenameOption);
55−
56 QCommandLineOption modeOption("mode",
52 QCommandLineOption modeOption("mode",
57 "Whether to run greeter and/or shell [full-greeter, full-shell, greeter, shell]",
53 "Whether to run greeter and/or shell [full-greeter, full-shell, greeter, shell]",
58 "mode", "full-greeter");
54 "mode", "full-greeter");
@@ -77,7 +73,6 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
77 m_hasFrameless = parser.isSet(framelessOption);
73 m_hasFrameless = parser.isSet(framelessOption);
78 m_hasMouseToTouch = parser.isSet(mousetouchOption);
74 m_hasMouseToTouch = parser.isSet(mousetouchOption);
79 m_hasFullscreen = parser.isSet(fullscreenOption);
75 m_hasFullscreen = parser.isSet(fullscreenOption);
80− m_deviceName = parser.value(devicenameOption);
81 resolveMode(parser, modeOption);
76 resolveMode(parser, modeOption);
82}
77}
83
78
src/UnityCommandLineParser.h−2
@@ -30,7 +30,6 @@ public:
30 bool hasFrameless() const { return m_hasFrameless; }
30 bool hasFrameless() const { return m_hasFrameless; }
31 bool hasMouseToTouch() const { return m_hasMouseToTouch; }
31 bool hasMouseToTouch() const { return m_hasMouseToTouch; }
32 bool hasFullscreen() const { return m_hasFullscreen; }
32 bool hasFullscreen() const { return m_hasFullscreen; }
33− QString deviceName() const { return m_deviceName; }
34 QString mode() const { return m_mode; }
33 QString mode() const { return m_mode; }
35private:
34private:
36
35
@@ -45,7 +44,6 @@ private:
45 bool m_hasFrameless;
44 bool m_hasFrameless;
46 bool m_hasMouseToTouch;
45 bool m_hasMouseToTouch;
47 bool m_hasFullscreen;
46 bool m_hasFullscreen;
48− QString m_deviceName;
49 QString m_mode;
47 QString m_mode;
50};
48};
51
49
src/main.cpp+2−4
@@ -54,6 +54,8 @@ int main(int argc, const char *argv[])
54 UnityCommandLineParser parser(*application);
54 UnityCommandLineParser parser(*application);
55
55
56 ApplicationArguments qmlArgs;
56 ApplicationArguments qmlArgs;
57+ qmlArgs.setSize(parser.windowGeometry());
58+
57 if (!parser.deviceName().isEmpty()) {
59 if (!parser.deviceName().isEmpty()) {
58 qmlArgs.setDeviceName(parser.deviceName());
60 qmlArgs.setDeviceName(parser.deviceName());
59 } else {
61 } else {
@@ -94,10 +96,6 @@ int main(int argc, const char *argv[])
94 }
96 }
95 TouchRegistry touchRegistry;
97 TouchRegistry touchRegistry;
96 view->installEventFilter(&touchRegistry);
98 view->installEventFilter(&touchRegistry);
97− if (parser.windowGeometry().isValid()) {
98− view->setWidth(parser.windowGeometry().width());
99− view->setHeight(parser.windowGeometry().height());
100− }
101
99
102 // You will need this if you want to interact with touch-only components using a mouse
100 // You will need this if you want to interact with touch-only components using a mouse
103 // Needed only when manually testing on a desktop.
101 // Needed only when manually testing on a desktop.