on xenial help sign in
Fix some nits from design
commit84adc8acf6a38e5669070a9dcd9ee4d9fffb48c1 authorMichael Terry <michael.terry@canonical.com> dateTue 4 Nov 2014, 15:05 (12 years ago) parent92cdeaf
9 files changed+130−60
qml/Launcher/Launcher.qml+16−8 qml/Shell.qml+3 qml/Tutorial/Bar.qml+2−2 qml/Tutorial/Tutorial.qml+61−35 qml/Tutorial/TutorialIntro.qml+5−1 qml/Tutorial/TutorialLeftFinish.qml+1−1 qml/Tutorial/TutorialLeftRelease.qml+24 qml/Tutorial/TutorialPage.qml+7−2 tests/qmltests/Tutorial/tst_Tutorial.qml+11−11
qml/Launcher/Launcher.qml+16−8
@@ -24,6 +24,8 @@ Item {
2424 id: root
2525
2626 property bool available: true // can be used to disable all interactions
27+ property bool shadeBackground: true // can be used to disable background shade when launcher is visible
28+ property bool preventHiding: false
2729
2830 property int panelWidth: units.gu(8)
2931 property int dragAreaWidth: units.gu(1)
@@ -42,6 +44,18 @@ Item {
4244 // emitted when the dash icon in the launcher has been tapped
4345 signal showDashHome()
4446
47+ QtObject {
48+ id: d
49+
50+ property bool preventHiding: root.preventHiding || panel.preventHiding
51+
52+ onPreventHidingChanged: {
53+ if (dismissTimer.running) {
54+ dismissTimer.restart();
55+ }
56+ }
57+ }
58+
4559 onStateChanged: {
4660 if (state == "") {
4761 dismissTimer.stop()
@@ -79,7 +93,7 @@ Item {
7993 objectName: "dismissTimer"
8094 interval: 5000
8195 onTriggered: {
82− if (!panel.preventHiding) {
96+ if (!d.preventHiding) {
8397 root.state = ""
8498 } else {
8599 dismissTimer.restart()
@@ -167,7 +181,7 @@ Item {
167181 id: backgroundShade
168182 anchors.fill: parent
169183 color: "black"
170− opacity: root.state == "visible" ? 0.6 : 0
184+ opacity: root.shadeBackground && root.state == "visible" ? 0.6 : 0
171185
172186 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.BriskDuration } }
173187 }
@@ -196,12 +210,6 @@ Item {
196210 root.showDashHome();
197211 }
198212
199− onPreventHidingChanged: {
200− if (dismissTimer.running) {
201− dismissTimer.restart();
202− }
203− }
204−
205213 Behavior on x {
206214 enabled: !dragArea.dragging && !launcherDragArea.drag.active && panel.animate;
207215 NumberAnimation {
qml/Shell.qml+3
@@ -699,6 +699,8 @@ Item {
699699 width: parent.width
700700 dragAreaWidth: shell.edgeSize
701701 available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && !greeter.hasLockedApp
702+ shadeBackground: !edgeDemo.running
703+ preventHiding: edgeDemo.running
702704
703705 onShowDashHome: showHome()
704706 onDash: showDash()
@@ -795,6 +797,7 @@ Item {
795797 launcher: launcher
796798 panel: panel
797799 stages: stages
800+ overlay: overlay
798801
799802 onFinished: AccountsService.demoEdges = false
800803 }
qml/Tutorial/Bar.qml+2−2
@@ -42,7 +42,7 @@ Item {
4242 gradient: Gradient {
4343 GradientStop {
4444 position: 0.0
45− color: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4) // UbuntuColors.orange, but transparent
45+ color: UbuntuColors.orange
4646 }
4747 GradientStop {
4848 position: 1.0
@@ -78,7 +78,7 @@ Item {
7878 id: hintAnimation
7979 loops: Animation.Infinite
8080 running: root.animating && root.visible
81− property double maxGlow: units.dp(20)
81+ property double maxGlow: units.gu(4)
8282 property int duration: UbuntuAnimation.SleepyDuration
8383
8484 StandardAnimation {
qml/Tutorial/Tutorial.qml+61−35
@@ -23,10 +23,12 @@ Item {
2323 property Item launcher
2424 property Item panel
2525 property Item stages
26+ property Item overlay
2627
2728 readonly property bool launcherEnabled: !running ||
2829 loader.sourceComponent === leftComponent ||
29− loader.sourceComponent === leftFinishComponent
30+ loader.sourceComponent === leftFinishComponent ||
31+ loader.sourceComponent === leftReleaseComponent
3032 readonly property bool stagesEnabled: !running
3133 readonly property bool panelEnabled: !running ||
3234 loader.sourceComponent === topComponent ||
@@ -36,8 +38,6 @@ Item {
3638
3739 property bool paused: false
3840
39− property int readingDelay: 3500
40−
4141 signal finished()
4242
4343 function finish() {
@@ -72,14 +72,14 @@ Item {
7272 target: root.panel.indicators
7373
7474 onFullyOpenedChanged: {
75− if (loader.sourceComponent === topComponent &&
75+ if (loader.target === topComponent &&
7676 root.panel.indicators.fullyOpened) {
7777 loader.load(topFinishComponent);
7878 }
7979 }
8080
8181 onPartiallyOpenedChanged: {
82− if (loader.sourceComponent === topFinishComponent &&
82+ if (loader.target === topFinishComponent &&
8383 !root.panel.indicators.partiallyOpened &&
8484 !root.panel.indicators.fullyOpened) {
8585 loader.load(leftComponent);
@@ -91,28 +91,29 @@ Item {
9191 target: root.launcher
9292
9393 onProgressChanged: {
94− if (loader.sourceComponent === leftComponent &&
95− launcher.progress > 0) {
96− loader.load(leftFinishComponent);
94+ if (loader.target === leftComponent && launcher.progress > 0) {
95+ loader.load(leftReleaseComponent);
9796 }
9897 }
9998
10099 onShownChanged: {
101− // This stanza is necessary because user might have dragged launcher
102− // far enough to trigger the progress check above, but then dragged
103− // it back into its original position.
104− if (loader.sourceComponent === leftFinishComponent &&
105− !launcher.shown) {
100+ // This stanza is necessary because user might have dragged the
101+ // launcher far enough to trigger the progress check above, but
102+ // then dragged it back into its original position.
103+ if (loader.target === leftReleaseComponent && !launcher.shown) {
106104 loader.load(null);
107105 }
108106 }
109107
110108 onStateChanged: {
111− if ((loader.sourceComponent === leftComponent || // happens if user didn't drag past launcher
112− loader.sourceComponent === leftFinishComponent) &&
113− launcher.state === "visible") {
114− loader.load(null);
115− launcher.hide();
109+ if (launcher.state === "visible") {
110+ if (loader.target === leftComponent) {
111+ // happens if user didn't drag past launcher
112+ loader.load(leftFinishComponent);
113+ } else if (loader.target === leftReleaseComponent) {
114+ loader.load(null);
115+ launcher.hide();
116+ }
116117 }
117118 }
118119 }
@@ -120,6 +121,16 @@ Item {
120121 Loader {
121122 id: loader
122123
124+ property Component target: {
125+ if (next) {
126+ return next;
127+ } else if (loader.item && loader.item.shown) {
128+ return sourceComponent;
129+ } else {
130+ return null;
131+ }
132+ }
133+
123134 property Component next: null
124135
125136 function load(comp) {
@@ -162,13 +173,7 @@ Item {
162173 objectName: "tutorialIntro"
163174 parent: root.stages
164175 anchors.fill: parent
165− backgroundFadesOut: false
166−
167− Timer {
168− interval: root.readingDelay
169− running: !root.paused
170− onTriggered: loader.load(topComponent)
171− }
176+ onShownChanged: if (!shown) loader.load(topComponent)
172177 }
173178 }
174179
@@ -176,11 +181,12 @@ Item {
176181 id: topComponent
177182 TutorialTop {
178183 objectName: "tutorialTop"
179− parent: root.stages
184+ parent: root.panel
180185 anchors.fill: parent
181− anchors.topMargin: root.panel.indicators.panelHeight
186+ mouseArea {
187+ anchors.topMargin: root.panel.indicators.minimizedPanelHeight
188+ }
182189 pageNumber: 1
183− backgroundFadesIn: false
184190 }
185191 }
186192
@@ -188,11 +194,14 @@ Item {
188194 id: topFinishComponent
189195 TutorialTopFinish {
190196 objectName: "tutorialTopFinish"
191− parent: root.panel.indicators
192− anchors.bottom: parent ? parent.content.bottom : undefined
193− anchors.left: parent ? parent.content.left : undefined
194− anchors.right: parent ? parent.content.right : undefined
195− height: root.stages.height
197+ parent: root.panel
198+ anchors.bottom: parent ? parent.bottom : undefined
199+ anchors.left: parent ? parent.left : undefined
200+ anchors.right: parent ? parent.right : undefined
201+ mouseArea {
202+ anchors.bottomMargin: root.panel.indicators.hideDragHandle.height
203+ }
204+ height: root.panel.height
196205 }
197206 }
198207
@@ -203,7 +212,17 @@ Item {
203212 parent: root.stages
204213 anchors.fill: parent
205214 pageNumber: 2
206− backgroundFadesOut: false
215+ }
216+ }
217+
218+ Component {
219+ id: leftReleaseComponent
220+ TutorialLeftRelease {
221+ objectName: "tutorialLeftRelease"
222+ parent: root.stages
223+ anchors.fill: parent
224+ textXOffset: root.launcher.panelWidth
225+ backgroundFadesOut: true
207226 }
208227 }
209228
@@ -214,7 +233,14 @@ Item {
214233 parent: root.stages
215234 anchors.fill: parent
216235 textXOffset: root.launcher.panelWidth
217− backgroundFadesIn: false
236+ backgroundFadesOut: true
237+ mouseArea {
238+ parent: root.overlay
239+ onClicked: {
240+ loader.load(null);
241+ root.launcher.hide();
242+ }
243+ }
218244 }
219245 }
220246}
qml/Tutorial/TutorialIntro.qml+5−1
@@ -21,5 +21,9 @@ TutorialPage {
2121 id: root
2222
2323 title: i18n.tr("Quick tips")
24− text: i18n.tr("The following tips are designed to help you learn how to use your phone…")
24+ text: i18n.tr("The following tips are designed to help you learn how to use your phone. <b>Tap</b> the screen to continue…")
25+
26+ mouseArea {
27+ onClicked: root.hide()
28+ }
2529}
qml/Tutorial/TutorialLeftFinish.qml+1−1
@@ -20,5 +20,5 @@ import Ubuntu.Components 1.1
2020TutorialPage {
2121 id: root
2222
23− text: i18n.tr("<b>Release</b> to hide the <b>Launcher</b> again and you’re all set!")
23+ text: i18n.tr("<b>Tap</b> the screen to hide it again and you’re all set!")
2424}
qml/Tutorial/TutorialLeftRelease.qmlnew file+24
@@ -0,0 +1,24 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 1.1
19+
20+TutorialPage {
21+ id: root
22+
23+ text: i18n.tr("<b>Release</b> to hide the <b>Launcher</b> again and you’re all set!")
24+}
qml/Tutorial/TutorialPage.qml+7−2
@@ -40,10 +40,10 @@ Showable {
4040 property int pageTotal
4141
4242 // Whether whole page (background + foreground) or just the foreground fades in
43− property bool backgroundFadesIn: true
43+ property bool backgroundFadesIn: false
4444
4545 // Whether whole page (background + foreground) or just the foreground fades out
46− property bool backgroundFadesOut: true
46+ property bool backgroundFadesOut: false
4747
4848 // An integrated glowing Bar class, for convenience
4949 property alias bar: bar
@@ -51,6 +51,9 @@ Showable {
5151 // The foreground Item, add children to it that you want to fade in
5252 property alias foreground: foregroundExtra
5353
54+ // The MouseArea that eats events (so you can adjust size as you will)
55+ property alias mouseArea: mouseArea
56+
5457 // X/Y offsets for text
5558 property real textXOffset: 0
5659 property real textYOffset: 0
@@ -120,6 +123,7 @@ Showable {
120123 }
121124
122125 MouseArea { // eat any errant presses
126+ id: mouseArea
123127 anchors.fill: parent
124128 }
125129
@@ -159,6 +163,7 @@ Showable {
159163 width: parent.width - d.sideMargin * 2 - root.textXOffset
160164 horizontalAlignment: Text.AlignHCenter
161165 wrapMode: Text.Wrap
166+ fontSize: "large"
162167 text: root.text
163168 }
164169
tests/qmltests/Tutorial/tst_Tutorial.qml+11−11
@@ -106,9 +106,6 @@ Item {
106106 swipeAwayGreeter();
107107 AccountsService.demoEdges = false;
108108 AccountsService.demoEdges = true;
109−
110− var tutorial = findChild(shell, "tutorial");
111− tutorial.readingDelay = 1;
112109 }
113110
114111 function cleanup() {
@@ -157,7 +154,10 @@ Item {
157154
158155 function waitForPage(name) {
159156 tryCompareFunction(function() { return findChild(shell, name) !== null; }, true);
160− return findChild(shell, name);
157+ var page = findChild(shell, name);
158+ tryCompare(page, "shown", true);
159+ tryCompare(page.showAnimation, "running", false);
160+ return page;
161161 }
162162
163163 function checkTopEdge() {
@@ -201,7 +201,7 @@ Item {
201201 function goToPage(name) {
202202 var page = waitForPage("tutorialIntro");
203203 if (name === "tutorialIntro") return page;
204− // Intro page will pass by itself
204+ tap(page);
205205
206206 page = waitForPage("tutorialTop");
207207 checkLeftEdge();
@@ -224,8 +224,8 @@ Item {
224224 if (name === "tutorialLeft") return page;
225225 touchFlick(shell, 0, halfHeight, halfWidth, halfHeight, true, false);
226226
227− page = waitForPage("tutorialLeftFinish");
228− if (name === "tutorialLeftFinish") return page;
227+ page = waitForPage("tutorialLeftRelease");
228+ if (name === "tutorialLeftRelease") return page;
229229 touchFlick(shell, halfWidth, halfHeight, halfWidth, halfHeight, false, true);
230230
231231 checkFinished();
@@ -262,9 +262,9 @@ Item {
262262 // Now drag out but not past launcher itself
263263 touchFlick(shell, 0, halfHeight, launcher.panelWidth * 0.9, halfHeight);
264264
265− // That actually finishes the launcher tutorial (drag is already
266− // over, it would be silly to show LeftFinish page that asks for a
267− // drag release)
265+ waitForPage("tutorialLeftFinish");
266+ tap(launcher);
267+
268268 checkFinished();
269269 }
270270
@@ -272,7 +272,7 @@ Item {
272272 // goToPage does a full launcher pull. But here we test pulling
273273 // all the way out, then dragging back into place.
274274
275− goToPage("tutorialLeftFinish");
275+ goToPage("tutorialLeftRelease");
276276 touchFlick(shell, halfWidth, halfHeight, 0, halfHeight, false, true);
277277
278278 checkFinished();