on xenial help sign in
Showing dash overview from temp scope (not from dash overview temp scope)
commit83cc4687c38063bae5aa6df254c9907c35695e93 authorAlbert Astals <albert.astals@canonical.com> dateFri 18 Jul 2014, 11:14 (12 years ago) parentfbd182d
4 files changed+51−18
qml/Dash/Dash.qml+41−6 qml/Dash/DashContent.qml−4 qml/Dash/ScopesOverview.qml+8−6 qml/Dash/ScopesOverviewFavorites.qml+2−2
qml/Dash/Dash.qml+41−6
@@ -85,13 +85,12 @@ Showable {
8585 }
8686 }
8787
88− // TODO showing Dash Overview from temp scope
8988 ScopesOverview {
9089 id: scopesOverview
9190 anchors.fill: parent
9291 scope: scopes ? scopes.getScope("scopesOverview") : null
9392 progress: overviewController.progress
94− scopeScale: 1 - overviewController.progress * 0.6
93+ scopeScale: scopeItem.scope ? 0.4 : (1 - overviewController.progress * 0.6)
9594 visible: scopeScale != 1
9695 currentIndex: dashContent.currentIndex
9796 onDone: {
@@ -101,7 +100,7 @@ Showable {
101100 hide();
102101 }
103102 onFavoriteSelected: {
104− dashContent.setCurrentScopeAtIndex(index, false, false);
103+ setCurrentScope(scopeId, false, false);
105104 hide();
106105 }
107106 onAllFavoriteSelected: {
@@ -128,10 +127,18 @@ Showable {
128127 overviewController.enableAnimation = true;
129128 overviewController.progress = 0;
130129 }
130+ onProgressChanged: {
131+ if (progress == 0) {
132+ currentTab = scopeItem.scope ? 1 : 0;
133+ }
134+ }
131135 }
132136
133137 DashContent {
134138 id: dashContent
139+
140+ property var scopeThatOpenedScope: null
141+
135142 parent: overviewController.progress == 0 ? dash : scopesOverview.dashItemEater
136143 objectName: "dashContent"
137144 width: dash.width
@@ -143,7 +150,9 @@ Showable {
143150 dash.setCurrentScope(scopeId, true, false);
144151 }
145152 onOpenScope: {
153+ scopeThatOpenedScope = currentScope;
146154 scopeItem.scope = scope;
155+ scopesOverview.currentTab = 1;
147156 x = -width;
148157 }
149158 onScopeLoaded: {
@@ -156,10 +165,15 @@ Showable {
156165 clip: scale != 1.0 || scopeItem.visible || overviewController.progress != 0
157166 Behavior on x {
158167 UbuntuNumberAnimation {
168+ duration: overviewController.progress != 0 ? 0 : UbuntuAnimation.FastDuration
159169 onRunningChanged: {
160170 if (!running && dashContent.x == 0) {
161− dashContent.closeScope(scopeItem.scope);
171+ dashContent.scopeThatOpenedScope.closeScope(scopeItem.scope);
162172 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+ }
163177 }
164178 }
165179 }
@@ -174,15 +188,36 @@ Showable {
174188 anchors.fill: scopeItem
175189 visible: scopeItem.visible
176190 parent: scopeItem.parent
191+ scale: scopeItem.scale
192+ opacity: scopeItem.opacity
177193 }
178194
179195 GenericScopeView {
180196 id: scopeItem
181197
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
183216 width: parent.width
184217 height: parent.height
185− scale: dash.contentScale
218+ scale: dash.contentScale * overviewProgressScale
219+ enabled: opacity == 1
220+ opacity: 1 - overviewController.progress
186221 clip: scale != 1.0
187222 visible: scope != null
188223 hasBackAction: true
qml/Dash/DashContent.qml−4
@@ -79,10 +79,6 @@ Item {
7979 }
8080 }
8181
82− function closeScope(scope) {
83− dashContentList.currentItem.theScope.closeScope(scope)
84− }
85−
8682 Item {
8783 id: dashContentListHolder
8884
qml/Dash/ScopesOverview.qml+8−6
@@ -21,16 +21,19 @@ import "../Components"
2121Item {
2222 id: root
2323
24− // Properties passed by parent
24+ // Properties set by parent
2525 property real progress: 0
2626 property var scope: null
2727 property int currentIndex: 0
2828 property real scopeScale: 1
2929
30+ // Properties set and used by parent
31+ property alias currentTab: tabBar.currentTab
32+
3033 // Properties used by parent
3134 property bool growingDashFromPos: false
35+ readonly property bool searching: scope && scope.searchQuery == ""
3236 readonly property bool showingNonFavoriteScope: tempScopeItem.scope != null
33− readonly property alias currentTab: tabBar.currentTab
3437 readonly property var dashItemEater: {
3538 if (!forceXYScalerEater && tabBar.currentTab == 0 && middleItems.count > 0) {
3639 var loaderItem = middleItems.itemAt(0).item;
@@ -59,7 +62,7 @@ Item {
5962
6063
6164 signal done()
62− signal favoriteSelected(int index)
65+ signal favoriteSelected(var scopeId)
6366 signal allFavoriteSelected(var scopeId)
6467 signal allSelected(var scopeId, var pos)
6568 signal searchSelected(var scopeId, var pos, var size)
@@ -112,7 +115,6 @@ Item {
112115
113116 onProgressChanged: {
114117 if (progress == 0) {
115− tabBar.currentTab = 0;
116118 pageHeader.resetSearch();
117119 pageHeader.unfocus(); // Shouldn't the previous call do this too?
118120 }
@@ -267,7 +269,7 @@ Item {
267269 target: loader.item
268270 onClicked: {
269271 if (tabBar.currentTab == 0) {
270− root.favoriteSelected(index)
272+ root.favoriteSelected(itemModel.scopeId)
271273 } else {
272274 var favoriteScopesItem = middleItems.itemAt(0).item;
273275 var scopeIndex = favoriteScopesItem.model.scopeIndex(itemModel.scopeId);
@@ -437,7 +439,7 @@ Item {
437439 scopesOverviewXYScaler.x = scopesOverviewXYScaler.restorePosition.x -(tempScopeItem.width - tempScopeItem.width * v) / 2;
438440 scopesOverviewXYScaler.y = scopesOverviewXYScaler.restorePosition.y -(tempScopeItem.height - tempScopeItem.height * v) / 2;
439441 scopesOverviewXYScaler.opacity = 0;
440− scopesOverview.middleItems = -1;
442+ middleItems.overrideOpacity = -1;
441443 }
442444 }
443445 }
qml/Dash/ScopesOverviewFavorites.qml+2−2
@@ -19,7 +19,7 @@ import QtQuick 2.0
1919Flickable {
2020 id: root
2121
22− signal clicked(int index, var result)
22+ signal clicked(int index, var result, var itemModel)
2323 signal pressAndHold(int index)
2424
2525 property var cardTool: null
@@ -64,7 +64,7 @@ Flickable {
6464
6565 Connections {
6666 target: loader.item
67− onClicked: root.clicked(index, result)
67+ onClicked: root.clicked(index, result, model)
6868 }
6969 }
7070 }