on xenial help sign in
disable transitions for secondary/extra pages
213d8afLukáš Tinkl
qml/Wizard/Page.qml+8−8
@@ -204,6 +204,7 @@ Item {
204 leftMargin: contentHolder.animatedMargin
204 leftMargin: contentHolder.animatedMargin
205 rightMargin: -contentHolder.animatedMargin
205 rightMargin: -contentHolder.animatedMargin
206 }
206 }
207+ visible: opacity > 0
207 }
208 }
208
209
209 // button bar
210 // button bar
@@ -252,10 +253,9 @@ Item {
252 }
253 }
253
254
254 // transitions
255 // transitions
255−
256 function aboutToShow(duration, direction) {
256 function aboutToShow(duration, direction) {
257 startContentAnimation(duration, direction)
257 startContentAnimation(duration, direction)
258− startShowing(duration)
258+ startControlsAnimation(duration)
259 }
259 }
260
260
261 function startContentAnimation(duration, direction) {
261 function startContentAnimation(duration, direction) {
@@ -264,12 +264,12 @@ Item {
264 contentAnimation.restart()
264 contentAnimation.restart()
265 }
265 }
266
266
267− function startShowing(showDuration) {
267+ function startControlsAnimation(showDuration) {
268 actionsShowAnimation.showDuration = showDuration
268 actionsShowAnimation.showDuration = showDuration
269 actionsShowAnimation.restart()
269 actionsShowAnimation.restart()
270 }
270 }
271
271
272− SequentialAnimation {
272+ SequentialAnimation { // animation for the button bar
273 id: actionsShowAnimation
273 id: actionsShowAnimation
274 property int showDuration: 0
274 property int showDuration: 0
275 PropertyAction {
275 PropertyAction {
@@ -286,12 +286,12 @@ Item {
286 }
286 }
287 }
287 }
288
288
289− SequentialAnimation {
289+ SequentialAnimation { // animations for the content
290 id: contentAnimation
290 id: contentAnimation
291 property int animationDurationBase: UbuntuAnimation.BriskDuration
291 property int animationDurationBase: UbuntuAnimation.BriskDuration
292 readonly property int additionalDuration: 200
292 readonly property int additionalDuration: 200
293 property int direction: Qt.LeftToRight
293 property int direction: Qt.LeftToRight
294− ScriptAction {
294+ ScriptAction { // direction of the effect
295 script: {
295 script: {
296 if (contentAnimation.direction === Qt.LeftToRight) {
296 if (contentAnimation.direction === Qt.LeftToRight) {
297 titleLabel.animatedMargin = -titleRect.width;
297 titleLabel.animatedMargin = -titleRect.width;
@@ -303,14 +303,14 @@ Item {
303 }
303 }
304 }
304 }
305 ParallelAnimation {
305 ParallelAnimation {
306− NumberAnimation {
306+ NumberAnimation { // the slide-in animation
307 targets: [titleLabel, content]
307 targets: [titleLabel, content]
308 property: 'animatedMargin'
308 property: 'animatedMargin'
309 to: 0
309 to: 0
310 duration: contentAnimation.animationDurationBase + contentAnimation.additionalDuration
310 duration: contentAnimation.animationDurationBase + contentAnimation.additionalDuration
311 easing.type: Easing.OutCubic
311 easing.type: Easing.OutCubic
312 }
312 }
313− NumberAnimation {
313+ NumberAnimation { // opacity animation
314 targets: [titleLabel,content]
314 targets: [titleLabel,content]
315 property: 'opacity'
315 property: 'opacity'
316 from: 0
316 from: 0
qml/Wizard/Pages.qml+12−8
@@ -77,23 +77,27 @@ Item {
77 // If we've opened any extra (non-main) pages, pop them before
77 // If we've opened any extra (non-main) pages, pop them before
78 // continuing so back button returns to the previous main page.
78 // continuing so back button returns to the previous main page.
79 while (pageList.index < pageStack.depth - 1)
79 while (pageList.index < pageStack.depth - 1)
80− pop()
80+ pop();
81− load(pageList.next())
81+ load(pageList.next());
82
82
83− currentPage.aboutToShow(UbuntuAnimation.BriskDuration, Qt.RightToLeft)
83+ currentPage.aboutToShow(UbuntuAnimation.BriskDuration, Qt.RightToLeft);
84 }
84 }
85
85
86 function prev() {
86 function prev() {
87+ var doTransitions = !currentPage.customTitle; // skip for secondary/extra pages
87− if (pageList.index >= pageStack.depth - 1)
88+ if (pageList.index >= pageStack.depth - 1) {
88− pageList.prev() // update pageList.index, but not for extra pages
89+ pageList.prev(); // update pageList.index, but not for extra pages
90+ }
89 pop()
91 pop()
90 if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
92 if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
91− prev()
93+ prev();
92 } else {
94 } else {
93− currentPage.enabled = true
95+ currentPage.enabled = true;
94 }
96 }
95
97
98+ if (doTransitions) {
96− currentPage.aboutToShow(UbuntuAnimation.BriskDuration, Qt.LeftToRight)
99+ currentPage.aboutToShow(UbuntuAnimation.BriskDuration, Qt.LeftToRight);
100+ }
97 }
101 }
98
102
99 function load(path) {
103 function load(path) {