on xenial help sign in
Add back support for bottom edge
0c1ddccMichael Terry
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+6−3
@@ -436,11 +436,14 @@ void DirectionalDragAreaPrivate::touchEvent_absent(QTouchEvent *event)
436 if (recognitionIsDisabled()) {
436 if (recognitionIsDisabled()) {
437 // Behave like a dumb TouchArea
437 // Behave like a dumb TouchArea
438 ddaDebug("Gesture recognition is disabled. Requesting touch ownership immediately.");
438 ddaDebug("Gesture recognition is disabled. Requesting touch ownership immediately.");
439+ setStatus(Recognized);
439− if (!monitorOnly) {
440+ if (monitorOnly) {
441+ watchPressedTouchPoints(touchPoints);
442+ event->ignore();
443+ } else {
440 TouchRegistry::instance()->requestTouchOwnership(touchId, q);
444 TouchRegistry::instance()->requestTouchOwnership(touchId, q);
445+ event->accept();
441 }
446 }
442− setStatus(Recognized);
443− event->accept();
444 } else {
447 } else {
445 // just monitor the touch points for now.
448 // just monitor the touch points for now.
446 if (monitorOnly) {
449 if (monitorOnly) {
qml/Shell.qml+1−2
@@ -247,8 +247,7 @@ Item {
247 }
247 }
248 }
248 }
249
249
250− property bool interactive: tutorial.spreadEnabled
251− && (!greeter || !greeter.shown)
250+ property bool interactive: (!greeter || !greeter.shown)
252 && panel.indicators.fullyClosed
251 && panel.indicators.fullyClosed
253 && launcher.progress == 0
252 && launcher.progress == 0
254 && !notifications.useModal
253 && !notifications.useModal
qml/Tutorial/TutorialBottom.qml+38−3
@@ -21,6 +21,32 @@ import Ubuntu.Gestures 0.1
21TutorialPage {
21TutorialPage {
22 id: root
22 id: root
23
23
24+ // This page is a bit fragile. It relies on knowing how the app beneath
25+ // the shell will react to a drag. What we do is put a monitor-only DDA
26+ // at the bottom of the page (so that we know when the drag is finished)
27+ // and pass the events on through to the app. Thus, it sees the drag and
28+ // brings its bottom edge up.
29+ //
30+ // Unfortunately, each app is on its own when implementing the bottom edge
31+ // drag. Most share copied-and-pasted code right now, but they will
32+ // eventually consolidate on a version of DirectionalDragArea that will
33+ // land in the SDK (making our guessing job easier). Though, also in the
34+ // future, this whole bottom tutorial component will also land in the SDK,
35+ // rending our version here obsolete.
36+ //
37+ // Anyway, for the moment, we base our guesses on the copied-and-pasted
38+ // code used in several of the core apps and only bring this component
39+ // up if we are in those core apps.
40+
41+ readonly property real dragAreaHeight: units.gu(3) // based on PageWithBottomEdge.qml
42+ readonly property real targetDistance: height * 0.2 + dragAreaHeight // based on PageWithBottomEdge.qml
43+
44+ opacityOverride: dragArea.dragging ? 1 - (-dragArea.distance / targetDistance) : 1
45+
46+ mouseArea {
47+ anchors.bottomMargin: root.dragAreaHeight
48+ }
49+
24 background {
50 background {
25 sourceSize.height: 1080
51 sourceSize.height: 1080
26 sourceSize.width: 1916
52 sourceSize.width: 1916
@@ -44,11 +70,20 @@ TutorialPage {
44 width: root.width - units.gu(8)
70 width: root.width - units.gu(8)
45 }
71 }
46
72
73+ // Watches drag events but does not intercept them, so that the app beneath
74+ // will still drag the bottom edge up.
47− /*DirectionalDragArea {
75+ DirectionalDragArea {
76+ id: dragArea
77+ monitorOnly: true
48 direction: Direction.Upwards
78 direction: Direction.Upwards
49 anchors.left: parent.left
79 anchors.left: parent.left
50 anchors.right: parent.right
80 anchors.right: parent.right
51 anchors.bottom: parent.bottom
81 anchors.bottom: parent.bottom
52− height: units.gu(1)
82+ height: root.dragAreaHeight
83+
84+ // Because apps currently don't use DDA, and DDA will stop a gesture if
85+ // horizontal motion is detected. But our apps wont'. So turn off
86+ // that gesture cleverness on our part, it will only get us out of sync.
87+ immediateRecognition: true
53− }*/
88+ }
54}
89}
qml/Tutorial/TutorialContent.qml+7−23
@@ -74,7 +74,7 @@ Item {
74 readonly property bool skipped: (root.usageScenario !== "phone"
74 readonly property bool skipped: (root.usageScenario !== "phone"
75 && root.usageScenario !== "tablet")
75 && root.usageScenario !== "tablet")
76 || AccountsService.demoEdgesCompleted.indexOf("top") != -1
76 || AccountsService.demoEdgesCompleted.indexOf("top") != -1
77− isReady: tutorialLeft.skipped && !skipped && !paused && !keyboardVisible
77+ isReady: tutorialLeft.skipped && !skipped && !paused && !keyboardVisible && !tutorialBottom.shown
78
78
79 Timer {
79 Timer {
80 id: tutorialTopTimer
80 id: tutorialTopTimer
@@ -103,7 +103,8 @@ Item {
103 paused: root.paused
103 paused: root.paused
104
104
105 readonly property bool skipped: AccountsService.demoEdgesCompleted.indexOf("right") != -1
105 readonly property bool skipped: AccountsService.demoEdgesCompleted.indexOf("right") != -1
106− isReady: tutorialTop.skipped && !skipped && !paused && !keyboardVisible && ApplicationManager.count >= 3
106+ isReady: tutorialTop.skipped && !skipped && !paused && !keyboardVisible && !tutorialBottom.shown &&
107+ ApplicationManager.count >= 3
107
108
108 Timer {
109 Timer {
109 id: tutorialRightTimer
110 id: tutorialRightTimer
@@ -119,10 +120,7 @@ Item {
119
120
120 onSkippedChanged: if (skipped && shown) hide()
121 onSkippedChanged: if (skipped && shown) hide()
121 onIsReadyChanged: if (isReady && !shown) tutorialRightTimer.start()
122 onIsReadyChanged: if (isReady && !shown) tutorialRightTimer.start()
122− onFinished: {
123− AccountsService.markDemoEdgeCompleted("right");
123+ onFinished: AccountsService.markDemoEdgeCompleted("right")
124− root.finish();
125− }
126 }
124 }
127
125
128 TutorialBottom {
126 TutorialBottom {
@@ -135,30 +133,16 @@ Item {
135 readonly property bool skipped: (root.usageScenario !== "phone"
133 readonly property bool skipped: (root.usageScenario !== "phone"
136 && root.usageScenario !== "tablet")
134 && root.usageScenario !== "tablet")
137 || AccountsService.demoEdgesCompleted.indexOf("bottom") != -1
135 || AccountsService.demoEdgesCompleted.indexOf("bottom") != -1
138− isReady: false /* tutorialRight.skipped && !skipped && !paused && !keyboardVisible &&
136+ isReady: !skipped && !paused && !keyboardVisible && !tutorialTop.shown && !tutorialRight.shown &&
139 // focused app is an app known to have a bottom edge
137 // focused app is an app known to have a bottom edge
140 (ApplicationManager.focusedApplicationId == "dialer-app" ||
138 (ApplicationManager.focusedApplicationId == "dialer-app" ||
141− ApplicationManager.focusedApplicationId == "webbrowser-app" ||
142 ApplicationManager.focusedApplicationId == "messaging-app" ||
139 ApplicationManager.focusedApplicationId == "messaging-app" ||
143 ApplicationManager.focusedApplicationId == "address-book-app" ||
140 ApplicationManager.focusedApplicationId == "address-book-app" ||
144− ApplicationManager.focusedApplicationId == "camera-app" ||
145 ApplicationManager.focusedApplicationId == "ubuntu-calculator-app" ||
141 ApplicationManager.focusedApplicationId == "ubuntu-calculator-app" ||
146− ApplicationManager.focusedApplicationId == "ubuntu-clock-app") */
142+ ApplicationManager.focusedApplicationId == "ubuntu-clock-app")
147−
148− /*Timer {
149− id: tutorialBottomTimer
150− objectName: "tutorialBottomTimer"
151− interval: 3000
152− onTriggered: if (tutorialBottom.isReady && !tutorialBottom.shown) tutorialBottom.show()
153− }*/
154−
155− Connections {
156− target: ApplicationManager
157− onApplicationAdded: if (tutorialBottom.isReady && !tutorialBottom.shown) tutorialBottom.show()
158− }
159
143
160 onSkippedChanged: if (skipped && shown) hide()
144 onSkippedChanged: if (skipped && shown) hide()
161− //onIsReadyChanged: if (isReady && !shown) tutorialBottomTimer.start()
145+ onIsReadyChanged: if (isReady && !shown) show()
162 onFinished: {
146 onFinished: {
163 AccountsService.markDemoEdgeCompleted("bottom");
147 AccountsService.markDemoEdgeCompleted("bottom");
164 root.finish();
148 root.finish();
qml/Tutorial/TutorialPage.qml+1−1
@@ -41,7 +41,7 @@ Showable {
41 visible: false
41 visible: false
42 shown: false
42 shown: false
43
43
44− opacity: Math.min(_showOpacity, opacityOverride)
44+ opacity: Math.max(Math.min(_showOpacity, opacityOverride), 0)
45 onOpacityOverrideChanged: if (opacityOverride <= 0) hide()
45 onOpacityOverrideChanged: if (opacityOverride <= 0) hide()
46 property real _showOpacity: 0
46 property real _showOpacity: 0
47
47