on xenial help sign in
Showing dash overview from temp scope (not from dash overview temp scope)
83cc468Albert Astals
qml/Dash/Dash.qml+41−6
@@ -85,13 +85,12 @@ Showable {
85 }
85 }
86 }
86 }
87
87
88− // TODO showing Dash Overview from temp scope
89 ScopesOverview {
88 ScopesOverview {
90 id: scopesOverview
89 id: scopesOverview
91 anchors.fill: parent
90 anchors.fill: parent
92 scope: scopes ? scopes.getScope("scopesOverview") : null
91 scope: scopes ? scopes.getScope("scopesOverview") : null
93 progress: overviewController.progress
92 progress: overviewController.progress
94− scopeScale: 1 - overviewController.progress * 0.6
93+ scopeScale: scopeItem.scope ? 0.4 : (1 - overviewController.progress * 0.6)
95 visible: scopeScale != 1
94 visible: scopeScale != 1
96 currentIndex: dashContent.currentIndex
95 currentIndex: dashContent.currentIndex
97 onDone: {
96 onDone: {
@@ -101,7 +100,7 @@ Showable {
101 hide();
100 hide();
102 }
101 }
103 onFavoriteSelected: {
102 onFavoriteSelected: {
104− dashContent.setCurrentScopeAtIndex(index, false, false);
103+ setCurrentScope(scopeId, false, false);
105 hide();
104 hide();
106 }
105 }
107 onAllFavoriteSelected: {
106 onAllFavoriteSelected: {
@@ -128,10 +127,18 @@ Showable {
128 overviewController.enableAnimation = true;
127 overviewController.enableAnimation = true;
129 overviewController.progress = 0;
128 overviewController.progress = 0;
130 }
129 }
130+ onProgressChanged: {
131+ if (progress == 0) {
132+ currentTab = scopeItem.scope ? 1 : 0;
133+ }
134+ }
131 }
135 }
132
136
133 DashContent {
137 DashContent {
134 id: dashContent
138 id: dashContent
139+
140+ property var scopeThatOpenedScope: null
141+
135 parent: overviewController.progress == 0 ? dash : scopesOverview.dashItemEater
142 parent: overviewController.progress == 0 ? dash : scopesOverview.dashItemEater
136 objectName: "dashContent"
143 objectName: "dashContent"
137 width: dash.width
144 width: dash.width
@@ -143,7 +150,9 @@ Showable {
143 dash.setCurrentScope(scopeId, true, false);
150 dash.setCurrentScope(scopeId, true, false);
144 }
151 }
145 onOpenScope: {
152 onOpenScope: {
153+ scopeThatOpenedScope = currentScope;
146 scopeItem.scope = scope;
154 scopeItem.scope = scope;
155+ scopesOverview.currentTab = 1;
147 x = -width;
156 x = -width;
148 }
157 }
149 onScopeLoaded: {
158 onScopeLoaded: {
@@ -156,10 +165,15 @@ Showable {
156 clip: scale != 1.0 || scopeItem.visible || overviewController.progress != 0
165 clip: scale != 1.0 || scopeItem.visible || overviewController.progress != 0
157 Behavior on x {
166 Behavior on x {
158 UbuntuNumberAnimation {
167 UbuntuNumberAnimation {
168+ duration: overviewController.progress != 0 ? 0 : UbuntuAnimation.FastDuration
159 onRunningChanged: {
169 onRunningChanged: {
160 if (!running && dashContent.x == 0) {
170 if (!running && dashContent.x == 0) {
161− dashContent.closeScope(scopeItem.scope);
171+ dashContent.scopeThatOpenedScope.closeScope(scopeItem.scope);
162 scopeItem.scope = null;
172 scopeItem.scope = null;
173+ if (overviewController.progress == 0) {
174+ // Set tab to Favorites only if we are not showing the overview
175+ scopesOverview.currentTab = 0;
176+ }
163 }
177 }
164 }
178 }
165 }
179 }
@@ -174,15 +188,36 @@ Showable {
174 anchors.fill: scopeItem
188 anchors.fill: scopeItem
175 visible: scopeItem.visible
189 visible: scopeItem.visible
176 parent: scopeItem.parent
190 parent: scopeItem.parent
191+ scale: scopeItem.scale
192+ opacity: scopeItem.opacity
177 }
193 }
178
194
179 GenericScopeView {
195 GenericScopeView {
180 id: scopeItem
196 id: scopeItem
181
197
182− anchors.left: dashContent.right
198+ readonly property real targetOverviewScale: {
199+ if (scopesOverview.currentTab == 0) {
200+ return 0.4;
201+ } else {
202+ return scopesOverview.allCardSize.width / scopeItem.width;
203+ }
204+ }
205+ readonly property real overviewProgressScale: (1 - overviewController.progress * (1 - targetOverviewScale))
206+ readonly property var targetOverviewPosition: scope ? scopesOverview.allScopeCardPosition(scope.id) : null
207+ readonly property real overviewProgressX: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ?
208+ overviewController.progress * (targetOverviewPosition.x - (width - scopesOverview.allCardSize.width) / 2)
209+ : 0
210+ readonly property real overviewProgressY: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ?
211+ overviewController.progress * (targetOverviewPosition.y - (height - scopesOverview.allCardSize.height) / 2)
212+ : 0
213+
214+ x: overviewController.progress == 0 ? dashContent.x + width : overviewProgressX
215+ y: overviewController.progress == 0 ? dashContent.y : overviewProgressY
183 width: parent.width
216 width: parent.width
184 height: parent.height
217 height: parent.height
185− scale: dash.contentScale
218+ scale: dash.contentScale * overviewProgressScale
219+ enabled: opacity == 1
220+ opacity: 1 - overviewController.progress
186 clip: scale != 1.0
221 clip: scale != 1.0
187 visible: scope != null
222 visible: scope != null
188 hasBackAction: true
223 hasBackAction: true
qml/Dash/DashContent.qml−4
@@ -79,10 +79,6 @@ Item {
79 }
79 }
80 }
80 }
81
81
82− function closeScope(scope) {
83− dashContentList.currentItem.theScope.closeScope(scope)
84− }
85−
86 Item {
82 Item {
87 id: dashContentListHolder
83 id: dashContentListHolder
88
84
qml/Dash/ScopesOverview.qml+8−6
@@ -21,16 +21,19 @@ import "../Components"
21Item {
21Item {
22 id: root
22 id: root
23
23
24− // Properties passed by parent
24+ // Properties set by parent
25 property real progress: 0
25 property real progress: 0
26 property var scope: null
26 property var scope: null
27 property int currentIndex: 0
27 property int currentIndex: 0
28 property real scopeScale: 1
28 property real scopeScale: 1
29
29
30+ // Properties set and used by parent
31+ property alias currentTab: tabBar.currentTab
32+
30 // Properties used by parent
33 // Properties used by parent
31 property bool growingDashFromPos: false
34 property bool growingDashFromPos: false
35+ readonly property bool searching: scope && scope.searchQuery == ""
32 readonly property bool showingNonFavoriteScope: tempScopeItem.scope != null
36 readonly property bool showingNonFavoriteScope: tempScopeItem.scope != null
33− readonly property alias currentTab: tabBar.currentTab
34 readonly property var dashItemEater: {
37 readonly property var dashItemEater: {
35 if (!forceXYScalerEater && tabBar.currentTab == 0 && middleItems.count > 0) {
38 if (!forceXYScalerEater && tabBar.currentTab == 0 && middleItems.count > 0) {
36 var loaderItem = middleItems.itemAt(0).item;
39 var loaderItem = middleItems.itemAt(0).item;
@@ -59,7 +62,7 @@ Item {
59
62
60
63
61 signal done()
64 signal done()
62− signal favoriteSelected(int index)
65+ signal favoriteSelected(var scopeId)
63 signal allFavoriteSelected(var scopeId)
66 signal allFavoriteSelected(var scopeId)
64 signal allSelected(var scopeId, var pos)
67 signal allSelected(var scopeId, var pos)
65 signal searchSelected(var scopeId, var pos, var size)
68 signal searchSelected(var scopeId, var pos, var size)
@@ -112,7 +115,6 @@ Item {
112
115
113 onProgressChanged: {
116 onProgressChanged: {
114 if (progress == 0) {
117 if (progress == 0) {
115− tabBar.currentTab = 0;
116 pageHeader.resetSearch();
118 pageHeader.resetSearch();
117 pageHeader.unfocus(); // Shouldn't the previous call do this too?
119 pageHeader.unfocus(); // Shouldn't the previous call do this too?
118 }
120 }
@@ -267,7 +269,7 @@ Item {
267 target: loader.item
269 target: loader.item
268 onClicked: {
270 onClicked: {
269 if (tabBar.currentTab == 0) {
271 if (tabBar.currentTab == 0) {
270− root.favoriteSelected(index)
272+ root.favoriteSelected(itemModel.scopeId)
271 } else {
273 } else {
272 var favoriteScopesItem = middleItems.itemAt(0).item;
274 var favoriteScopesItem = middleItems.itemAt(0).item;
273 var scopeIndex = favoriteScopesItem.model.scopeIndex(itemModel.scopeId);
275 var scopeIndex = favoriteScopesItem.model.scopeIndex(itemModel.scopeId);
@@ -437,7 +439,7 @@ Item {
437 scopesOverviewXYScaler.x = scopesOverviewXYScaler.restorePosition.x -(tempScopeItem.width - tempScopeItem.width * v) / 2;
439 scopesOverviewXYScaler.x = scopesOverviewXYScaler.restorePosition.x -(tempScopeItem.width - tempScopeItem.width * v) / 2;
438 scopesOverviewXYScaler.y = scopesOverviewXYScaler.restorePosition.y -(tempScopeItem.height - tempScopeItem.height * v) / 2;
440 scopesOverviewXYScaler.y = scopesOverviewXYScaler.restorePosition.y -(tempScopeItem.height - tempScopeItem.height * v) / 2;
439 scopesOverviewXYScaler.opacity = 0;
441 scopesOverviewXYScaler.opacity = 0;
440− scopesOverview.middleItems = -1;
442+ middleItems.overrideOpacity = -1;
441 }
443 }
442 }
444 }
443 }
445 }
qml/Dash/ScopesOverviewFavorites.qml+2−2
@@ -19,7 +19,7 @@ import QtQuick 2.0
19Flickable {
19Flickable {
20 id: root
20 id: root
21
21
22− signal clicked(int index, var result)
22+ signal clicked(int index, var result, var itemModel)
23 signal pressAndHold(int index)
23 signal pressAndHold(int index)
24
24
25 property var cardTool: null
25 property var cardTool: null
@@ -64,7 +64,7 @@ Flickable {
64
64
65 Connections {
65 Connections {
66 target: loader.item
66 target: loader.item
67− onClicked: root.clicked(index, result)
67+ onClicked: root.clicked(index, result, model)
68 }
68 }
69 }
69 }
70 }
70 }