Merge lp:~zsombi/ubuntu-ui-toolkit/progressbar into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Cris Dywan
Approved revision: 2063
Merged at revision: 2095
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/progressbar
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 215 lines (+95/-64)
3 files modified
examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml (+13/-4)
src/Ubuntu/Components/1.3/ProgressBar.qml (+4/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml (+78/-58)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/progressbar
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+303538@code.launchpad.net

Commit message

New visuals for ProgressBar

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

+ Specifies if the value of the progress is visible. The current visuals in
+ Ubuntu Components 1.3 do not support this feature.
     */
    property bool showProgressPercentage: true

This seems to break behavior compatibility: any app that relies on the percentage will be lacking this detail.
And if new code doesn't set showProgressPercentage, like the example in the gallery, a later change in design would result in unexpected labels. So either the default should change to false to prevent this, or showProgressPercentage needs to be deprecated (short of that, we would need visuals so that developers can see that the property affects the component).

+ readonly property bool animateStrip:
+ (styledItem.enabled || styledItem.visible)

Why || rather than && here? What's the purpose of animating an enabled, !visible component?

review: Needs Information
Revision history for this message
Zsombor Egri (zsombi) wrote :

> + Specifies if the value of the progress is visible. The current visuals
> in
> + Ubuntu Components 1.3 do not support this feature.
> */
> property bool showProgressPercentage: true
>
> This seems to break behavior compatibility: any app that relies on the
> percentage will be lacking this detail.
> And if new code doesn't set showProgressPercentage, like the example in the
> gallery, a later change in design would result in unexpected labels. So either
> the default should change to false to prevent this, or showProgressPercentage
> needs to be deprecated (short of that, we would need visuals so that
> developers can see that the property affects the component).

I was thinking to keep the property as if someone wants to have visuals to support the value, they can be driven with it. But I am not strong against deprecating the property, this is typically one property which was introduced later and now we drop it... And it is not really an essential part of the ProgressBar API. But changing the default value is definitely a break, so we rather deprecate it.

>
> + readonly property bool animateStrip:
> + (styledItem.enabled || styledItem.visible)
>
> Why || rather than && here? What's the purpose of animating an enabled,
> !visible component?

Good catch!! I was trying several things to get the indeterminate acting properly, and seems I left the condition messed. So this is a needs fixing type :)

2060. By Zsombor Egri

staging sync

2061. By Zsombor Egri

animate value change on standard progress indication; deprecate showProgressPercentage property

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Phone down, rerunning armhf only manually.

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> > > + readonly property bool animateStrip:
> > Why || rather than && here?
> Good catch!! I was trying several things

You added the 'NumberAnimation on width' but that doesn't change the fact that animateStrip makes no sense - forgot to update it?

review: Needs Fixing
Revision history for this message
Zsombor Egri (zsombi) wrote :

> > > > + readonly property bool animateStrip:
> > > Why || rather than && here?
> > Good catch!! I was trying several things
>
> You added the 'NumberAnimation on width' but that doesn't change the fact that
> animateStrip makes no sense - forgot to update it?

CRAP, yes I did... :/

2062. By Zsombor Egri

fix indeterminate animation condition

2063. By Zsombor Egri

staging sync

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> > You added the 'NumberAnimation on width' but that doesn't change the fact that
> > animateStrip makes no sense - forgot to update it?
> CRAP, yes I did... :/
Thanks!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml'
2--- examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml 2015-04-25 08:18:45 +0000
3+++ examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml 2016-09-07 05:47:50 +0000
4@@ -56,13 +56,13 @@
5 }
6
7 TemplateRow {
8- title: i18n.tr("No label")
9+ title: progressTypeFlip.indeterminate ? i18n.tr("Infinite") : i18n.tr("Standard")
10
11 ProgressBar {
12- id: progressNoLabel
13+ id: progressTypeFlip
14 objectName: "progressbar_nolabel"
15- width: parent.width
16- showProgressPercentage: false
17+ anchors.verticalCenter: parent.verticalCenter
18+ width: parent.width - (switchBox.width + label.width + 2 * parent.spacing)
19
20 SequentialAnimation on value {
21 loops: Animation.Infinite
22@@ -74,6 +74,15 @@
23 PauseAnimation {duration: 1000}
24 }
25 }
26+ Switch {
27+ id: switchBox
28+ checked: progressTypeFlip.indeterminate
29+ onTriggered: progressTypeFlip.indeterminate = !progressTypeFlip.indeterminate
30+ }
31+ Label {
32+ id: label
33+ text: progressTypeFlip.indeterminate ? i18n.tr("to standard") : i18n.tr("to infinite")
34+ }
35 }
36 }
37
38
39=== modified file 'src/Ubuntu/Components/1.3/ProgressBar.qml'
40--- src/Ubuntu/Components/1.3/ProgressBar.qml 2016-05-25 12:48:10 +0000
41+++ src/Ubuntu/Components/1.3/ProgressBar.qml 2016-09-07 05:47:50 +0000
42@@ -1,5 +1,5 @@
43 /*
44- * Copyright 2015 Canonical Ltd.
45+ * Copyright 2015-2016 Canonical Ltd.
46 *
47 * This program is free software; you can redistribute it and/or modify
48 * it under the terms of the GNU Lesser General Public License as published by
49@@ -66,7 +66,9 @@
50
51 /*!
52 \since Ubuntu.Components 1.1
53- Specifies if the value of the progress is visible
54+ \deprecated
55+ Specifies if the value of the progress is visible. The current visuals in
56+ Ubuntu Components 1.3 do not support this feature.
57 */
58 property bool showProgressPercentage: true
59
60
61=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml'
62--- src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml 2016-01-27 15:17:56 +0000
63+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml 2016-09-07 05:47:50 +0000
64@@ -1,5 +1,5 @@
65 /*
66- * Copyright 2015 Canonical Ltd.
67+ * Copyright 2016 Canonical Ltd.
68 *
69 * This program is free software; you can redistribute it and/or modify
70 * it under the terms of the GNU Lesser General Public License as published by
71@@ -17,67 +17,87 @@
72 import QtQuick 2.4
73 import Ubuntu.Components 1.3
74
75-Item {
76+Rectangle {
77 id: progressBarStyle
78
79 property color foregroundColor: styledItem.enabled
80 ? theme.palette.normal.activity
81 : theme.palette.disabled.activity
82- property color foregroundTextColor: styledItem.enabled
83- ? theme.palette.normal.activityText
84- : theme.palette.disabled.activityText
85- property color backgroundColor: styledItem.enabled
86- ? theme.palette.normal.base
87- : theme.palette.disabled.base
88- property color backgroundTextColor: styledItem.enabled
89- ? theme.palette.normal.baseText
90- : theme.palette.disabled.baseText
91-
92- property var progressBar: styledItem
93-
94- implicitWidth: units.gu(38)
95- implicitHeight: units.gu(4)
96-
97- UbuntuShapeOverlay {
98- id: background
99- anchors.fill: parent
100- backgroundColor: progressBarStyle.backgroundColor
101- overlayColor: foregroundColor
102- overlayRect: Qt.application.layoutDirection == Qt.LeftToRight ?
103- Qt.rect(0.0, 0.0, progressBarStyle.progress, 1.0) :
104- Qt.rect(1.0 - progressBarStyle.progress, 0.0, 1.0, 1.0)
105- }
106-
107- property real progress: progressBar.indeterminate ? 0.0
108- : progressBar.value / (progressBar.maximumValue - progressBar.minimumValue)
109-
110- Label {
111- id: valueLabel
112- anchors.centerIn: background
113- color: backgroundTextColor
114- text: progressBar.indeterminate ? i18n.dtr("ubuntu-ui-toolkit", "In Progress")
115- : "%1%".arg(Number(progressBarStyle.progress * 100.0).toFixed(0))
116- visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
117-
118- SequentialAnimation on opacity {
119- loops: Animation.Infinite
120- running: progressBar.indeterminate
121- UbuntuNumberAnimation {
122- to: 0.2; duration: UbuntuAnimation.BriskDuration
123- }
124- UbuntuNumberAnimation {
125- to: 1.0; duration: UbuntuAnimation.BriskDuration
126- }
127- }
128- }
129-
130- PartialColorize {
131- anchors.fill: valueLabel
132- sourceItem: progressBar.indeterminate ? null : valueLabel
133- leftColor: foregroundTextColor
134- rightColor: backgroundTextColor
135- progress: (progressBarStyle.progress * background.width - valueLabel.x) / valueLabel.width
136- mirror: Qt.application.layoutDirection == Qt.RightToLeft
137- visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
138+ color: styledItem.enabled
139+ ? theme.palette.normal.base
140+ : theme.palette.disabled.base
141+
142+ implicitWidth: units.gu(36)
143+ implicitHeight: units.gu(0.4)
144+ clip: true
145+
146+ property real progress: styledItem.indeterminate ? 0.0
147+ : styledItem.value / (styledItem.maximumValue - styledItem.minimumValue)
148+
149+ Rectangle {
150+ id: strip
151+ anchors {
152+ top: parent.top
153+ left: !styledItem.indeterminate ? parent.left : undefined
154+ bottom: parent.bottom
155+ }
156+ color: foregroundColor
157+ width: styledItem.indeterminate
158+ ? MathUtils.clamp(parent.width / 4, units.gu(1), units.gu(30))
159+ : parent.width * progressBarStyle.progress
160+
161+ property int duration: UbuntuAnimation.SleepyDuration
162+ property int easing: Easing.InOutQuad
163+ readonly property bool animateStrip:
164+ styledItem.enabled && styledItem.visible
165+ && styledItem.indeterminate
166+ // animate only after style completion!
167+ && animated && !reverseAnimate
168+ property bool reverseAnimate: false
169+
170+ NumberAnimation on width {
171+ duration: UbuntuAnimation.SlowDuration
172+ easing.type: strip.easing
173+ running: !styledItem.indeterminate && styledItem.enabled && styledItem.visible
174+ }
175+
176+ state: animateStrip ? "animate" : ""
177+
178+ // reversible doesn't work, so we need animatiomns for both transitions
179+ // note: we cannot use XAnimator as there will be a point when
180+ // there will be two animators altering (running) the x property at the
181+ // same time, which causes SIGSEG
182+ transitions: [
183+ Transition {
184+ from: ""
185+ to: "animate"
186+ SequentialAnimation {
187+ NumberAnimation {
188+ target: strip
189+ property: "x"
190+ duration: strip.duration
191+ easing.type: strip.easing
192+ from: -strip.width
193+ to: progressBarStyle.width
194+ }
195+ ScriptAction { script: strip.reverseAnimate = true; }
196+ }
197+ },
198+ Transition {
199+ from: "animate"
200+ to: ""
201+ SequentialAnimation {
202+ NumberAnimation {
203+ target: strip
204+ property: "x"
205+ duration: strip.duration
206+ easing.type: strip.easing
207+ to: -strip.width
208+ from: progressBarStyle.width
209+ }
210+ ScriptAction { script: strip.reverseAnimate = false; }
211+ }
212+ }
213+ ]
214 }
215 }

Subscribers

People subscribed via source and target branches