@@ -16,6 +16,7 @@
1616
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
19+import Ubuntu.Gestures 0.1
1920import Unity 0.2
2021import Utils 0.1
2122import "../Components"
@@ -29,7 +30,7 @@ Showable {
2930 property string showScopeOnLoaded: "clickscope"
3031 property real contentScale: 1.0
3132
32− property alias overviewHandleHeight: dashContent.overviewHandleHeight
33+ property alias overviewHandleHeight: overviewDragHandle.height
3334
3435 function setCurrentScope(scopeId, animate, reset) {
3536 var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
@@ -68,6 +69,42 @@ Showable {
6869 filterRegExp: RegExp("^true$")
6970 }
7071
72+ QtObject {
73+ id: overviewController
74+
75+ property bool accepted: false
76+ property bool enableAnimation: false
77+ property real progress: 0
78+ }
79+
80+ ScopesOverview {
81+ id: scopesOverview
82+ anchors.fill: parent
83+ scope: scopes ? scopes.getScope("scopesOverview") : null
84+ progress: overviewController.progress
85+ scopeScale: dashContent.scale
86+ visible: scopeScale != 1
87+ onDone: hide();
88+ onFavoriteSelected: {
89+ dashContent.setCurrentScopeAtIndex(index, false, false);
90+ hide();
91+ }
92+ function hide() {
93+ overviewController.enableAnimation = true;
94+ overviewController.progress = 0;
95+ overviewController.accepted = false;
96+ }
97+
98+ Connections {
99+ target: scopesOverview.scope
100+ onOpenScope: {
101+ scopeItem.scope = scope;
102+ scopesOverview.hide();
103+ dashContent.x = -dashContent.width; // TODO
104+ }
105+ }
106+ }
107+
71108 DashContent {
72109 id: dashContent
73110 objectName: "dashContent"
@@ -89,18 +126,35 @@ Showable {
89126 dash.showScopeOnLoaded = ""
90127 }
91128 }
92− scale: dash.contentScale
129+ scale: dash.contentScale * (1 - overviewController.progress * 0.6)
93130 clip: scale != 1.0 || scopeItem.visible
94131 Behavior on x {
95132 UbuntuNumberAnimation {
96133 onRunningChanged: {
97134 if (!running && dashContent.x == 0) {
135+ // TODO If it came from ScopesOverview it has to be ScopesOverview.scope.closeScope()
98136 dashContent.closeScope(scopeItem.scope);
99137 scopeItem.scope = null;
100138 }
101139 }
102140 }
103141 }
142+
143+ enabled: scale == 1
144+ opacity: 1 - overviewController.progress
145+ Behavior on scale {
146+ id: dashContentScaleAnimation
147+ enabled: overviewController.enableAnimation
148+ UbuntuNumberAnimation { }
149+ }
150+ }
151+
152+ Image {
153+ anchors.fill: scopeItem
154+ source: parent.width > parent.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png"
155+ fillMode: Image.PreserveAspectCrop
156+ horizontalAlignment: Image.AlignRight
157+ verticalAlignment: Image.AlignTop
104158 }
105159
106160 GenericScopeView {
@@ -114,6 +168,7 @@ Showable {
114168 hasBackAction: true
115169 isCurrent: visible
116170 onBackClicked: {
171+ // TODO if coming from dash overview this needs to go to overview
117172 closeOverlayScope();
118173 closePreview();
119174 }
@@ -128,4 +183,31 @@ Showable {
128183 }
129184 }
130185 }
186+
187+ EdgeDragArea {
188+ id: overviewDragHandle
189+ direction: Direction.Upwards
190+ distanceThreshold: units.gu(20)
191+ enabled: !overviewController.accepted || dragging
192+
193+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
194+ height: units.gu(2)
195+
196+ onSceneDistanceChanged: {
197+ overviewController.enableAnimation = false;
198+ overviewController.progress = Math.min(1, sceneDistance / distanceThreshold);
199+ }
200+
201+ onStatusChanged: {
202+ if (status == DirectionalDragArea.Recognized) {
203+ overviewController.accepted = true;
204+ }
205+ }
206+
207+ onDraggingChanged: {
208+ overviewController.enableAnimation = true;
209+ overviewController.progress = overviewController.accepted ? 1 : 0;
210+ }
211+ }
212+
131213}