on xenial help sign in
Some more animations, it's not perfect yet but getting there
commitef326d954e178e09605de029d7f7597177181d90 authorAlbert Astals <albert.astals@canonical.com> dateMon 14 Jul 2014, 12:01 (12 years ago) parent3f8d091
3 files changed+57−37
qml/Dash/Dash.qml+34−13 qml/Dash/ScopesOverview.qml+23−23 qml/Dash/ScopesOverviewFavourites.qml−1
qml/Dash/Dash.qml+34−13
@@ -78,10 +78,11 @@ Showable {
7878 id: overviewController
7979
8080 property bool accepted: false
81− property bool enableAnimation: false
81+ property alias enableAnimation: progressAnimation.enabled
8282 property real progress: 0
83+ property bool showingNonFavoriteScope: false
8384 Behavior on progress {
84− enabled: overviewController.enableAnimation
85+ id: progressAnimation
8586 UbuntuNumberAnimation { }
8687 }
8788 }
@@ -90,6 +91,7 @@ Showable {
9091 id: scopesOverview
9192 anchors.fill: parent
9293 scope: scopes ? scopes.getScope("scopesOverview") : null
94+ showingNonFavoriteScope: overviewController.showingNonFavoriteScope
9395 progress: overviewController.progress
9496 scopeScale: 1 - overviewController.progress * 0.6
9597 visible: scopeScale != 1
@@ -109,8 +111,9 @@ Showable {
109111 target: scopesOverview.scope
110112 onOpenScope: {
111113 scopeItem.scope = scope;
112− scopesOverview.hide();
113− dashContent.x = -dashContent.width; // TODO
114+ scopeItem.overviewScale = 0.4;
115+ overviewController.showingNonFavoriteScope = true;
116+ scopeItem.overviewScale = 1;
114117 }
115118 }
116119 }
@@ -123,7 +126,7 @@ Showable {
123126 height: dash.height
124127 model: filteredScopes
125128 scopes: scopes
126− visible: x != -width
129+ visible: !overviewController.showingNonFavoriteScope && x != -width
127130 onGotoScope: {
128131 dash.setCurrentScope(scopeId, true, false);
129132 }
@@ -143,7 +146,6 @@ Showable {
143146 UbuntuNumberAnimation {
144147 onRunningChanged: {
145148 if (!running && dashContent.x == 0) {
146− // TODO If it came from ScopesOverview it has to be ScopesOverview.scope.closeScope()
147149 dashContent.closeScope(scopeItem.scope);
148150 scopeItem.scope = null;
149151 }
@@ -151,29 +153,48 @@ Showable {
151153 }
152154 }
153155
154− enabled: overviewController.progress == 0
156+ enabled: opacity == 1
155157 opacity: 1 - overviewController.progress
156158 }
157159
158160 DashBackground
159161 {
160162 anchors.fill: scopeItem
163+ scale: scopeItem.scale
161164 }
162165
163166 GenericScopeView {
164167 id: scopeItem
165− anchors.left: dashContent.right
168+
169+ property real overviewScale: 1
170+
171+ x: overviewController.showingNonFavoriteScope ? 0 : width + dashContent.x
166172 width: parent.width
167173 height: parent.height
168− scale: dash.contentScale
174+ scale: dash.contentScale * overviewScale
175+ Behavior on overviewScale {
176+ enabled: overviewController.showingNonFavoriteScope
177+ UbuntuNumberAnimation {
178+ onRunningChanged: {
179+ if (!running && scopeItem.overviewScale == 0.4) {
180+ scopesOverview.scope.closeScope(scopeItem.scope);
181+ overviewController.showingNonFavoriteScope = false;
182+ scopeItem.scope = null;
183+ }
184+ }
185+ }
186+ }
169187 clip: scale != 1.0
170− visible: scope != null
188+ visible: scope != null
171189 hasBackAction: true
172190 isCurrent: visible
173191 onBackClicked: {
174− // TODO if coming from dash overview this needs to go to overview
175− closeOverlayScope();
176− closePreview();
192+ if (overviewController.showingNonFavoriteScope) {
193+ scopeItem.overviewScale = 0.4;
194+ } else {
195+ closeOverlayScope();
196+ closePreview();
197+ }
177198 }
178199
179200 Connections {
qml/Dash/ScopesOverview.qml+23−23
@@ -23,18 +23,16 @@ Item {
2323
2424 property real progress: 0
2525 property var scope: null
26− // TODO This needs to account for when all is the current item
27− // And All needs a currentItem concept
28− // TODO we also need a centered item so when we click done from all the item grows from the middle: think
2926 property var dashItemEater: {
30− if (middleItems.count > tabBarHolder.currentTab) {
31− var loader = middleItems.itemAt(tabBarHolder.currentTab).item;
32− return loader && loader.currentItem ? loader.currentItem.item : null;
27+ if (tabBarHolder.currentTab == 0 && middleItems.count > 1) {
28+ var loader = middleItems.itemAt(0).item;
29+ return loader && loader.currentItem ? loader.currentItem : null;
3330 }
3431 return null;
3532 }
3633 property int currentIndex: 0
3734 property real scopeScale: 1
35+ property bool showingNonFavoriteScope: false
3836 property QtObject scopeStyle: QtObject {
3937 property string headerLogo: ""
4038 property color foreground: "white"
@@ -44,6 +42,8 @@ Item {
4442 signal favoriteSelected(int index)
4543 signal allSelected(var scope)
4644
45+ enabled: !showingNonFavoriteScope
46+
4747 DashBackground {
4848 anchors.fill: parent
4949 Rectangle {
@@ -187,7 +187,7 @@ Item {
187187
188188 scale: index == 0 ? scopeScale : 1
189189
190− opacity: tabBarHolder.currentTab == index ? 1 : 0
190+ opacity: root.showingNonFavoriteScope ? 0 : tabBarHolder.currentTab == index ? 1 : 0
191191 Behavior on opacity { UbuntuNumberAnimation { } }
192192 enabled: opacity == 1
193193
@@ -218,29 +218,29 @@ Item {
218218 item.scopeWidth = root.width;
219219 item.scopeHeight = root.height;
220220 item.appliedScale = Qt.binding(function() { return loader.scale })
221− item.currentIndex = Qt.binding(function() { return root.currentIndex }) // TODO Move down
221+ item.currentIndex = Qt.binding(function() { return root.currentIndex })
222222 } else if (index == 1) {
223223 item.extraHeight = bottomBar.height;
224224 }
225225 }
226226
227227 Connections {
228− target: loader.item
229− onClicked: {
230− if (tabBarHolder.currentTab == 0) {
231− root.favoriteSelected(index)
232− } else {
233− // This will result in an openScope
234− // that we handle in Dash.qml
235− scope.activate(result)
236− }
237− }
238− onPressAndHold: {
239− previewListView.model = target.model;
240− previewListView.currentIndex = -1
241− previewListView.currentIndex = index;
242− previewListView.open = true
228+ target: loader.item
229+ onClicked: {
230+ if (tabBarHolder.currentTab == 0) {
231+ root.favoriteSelected(index)
232+ } else {
233+ // This will result in an openScope
234+ // that we handle in Dash.qml
235+ scope.activate(result)
243236 }
237+ }
238+ onPressAndHold: {
239+ previewListView.model = target.model;
240+ previewListView.currentIndex = -1
241+ previewListView.currentIndex = index;
242+ previewListView.open = true
243+ }
244244 }
245245 }
246246 }
qml/Dash/ScopesOverviewFavourites.qml−1
@@ -35,7 +35,6 @@ ListView {
3535 delegate: Loader {
3636 id: loader
3737
38−
3938 sourceComponent: cardTool.cardComponent
4039 onLoaded: {
4140 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });