on xenial help sign in
Some more animations, it's not perfect yet but getting there
ef326d9Albert Astals
qml/Dash/Dash.qml+34−13
@@ -78,10 +78,11 @@ Showable {
78 id: overviewController
78 id: overviewController
79
79
80 property bool accepted: false
80 property bool accepted: false
81− property bool enableAnimation: false
81+ property alias enableAnimation: progressAnimation.enabled
82 property real progress: 0
82 property real progress: 0
83+ property bool showingNonFavoriteScope: false
83 Behavior on progress {
84 Behavior on progress {
84− enabled: overviewController.enableAnimation
85+ id: progressAnimation
85 UbuntuNumberAnimation { }
86 UbuntuNumberAnimation { }
86 }
87 }
87 }
88 }
@@ -90,6 +91,7 @@ Showable {
90 id: scopesOverview
91 id: scopesOverview
91 anchors.fill: parent
92 anchors.fill: parent
92 scope: scopes ? scopes.getScope("scopesOverview") : null
93 scope: scopes ? scopes.getScope("scopesOverview") : null
94+ showingNonFavoriteScope: overviewController.showingNonFavoriteScope
93 progress: overviewController.progress
95 progress: overviewController.progress
94 scopeScale: 1 - overviewController.progress * 0.6
96 scopeScale: 1 - overviewController.progress * 0.6
95 visible: scopeScale != 1
97 visible: scopeScale != 1
@@ -109,8 +111,9 @@ Showable {
109 target: scopesOverview.scope
111 target: scopesOverview.scope
110 onOpenScope: {
112 onOpenScope: {
111 scopeItem.scope = scope;
113 scopeItem.scope = scope;
112− scopesOverview.hide();
114+ scopeItem.overviewScale = 0.4;
113− dashContent.x = -dashContent.width; // TODO
115+ overviewController.showingNonFavoriteScope = true;
116+ scopeItem.overviewScale = 1;
114 }
117 }
115 }
118 }
116 }
119 }
@@ -123,7 +126,7 @@ Showable {
123 height: dash.height
126 height: dash.height
124 model: filteredScopes
127 model: filteredScopes
125 scopes: scopes
128 scopes: scopes
126− visible: x != -width
129+ visible: !overviewController.showingNonFavoriteScope && x != -width
127 onGotoScope: {
130 onGotoScope: {
128 dash.setCurrentScope(scopeId, true, false);
131 dash.setCurrentScope(scopeId, true, false);
129 }
132 }
@@ -143,7 +146,6 @@ Showable {
143 UbuntuNumberAnimation {
146 UbuntuNumberAnimation {
144 onRunningChanged: {
147 onRunningChanged: {
145 if (!running && dashContent.x == 0) {
148 if (!running && dashContent.x == 0) {
146− // TODO If it came from ScopesOverview it has to be ScopesOverview.scope.closeScope()
147 dashContent.closeScope(scopeItem.scope);
149 dashContent.closeScope(scopeItem.scope);
148 scopeItem.scope = null;
150 scopeItem.scope = null;
149 }
151 }
@@ -151,29 +153,48 @@ Showable {
151 }
153 }
152 }
154 }
153
155
154− enabled: overviewController.progress == 0
156+ enabled: opacity == 1
155 opacity: 1 - overviewController.progress
157 opacity: 1 - overviewController.progress
156 }
158 }
157
159
158 DashBackground
160 DashBackground
159 {
161 {
160 anchors.fill: scopeItem
162 anchors.fill: scopeItem
163+ scale: scopeItem.scale
161 }
164 }
162
165
163 GenericScopeView {
166 GenericScopeView {
164 id: scopeItem
167 id: scopeItem
165− anchors.left: dashContent.right
168+
169+ property real overviewScale: 1
170+
171+ x: overviewController.showingNonFavoriteScope ? 0 : width + dashContent.x
166 width: parent.width
172 width: parent.width
167 height: parent.height
173 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+ }
169 clip: scale != 1.0
187 clip: scale != 1.0
170− visible: scope != null
188+ visible: scope != null
171 hasBackAction: true
189 hasBackAction: true
172 isCurrent: visible
190 isCurrent: visible
173 onBackClicked: {
191 onBackClicked: {
174− // TODO if coming from dash overview this needs to go to overview
192+ if (overviewController.showingNonFavoriteScope) {
193+ scopeItem.overviewScale = 0.4;
194+ } else {
175− closeOverlayScope();
195+ closeOverlayScope();
176− closePreview();
196+ closePreview();
197+ }
177 }
198 }
178
199
179 Connections {
200 Connections {
qml/Dash/ScopesOverview.qml+23−23
@@ -23,18 +23,16 @@ Item {
23
23
24 property real progress: 0
24 property real progress: 0
25 property var scope: null
25 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
29 property var dashItemEater: {
26 property var dashItemEater: {
30− if (middleItems.count > tabBarHolder.currentTab) {
27+ if (tabBarHolder.currentTab == 0 && middleItems.count > 1) {
31− var loader = middleItems.itemAt(tabBarHolder.currentTab).item;
28+ var loader = middleItems.itemAt(0).item;
32− return loader && loader.currentItem ? loader.currentItem.item : null;
29+ return loader && loader.currentItem ? loader.currentItem : null;
33 }
30 }
34 return null;
31 return null;
35 }
32 }
36 property int currentIndex: 0
33 property int currentIndex: 0
37 property real scopeScale: 1
34 property real scopeScale: 1
35+ property bool showingNonFavoriteScope: false
38 property QtObject scopeStyle: QtObject {
36 property QtObject scopeStyle: QtObject {
39 property string headerLogo: ""
37 property string headerLogo: ""
40 property color foreground: "white"
38 property color foreground: "white"
@@ -44,6 +42,8 @@ Item {
44 signal favoriteSelected(int index)
42 signal favoriteSelected(int index)
45 signal allSelected(var scope)
43 signal allSelected(var scope)
46
44
45+ enabled: !showingNonFavoriteScope
46+
47 DashBackground {
47 DashBackground {
48 anchors.fill: parent
48 anchors.fill: parent
49 Rectangle {
49 Rectangle {
@@ -187,7 +187,7 @@ Item {
187
187
188 scale: index == 0 ? scopeScale : 1
188 scale: index == 0 ? scopeScale : 1
189
189
190− opacity: tabBarHolder.currentTab == index ? 1 : 0
190+ opacity: root.showingNonFavoriteScope ? 0 : tabBarHolder.currentTab == index ? 1 : 0
191 Behavior on opacity { UbuntuNumberAnimation { } }
191 Behavior on opacity { UbuntuNumberAnimation { } }
192 enabled: opacity == 1
192 enabled: opacity == 1
193
193
@@ -218,29 +218,29 @@ Item {
218 item.scopeWidth = root.width;
218 item.scopeWidth = root.width;
219 item.scopeHeight = root.height;
219 item.scopeHeight = root.height;
220 item.appliedScale = Qt.binding(function() { return loader.scale })
220 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 })
222 } else if (index == 1) {
222 } else if (index == 1) {
223 item.extraHeight = bottomBar.height;
223 item.extraHeight = bottomBar.height;
224 }
224 }
225 }
225 }
226
226
227 Connections {
227 Connections {
228− target: loader.item
228+ target: loader.item
229− onClicked: {
229+ onClicked: {
230− if (tabBarHolder.currentTab == 0) {
230+ if (tabBarHolder.currentTab == 0) {
231− root.favoriteSelected(index)
231+ root.favoriteSelected(index)
232− } else {
232+ } else {
233− // This will result in an openScope
233+ // This will result in an openScope
234− // that we handle in Dash.qml
234+ // that we handle in Dash.qml
235− scope.activate(result)
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
243 }
236 }
237+ }
238+ onPressAndHold: {
239+ previewListView.model = target.model;
240+ previewListView.currentIndex = -1
241+ previewListView.currentIndex = index;
242+ previewListView.open = true
243+ }
244 }
244 }
245 }
245 }
246 }
246 }
qml/Dash/ScopesOverviewFavourites.qml−1
@@ -35,7 +35,6 @@ ListView {
35 delegate: Loader {
35 delegate: Loader {
36 id: loader
36 id: loader
37
37
38−
39 sourceComponent: cardTool.cardComponent
38 sourceComponent: cardTool.cardComponent
40 onLoaded: {
39 onLoaded: {
41 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });
40 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });