Merge lp:~nicolas-doffay/ubuntu-ui-toolkit/selector-api-break-fix into lp:ubuntu-ui-toolkit

Proposed by Nicolas d'Offay
Status: Merged
Approved by: Tim Peeters
Approved revision: 829
Merged at revision: 825
Proposed branch: lp:~nicolas-doffay/ubuntu-ui-toolkit/selector-api-break-fix
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 492 lines (+60/-61)
10 files modified
CHANGES (+2/-4)
components.api (+4/-4)
examples/ubuntu-ui-toolkit-gallery/ListItems.qml (+4/-4)
examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml (+4/-4)
modules/Ubuntu/Components/ListItems/ItemSelector.qml (+14/-14)
modules/Ubuntu/Components/OptionSelector.qml (+13/-13)
modules/Ubuntu/Components/OptionSelectorDelegate.qml (+7/-7)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py (+3/-2)
tests/unit_x11/tst_components/tst_listitems_itemselector.qml (+4/-4)
tests/unit_x11/tst_components/tst_optionselector.qml (+5/-5)
To merge this branch: bzr merge lp:~nicolas-doffay/ubuntu-ui-toolkit/selector-api-break-fix
Reviewer Review Type Date Requested Status
Tim Peeters Approve
Timo Jyrinki Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+194313@code.launchpad.net

Commit message

Reverted API break on the selectors.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:825
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/1178/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/554
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/542/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-amd64-ci/126
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/126
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/126/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/511
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/554
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/554/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/542
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/542/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/3009/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3191/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1203
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1201

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/1178/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :
review: Needs Fixing
Revision history for this message
Tim Peeters (tpeeters) wrote :

I propose to keep the "alwaysExpanded" property as it is, and make "expanded" an alias of that one (and mark it as deprecated). That way we introduce the "alwaysExpanded", and we don't break apps that use "expanded".

Also the changes below in the code to change "alwaysExpanded" to "expanded" everywhere can be undone, so this MR will make a lot fewer changes with the same results.

review: Needs Fixing
Revision history for this message
Nicolas d'Offay (nicolas-doffay) wrote :

As mentioned on #sdk I believe it's best to keep it as it is currently. Judging from yesterdays reactions there seemed to be a lot of confusion.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:826
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/1182/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/572
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/557/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-amd64-ci/130
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/130
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/130/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/526
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/572
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/572/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/557
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/557/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/3020/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3202/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1227
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1222

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/1182/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

> As mentioned on #sdk I believe it's best to keep it as it is currently.
> Judging from yesterdays reactions there seemed to be a lot of confusion.

okay

Revision history for this message
Tim Peeters (tpeeters) wrote :

There is still one alwaysExpanded in test_optionselector.py, so one test fails:

https://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/3020/testReport/junit/ubuntuuitoolkit.tests.gallery.test_optionselector/OptionSelectorTests/test_optionselector_collapsed/

Please make sure all tests pass and then ping me so I can approve.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:827
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/1185/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/586
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/571/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-amd64-ci/133
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/133
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/133/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/538
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/586
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/586/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/571
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/571/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/3033/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3215/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1252
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1246

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/1185/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

The error currently seems to be:

./tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py:51:80: E501 line too long (80 > 79 characters)
        self.assertThat(styleditem.currentlyExpanded, Eventually(Equals(False)))
                                                                               ^
./debian/ubuntu-ui-toolkit-autopilot/usr/lib/python2.7/dist-packages/ubuntuuitoolkit/tests/gallery/test_optionselector.py:51:80: E501 line too long (80 > 79 characters)
        self.assertThat(styleditem.currentlyExpanded, Eventually(Equals(False)))
                                                                               ^
./debian/tmp/usr/lib/python2.7/dist-packages/ubuntuuitoolkit/tests/gallery/test_optionselector.py:51:80: E501 line too long (80 > 79 characters)
        self.assertThat(styleditem.currentlyExpanded, Eventually(Equals(False)))

review: Needs Fixing
829. By Nicolas d'Offay

Split long line

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Would be good to get in now that jenkins also approves it.

review: Approve
Revision history for this message
Tim Peeters (tpeeters) wrote :

good to go now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CHANGES'
--- CHANGES 2013-10-23 13:40:23 +0000
+++ CHANGES 2013-11-08 09:19:22 +0000
@@ -9,10 +9,8 @@
99
10API Changes10API Changes
11***********11***********
12* CHANGED IN: OptionSelector: property bool expanded TO bool alwaysExpanded12* ADDED IN: OptionSelector: readonly property bool currentlyExpanded
13* CHANGED IN: ItemSelector: property bool expanded TO bool alwaysExpanded13* ADDED IN: ItemSelector: readonly property bool currentlyExpanded
14* ADDED IN: OptionSelector: readonly property bool expanded
15* ADDED IN: ItemSelector: readonly property bool expanded
16* ADDED IN: Tab: readonly property int index14* ADDED IN: Tab: readonly property int index
17* ADDED IN: ListItem.Empty: property bool confirmRemoval15* ADDED IN: ListItem.Empty: property bool confirmRemoval
18* ADDED IN: OptionSelector: property bool multiSelection16* ADDED IN: OptionSelector: property bool multiSelection
1917
=== modified file 'components.api'
--- components.api 2013-11-04 20:49:16 +0000
+++ components.api 2013-11-08 09:19:22 +0000
@@ -100,12 +100,12 @@
100modules/Ubuntu/Components/OptionSelector.qml100modules/Ubuntu/Components/OptionSelector.qml
101ListItem.Empty101ListItem.Empty
102 property var model102 property var model
103 property bool alwaysExpanded103 property bool expanded
104 property bool multiSelection104 property bool multiSelection
105 property bool colourImage105 property bool colourImage
106 property real containerHeight106 property real containerHeight
107 property int selectedIndex107 property int selectedIndex
108 readonly property bool expanded108 readonly property bool currentlyExpanded
109 readonly property real itemHeight109 readonly property real itemHeight
110 signal delegateClicked(int index)110 signal delegateClicked(int index)
111 signal expansionCompleted()111 signal expansionCompleted()
@@ -441,12 +441,12 @@
441modules/Ubuntu/Components/ListItems/ItemSelector.qml441modules/Ubuntu/Components/ListItems/ItemSelector.qml
442ListItem.Empty442ListItem.Empty
443 property var model443 property var model
444 property bool alwaysExpanded444 property bool expanded
445 property bool multiSelection445 property bool multiSelection
446 property bool colourImage446 property bool colourImage
447 property real containerHeight447 property real containerHeight
448 property int selectedIndex448 property int selectedIndex
449 readonly property bool expanded449 readonly property bool currentlyExpanded
450 readonly property real itemHeight450 readonly property real itemHeight
451 signal delegateClicked(int index)451 signal delegateClicked(int index)
452 signal expansionCompleted()452 signal expansionCompleted()
453453
=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItems.qml'
--- examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2013-10-14 15:58:57 +0000
+++ examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2013-11-08 09:19:22 +0000
@@ -95,7 +95,7 @@
9595
96 ListItem.ItemSelector {96 ListItem.ItemSelector {
97 text: i18n.tr("Expanded")97 text: i18n.tr("Expanded")
98 alwaysExpanded: true98 expanded: true
99 model: [i18n.tr("Value 1"),99 model: [i18n.tr("Value 1"),
100 i18n.tr("Value 2"),100 i18n.tr("Value 2"),
101 i18n.tr("Value 3"),101 i18n.tr("Value 3"),
@@ -104,7 +104,7 @@
104104
105 ListItem.ItemSelector {105 ListItem.ItemSelector {
106 text: i18n.tr("Multiple Selection")106 text: i18n.tr("Multiple Selection")
107 alwaysExpanded: false107 expanded: false
108 multiSelection: true108 multiSelection: true
109 model: [i18n.tr("Value 1"),109 model: [i18n.tr("Value 1"),
110 i18n.tr("Value 2"),110 i18n.tr("Value 2"),
@@ -115,7 +115,7 @@
115 ListItem.ItemSelector {115 ListItem.ItemSelector {
116 text: i18n.tr("Custom Model")116 text: i18n.tr("Custom Model")
117 model: customModel117 model: customModel
118 alwaysExpanded: true118 expanded: true
119 colourImage: true119 colourImage: true
120 delegate: selectorDelegate120 delegate: selectorDelegate
121 }121 }
@@ -148,7 +148,7 @@
148148
149 ListItem.ItemSelector {149 ListItem.ItemSelector {
150 text: i18n.tr("Label")150 text: i18n.tr("Label")
151 alwaysExpanded: true151 expanded: true
152 selectedIndex: -1152 selectedIndex: -1
153 model: [i18n.tr("Value 1"),153 model: [i18n.tr("Value 1"),
154 i18n.tr("Value 2"),154 i18n.tr("Value 2"),
155155
=== modified file 'examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml'
--- examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml 2013-10-21 07:44:03 +0000
+++ examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml 2013-11-08 09:19:22 +0000
@@ -39,7 +39,7 @@
39 OptionSelector {39 OptionSelector {
40 objectName: "optionselector_expanded"40 objectName: "optionselector_expanded"
41 text: i18n.tr("Expanded")41 text: i18n.tr("Expanded")
42 alwaysExpanded: true42 expanded: true
43 model: [i18n.tr("Value 1"),43 model: [i18n.tr("Value 1"),
44 i18n.tr("Value 2"),44 i18n.tr("Value 2"),
45 i18n.tr("Value 3"),45 i18n.tr("Value 3"),
@@ -49,7 +49,7 @@
49 OptionSelector {49 OptionSelector {
50 objectName: "optionselector_multipleselection"50 objectName: "optionselector_multipleselection"
51 text: i18n.tr("Multiple Selection")51 text: i18n.tr("Multiple Selection")
52 alwaysExpanded: false52 expanded: false
53 multiSelection: true53 multiSelection: true
54 model: [i18n.tr("Value 1"),54 model: [i18n.tr("Value 1"),
55 i18n.tr("Value 2"),55 i18n.tr("Value 2"),
@@ -61,7 +61,7 @@
61 objectName: "optionselector_custommodel"61 objectName: "optionselector_custommodel"
62 text: i18n.tr("Custom Model")62 text: i18n.tr("Custom Model")
63 model: customModel63 model: customModel
64 alwaysExpanded: true64 expanded: true
65 colourImage: true65 colourImage: true
66 delegate: selectorDelegate66 delegate: selectorDelegate
67 }67 }
@@ -94,7 +94,7 @@
9494
95 OptionSelector {95 OptionSelector {
96 text: i18n.tr("Label")96 text: i18n.tr("Label")
97 alwaysExpanded: true97 expanded: true
98 selectedIndex: -198 selectedIndex: -1
99 model: [i18n.tr("Value 1"),99 model: [i18n.tr("Value 1"),
100 i18n.tr("Value 2"),100 i18n.tr("Value 2"),
101101
=== modified file 'modules/Ubuntu/Components/ListItems/ItemSelector.qml'
--- modules/Ubuntu/Components/ListItems/ItemSelector.qml 2013-10-14 17:08:13 +0000
+++ modules/Ubuntu/Components/ListItems/ItemSelector.qml 2013-11-08 09:19:22 +0000
@@ -45,7 +45,7 @@
4545
46 ListItem.ItemSelector {46 ListItem.ItemSelector {
47 text: i18n.tr("Label")47 text: i18n.tr("Label")
48 alwaysExpanded: true48 expanded: true
49 model: [i18n.tr("Value 1"),49 model: [i18n.tr("Value 1"),
50 i18n.tr("Value 2"),50 i18n.tr("Value 2"),
51 i18n.tr("Value 3"),51 i18n.tr("Value 3"),
@@ -55,7 +55,7 @@
55 ListItem.ItemSelector {55 ListItem.ItemSelector {
56 text: i18n.tr("Multiple Selection")56 text: i18n.tr("Multiple Selection")
57 alwaysExpanded: false57 alwaysExpanded: false
58 multiSelection: true58 expanded: true
59 model: [i18n.tr("Value 1"),59 model: [i18n.tr("Value 1"),
60 i18n.tr("Value 2"),60 i18n.tr("Value 2"),
61 i18n.tr("Value 3"),61 i18n.tr("Value 3"),
@@ -65,7 +65,7 @@
65 ListItem.ItemSelector {65 ListItem.ItemSelector {
66 text: i18n.tr("Label")66 text: i18n.tr("Label")
67 model: customModel67 model: customModel
68 alwaysExpanded: true68 expanded: true
69 colourImage: true69 colourImage: true
70 delegate: selectorDelegate70 delegate: selectorDelegate
71 }71 }
@@ -98,7 +98,7 @@
9898
99 ListItem.ItemSelector {99 ListItem.ItemSelector {
100 text: i18n.tr("Label")100 text: i18n.tr("Label")
101 alwaysExpanded: true101 expanded: true
102 model: [i18n.tr("Value 1"),102 model: [i18n.tr("Value 1"),
103 i18n.tr("Value 2"),103 i18n.tr("Value 2"),
104 i18n.tr("Value 3"),104 i18n.tr("Value 3"),
@@ -127,7 +127,7 @@
127 \preliminary127 \preliminary
128 Specifies whether the list is always alwaysExpanded.128 Specifies whether the list is always alwaysExpanded.
129 */129 */
130 property bool alwaysExpanded: false130 property bool expanded: false
131131
132 /*!132 /*!
133 \preliminary133 \preliminary
@@ -161,9 +161,9 @@
161161
162 /*!162 /*!
163 \qmlproperty bool expanded163 \qmlproperty bool expanded
164 Is our list currently alwaysExpanded?164 Is our list currently expanded?
165 */165 */
166 readonly property alias expanded: listContainer.expanded166 readonly property alias currentlyExpanded: listContainer.currentlyExpanded
167167
168 /*!168 /*!
169 \qmlproperty real itemHeight169 \qmlproperty real itemHeight
@@ -204,25 +204,25 @@
204 readonly property url tick: __styleInstance.tick204 readonly property url tick: __styleInstance.tick
205 readonly property color themeColour: Theme.palette.selected.fieldText205 readonly property color themeColour: Theme.palette.selected.fieldText
206 readonly property alias colourImage: itemSelector.colourImage206 readonly property alias colourImage: itemSelector.colourImage
207 property bool expanded: alwaysExpanded || multiSelection207 property bool currentlyExpanded: expanded || multiSelection
208208
209 anchors {209 anchors {
210 left: parent.left210 left: parent.left
211 right: parent.right211 right: parent.right
212 }212 }
213 state: itemSelector.alwaysExpanded ? state = "alwaysExpanded" : state = "collapsed"213 state: itemSelector.expanded ? state = "alwaysExpanded" : state = "collapsed"
214 style: Theme.createStyleComponent("ListItemOptionSelectorStyle.qml", listContainer)214 style: Theme.createStyleComponent("ListItemOptionSelectorStyle.qml", listContainer)
215215
216 states: [ State {216 states: [ State {
217 name: "expanded"217 name: "expanded"
218 when: listContainer.expanded218 when: listContainer.currentlyExpanded
219 PropertyChanges {219 PropertyChanges {
220 target: listContainer220 target: listContainer
221 height: list.contentHeight < containerHeight ? list.contentHeight : containerHeight221 height: list.contentHeight < containerHeight ? list.contentHeight : containerHeight
222 }222 }
223 }, State {223 }, State {
224 name: "collapsed"224 name: "collapsed"
225 when: !listContainer.expanded225 when: !listContainer.currentlyExpanded
226 PropertyChanges {226 PropertyChanges {
227 target: listContainer227 target: listContainer
228 height: list.itemHeight228 height: list.itemHeight
@@ -238,7 +238,7 @@
238 }238 }
239 ScriptAction {239 ScriptAction {
240 script: {240 script: {
241 if (listContainer.expanded) {241 if (listContainer.currentlyExpanded) {
242 expansionCompleted();242 expansionCompleted();
243 }243 }
244 }244 }
@@ -252,14 +252,14 @@
252 objectName: "listView"252 objectName: "listView"
253253
254 property int previousIndex: list.currentIndex254 property int previousIndex: list.currentIndex
255 readonly property alias alwaysExpanded: itemSelector.alwaysExpanded255 readonly property alias expanded: itemSelector.expanded
256 readonly property alias multiSelection: itemSelector.multiSelection256 readonly property alias multiSelection: itemSelector.multiSelection
257 readonly property alias container: listContainer257 readonly property alias container: listContainer
258 property real itemHeight258 property real itemHeight
259 signal delegateClicked(int index)259 signal delegateClicked(int index)
260260
261 onDelegateClicked: itemSelector.delegateClicked(index);261 onDelegateClicked: itemSelector.delegateClicked(index);
262 interactive: listContainer.height !== list.contentHeight && listContainer.expanded ? true : false262 interactive: listContainer.height !== list.contentHeight && listContainer.currentlyExpanded ? true : false
263 clip: true263 clip: true
264 currentIndex: 0264 currentIndex: 0
265 model: itemSelector.model265 model: itemSelector.model
266266
=== modified file 'modules/Ubuntu/Components/OptionSelector.qml'
--- modules/Ubuntu/Components/OptionSelector.qml 2013-10-14 15:58:57 +0000
+++ modules/Ubuntu/Components/OptionSelector.qml 2013-11-08 09:19:22 +0000
@@ -43,7 +43,7 @@
4343
44 OptionSelector {44 OptionSelector {
45 text: i18n.tr("Label")45 text: i18n.tr("Label")
46 alwaysExpanded: true46 expanded: true
47 model: [i18n.tr("Value 1"),47 model: [i18n.tr("Value 1"),
48 i18n.tr("Value 2"),48 i18n.tr("Value 2"),
49 i18n.tr("Value 3"),49 i18n.tr("Value 3"),
@@ -53,7 +53,7 @@
53 OptionSelector {53 OptionSelector {
54 objectName: "optionselector_multipleselection"54 objectName: "optionselector_multipleselection"
55 text: i18n.tr("Multiple Selection")55 text: i18n.tr("Multiple Selection")
56 alwaysExpanded: false56 expanded: false
57 multiSelection: true57 multiSelection: true
58 model: [i18n.tr("Value 1"),58 model: [i18n.tr("Value 1"),
59 i18n.tr("Value 2"),59 i18n.tr("Value 2"),
@@ -64,7 +64,7 @@
64 OptionSelector {64 OptionSelector {
65 text: i18n.tr("Label")65 text: i18n.tr("Label")
66 model: customModel66 model: customModel
67 alwaysExpanded: true67 expanded: true
68 colourImage: true68 colourImage: true
69 delegate: selectorDelegate69 delegate: selectorDelegate
70 }70 }
@@ -97,7 +97,7 @@
9797
98 OptionSelector {98 OptionSelector {
99 text: i18n.tr("Label")99 text: i18n.tr("Label")
100 alwaysExpanded: true100 expanded: true
101 model: [i18n.tr("Value 1"),101 model: [i18n.tr("Value 1"),
102 i18n.tr("Value 2"),102 i18n.tr("Value 2"),
103 i18n.tr("Value 3"),103 i18n.tr("Value 3"),
@@ -126,7 +126,7 @@
126 \preliminary126 \preliminary
127 Specifies whether the list is always expanded.127 Specifies whether the list is always expanded.
128 */128 */
129 property bool alwaysExpanded: false129 property bool expanded: false
130130
131 /*!131 /*!
132 \preliminary132 \preliminary
@@ -162,7 +162,7 @@
162 \qmlproperty bool expanded162 \qmlproperty bool expanded
163 Is our list currently expanded?163 Is our list currently expanded?
164 */164 */
165 readonly property alias expanded: listContainer.expanded165 readonly property alias currentlyExpanded: listContainer.currentlyExpanded
166166
167 /*!167 /*!
168 \qmlproperty real itemHeight168 \qmlproperty real itemHeight
@@ -215,24 +215,24 @@
215 readonly property url tick: __styleInstance.tick215 readonly property url tick: __styleInstance.tick
216 readonly property color themeColour: Theme.palette.selected.fieldText216 readonly property color themeColour: Theme.palette.selected.fieldText
217 readonly property alias colourImage: optionSelector.colourImage217 readonly property alias colourImage: optionSelector.colourImage
218 property bool expanded: alwaysExpanded || multiSelection218 property bool currentlyExpanded: expanded || multiSelection
219219
220 anchors {220 anchors {
221 left: parent.left221 left: parent.left
222 right: parent.right222 right: parent.right
223 }223 }
224 state: optionSelector.alwaysExpanded ? state = "expanded" : state = "collapsed"224 state: optionSelector.expanded ? state = "expanded" : state = "collapsed"
225 style: Theme.createStyleComponent("OptionSelectorStyle.qml", listContainer)225 style: Theme.createStyleComponent("OptionSelectorStyle.qml", listContainer)
226 states: [ State {226 states: [ State {
227 name: "expanded"227 name: "expanded"
228 when: listContainer.expanded228 when: listContainer.currentlyExpanded
229 PropertyChanges {229 PropertyChanges {
230 target: listContainer230 target: listContainer
231 height: list.contentHeight < containerHeight ? list.contentHeight : containerHeight231 height: list.contentHeight < containerHeight ? list.contentHeight : containerHeight
232 }232 }
233 }, State {233 }, State {
234 name: "collapsed"234 name: "collapsed"
235 when: !listContainer.expanded235 when: !listContainer.currentlyExpanded
236 PropertyChanges {236 PropertyChanges {
237 target: listContainer237 target: listContainer
238 height: list.itemHeight238 height: list.itemHeight
@@ -248,7 +248,7 @@
248 }248 }
249 ScriptAction {249 ScriptAction {
250 script: {250 script: {
251 if (listContainer.expanded) {251 if (listContainer.currentlyExpanded) {
252 expansionCompleted();252 expansionCompleted();
253 }253 }
254 }254 }
@@ -261,14 +261,14 @@
261 id: list261 id: list
262262
263 property int previousIndex: -1263 property int previousIndex: -1
264 readonly property alias alwaysExpanded: optionSelector.alwaysExpanded264 readonly property alias expanded: optionSelector.expanded
265 readonly property alias multiSelection: optionSelector.multiSelection265 readonly property alias multiSelection: optionSelector.multiSelection
266 readonly property alias container: listContainer266 readonly property alias container: listContainer
267 property real itemHeight267 property real itemHeight
268 signal delegateClicked(int index)268 signal delegateClicked(int index)
269269
270 onDelegateClicked: optionSelector.delegateClicked(index);270 onDelegateClicked: optionSelector.delegateClicked(index);
271 interactive: listContainer.height !== list.contentHeight && listContainer.expanded ? true : false271 interactive: listContainer.height !== list.contentHeight && listContainer.currentlyExpanded ? true : false
272 clip: true272 clip: true
273 currentIndex: 0273 currentIndex: 0
274 model: optionSelector.model274 model: optionSelector.model
275275
=== modified file 'modules/Ubuntu/Components/OptionSelectorDelegate.qml'
--- modules/Ubuntu/Components/OptionSelectorDelegate.qml 2013-10-14 15:58:57 +0000
+++ modules/Ubuntu/Components/OptionSelectorDelegate.qml 2013-11-08 09:19:22 +0000
@@ -115,7 +115,7 @@
115 right: parent.right115 right: parent.right
116 }116 }
117 onClicked: {117 onClicked: {
118 if (listView.container.expanded) {118 if (listView.container.currentlyExpanded) {
119 listView.delegateClicked(index);119 listView.delegateClicked(index);
120120
121 if (!listView.multiSelection) {121 if (!listView.multiSelection) {
@@ -126,8 +126,8 @@
126 }126 }
127 }127 }
128128
129 if (!listView.alwaysExpanded && !listView.multiSelection) {129 if (!listView.expanded && !listView.multiSelection) {
130 listView.container.expanded = !listView.container.expanded;130 listView.container.currentlyExpanded = !listView.container.currentlyExpanded;
131 }131 }
132 }132 }
133133
@@ -168,14 +168,14 @@
168 resources: [168 resources: [
169 Connections {169 Connections {
170 target: listView.container170 target: listView.container
171 onExpandedChanged: {171 onCurrentlyExpandedChanged: {
172 optionExpansion.stop();172 optionExpansion.stop();
173 imageExpansion.stop();173 imageExpansion.stop();
174 optionCollapse.stop();174 optionCollapse.stop();
175 selectedImageCollapse.stop();175 selectedImageCollapse.stop();
176 deselectedImageCollapse.stop();176 deselectedImageCollapse.stop();
177177
178 if (listView.container.expanded === true) {178 if (listView.container.currentlyExpanded === true) {
179 if (!option.selected) {179 if (!option.selected) {
180 optionExpansion.start();180 optionExpansion.start();
181181
@@ -341,7 +341,7 @@
341341
342 width: units.gu(2)342 width: units.gu(2)
343 height: units.gu(2)343 height: units.gu(2)
344 source: listView.alwaysExpanded || listView.multiSelection ? listView.container.tick : listView.container.chevron344 source: listView.expanded || listView.multiSelection ? listView.container.tick : listView.container.chevron
345 opacity: option.selected ? 1.0 : 0.0345 opacity: option.selected ? 1.0 : 0.0
346 anchors {346 anchors {
347 right: parent.right347 right: parent.right
@@ -351,7 +351,7 @@
351351
352 //Our behaviour is only enabled for our expanded list due to flickering bugs in relation to all this other animations running on the expanding version.352 //Our behaviour is only enabled for our expanded list due to flickering bugs in relation to all this other animations running on the expanding version.
353 Behavior on opacity {353 Behavior on opacity {
354 enabled: listView.alwaysExpanded354 enabled: listView.expanded
355355
356 Toolkit.UbuntuNumberAnimation {356 Toolkit.UbuntuNumberAnimation {
357 properties: "opacity"357 properties: "opacity"
358358
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2013-10-21 10:03:23 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2013-11-08 09:19:22 +0000
@@ -35,7 +35,7 @@
3535
36 self.assertThat(collapsed.selectedIndex, Equals(0))36 self.assertThat(collapsed.selectedIndex, Equals(0))
37 self.pointing_device.click_object(collapsed)37 self.pointing_device.click_object(collapsed)
38 self.assertThat(styleditem.expanded, Eventually(Equals(True)))38 self.assertThat(styleditem.currentlyExpanded, Eventually(Equals(True)))
39 #try to search the following list entry few times39 #try to search the following list entry few times
40 #as it may not be available immediately.40 #as it may not be available immediately.
41 for t in range(0, 9):41 for t in range(0, 9):
@@ -48,7 +48,8 @@
4848
49 self.pointing_device.click_object(selectedValue)49 self.pointing_device.click_object(selectedValue)
50 self.assertThat(collapsed.selectedIndex, Eventually(Equals(3)))50 self.assertThat(collapsed.selectedIndex, Eventually(Equals(3)))
51 self.assertThat(styleditem.expanded, Eventually(Equals(False)))51 self.assertThat(styleditem.currentlyExpanded,
52 Eventually(Equals(False)))
5253
53 def test_optionselector_expanded(self):54 def test_optionselector_expanded(self):
54 item = "Option Selector"55 item = "Option Selector"
5556
=== modified file 'tests/unit_x11/tst_components/tst_listitems_itemselector.qml'
--- tests/unit_x11/tst_components/tst_listitems_itemselector.qml 2013-10-14 17:08:43 +0000
+++ tests/unit_x11/tst_components/tst_listitems_itemselector.qml 2013-11-08 09:19:22 +0000
@@ -73,12 +73,12 @@
73 function test_expanded() {73 function test_expanded() {
74 var listContainer = findChild(selector, "listContainer");74 var listContainer = findChild(selector, "listContainer");
7575
76 selector.alwaysExpanded = false;76 selector.expanded = false;
77 compare(listContainer.expanded, false, "expanded should be true if list is an expanded one");77 compare(listContainer.currentlyExpanded, false, "expanded should be true if list is an expanded one");
78 compare(listContainer.state, "collapsed", "state should be collapsed");78 compare(listContainer.state, "collapsed", "state should be collapsed");
7979
80 selector.alwaysExpanded = true;80 selector.expanded = true;
81 compare(listContainer.expanded, true, "expanded should be false if list is an expanded one");81 compare(listContainer.currentlyExpanded, true, "expanded should be false if list is an expanded one");
82 compare(listContainer.state, "expanded", "state should be expanded");82 compare(listContainer.state, "expanded", "state should be expanded");
83 }83 }
8484
8585
=== modified file 'tests/unit_x11/tst_components/tst_optionselector.qml'
--- tests/unit_x11/tst_components/tst_optionselector.qml 2013-10-14 17:08:13 +0000
+++ tests/unit_x11/tst_components/tst_optionselector.qml 2013-11-08 09:19:22 +0000
@@ -35,7 +35,7 @@
35 text: "TEST"35 text: "TEST"
36 delegate: selectorDelegate36 delegate: selectorDelegate
37 model: customModel37 model: customModel
38 alwaysExpanded: true38 expanded: true
3939
40 action: {40 action: {
41 enabled: true41 enabled: true
@@ -93,12 +93,12 @@
93 function test_expanded() {93 function test_expanded() {
94 var listContainer = findChild(selector, "listContainer");94 var listContainer = findChild(selector, "listContainer");
9595
96 selector.alwaysExpanded = false;96 selector.expanded = false;
97 compare(listContainer.expanded, false, "expanded should be true if list is an expanded one");97 compare(listContainer.currentlyExpanded, false, "expanded should be true if list is an expanded one");
98 compare(listContainer.state, "collapsed", "state should be collapsed");98 compare(listContainer.state, "collapsed", "state should be collapsed");
9999
100 selector.alwaysExpanded = true;100 selector.expanded = true;
101 compare(listContainer.expanded, true, "expanded should be false if list is an expanded one");101 compare(listContainer.currentlyExpanded, true, "expanded should be false if list is an expanded one");
102 compare(listContainer.state, "expanded", "state should be expanded");102 compare(listContainer.state, "expanded", "state should be expanded");
103 }103 }
104104

Subscribers

People subscribed via source and target branches

to status/vote changes: