on xenial help sign in
Add error text if user drags too far
709e634Michael Terry
qml/Shell.qml+1−1
@@ -847,7 +847,7 @@ Item {
847 id: tutorial
847 id: tutorial
848 objectName: "tutorial"
848 objectName: "tutorial"
849 visible: AccountsService.demoEdges
849 visible: AccountsService.demoEdges
850− paused: Powerd.status === Powerd.Off || LightDM.Greeter.active
850+ paused: LightDM.Greeter.active
851 launcher: launcher
851 launcher: launcher
852 panel: panel
852 panel: panel
853 stages: stages
853 stages: stages
qml/Tutorial/Tutorial.qml+3−13
@@ -26,7 +26,7 @@ Item {
26 property Item overlay
26 property Item overlay
27
27
28 readonly property bool launcherEnabled: !running ||
28 readonly property bool launcherEnabled: !running ||
29− loader.target === leftComponent
29+ (!paused && loader.target === leftComponent)
30 readonly property bool stagesEnabled: !running
30 readonly property bool stagesEnabled: !running
31 readonly property bool panelEnabled: !running
31 readonly property bool panelEnabled: !running
32 readonly property bool panelContentEnabled: !running
32 readonly property bool panelContentEnabled: !running
@@ -63,18 +63,6 @@ Item {
63 }
63 }
64 }
64 }
65
65
66− Connections {
67− target: root.launcher
68−
69− onStateChanged: {
70− if (launcher.state === "visible") {
71− if (loader.target === leftComponent) {
72− loader.load(leftFinishComponent);
73− }
74− }
75− }
76− }
77−
78 Loader {
66 Loader {
79 id: loader
67 id: loader
80
68
@@ -125,6 +113,8 @@ Item {
125 parent: root.stages
113 parent: root.stages
126 anchors.fill: parent
114 anchors.fill: parent
127 launcher: root.launcher
115 launcher: root.launcher
116+
117+ onFinished: loader.load(leftFinishComponent)
128 }
118 }
129 }
119 }
130
120
qml/Tutorial/TutorialLeft.qml+25
@@ -25,9 +25,34 @@ TutorialPage {
25
25
26 title: i18n.tr("Open the launcher")
26 title: i18n.tr("Open the launcher")
27 text: i18n.tr("Short swipe from the left edge.")
27 text: i18n.tr("Short swipe from the left edge.")
28+ errorText: i18n.tr("Too far!") + "\n" + i18n.tr("Try again.")
28
29
29 textXOffset: root.launcher.visibleWidth
30 textXOffset: root.launcher.visibleWidth
30
31
32+ Connections {
33+ target: root.launcher
34+
35+ property bool maybeDone
36+
37+ onStateChanged: {
38+ if (launcher.state === "visible") {
39+ maybeDone = true;
40+ }
41+ }
42+
43+ onDash: {
44+ maybeDone = false;
45+ root.showError();
46+ root.launcher.hide();
47+ }
48+
49+ onDragDistanceChanged: {
50+ if (root.launcher.dragDistance === 0 && maybeDone) {
51+ root.hide();
52+ }
53+ }
54+ }
55+
31 Timer {
56 Timer {
32 id: teaseTimer
57 id: teaseTimer
33 interval: UbuntuAnimation.SleepyDuration
58 interval: UbuntuAnimation.SleepyDuration
qml/Tutorial/TutorialPage.qml+61−2
@@ -27,6 +27,9 @@ Showable {
27 // This is the block of text displayed below the header
27 // This is the block of text displayed below the header
28 property alias text: textLabel.text
28 property alias text: textLabel.text
29
29
30+ // This is the block of text displayed during an error
31+ property alias errorText: errorLabel.text
32+
30 // Whether animations are paused
33 // Whether animations are paused
31 property bool paused
34 property bool paused
32
35
@@ -57,6 +60,10 @@ Showable {
57
60
58 signal finished()
61 signal finished()
59
62
63+ function showError() {
64+ errorTimer.start();
65+ }
66+
60 ////
67 ////
61
68
62 shown: false
69 shown: false
@@ -99,6 +106,11 @@ Showable {
99 }
106 }
100 }
107 }
101
108
109+ Timer {
110+ id: errorTimer
111+ interval: 3500
112+ }
113+
102 MouseArea { // eat any errant presses
114 MouseArea { // eat any errant presses
103 id: mouseArea
115 id: mouseArea
104 anchors.fill: parent
116 anchors.fill: parent
@@ -128,7 +140,6 @@ Showable {
128 wrapMode: Text.Wrap
140 wrapMode: Text.Wrap
129 font.weight: Font.Light
141 font.weight: Font.Light
130 font.pixelSize: units.gu(3.5)
142 font.pixelSize: units.gu(3.5)
131− text: root.title
132 }
143 }
133
144
134 Label {
145 Label {
@@ -144,7 +155,22 @@ Showable {
144 wrapMode: Text.Wrap
155 wrapMode: Text.Wrap
145 font.weight: Font.Light
156 font.weight: Font.Light
146 font.pixelSize: units.gu(2.5)
157 font.pixelSize: units.gu(2.5)
147− text: root.text
158+ }
159+
160+ Label {
161+ id: errorLabel
162+ anchors {
163+ top: parent.verticalCenter
164+ topMargin: d.verticalOffset + root.textYOffset
165+ left: parent.left
166+ leftMargin: d.sideMargin + d.textXOffset
167+ }
168+ width: parent.width - d.sideMargin * 2
169+ horizontalAlignment: Text.AlignLeft
170+ wrapMode: Text.Wrap
171+ font.weight: Font.Light
172+ font.pixelSize: units.gu(3.5)
173+ opacity: 0
148 }
174 }
149
175
150 // A place for subclasses to add extra widgets
176 // A place for subclasses to add extra widgets
@@ -153,4 +179,37 @@ Showable {
153 anchors.fill: parent
179 anchors.fill: parent
154 }
180 }
155 }
181 }
182+
183+ states: State {
184+ name: "errorState"
185+ when: errorTimer.running
186+ PropertyChanges { target: titleLabel; opacity: 0 }
187+ PropertyChanges { target: textLabel; opacity: 0 }
188+ PropertyChanges { target: errorLabel; opacity: 1 }
189+ }
190+
191+ transitions: Transition {
192+ to: "errorState"
193+ reversible: true
194+ SequentialAnimation {
195+ id: showErrorAnimation
196+ ParallelAnimation {
197+ StandardAnimation {
198+ target: titleLabel
199+ property: "opacity"
200+ duration: UbuntuAnimation.BriskDuration
201+ }
202+ StandardAnimation {
203+ target: textLabel
204+ property: "opacity"
205+ duration: UbuntuAnimation.BriskDuration
206+ }
207+ }
208+ StandardAnimation {
209+ target: errorLabel
210+ property: "opacity"
211+ duration: UbuntuAnimation.BriskDuration
212+ }
213+ }
214+ }
156}
215}