Merge lp:~nicolas-doffay/ubuntu-ui-toolkit/ubuntu-shape-option-selector into lp:ubuntu-ui-toolkit

Proposed by Nicolas d'Offay
Status: Merged
Approved by: Cris Dywan
Approved revision: 724
Merged at revision: 722
Proposed branch: lp:~nicolas-doffay/ubuntu-ui-toolkit/ubuntu-shape-option-selector
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 1049 lines (+824/-58)
15 files modified
CHANGES (+1/-1)
components.api (+17/-0)
examples/ubuntu-ui-toolkit-gallery/ListItems.qml (+0/-12)
examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml (+73/-0)
examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml (+5/-0)
modules/Ubuntu/Components/ListItems/Empty.qml (+9/-44)
modules/Ubuntu/Components/OptionSelector.qml (+198/-0)
modules/Ubuntu/Components/OptionSelectorDelegate.qml (+324/-0)
modules/Ubuntu/Components/Themes/Ambiance/OptionSelectorStyle.qml (+35/-0)
modules/Ubuntu/Components/Themes/Ambiance/qmldir (+1/-0)
modules/Ubuntu/Components/Themes/SuruDark/OptionSelectorStyle.qml (+23/-0)
modules/Ubuntu/Components/Themes/SuruGradient/OptionSelectorStyle.qml (+27/-0)
modules/Ubuntu/Components/qmldir (+2/-0)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py (+2/-1)
tests/unit/tst_components/tst_optionselector.qml (+107/-0)
To merge this branch: bzr merge lp:~nicolas-doffay/ubuntu-ui-toolkit/ubuntu-shape-option-selector
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zsombor Egri Approve
Cris Dywan Approve
Michał Sawicz functional Approve
Review via email: mp+175242@code.launchpad.net

Commit message

Themed UbuntuShape OptionSelector.

Description of the change

Added UbuntuShape OptionSelector to components with Ambiance, SuruDark and SuruGradient themes.

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

selectedIndex needs "\qmlproperty int selectedIndex" to make it show the type in the docs.

"scrollContainer" seems a little magic - I'm seeing this for the first time and there's no type check. I have a "flickable" property elsewhere… does this expect a flickable? Or some other component?

How about documenting that "values" is indeed a list model? One might not expect that it's supported.

review: Needs Fixing
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
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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

There are a few visual issues - compare the two images:

http://ubuntuone.com/6OMAdfdJG4nACLEbqJJTYj
http://ubuntuone.com/3RBKZ3CYARvYRk0QN0JqGZ

* the only change there is expanding the list, but text shifts
* grey highlight overlays the borders (are you using an UbuntuShape with a ShaderEffectSource for this?)
* the border shape changes weird when expanding (like at the top it gets pretty thick)
* the chevron and "downward caret" signs are replaced in one frame - do we have design guidance on what the transition should be?
* same for the selected item hightlight - shouldn't there be a transition when you change the selection in the "expanded" OptionSelector?
* where is the full-width OptionSelector? And is it desired that ValueSelector isn't there in the gallery any more?

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicolas d'Offay (nicolas-doffay) wrote :

Good points Saviq. Design's guidance is certainly required. The grey highlight was dealt with in a separate branch for the SDK. It was totally removed since it wasn't required in any components. Unsure as to why this is still here, going to do some digging.

Regarding the full width Option Selector, that will be landed immediatly after this is. They have been split into two separate components as per Florian's request.

The value selector is going to be deprecated, so I figured it would be a good idea to remove it from the gallery.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Which branch are you referring to wrt the grey highlight? Can you merge the changes here now?

And to re-cap, these design questions need to be resolved:
* the only change there is expanding the list, but text shifts
* the border shape changes weird when expanding (like at the top it gets pretty thick)
* the chevron and "downward caret" signs are replaced in one frame
* shouldn't there be a transition when you change the selection in the "expanded" OptionSelector?

review: Needs Information
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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicolas d'Offay (nicolas-doffay) wrote :

The issue with the UbuntuShape will hopefully be addressed by Loic's refactoring of it. Holding off on that 'til then.

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
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
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
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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

listItemClicked is missing from components.api.

Shouldn't listItemClicked() come after changing the values? Otherwise a callback handling this would see the old state with no easy way to see what will happen.

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

I named it incorrectly! Good point about the state checking too. Moved it to the end.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Nice stuff.

review: Approve
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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

The animations are incorrect:
* when expanding, there should be no pause before the tick replaces the chevron - according to design, the chevron should finish fading out when the expansion finished, and that's when the tick is supposed to fade in
* ticks and chevrons should not cross-fade, but fade-out and fade-in in sequence
* ticks should fade-out/fade-in when changing positions

review: Needs Fixing
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
Michał Sawicz (saviq) wrote :

* the first divider does not fade-out / in, the design says that all of them should.
* the chevron/tick fade-out/fade-in is only started *after* the expansion happened, the chevron fade-out should finish with the expansion and then the tick fade-in should start

Something is wrong with first item's tick animation, in gallery:
* expand the expandable selector
* observe the first item's tick
* select a different option - the first item's tick flickers

review: Needs Fixing
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
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
Michał Sawicz (saviq) wrote :

This looks good now!

review: Approve (functional)
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
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
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
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
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
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: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

I'll be damned, r711 looks so dead simple just to fix Jenkins. For record, we need to get better ways to locally test and find such problems.

Love the delegate, nice and simple on the app side. A style we should consider in other places when it makes sense.

There's one problem theming-wise I see: with SuruGradient the icon used in the gallery won't change color. It should be supporting the colorizing done in eg. Icon. It would be nice to move the Image/ShaderEffect of Icon into a component like ColorizedIcon and re-use the code. This could also be used for the chevron.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicolas d'Offay (nicolas-doffay) wrote :

I think for this case it would be best to leave ColourizeIcon as it as, instead move the tick and chevron assets to where the "Icon" assets live and use an Image for that component. As for the image, I think the shader should be used in this case.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> I think for this case it would be best to leave ColourizeIcon as it as,
> instead move the tick and chevron assets to where the "Icon" assets live and
> use an Image for that component. As for the image, I think the shader should
> be used in this case.

*nod* I'm fine with leaving that for a separate branch/ discussion. Theming works fine now with the shader.

review: Approve
716. By Zsombor Egri

Fixing Unity8 crash with the latest SDK release. (LP: #1217650)

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

Guys, you made the PopoverForegroundStyle as internal, and that breaks Unity8. So I had to remove this from the trunk and set back for review. Please push it again once fixed.

Thx!

review: Needs Fixing
717. By Timo Jyrinki

Sync changelog.

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)
718. By PS Jenkins bot

Releasing 0.1.46+13.10.20130828-0ubuntu1 (revision 717 from lp:ubuntu-ui-toolkit).

Approved by PS Jenkins bot.

719. By Nicolas d'Offay

Comitted revert

720. By Nicolas d'Offay

Bazaar seemed to be confused, redid changes.

721. By Nicolas d'Offay

Merged trunk.

722. By Nicolas d'Offay

Updated docs.

723. By Nicolas d'Offay

Removed some text from the OptionSelectorDelegate.

724. By Nicolas d'Offay

Changed documentation again, OptionSelector is a component, not a ListItem.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

good to go now :)

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CHANGES'
--- CHANGES 2013-08-28 08:06:11 +0000
+++ CHANGES 2013-08-28 12:13:08 +0000
@@ -9,7 +9,7 @@
99
10API Changes10API Changes
11***********11***********
1212* ADDED IN: Empty: property alias divider
13* REMOVED IN ALL: attached property ItemStyle13* REMOVED IN ALL: attached property ItemStyle
14* ADDED IN OrientationHelper: property alias rotating14* ADDED IN OrientationHelper: property alias rotating
15* ADDED IN OrientationHelper: property alias __orientationHelper15* ADDED IN OrientationHelper: property alias __orientationHelper
1616
=== modified file 'components.api'
--- components.api 2013-08-28 08:06:11 +0000
+++ components.api 2013-08-28 12:13:08 +0000
@@ -99,6 +99,23 @@
99modules/Ubuntu/Components/Object.qml99modules/Ubuntu/Components/Object.qml
100QtObject100QtObject
101 default property internal children101 default property internal children
102modules/Ubuntu/Components/OptionSelector.qml
103ListItem.Empty
104 property var model
105 property bool expanded
106 property bool colourImage
107 readonly property int selectedIndex
108 property real containerHeight
109 signal scroll()
110modules/Ubuntu/Components/OptionSelectorDelegate.qml
111ListItem.Standard
112 property string text
113 property string subText
114 property url icon
115 property ListView listView
116 property color assetColour
117 property bool colourImage
118 property string fragColourShader
102modules/Ubuntu/Components/OrientationHelper.qml119modules/Ubuntu/Components/OrientationHelper.qml
103Item120Item
104 property bool automaticOrientation121 property bool automaticOrientation
105122
=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItems.qml'
--- examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2013-08-28 08:06:11 +0000
+++ examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2013-08-28 12:13:08 +0000
@@ -77,18 +77,6 @@
77 }77 }
7878
79 ListItemsSection {79 ListItemsSection {
80 title: i18n.tr("Value selector")
81 className: "ValueSelector"
82 delegate: ListItem.ValueSelector {
83 text: i18n.tr("Label")
84 values: [i18n.tr("Value 1"),
85 i18n.tr("Value 2"),
86 i18n.tr("Value 3"),
87 i18n.tr("Value 4")]
88 }
89 }
90
91 ListItemsSection {
92 title: i18n.tr("Control")80 title: i18n.tr("Control")
93 className: "Standard"81 className: "Standard"
94 delegate: ListItem.Standard {82 delegate: ListItem.Standard {
9583
=== added file 'examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml'
--- examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml 1970-01-01 00:00:00 +0000
+++ examples/ubuntu-ui-toolkit-gallery/OptionSelectors.qml 2013-08-28 12:13:08 +0000
@@ -0,0 +1,73 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Template {
21 TemplateSection {
22 id: section
23
24 title: i18n.tr("Option Selector")
25 className: "Option Selector"
26
27 Column {
28 id: column
29 anchors.left: parent.left
30 anchors.right: parent.right
31 spacing: units.gu(3)
32
33 OptionSelector {
34 text: i18n.tr("Label")
35 model: [i18n.tr("Value 1"),
36 i18n.tr("Value 2"),
37 i18n.tr("Value 3"),
38 i18n.tr("Value 4")]
39 }
40
41 OptionSelector {
42 text: i18n.tr("Label")
43 expanded: true
44 model: [i18n.tr("Value 1"),
45 i18n.tr("Value 2"),
46 i18n.tr("Value 3"),
47 i18n.tr("Value 4")]
48 }
49
50 OptionSelector {
51 text: i18n.tr("Label")
52 model: customModel
53 expanded: true
54 colourImage: true
55 delegate: selectorDelegate
56 }
57
58 Component {
59 id: selectorDelegate
60
61 OptionSelectorDelegate { text: name; subText: description; icon: image }
62 }
63
64 ListModel {
65 id: customModel
66 ListElement { name: "Name 1"; description: "Description 1"; image: "images.png" }
67 ListElement { name: "Name 2"; description: "Description 2"; image: "images.png" }
68 ListElement { name: "Name 3"; description: "Description 3"; image: "images.png" }
69 ListElement { name: "Name 4"; description: "Description 4"; image: "images.png" }
70 }
71 }
72 }
73}
074
=== modified file 'examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml'
--- examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2013-08-28 08:06:11 +0000
+++ examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2013-08-28 12:13:08 +0000
@@ -40,6 +40,11 @@
40 source: "TextInputs.qml"40 source: "TextInputs.qml"
41 }41 }
4242
43 ListElement {
44 label: "Option Selector"
45 source: "OptionSelectors.qml"
46 }
47
43 // Not in design guidelines yet48 // Not in design guidelines yet
44 ListElement {49 ListElement {
45 label: "Progress and activity"50 label: "Progress and activity"
4651
=== added file 'examples/ubuntu-ui-toolkit-gallery/images.png'
47Binary files examples/ubuntu-ui-toolkit-gallery/images.png 1970-01-01 00:00:00 +0000 and examples/ubuntu-ui-toolkit-gallery/images.png 2013-08-28 12:13:08 +0000 differ52Binary files examples/ubuntu-ui-toolkit-gallery/images.png 1970-01-01 00:00:00 +0000 and examples/ubuntu-ui-toolkit-gallery/images.png 2013-08-28 12:13:08 +0000 differ
=== modified file 'modules/Ubuntu/Components/ListItems/Empty.qml'
--- modules/Ubuntu/Components/ListItems/Empty.qml 2013-08-28 08:06:11 +0000
+++ modules/Ubuntu/Components/ListItems/Empty.qml 2013-08-28 12:13:08 +0000
@@ -120,34 +120,7 @@
120 Set to show or hide the thin bottom divider line (drawn by the \l ThinDivider component).120 Set to show or hide the thin bottom divider line (drawn by the \l ThinDivider component).
121 This line is shown by default except in cases where this item is the delegate of a ListView.121 This line is shown by default except in cases where this item is the delegate of a ListView.
122 */122 */
123 property bool showDivider: __showDivider()123 property bool showDivider: true
124
125 /*!
126 \internal
127 Method to automatically determine if the bottom divider line should be drawn.
128 This always returns true, unless item is a delegate in a ListView. If in a ListView
129 it will return false only when:
130 + if there is a section.delegate below this item (as thin divider line and section
131 delegate should not both appear)
132 + if this is the final item in the list, and ListView.footer is set (again as thin
133 divider line won't look well with footer below it)
134 */
135 // FIXME: The new design shows dividers everywhere, so if it does not change anymore,
136 // the __showDivider() function may be removed.
137 function __showDivider() {
138 // if we're not in ListView, always show a thin dividing line at the bottom
139 //if (ListView.view !== null) {
140
141 // if we're last item in ListView, show divider if no footer is defined
142 // and hide it if footer defined
143 //if (index === ListView.view.model.count - 1) return !ListView.footer;
144
145 // if section.delegate is positioned between this item and the next
146 //else if (ListView.section !== ListView.nextSection) return true;
147 //else return false;
148 //}
149 return true;
150 }
151124
152 /*!125 /*!
153 \internal126 \internal
@@ -169,6 +142,13 @@
169 */142 */
170 property alias backgroundIndicator: backgroundIndicator.children143 property alias backgroundIndicator: backgroundIndicator.children
171144
145 /*!
146 \preliminary
147 \qmlproperty ThinDivider bottomDividerLine
148 Exposes our the bottom line divider.
149 */
150 property alias divider: bottomDividerLine
151
172 /*! \internal152 /*! \internal
173 The spacing inside the list item.153 The spacing inside the list item.
174 */154 */
@@ -272,21 +252,6 @@
272 }252 }
273 }253 }
274254
275 Rectangle {
276 id: highlight
277
278 z: -1
279 visible: !priv.removed && emptyListItem.swipingState === "" ? emptyListItem.selected || (emptyListItem.highlightWhenPressed && emptyListItem.pressed) : false
280 anchors {
281 left: parent.left
282 right: parent.right
283 top: parent.top
284 }
285 height: emptyListItem.height - bottomDividerLine.height
286 color: Theme.palette.selected.background
287 }
288
289
290 ThinDivider {255 ThinDivider {
291 id: bottomDividerLine256 id: bottomDividerLine
292 anchors.bottom: parent.bottom257 anchors.bottom: parent.bottom
@@ -302,7 +267,7 @@
302 left: parent.left267 left: parent.left
303 right: parent.right268 right: parent.right
304 top: parent.top269 top: parent.top
305 bottom: bottomDividerLine.top270 bottom: parent.bottom
306 }271 }
307272
308 Item {273 Item {
309274
=== added file 'modules/Ubuntu/Components/OptionSelector.qml'
--- modules/Ubuntu/Components/OptionSelector.qml 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/OptionSelector.qml 2013-08-28 12:13:08 +0000
@@ -0,0 +1,198 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "ListItems" as ListItem
19import Ubuntu.Components 0.1 as Components
20
21/*!
22 \qmltype OptionSelector
23 \inqmlmodule Components.Components 0.1
24 \ingroup ubuntu-components
25 \brief Component displaying a single selected value with and optional image and subtext when not expanded, where expanding
26 it opens a listing of all the possible values for selection with an additional option of always being expanded.
27
28 \b{This component is under heavy development.}
29
30 Examples:
31 \qml
32 import Components.Components 0.1
33 Column {
34 width: 250
35 OptionSelector {
36 text: "Standard"
37 model: ["Value 1", "Value 2", "Value 3", "Value 4"]
38 }
39 OptionSelector {
40 text: "Disabled"
41 model: ["Value 1", "Value 2", "Value 3", "Value 4"]
42 enabled: false
43 }
44 OptionSelector {
45 text: "Expanded"
46 model: ["Value 1", "Value 2", "Value 3", "Value 4"]
47 expanded: true
48 }
49 OptionSelector {
50 text: "Icon"
51 icon: Qt.resolvedUrl("icon.png")
52 values: ["Value 1", "Value 2", "Value 3", "Value 4"]
53 selectedIndex: 2
54 }
55 OptionSelector {
56 text: i18n.tr("Label")
57 model: customModel
58 expanded: true
59 colourImage: true
60 delegate: OptionSelectorDelegate { text: name; subText: description; icon: image }
61 }
62 ListModel {
63 id: customModel
64 ListElement { name: "Name 1"; description: "Description 1"; image: "images.png" }
65 ListElement { name: "Name 2"; description: "Description 2"; image: "images.png" }
66 ListElement { name: "Name 3"; description: "Description 3"; image: "images.png" }
67 ListElement { name: "Name 4"; description: "Description 4"; image: "images.png" }
68 }
69 }
70 \endqml
71*/
72
73ListItem.Empty {
74 id: optionSelector
75 __height: column.height
76
77 /*!
78 \preliminary
79 The list of values that will be shown under the label text. This is a model.
80 */
81 property var model
82
83 /*!
84 \preliminary
85 Specifies whether the list is always expanded.
86 */
87 property bool expanded: false
88
89 /*!
90 \preliminary
91 Colours image according to the fieldText colour of the theme, otherwise source colour is maintained.
92 */
93 property bool colourImage: false
94
95 /*!
96 \preliminary
97 ListView delegate.
98 */
99 property Component delegate: OptionSelectorDelegate {}
100
101 /*!
102 \qmlproperty int selectedIndex
103 The index of the currently selected element in our list.
104 */
105 readonly property alias selectedIndex: list.currentIndex
106
107 /*!
108 \qmlproperty real containerHeight
109 Custom height for list container which allows scrolling inside the selector.
110 */
111 property real containerHeight: list.contentHeight
112
113 /*!
114 Called when the optionSelector is either expanded or collapsed.
115 */
116 signal scroll()
117
118 showDivider: false
119
120 Column {
121 id: column
122
123 spacing: units.gu(2)
124 anchors {
125 left: parent.left
126 right: parent.right
127 }
128
129 Label {
130 text: optionSelector.text
131 height: units.gu(2)
132 }
133
134 StyledItem {
135 id: listContainer
136 objectName: "listContainer"
137
138 readonly property url chevron: __styleInstance.chevron
139 readonly property url tick: __styleInstance.tick
140 readonly property color themeColour: Theme.palette.selected.fieldText
141 property bool isExpanded: expanded
142 property bool isFullyExpanded: expanded
143 property bool colourImage: optionSelector.colourImage
144
145 anchors {
146 left: parent.left
147 right: parent.right
148 }
149 state: optionSelector.expanded ? state = "expanded" : state = "collapsed"
150 style: Theme.createStyleComponent("OptionSelectorStyle.qml", listContainer)
151
152 onHeightChanged: scroll()
153
154 states: [ State {
155 name: "expanded"
156 when: listContainer.isExpanded
157 PropertyChanges {
158 target: listContainer
159 height: containerHeight
160 }
161 }, State {
162 name: "collapsed"
163 when: !listContainer.isExpanded
164 PropertyChanges {
165 target: listContainer
166 height: list.itemHeight
167 }
168 }
169 ]
170
171 transitions: [ Transition {
172 UbuntuNumberAnimation {
173 properties: "height"
174 duration: Components.UbuntuAnimation.BriskDuration
175 }
176 }
177 ]
178
179 ListView {
180 id: list
181
182 property int previousIndex: -1
183 readonly property alias expanded: optionSelector.expanded
184 readonly property alias container: listContainer
185 property real itemHeight
186
187 boundsBehavior: Flickable.StopAtBounds
188 interactive: listContainer.height !== list.contentHeight && listContainer.isExpanded ? true : false
189 clip: true
190 currentIndex: 0
191 model: optionSelector.model
192 anchors.fill: parent
193
194 delegate: optionSelector.delegate
195 }
196 }
197 }
198}
0199
=== added file 'modules/Ubuntu/Components/OptionSelectorDelegate.qml'
--- modules/Ubuntu/Components/OptionSelectorDelegate.qml 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/OptionSelectorDelegate.qml 2013-08-28 12:13:08 +0000
@@ -0,0 +1,324 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*!
18 \qmltype OptionSelectorDelegate
19 \inqmlmodule Components.Components 0.1
20 \ingroup ubuntu-components
21 \brief OptionSelector delegate which can display text, subtext and an image from a custom model.
22
23 \b{This component is under heavy development.}
24
25 Examples:
26 \qml
27 import Components.Components 0.1
28 Column {
29 width: 250
30 OptionSelector {
31 text: i18n.tr("Label")
32 model: customModel
33 delegate: OptionSelectorDelegate { text: name; subText: description; icon: image }
34 }
35 ListModel {
36 id: customModel
37 ListElement { name: "Name 1"; description: "Description 1"; image: "images.png" }
38 ListElement { name: "Name 2"; description: "Description 2"; image: "images.png" }
39 ListElement { name: "Name 3"; description: "Description 3"; image: "images.png" }
40 ListElement { name: "Name 4"; description: "Description 4"; image: "images.png" }
41 }
42 }
43 \endqml
44*/
45
46import QtQuick 2.0
47import "ListItems" as ListItem
48import Ubuntu.Components 0.1 as Components
49
50ListItem.Standard {
51 id: option
52
53 property string text
54 property string subText
55 property url icon
56 property ListView listView: ListView.view
57 property color assetColour: listView.container.themeColour
58 property bool colourImage: listView.container.colourImage
59 property string fragColourShader:
60 "varying highp vec2 qt_TexCoord0;
61 uniform sampler2D source;
62 uniform lowp vec4 colour;
63 uniform lowp float qt_Opacity;
64
65 void main() {
66 lowp vec4 sourceColour = texture2D(source, qt_TexCoord0);
67 gl_FragColor = colour * sourceColour.a * qt_Opacity;
68 }"
69
70 width: parent.width + units.gu(2)
71 showDivider: index !== listView.count - 1 ? 1 : 0
72 highlightWhenPressed: false
73 selected: ListView.isCurrentItem
74 anchors {
75 left: parent.left
76 leftMargin: units.gu(-2)
77 }
78 onClicked: {
79 if (listView.container.isExpanded) {
80 listView.previousIndex = listView.currentIndex;
81 listView.currentIndex = index;
82 }
83
84 if (!listView.expanded) {
85 listView.container.isExpanded = !listView.container.isExpanded;
86 }
87 }
88
89 Component.onCompleted: {
90 height = listView.itemHeight = childrenRect.height;
91 }
92
93 //Since we don't want to add states to our divider, we use the exposed alias provided in Empty to access it and alter it's opacity from here.
94 states: [ State {
95 name: "dividerExpanded"
96 when: listView.container.state === "expanded" && index === listView.currentIndex
97 PropertyChanges {
98 target: option.divider
99 opacity: 1
100 }
101 }, State {
102 name: "dividerCollapsed"
103 when: listView.container.state === "collapsed" && index === listView.currentIndex
104 PropertyChanges {
105 target: option.divider
106 opacity: 0
107 }
108 }
109 ]
110
111 //As with our states, we apply the transition with our divider as the target.
112 transitions: [ Transition {
113 from: "dividerExpanded"
114 to: "dividerCollapsed"
115 UbuntuNumberAnimation {
116 target: option.divider
117 properties: "opacity"
118 duration: Components.UbuntuAnimation.SlowDuration
119 }
120 }
121 ]
122
123 resources: [
124 Connections {
125 target: listView.container
126 onIsExpandedChanged: {
127 optionExpansion.stop();
128 imageExpansion.stop();
129 optionCollapse.stop();
130 selectedImageCollapse.stop();
131 deselectedImageCollapse.stop();
132
133 if (listView.container.isExpanded === true) {
134 if (!option.selected) {
135 optionExpansion.start();
136
137 //Ensure a source change. This solves a bug which happens occasionaly when source is switched correctly. Probably related to the image.source binding.
138 image.source = listView.container.tick
139 } else {
140 imageExpansion.start();
141 }
142 } else {
143 if (!option.selected) {
144 optionCollapse.start();
145 } else {
146 if (listView.previousIndex !== listView.currentIndex)
147 selectedImageCollapse.start();
148 else {
149 deselectedImageCollapse.start();
150 }
151 }
152 }
153 }
154 }, SequentialAnimation {
155 id: imageExpansion
156
157 PropertyAnimation {
158 target: image
159 properties: "opacity"
160 from : 1.0
161 to: 0.0
162 duration: Components.UbuntuAnimation.FastDuration
163 }
164 PauseAnimation { duration: Components.UbuntuAnimation.BriskDuration - Components.UbuntuAnimation.FastDuration }
165 PropertyAction {
166 target: image
167 property: "source"
168 value: listView.container.tick
169 }
170 PropertyAnimation {
171 target: image
172 properties: "opacity"
173 from : 0.0
174 to: 1.0
175 duration: Components.UbuntuAnimation.FastDuration
176 }
177 }, PropertyAnimation {
178 id: optionExpansion
179
180 target: option
181 properties: "opacity"
182 from : 0.0
183 to: 1.0
184 duration: Components.UbuntuAnimation.SlowDuration
185 }, SequentialAnimation {
186 id: deselectedImageCollapse
187
188 PauseAnimation { duration: Components.UbuntuAnimation.BriskDuration }
189 PropertyAnimation {
190 target: image
191 properties: "opacity"
192 from : 1.0
193 to: 0.0
194 duration: Components.UbuntuAnimation.FastDuration
195 }
196 PauseAnimation { duration: Components.UbuntuAnimation.FastDuration }
197 PropertyAction {
198 target: image
199 property: "source"
200 value: listView.container.chevron
201 }
202 PropertyAnimation {
203 target: image
204 properties: "opacity"
205 from : 0.0
206 to: 1.0
207 duration: Components.UbuntuAnimation.FastDuration
208 }
209 }, SequentialAnimation {
210 id: selectedImageCollapse
211
212 PropertyAnimation {
213 target: image
214 properties: "opacity"
215 from : 0.0
216 to: 1.0
217 duration: Components.UbuntuAnimation.FastDuration
218 }
219 PauseAnimation { duration: Components.UbuntuAnimation.BriskDuration - Components.UbuntuAnimation.FastDuration }
220 PropertyAnimation {
221 target: image
222 properties: "opacity"
223 from : 1.0
224 to: 0.0
225 duration: Components.UbuntuAnimation.FastDuration
226 }
227 PauseAnimation { duration: Components.UbuntuAnimation.FastDuration }
228 PropertyAction {
229 target: image
230 property: "source"
231 value: listView.container.chevron
232 }
233 PropertyAnimation {
234 target: image
235 properties: "opacity"
236 from : 0.0
237 to: 1.0
238 duration: Components.UbuntuAnimation.FastDuration
239 }
240 }, PropertyAnimation {
241 id: optionCollapse
242 target: option
243 properties: "opacity"
244 from : 1.0
245 to: 0.0
246 duration: Components.UbuntuAnimation.SlowDuration
247 }
248 ]
249
250 Row {
251 spacing: units.gu(1)
252
253 anchors {
254 left: parent.left
255 leftMargin: units.gu(3)
256 verticalCenter: parent.verticalCenter
257 }
258
259 Image {
260 id: leftIcon
261
262 source: icon
263
264 ShaderEffect {
265 property color colour: assetColour
266 property Image source: parent
267
268 width: source.width
269 height: source.height
270 visible: colourImage
271
272 fragmentShader: fragColourShader
273 }
274 }
275
276 Column {
277 anchors {
278 verticalCenter: parent.verticalCenter
279 }
280 Label {
281 text: option.text === "" ? modelData : option.text
282 }
283 Label {
284 text: option.subText
285 visible: option.subText !== "" ? true : false
286 fontSize: "small"
287 }
288 }
289 }
290
291 Image {
292 id: image
293
294 width: units.gu(2)
295 height: units.gu(2)
296 source: listView.expanded ? listView.container.tick : listView.container.chevron
297 opacity: option.selected ? 1.0 : 0.0
298 anchors {
299 right: parent.right
300 rightMargin: units.gu(2)
301 verticalCenter: parent.verticalCenter
302 }
303
304 //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.
305 Behavior on opacity {
306 enabled: listView.expanded
307
308 UbuntuNumberAnimation {
309 properties: "opacity"
310 duration: Components.UbuntuAnimation.FastDuration
311 }
312 }
313
314 ShaderEffect {
315 property color colour: assetColour
316 property Image source: parent
317
318 width: source.width
319 height: source.height
320
321 fragmentShader: fragColourShader
322 }
323 }
324}
0325
=== added file 'modules/Ubuntu/Components/Themes/Ambiance/OptionSelectorStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/OptionSelectorStyle.qml 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/OptionSelectorStyle.qml 2013-08-28 12:13:08 +0000
@@ -0,0 +1,35 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18import QtQuick 2.0
19import Ubuntu.Components 0.1
20
21Item {
22 id: ambianceStyle
23
24 property url chevron: "../../artwork/chevron_down@30.png"
25 property url tick: "../../artwork/tick@30.png"
26 property bool colourComponent: true
27
28 UbuntuShape {
29 id: background
30
31 width: styledItem.width
32 height: styledItem.height
33 radius: "medium"
34 }
35}
036
=== removed file 'modules/Ubuntu/Components/Themes/Ambiance/artwork/tick@30.png'
1Binary files modules/Ubuntu/Components/Themes/Ambiance/artwork/tick@30.png 2013-08-28 08:06:11 +0000 and modules/Ubuntu/Components/Themes/Ambiance/artwork/tick@30.png 1970-01-01 00:00:00 +0000 differ37Binary files modules/Ubuntu/Components/Themes/Ambiance/artwork/tick@30.png 2013-08-28 08:06:11 +0000 and modules/Ubuntu/Components/Themes/Ambiance/artwork/tick@30.png 1970-01-01 00:00:00 +0000 differ
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/qmldir'
--- modules/Ubuntu/Components/Themes/Ambiance/qmldir 2013-08-28 08:06:11 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/qmldir 2013-08-28 12:13:08 +0000
@@ -5,6 +5,7 @@
5internal DialogForegroundStyle DialogForegroundStyle.qml5internal DialogForegroundStyle DialogForegroundStyle.qml
6internal HeaderStyle HeaderStyle.qml6internal HeaderStyle HeaderStyle.qml
7MainViewStyle 0.1 MainViewStyle.qml7MainViewStyle 0.1 MainViewStyle.qml
8OptionSelectorStyle 0.1 OptionSelectorStyle.qml
8PopoverForegroundStyle 0.1 PopoverForegroundStyle.qml9PopoverForegroundStyle 0.1 PopoverForegroundStyle.qml
9internal ScrollbarStyle ScrollbarStyle.qml10internal ScrollbarStyle ScrollbarStyle.qml
10internal SelectionCursorStyle SelectionCursorStyle.qml11internal SelectionCursorStyle SelectionCursorStyle.qml
1112
=== added file 'modules/Ubuntu/Components/Themes/SuruDark/OptionSelectorStyle.qml'
--- modules/Ubuntu/Components/Themes/SuruDark/OptionSelectorStyle.qml 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/Themes/SuruDark/OptionSelectorStyle.qml 2013-08-28 12:13:08 +0000
@@ -0,0 +1,23 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18import QtQuick 2.0
19import Ubuntu.Components.Themes.Ambiance 0.1
20
21OptionSelectorStyle {
22 id: suruDarkStyle
23}
024
=== added file 'modules/Ubuntu/Components/Themes/SuruGradient/OptionSelectorStyle.qml'
--- modules/Ubuntu/Components/Themes/SuruGradient/OptionSelectorStyle.qml 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/Themes/SuruGradient/OptionSelectorStyle.qml 2013-08-28 12:13:08 +0000
@@ -0,0 +1,27 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18import QtQuick 2.0
19import Ubuntu.Components.Themes.Ambiance 0.1
20
21OptionSelectorStyle {
22 id: suruGradientStyle
23
24 chevron: "artwork/chevron_down@30.png"
25 tick: "artwork/tick@30.png"
26 colourComponent: false
27}
028
=== added directory 'modules/Ubuntu/Components/Themes/SuruGradient/artwork'
=== added file 'modules/Ubuntu/Components/Themes/SuruGradient/artwork/chevron_down@30.png'
1Binary files modules/Ubuntu/Components/Themes/SuruGradient/artwork/chevron_down@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Themes/SuruGradient/artwork/chevron_down@30.png 2013-08-28 12:13:08 +0000 differ29Binary files modules/Ubuntu/Components/Themes/SuruGradient/artwork/chevron_down@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Themes/SuruGradient/artwork/chevron_down@30.png 2013-08-28 12:13:08 +0000 differ
=== added file 'modules/Ubuntu/Components/Themes/SuruGradient/artwork/tick@30.png'
2Binary files modules/Ubuntu/Components/Themes/SuruGradient/artwork/tick@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Themes/SuruGradient/artwork/tick@30.png 2013-08-28 12:13:08 +0000 differ30Binary files modules/Ubuntu/Components/Themes/SuruGradient/artwork/tick@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Themes/SuruGradient/artwork/tick@30.png 2013-08-28 12:13:08 +0000 differ
=== added file 'modules/Ubuntu/Components/artwork/chevron_down@30.png'
3Binary files modules/Ubuntu/Components/artwork/chevron_down@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/artwork/chevron_down@30.png 2013-08-28 12:13:08 +0000 differ31Binary files modules/Ubuntu/Components/artwork/chevron_down@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/artwork/chevron_down@30.png 2013-08-28 12:13:08 +0000 differ
=== added file 'modules/Ubuntu/Components/artwork/tick@30.png'
4Binary files modules/Ubuntu/Components/artwork/tick@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/artwork/tick@30.png 2013-08-28 12:13:08 +0000 differ32Binary files modules/Ubuntu/Components/artwork/tick@30.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/artwork/tick@30.png 2013-08-28 12:13:08 +0000 differ
=== modified file 'modules/Ubuntu/Components/qmldir'
--- modules/Ubuntu/Components/qmldir 2013-08-28 08:06:11 +0000
+++ modules/Ubuntu/Components/qmldir 2013-08-28 12:13:08 +0000
@@ -25,6 +25,8 @@
25Scrollbar 0.1 Scrollbar.qml25Scrollbar 0.1 Scrollbar.qml
26internal ModelSectionCounter ModelSectionCounter.qml26internal ModelSectionCounter ModelSectionCounter.qml
27Object 0.1 Object.qml27Object 0.1 Object.qml
28OptionSelector 0.1 OptionSelector.qml
29OptionSelectorDelegate 0.1 OptionSelectorDelegate.qml
28Page 0.1 Page.qml30Page 0.1 Page.qml
29internal PageTreeNode PageTreeNode.qml31internal PageTreeNode PageTreeNode.qml
30PageStack 0.1 PageStack.qml32PageStack 0.1 PageStack.qml
3133
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2013-08-28 08:06:11 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2013-08-28 12:13:08 +0000
@@ -69,11 +69,11 @@
69 "Buttons",69 "Buttons",
70 "Slider",70 "Slider",
71 "Text Field",71 "Text Field",
72 "Option Selector",
72 "Progress and activity",73 "Progress and activity",
73 "Ubuntu Shape",74 "Ubuntu Shape",
74 "Icons",75 "Icons",
75 "Label",76 "Label",
76 "List Items",
77 ]77 ]
7878
79 for item in items:79 for item in items:
@@ -91,6 +91,7 @@
9191
92 # now that we have more items, lets continue92 # now that we have more items, lets continue
93 items = [93 items = [
94 "List Items",
94 "Dialog",95 "Dialog",
95 "Popover",96 "Popover",
96 "Sheet",97 "Sheet",
9798
=== added file 'tests/unit/tst_components/tst_optionselector.qml'
--- tests/unit/tst_components/tst_optionselector.qml 1970-01-01 00:00:00 +0000
+++ tests/unit/tst_components/tst_optionselector.qml 2013-08-28 12:13:08 +0000
@@ -0,0 +1,107 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import Ubuntu.Components 0.1
20import Ubuntu.Test 0.1
21
22UbuntuTestCase {
23 name: "OptionSelectorAPI"
24
25 function test_expanded() {
26 var listContainer = findChild(optionSelector, "listContainer");
27
28 optionSelector.expanded = false;
29 compare(listContainer.isExpanded, false, "isExpanded should be true if list is an expanded one");
30
31 optionSelector.expanded = true;
32 compare(listContainer.isExpanded, true, "isExpanded should be false if list is an expanded one");
33 }
34
35 function test_states_and_signal() {
36 var listContainer = findChild(optionSelector, "listContainer");
37
38 signalSpy.signalName = "scroll";
39 compare(signalSpy.count, 0);
40
41 optionSelector.expanded = false;
42 compare(listContainer.state, "collapsed", "state should be collapsed");
43
44 optionSelector.expanded = true;
45 compare(listContainer.state, "expanded", "state should be expanded");
46
47 //Check if scroll signal was fired after expansion.
48 compare(signalSpy.count, 2);
49 }
50
51 function test_text() {
52 compare(optionSelector.text,"","text is '' by default")
53 var newText = "Hello World!";
54 optionSelector.text = newText;
55 compare(optionSelector.text, newText, "set/get");
56 }
57
58 function test_selectedIndex() {
59 compare(optionSelector.selectedIndex, 0, "selectedIndex is 0 by default");
60 }
61
62 function test_values() {
63 compare(optionSelector.values,undefined,"values is undefined by default")
64 var newValues = ["value1","value2","value3"];
65 optionSelector.model = newValues;
66 compare(optionSelector.model, newValues, "set/get");
67 }
68
69 function test_custom_model_delegate() {
70 compare(optionSelector.model, undefined, "model is undefined by default");
71 optionSelector.model = customModel;
72 optionSelector.delegate = selectorDelegate;
73 compare(optionSelector.model, customModel, "Model wasn't set correctly.");
74 compare(optionSelector.delegate, selectorDelegate, "Delegate hasn't been set correctly");
75 }
76
77 Rectangle {
78 id: testItem
79 }
80
81 OptionSelector {
82 id: optionSelector
83
84 SignalSpy {
85 id: signalSpy
86 target: optionSelector
87 }
88 }
89
90 OptionSelector {
91 id: optionSelectorCustomModel
92 }
93
94 Component {
95 id: selectorDelegate
96
97 OptionSelectorDelegate { text: name; subText: description }
98 }
99
100 ListModel {
101 id: customModel
102 ListElement { name: "Name 1"; description: "Description 1" }
103 ListElement { name: "Name 2"; description: "Description 2" }
104 ListElement { name: "Name 3"; description: "Description 3" }
105 ListElement { name: "Name 4"; description: "Description 4" }
106 }
107}

Subscribers

People subscribed via source and target branches

to status/vote changes: