on xenial help sign in
Fixes for dash as app
e9cd5c8Albert Astals
qml/Components/EdgeDemo.qml+15−15
@@ -24,13 +24,13 @@ Item {
24 property Item greeter
24 property Item greeter
25 property Item launcher
25 property Item launcher
26 property Item indicators
26 property Item indicators
27− property Item underlay
27+ property Item stages
28
28
29 property bool launcherEnabled: true
29 property bool launcherEnabled: true
30− property bool dashEnabled: true
30+ property bool stagesEnabled: true
31 property bool panelEnabled: true
31 property bool panelEnabled: true
32 property bool panelContentEnabled: true
32 property bool panelContentEnabled: true
33− property bool running: !launcherEnabled || !dashEnabled || !panelEnabled || !panelContentEnabled
33+ property bool running: !launcherEnabled || !stagesEnabled || !panelEnabled || !panelContentEnabled
34
34
35 property bool paused: false
35 property bool paused: false
36
36
@@ -58,7 +58,7 @@ Item {
58
58
59 function stopDemo() {
59 function stopDemo() {
60 launcherEnabled = true
60 launcherEnabled = true
61− dashEnabled = true
61+ stagesEnabled = true
62 panelEnabled = true
62 panelEnabled = true
63 panelContentEnabled = true
63 panelContentEnabled = true
64 if (d.rightEdgeDemo) d.rightEdgeDemo.destroy()
64 if (d.rightEdgeDemo) d.rightEdgeDemo.destroy()
@@ -74,11 +74,11 @@ Item {
74 }
74 }
75
75
76 launcherEnabled = false;
76 launcherEnabled = false;
77− dashEnabled = false;
77+ stagesEnabled = false;
78 panelEnabled = false;
78 panelEnabled = false;
79 panelContentEnabled = false;
79 panelContentEnabled = false;
80
80
81− // Begin with either greeter or dash, depending on which is visible
81+ // Begin with either greeter or top, depending on which is visible
82 if (greeter && greeter.shown) {
82 if (greeter && greeter.shown) {
83 startRightEdgeDemo()
83 startRightEdgeDemo()
84 } else {
84 } else {
@@ -138,12 +138,12 @@ Item {
138
138
139 function startTopEdgeDemo() {
139 function startTopEdgeDemo() {
140 demo.panelEnabled = true;
140 demo.panelEnabled = true;
141− if (demo.dash && demo.underlay) {
141+ if (demo.stages) {
142− d.topEdgeDemo = d.overlay.createObject(demo.underlay, {
142+ d.topEdgeDemo = d.overlay.createObject(demo.stages, {
143 "edge": "top",
143 "edge": "top",
144 "title": i18n.tr("Top edge"),
144 "title": i18n.tr("Top edge"),
145 "text": i18n.tr("Try swiping from the top edge to access the indicators"),
145 "text": i18n.tr("Try swiping from the top edge to access the indicators"),
146− "anchors.fill": demo.underlay,
146+ "anchors.fill": demo.stages,
147 });
147 });
148 }
148 }
149 if (d.topEdgeDemo) {
149 if (d.topEdgeDemo) {
@@ -192,12 +192,12 @@ Item {
192 function startLeftEdgeDemo() {
192 function startLeftEdgeDemo() {
193 demo.panelEnabled = false;
193 demo.panelEnabled = false;
194 demo.launcherEnabled = true;
194 demo.launcherEnabled = true;
195− if (demo.underlay) {
195+ if (demo.stages) {
196− d.leftEdgeDemo = d.overlay.createObject(demo.underlay, {
196+ d.leftEdgeDemo = d.overlay.createObject(demo.stages, {
197 "edge": "left",
197 "edge": "left",
198 "title": i18n.tr("Left edge"),
198 "title": i18n.tr("Left edge"),
199 "text": i18n.tr("Swipe from the left to reveal the launcher for quick access to apps"),
199 "text": i18n.tr("Swipe from the left to reveal the launcher for quick access to apps"),
200− "anchors.fill": demo.underlay,
200+ "anchors.fill": demo.stages,
201 });
201 });
202 }
202 }
203 if (d.leftEdgeDemo) {
203 if (d.leftEdgeDemo) {
@@ -220,12 +220,12 @@ Item {
220
220
221 function startFinalEdgeDemo() {
221 function startFinalEdgeDemo() {
222 demo.launcherEnabled = false;
222 demo.launcherEnabled = false;
223− if (demo.underlay) {
223+ if (demo.stages) {
224− d.finalEdgeDemo = d.overlay.createObject(demo.underlay, {
224+ d.finalEdgeDemo = d.overlay.createObject(demo.stages, {
225 "edge": "none",
225 "edge": "none",
226 "title": i18n.tr("Well done"),
226 "title": i18n.tr("Well done"),
227 "text": i18n.tr("You have now mastered the edge gestures and can start using the phone<br><br>Tap on the screen to start"),
227 "text": i18n.tr("You have now mastered the edge gestures and can start using the phone<br><br>Tap on the screen to start"),
228− "anchors.fill": demo.underlay,
228+ "anchors.fill": demo.stages,
229 "showSkip": false,
229 "showSkip": false,
230 });
230 });
231 }
231 }
qml/Dash/Dash.qml+8
@@ -73,6 +73,14 @@ Showable {
73 id: scopes
73 id: scopes
74 }
74 }
75
75
76+ Image {
77+ anchors.fill: parent
78+ source: parent.width > parent.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png"
79+ fillMode: Image.PreserveAspectCrop
80+ horizontalAlignment: Image.AlignRight
81+ verticalAlignment: Image.AlignTop
82+ }
83+
76 DashContent {
84 DashContent {
77 id: dashContent
85 id: dashContent
78 objectName: "dashContent"
86 objectName: "dashContent"
qml/Dash/DashApplication.qml+6
@@ -23,6 +23,12 @@ MainView {
23
23
24 useDeprecatedToolbar: false
24 useDeprecatedToolbar: false
25
25
26+ Binding {
27+ target: i18n
28+ property: "domain"
29+ value: "unity8"
30+ }
31+
26 Dash {
32 Dash {
27 anchors.fill: parent
33 anchors.fill: parent
28 }
34 }
qml/Greeter/Greeter.qml+1−1
@@ -70,7 +70,7 @@ Showable {
70 DraggingArea {
70 DraggingArea {
71 id: dragHandle
71 id: dragHandle
72 anchors.fill: parent
72 anchors.fill: parent
73− enabled: (greeter.narrowMode || !greeter.locked) && greeter.enabled
73+ enabled: (greeter.narrowMode || !greeter.locked) && greeter.enabled && greeter.shown
74 orientation: Qt.Horizontal
74 orientation: Qt.Horizontal
75 propagateComposedEvents: true
75 propagateComposedEvents: true
76
76
qml/Shell.qml+3−22
@@ -112,25 +112,6 @@ Item {
112 }
112 }
113 }
113 }
114
114
115− Item {
116− id: underlay
117− objectName: "underlay"
118− anchors.fill: parent
119−
120− // Whether the underlay is fully covered by opaque UI elements.
121− property bool fullyCovered: (panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth)
122− || stages.fullyShown || greeterWrapper.fullyShown
123− visible: !fullyCovered
124−
125− Image {
126− anchors.fill: underlay
127− source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
128− fillMode: Image.PreserveAspectCrop
129− horizontalAlignment: Image.AlignRight
130− verticalAlignment: Image.AlignTop
131− }
132− }
133−
134 Item {
115 Item {
135 id: stages
116 id: stages
136 objectName: "stages"
117 objectName: "stages"
@@ -186,12 +167,12 @@ Item {
186 Binding {
167 Binding {
187 target: applicationsDisplayLoader.item
168 target: applicationsDisplayLoader.item
188 property: "interactive"
169 property: "interactive"
189− value: !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
170+ value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
190 }
171 }
191 Binding {
172 Binding {
192 target: applicationsDisplayLoader.item
173 target: applicationsDisplayLoader.item
193 property: "spreadEnabled"
174 property: "spreadEnabled"
194− value: greeter.fakeActiveForApp === "" // to support emergency dialer hack
175+ value: edgeDemo.stagesEnabled && greeter.fakeActiveForApp === "" // to support emergency dialer hack
195 }
176 }
196 Binding {
177 Binding {
197 target: applicationsDisplayLoader.item
178 target: applicationsDisplayLoader.item
@@ -580,7 +561,7 @@ Item {
580 greeter: greeter
561 greeter: greeter
581 launcher: launcher
562 launcher: launcher
582 indicators: panel.indicators
563 indicators: panel.indicators
583− underlay: underlay
564+ stages: stages
584 }
565 }
585
566
586 Connections {
567 Connections {
src/Dash/CMakeLists.txt+1
@@ -1,5 +1,6 @@
1set(DASH_SRCS
1set(DASH_SRCS
2 main.cpp
2 main.cpp
3+ ../MouseTouchAdaptor.cpp
3)
4)
4
5
5add_executable(unity8-dash ${DASH_SRCS})
6add_executable(unity8-dash ${DASH_SRCS})
src/Dash/main.cpp+26−4
@@ -24,8 +24,10 @@
24#include <QDebug>
24#include <QDebug>
25#include <QCommandLineParser>
25#include <QCommandLineParser>
26#include <QLibrary>
26#include <QLibrary>
27+#include <libintl.h>
27
28
28#include <paths.h>
29#include <paths.h>
30+#include "../MouseTouchAdaptor.h"
29
31
30int main(int argc, const char *argv[])
32int main(int argc, const char *argv[])
31{
33{
@@ -35,11 +37,21 @@ int main(int argc, const char *argv[])
35 parser.setApplicationDescription("Description: Unity 8 Shell Dash");
37 parser.setApplicationDescription("Description: Unity 8 Shell Dash");
36 parser.addHelpOption();
38 parser.addHelpOption();
37
39
38− QCommandLineOption testabilityOption("testability",
40+ QCommandLineOption mousetouchOption("mousetouch",
39− "Load the testability driver (Alternatively export QT_LOAD_TESTABILITY");
41+ "Allow the mouse to provide touch input");
40− parser.addOption(testabilityOption);
42+ parser.addOption(mousetouchOption);
41
43
44+ // FIXME Remove once we drop the need of the hint
45+ QCommandLineOption desktopFileHintOption("desktop_file_hint",
46+ "The desktop_file_hint option for QtMir", "hint_file");
47+ parser.addOption(desktopFileHintOption);
48+
49+ // Treat args with single dashes the same as arguments with two dashes
50+ // Ex: -fullscreen == --fullscreen
51+ parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
52+ parser.process(*application);
53+
42− if (parser.isSet(testabilityOption) || getenv("QT_LOAD_TESTABILITY")) {
54+ if (getenv("QT_LOAD_TESTABILITY")) {
43 QLibrary testLib(QLatin1String("qttestability"));
55 QLibrary testLib(QLatin1String("qttestability"));
44 if (testLib.load()) {
56 if (testLib.load()) {
45 typedef void (*TasInitialize)(void);
57 typedef void (*TasInitialize)(void);
@@ -54,10 +66,20 @@ int main(int argc, const char *argv[])
54 }
66 }
55 }
67 }
56
68
69+ bindtextdomain("unity8", translationDirectory().toUtf8().data());
70+
57 QQuickView* view = new QQuickView();
71 QQuickView* view = new QQuickView();
58 view->setResizeMode(QQuickView::SizeRootObjectToView);
72 view->setResizeMode(QQuickView::SizeRootObjectToView);
59 view->setTitle("Unity Dash");
73 view->setTitle("Unity Dash");
60
74
75+ // You will need this if you want to interact with touch-only components using a mouse
76+ // Needed only when manually testing on a desktop.
77+ MouseTouchAdaptor *mouseTouchAdaptor = 0;
78+ if (parser.isSet(mousetouchOption)) {
79+ mouseTouchAdaptor = new MouseTouchAdaptor;
80+ application->installNativeEventFilter(mouseTouchAdaptor);
81+ }
82+
61 QUrl source(::qmlDirectory()+"Dash/DashApplication.qml");
83 QUrl source(::qmlDirectory()+"Dash/DashApplication.qml");
62 prependImportPaths(view->engine(), ::overrideImportPaths());
84 prependImportPaths(view->engine(), ::overrideImportPaths());
63 appendImportPaths(view->engine(), ::fallbackImportPaths());
85 appendImportPaths(view->engine(), ::fallbackImportPaths());