@@ -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}