Merge lp:~bzoltan/ubuntu-ui-toolkit/landing_12-6-2015 into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh on 2015-06-12
Status: Merged
Approved by: Christian Dywan on 2015-06-18
Approved revision: 1535
Merged at revision: 1196
Proposed branch: lp:~bzoltan/ubuntu-ui-toolkit/landing_12-6-2015
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 3417 lines (+1578/-271)
98 files modified
components.api (+3/-1)
debian/changelog (+42/-0)
debian/control (+7/-6)
documentation/ubuntu-theming.qdoc (+13/-7)
examples/ubuntu-ui-toolkit-gallery/Dialog.qml (+4/-0)
modules/Ubuntu/Components/1.1/Button.qml (+1/-1)
modules/Ubuntu/Components/1.2/TextCursor.qml (+1/-1)
modules/Ubuntu/Components/1.3/ActionBar.qml (+1/-1)
modules/Ubuntu/Components/1.3/ActivityIndicator.qml (+1/-1)
modules/Ubuntu/Components/1.3/AppHeader.qml (+1/-2)
modules/Ubuntu/Components/1.3/Button.qml (+1/-1)
modules/Ubuntu/Components/1.3/CheckBox.qml (+1/-1)
modules/Ubuntu/Components/1.3/ComboButton.qml (+1/-1)
modules/Ubuntu/Components/1.3/MainViewBase.qml (+1/-1)
modules/Ubuntu/Components/1.3/OptionSelector.qml (+1/-1)
modules/Ubuntu/Components/1.3/ProgressBar.qml (+1/-1)
modules/Ubuntu/Components/1.3/PullToRefresh.qml (+1/-1)
modules/Ubuntu/Components/1.3/Scrollbar.qml (+1/-1)
modules/Ubuntu/Components/1.3/Slider.qml (+1/-1)
modules/Ubuntu/Components/1.3/Switch.qml (+1/-1)
modules/Ubuntu/Components/1.3/TabBar.qml (+1/-1)
modules/Ubuntu/Components/1.3/TextArea.qml (+1/-1)
modules/Ubuntu/Components/1.3/TextCursor.qml (+2/-2)
modules/Ubuntu/Components/1.3/TextField.qml (+1/-1)
modules/Ubuntu/Components/1.3/TextInputPopover.qml (+1/-1)
modules/Ubuntu/Components/1.3/Toolbar.qml (+1/-1)
modules/Ubuntu/Components/1.3/ToolbarButton.qml (+1/-1)
modules/Ubuntu/Components/ListItems/1.2/Caption.qml (+9/-3)
modules/Ubuntu/Components/ListItems/1.3/Caption.qml (+9/-3)
modules/Ubuntu/Components/ListItems/1.3/ItemSelector.qml (+1/-1)
modules/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml (+1/-1)
modules/Ubuntu/Components/Pickers/1.3/DatePicker.qml (+1/-1)
modules/Ubuntu/Components/Pickers/1.3/Dialer.qml (+1/-1)
modules/Ubuntu/Components/Pickers/1.3/DialerHand.qml (+1/-1)
modules/Ubuntu/Components/Pickers/1.3/Picker.qml (+1/-1)
modules/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml (+1/-1)
modules/Ubuntu/Components/Popups/1.3/Dialog.qml (+1/-1)
modules/Ubuntu/Components/Popups/1.3/Popover.qml (+1/-1)
modules/Ubuntu/Components/Popups/1.3/SheetBase.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml (+6/-4)
modules/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml (+80/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml (+1/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/SuruDark/1.2/Palette.qml (+1/-1)
modules/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml (+1/-1)
modules/Ubuntu/Components/plugin/plugin.cpp (+3/-0)
modules/Ubuntu/Components/plugin/plugin.pro (+4/-2)
modules/Ubuntu/Components/plugin/propertychange_p.cpp (+30/-9)
modules/Ubuntu/Components/plugin/propertychange_p.h (+9/-0)
modules/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp (+9/-0)
modules/Ubuntu/Components/plugin/uclistitem.cpp (+21/-29)
modules/Ubuntu/Components/plugin/uclistitem_p.h (+1/-2)
modules/Ubuntu/Components/plugin/ucstyleditembase.cpp (+126/-34)
modules/Ubuntu/Components/plugin/ucstyleditembase.h (+5/-1)
modules/Ubuntu/Components/plugin/ucstyleditembase_p.h (+8/-9)
modules/Ubuntu/Components/plugin/ucstylehints.cpp (+259/-0)
modules/Ubuntu/Components/plugin/ucstylehints.h (+92/-0)
modules/Ubuntu/Components/plugin/uctheme.cpp (+16/-14)
modules/Ubuntu/Components/plugin/uctheme.h (+1/-2)
modules/Ubuntu/Components/plugin/ucubuntushape.cpp (+36/-31)
modules/Ubuntu/Components/plugin/ucubuntushape.h (+1/-0)
modules/Ubuntu/Test/plugin/uctestcase.cpp (+9/-5)
modules/Ubuntu/Test/plugin/uctestcase.h (+1/-1)
tests/apicheck/apicheck.cpp (+1/-1)
tests/autopilot/ubuntuuitoolkit/fixture_setup.py (+47/-3)
tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.header.qml (+0/-2)
tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py (+6/-7)
tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.LaunchFakeApplicationTestCase.qml (+30/-0)
tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py (+50/-10)
tests/resources/navigation/tabs.qml (+2/-2)
tests/unit/runtest.sh (+4/-5)
tests/unit/tst_performance/PaletteConfigurationAllColors.qml (+1/-1)
tests/unit/tst_performance/PaletteConfigurationOneColor.qml (+1/-1)
tests/unit_x11/tst_components/tst_actionbar.qml (+1/-1)
tests/unit_x11/tst_components/tst_header_presets.qml (+8/-1)
tests/unit_x11/tst_subtheming/DeprecatedTheme.qml (+1/-1)
tests/unit_x11/tst_subtheming/GroupPropertyBindingHints.qml (+32/-0)
tests/unit_x11/tst_subtheming/HintedButton.qml (+24/-0)
tests/unit_x11/tst_subtheming/MoreStyleHints.qml (+34/-0)
tests/unit_x11/tst_subtheming/OverrideStyleHints.qml (+30/-0)
tests/unit_x11/tst_subtheming/PropertyBindingHints.qml (+31/-0)
tests/unit_x11/tst_subtheming/SimpleItem.qml (+2/-6)
tests/unit_x11/tst_subtheming/SimplePropertyHints.qml (+30/-0)
tests/unit_x11/tst_subtheming/StyleHintsElsewhere.qml (+27/-0)
tests/unit_x11/tst_subtheming/StyleHintsInvalidProperty.qml (+30/-0)
tests/unit_x11/tst_subtheming/StyleHintsWithObject.qml (+29/-0)
tests/unit_x11/tst_subtheming/StyleHintsWithSignal.qml (+29/-0)
tests/unit_x11/tst_subtheming/StyleKept.qml (+43/-0)
tests/unit_x11/tst_subtheming/StyleOverride.qml (+46/-0)
tests/unit_x11/tst_subtheming/StyledItemAppThemeFallback.qml (+1/-1)
tests/unit_x11/tst_subtheming/StyledItemAppThemeVersioned.qml (+1/-1)
tests/unit_x11/tst_subtheming/StyledItemFallback.qml (+1/-1)
tests/unit_x11/tst_subtheming/StyledItemV12.qml (+1/-1)
tests/unit_x11/tst_subtheming/StyledItemV13.qml (+1/-1)
tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.2/TestStyle.qml (+1/-0)
tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.3/TestStyle.qml (+1/-0)
tests/unit_x11/tst_subtheming/tst_subtheming.cpp (+178/-24)
tests/unit_x11/tst_subtheming/tst_subtheming.pro (+13/-1)
To merge this branch: bzr merge lp:~bzoltan/ubuntu-ui-toolkit/landing_12-6-2015
Reviewer Review Type Date Requested Status
Christian Dywan 2015-06-12 Approve on 2015-06-18
PS Jenkins bot continuous-integration Needs Fixing on 2015-06-16
Review via email: mp+261831@code.launchpad.net

Commit Message

Landing 12.6.2015

Description of the Change

Landing 12.6.2015

To post a comment you must log in.
1535. By Zoltan Balogh on 2015-06-16

Sync with staging

Christian Dywan (kalikiana) wrote :

Rubberstamp.

review: Approve
1536. By Zoltan Balogh on 2015-06-19

sync with the trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2015-05-22 11:18:01 +0000
3+++ components.api 2015-06-19 04:42:29 +0000
4@@ -871,11 +871,14 @@
5 property bool iconFrame
6 property bool progression
7 Ubuntu.Components.StateSaver 1.0 0.1: QtObject
8+Ubuntu.Components.StyleHints 1.3: QtObject
9+ property bool ignoreUnknownProperties
10 Ubuntu.Components.StyledItem 1.3 1.1 1.0 0.1: Item
11 property bool activeFocusOnPress
12 function bool requestFocus(Qt.FocusReason reason)
13 function bool requestFocus()
14 property Component style
15+ property string styleName
16 property ThemeSettings theme
17 Ubuntu.Components.ListItems.Subtitled 1.0 0.1: Base
18 property string subText
19@@ -1198,7 +1201,6 @@
20 Ubuntu.PerformanceMetrics.TextureFromImage 1.0 0.1: Item
21 property QImage image
22 Ubuntu.Components.ThemeSettings 1.3: QtObject
23- function QQmlComponent* createStyleComponent(string styleName, QtObject parent)
24 property string name
25 property QtObject palette
26 readonly property ThemeSettings parentTheme
27
28=== modified file 'debian/changelog'
29--- debian/changelog 2015-06-15 16:00:12 +0000
30+++ debian/changelog 2015-06-19 04:42:29 +0000
31@@ -1,3 +1,45 @@
32+ubuntu-ui-toolkit (1.3.1534+15.10.20150523-0ubuntu2) UNRELEASED; urgency=medium
33+
34+ [ Christian Dywan ]
35+ * Use TextField.write rather than keyboard.type.
36+ * Update normal.backgroundText in SuruDark to #5D5D5D. Fixes LP: #1413801.
37+ * Fix "runtest.sh: line 78: [: -eq: unary operator expected]".
38+ * Consider caret visibility to decide text menu anchor. Fixes LP: #1462419.
39+ * Remove text from header textinput AP test QML. Fixes LP: #1459632.
40+ * No deprecation notes for our own components. Fixes LP: #1457528.
41+
42+ [ Leonardo Arias Fonseca ]
43+ * Add url protocols to the fake application.
44+ * Adds a dependency to url-dispatcher-tools in ubuntu-ui-toolkit-autopilot.
45+ * Use the test launcher for all the toolkit autopilot tests.
46+
47+ [ Zsombor Egri ]
48+ * Remove property bindings before property write does it. Fixes LP: #1462738.
49+ * Introducing StyleHints to provide style specific property changes.
50+ * Remove ThemeSettings.createStyleComponent() and add styleName to StyledItem.
51+ Fixes LP: #1458845.
52+
53+ [ Loïc Molinari ]
54+ * [UbuntuShape] Computed dfdt factors based on window content orientation.
55+ * Previous logic was based on screen orientation which is not in sync with
56+ OrientationHelper.qml. Fixes LP: #1455567.
57+
58+ [ Timo Jyrinki ]
59+ * Change -html documentation runtime dependencies into Suggests only to limit
60+ ubuntu-sdk download size. We're switching to offering only .qch offline
61+ documentation in SDK (inside of it), and they're being added to the seed.
62+ Fixes LP: #1461034.
63+ * Licensecheck started complaining about a person name, change to Canonical.
64+ Fixes LP: #1464549
65+
66+ [ Andrea Bernabei ]
67+ * Modify ListItem.Caption label margins. Fixes LP: #1314672.
68+
69+ [ Tim Peeters ]
70+ * Introduce IconButtonStyle.
71+
72+ -- Zoltán Balogh <zoltan@bakter.hu> Fri, 12 Jun 2015 11:49:32 +0300
73+
74 ubuntu-ui-toolkit (1.3.1517+15.10.20150523-0ubuntu3) wily; urgency=medium
75
76 * Rebuild against Qt 5.4.2
77
78=== modified file 'debian/control'
79--- debian/control 2015-05-20 15:36:55 +0000
80+++ debian/control 2015-06-19 04:42:29 +0000
81@@ -97,12 +97,12 @@
82 Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends}
83 Depends: ${misc:Depends},
84 ${shlibs:Depends},
85- qtdeclarative5-doc-html,
86- qtwebkit5-doc-html,
87- qtsvg5-doc-html,
88- qtscript5-doc-html,
89- qtmultimedia5-doc-html,
90- unity-action-doc,
91+Suggests: qtdeclarative5-doc-html,
92+ qtwebkit5-doc-html,
93+ qtsvg5-doc-html,
94+ qtscript5-doc-html,
95+ qtmultimedia5-doc-html,
96+ unity-action-doc,
97 Conflicts: qt-components-ubuntu-doc
98 Replaces: qt-components-ubuntu-doc
99 Provides: qt-components-ubuntu-doc
100@@ -149,6 +149,7 @@
101 qttestability-autopilot,
102 ubuntu-ui-toolkit-examples (>= ${source:Version}),
103 upstart,
104+ url-dispatcher-tools,
105 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= ${source:Version}) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
106 qml-module-qttest | qtdeclarative5-test-plugin,
107 Description: Test package for Ubuntu UI Toolkit
108
109=== modified file 'documentation/ubuntu-theming.qdoc'
110--- documentation/ubuntu-theming.qdoc 2015-05-04 10:58:14 +0000
111+++ documentation/ubuntu-theming.qdoc 2015-06-19 04:42:29 +0000
112@@ -78,7 +78,7 @@
113 * \section2 Naming conventions
114 * With few exception, each toolkit component is having StyledItem as its base
115 * component. The component is aimed to be the base component for all styled
116- * elements in the toolkit. Modules providing additional components to UI Toolkit
117+ * elements in the toolkit. Modules providing additional components to UI Toolkit
118 * can also use this component as base, especially if they want to provide styling
119 * capabilities.
120 *
121@@ -93,7 +93,7 @@
122 * AbstractButton {
123 * id: button
124 * // [...]
125- * style: theme.createStyleComponent("ButtonStyle.qml", button)
126+ * styleName: "ButtonStyle"
127 * }
128 * \endqml
129 * Developers can override the style in two ways, depending on how they want to style
130@@ -127,7 +127,7 @@
131 * A typical example of such a style API is the PullToRefresh component's style:
132 * \snippet Styles/1.2/PullToRefreshStyle.qml 0
133 * The default style implementation can be found under Ubuntu.Components.Themes.Ambiance
134- * theme \l {http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/modules/Ubuntu/Components/Themes/Ambiance/PullToRefreshStyle.qml}
135+ * theme \l {http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/modules/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml}
136 * {PullToRefreshStyle.qml}.
137 *
138 * Beside these, component styles may provide default values for colors, fonts, widths,
139@@ -141,15 +141,17 @@
140 *
141 * \section3 Override with a different style from the theme
142 * Returning back to the ways to override a component's style, overriding by using a different
143- * style from the theme can simply be done by calling the theme's \l{Theme::createStyleComponent}
144- * {createStyleComponent()} function with the alternative style document name as follows:
145+ * style from the theme can simply be done by assigning the document name to the \l {StyledItem::styleName}
146+ * {StyledItem.styleName} property as follows:
147 * \qml
148 * Button {
149 * id: button
150- * style: theme.createStyleComponent("SquaryButtonStyle.qml", button)
151+ * styleName: "SquaryButtonStyle"
152 * }
153 * \endqml
154- * \note This assumes that the \c SquaryButtonStyle.qml document is present in the theme.
155+ * \note The document extension doesn't have to be specified, the style creation will automatically
156+ * append the .qml extension to it. This kind of style override assumes that the \c SquaryButtonStyle.qml
157+ * document is present in the theme.
158 * This type of component styling makes sure the style will always have theme specific implementation
159 * or coloring, however it also requires the style document to be present in all the themes
160 * used by the application.
161@@ -178,6 +180,10 @@
162 * }
163 * }
164 * \endqml
165+ * \note Specifying a component for the \l {StyledItem::style}{StyledItem.style} has precedence
166+ * over the \l {StyledItem::styleName}{StyledItem::styleName}. When both set, the stlke specified
167+ * \c style property will be used. When this property is set to undefined or null, the style specified
168+ * in \c styleName will be used. Obviously, when both properties are invalid, no style will be used.
169 */
170
171 /*!
172
173=== modified file 'examples/ubuntu-ui-toolkit-gallery/Dialog.qml'
174--- examples/ubuntu-ui-toolkit-gallery/Dialog.qml 2015-04-29 08:55:31 +0000
175+++ examples/ubuntu-ui-toolkit-gallery/Dialog.qml 2015-06-19 04:42:29 +0000
176@@ -43,6 +43,10 @@
177 title: "Sample Dialog"
178 text: "Descriptive text goes here"
179
180+ TextField {
181+ placeholderText: "Type like your lifes depends on it"
182+ }
183+
184 Row {
185 id: row
186 width: parent.width
187
188=== modified file 'modules/Ubuntu/Components/1.1/Button.qml'
189--- modules/Ubuntu/Components/1.1/Button.qml 2015-04-24 12:00:23 +0000
190+++ modules/Ubuntu/Components/1.1/Button.qml 2015-06-19 04:42:29 +0000
191@@ -122,5 +122,5 @@
192 property string iconPosition: "left"
193
194 theme.version: Ubuntu.toolkitVersion
195- style: theme.createStyleComponent("ButtonStyle.qml", button)
196+ style: Theme.createStyleComponent("ButtonStyle.qml", button)
197 }
198
199=== modified file 'modules/Ubuntu/Components/1.2/TextCursor.qml'
200--- modules/Ubuntu/Components/1.2/TextCursor.qml 2015-05-18 05:37:17 +0000
201+++ modules/Ubuntu/Components/1.2/TextCursor.qml 2015-06-19 04:42:29 +0000
202@@ -110,7 +110,7 @@
203
204 // if the cursor is out of the visible viewport, anchor the
205 // contextual menu to the input field
206- var anchor = fakeCursor.visible ? draggedItem : handler.main
207+ var anchor = caret.visible ? draggedItem : handler.main
208 var popup = PopupUtils.open(component, anchor, {
209 "target": handler.main,
210 });
211
212=== modified file 'modules/Ubuntu/Components/1.3/ActionBar.qml'
213--- modules/Ubuntu/Components/1.3/ActionBar.qml 2015-05-14 20:33:48 +0000
214+++ modules/Ubuntu/Components/1.3/ActionBar.qml 2015-06-19 04:42:29 +0000
215@@ -50,7 +50,7 @@
216 */
217 StyledItem {
218 id: bar
219- style: theme.createStyleComponent("ActionBarStyle.qml", bar)
220+ styleName: "ActionBarStyle"
221
222 /*!
223 The actions to display in the bar.
224
225=== modified file 'modules/Ubuntu/Components/1.3/ActivityIndicator.qml'
226--- modules/Ubuntu/Components/1.3/ActivityIndicator.qml 2015-04-25 08:54:58 +0000
227+++ modules/Ubuntu/Components/1.3/ActivityIndicator.qml 2015-06-19 04:42:29 +0000
228@@ -55,5 +55,5 @@
229 implicitWidth: units.gu(3)
230 implicitHeight: units.gu(3)
231
232- style: theme.createStyleComponent("ActivityIndicatorStyle.qml", indicator)
233+ styleName: "ActivityIndicatorStyle"
234 }
235
236=== modified file 'modules/Ubuntu/Components/1.3/AppHeader.qml'
237--- modules/Ubuntu/Components/1.3/AppHeader.qml 2015-04-30 08:32:44 +0000
238+++ modules/Ubuntu/Components/1.3/AppHeader.qml 2015-06-19 04:42:29 +0000
239@@ -343,6 +343,5 @@
240 }
241
242 theme.version: Components.Ubuntu.toolkitVersion
243- style: header.useDeprecatedToolbar ? theme.createStyleComponent("HeaderStyle.qml", header) :
244- theme.createStyleComponent("PageHeadStyle.qml", header)
245+ styleName: header.useDeprecatedToolbar ? "HeaderStyle" : "PageHeadStyle"
246 }
247
248=== modified file 'modules/Ubuntu/Components/1.3/Button.qml'
249--- modules/Ubuntu/Components/1.3/Button.qml 2015-04-25 08:54:58 +0000
250+++ modules/Ubuntu/Components/1.3/Button.qml 2015-06-19 04:42:29 +0000
251@@ -122,5 +122,5 @@
252 property string iconPosition: "left"
253
254 theme.version: Ubuntu.toolkitVersion
255- style: theme.createStyleComponent("ButtonStyle.qml", button)
256+ styleName: "ButtonStyle"
257 }
258
259=== modified file 'modules/Ubuntu/Components/1.3/CheckBox.qml'
260--- modules/Ubuntu/Components/1.3/CheckBox.qml 2015-04-25 08:54:58 +0000
261+++ modules/Ubuntu/Components/1.3/CheckBox.qml 2015-06-19 04:42:29 +0000
262@@ -50,5 +50,5 @@
263 onTriggered: checked = !checked
264
265 theme.version: Ubuntu.toolkitVersion
266- style: theme.createStyleComponent("CheckBoxStyle.qml", checkBox)
267+ styleName: "CheckBoxStyle"
268 }
269
270=== modified file 'modules/Ubuntu/Components/1.3/ComboButton.qml'
271--- modules/Ubuntu/Components/1.3/ComboButton.qml 2015-04-29 08:55:31 +0000
272+++ modules/Ubuntu/Components/1.3/ComboButton.qml 2015-06-19 04:42:29 +0000
273@@ -247,7 +247,7 @@
274 property color dropdownColor: __styleInstance ? __styleInstance.defaultDropdownColor : color
275
276
277- style: theme.createStyleComponent("ComboButtonStyle.qml", combo)
278+ styleName: "ComboButtonStyle"
279
280 Component.onCompleted: {
281 // update mouse area to report clicks only on the main button area
282
283=== modified file 'modules/Ubuntu/Components/1.3/MainViewBase.qml'
284--- modules/Ubuntu/Components/1.3/MainViewBase.qml 2015-04-25 08:54:58 +0000
285+++ modules/Ubuntu/Components/1.3/MainViewBase.qml 2015-06-19 04:42:29 +0000
286@@ -36,7 +36,7 @@
287 id: background
288 anchors.fill: parent
289 // theme is inherited from PageTreeNode, no need to update versioning
290- style: theme.createStyleComponent("MainViewStyle.qml", background)
291+ styleName: "MainViewStyle"
292
293 property color headerColor: backgroundColor
294 property color backgroundColor: theme.palette.normal.background
295
296=== modified file 'modules/Ubuntu/Components/1.3/OptionSelector.qml'
297--- modules/Ubuntu/Components/1.3/OptionSelector.qml 2015-04-29 07:21:29 +0000
298+++ modules/Ubuntu/Components/1.3/OptionSelector.qml 2015-06-19 04:42:29 +0000
299@@ -226,7 +226,7 @@
300 }
301 state: optionSelector.expanded ? "expanded" : "collapsed"
302 theme.version: Toolkit.Ubuntu.toolkitVersion
303- style: theme.createStyleComponent("OptionSelectorStyle.qml", listContainer)
304+ styleName: "OptionSelectorStyle"
305 states: [ State {
306 name: "expanded"
307 when: listContainer.currentlyExpanded
308
309=== modified file 'modules/Ubuntu/Components/1.3/ProgressBar.qml'
310--- modules/Ubuntu/Components/1.3/ProgressBar.qml 2015-05-04 10:58:14 +0000
311+++ modules/Ubuntu/Components/1.3/ProgressBar.qml 2015-06-19 04:42:29 +0000
312@@ -71,5 +71,5 @@
313 property bool showProgressPercentage: true
314
315 theme.version: Ubuntu.toolkitVersion
316- style: theme.createStyleComponent("ProgressBarStyle.qml", progressBar)
317+ styleName: "ProgressBarStyle"
318 }
319
320=== modified file 'modules/Ubuntu/Components/1.3/PullToRefresh.qml'
321--- modules/Ubuntu/Components/1.3/PullToRefresh.qml 2015-04-29 07:21:29 +0000
322+++ modules/Ubuntu/Components/1.3/PullToRefresh.qml 2015-06-19 04:42:29 +0000
323@@ -223,7 +223,7 @@
324 signal refresh()
325
326 theme.version: Ubuntu.toolkitVersion
327- style: theme.createStyleComponent("PullToRefreshStyle.qml", control)
328+ styleName: "PullToRefreshStyle"
329 implicitHeight: __styleInstance.implicitHeight
330 anchors {
331 left: target.left
332
333=== modified file 'modules/Ubuntu/Components/1.3/Scrollbar.qml'
334--- modules/Ubuntu/Components/1.3/Scrollbar.qml 2015-04-25 08:54:58 +0000
335+++ modules/Ubuntu/Components/1.3/Scrollbar.qml 2015-06-19 04:42:29 +0000
336@@ -147,5 +147,5 @@
337 }
338
339 theme.version: Toolkit.Ubuntu.toolkitVersion
340- style: theme.createStyleComponent("ScrollbarStyle.qml", scrollbar)
341+ styleName: "ScrollbarStyle"
342 }
343
344=== modified file 'modules/Ubuntu/Components/1.3/Slider.qml'
345--- modules/Ubuntu/Components/1.3/Slider.qml 2015-05-12 20:15:43 +0000
346+++ modules/Ubuntu/Components/1.3/Slider.qml 2015-06-19 04:42:29 +0000
347@@ -207,5 +207,5 @@
348 }
349
350 theme.version: Toolkit.Ubuntu.toolkitVersion
351- style: theme.createStyleComponent("SliderStyle.qml", slider)
352+ styleName: "SliderStyle"
353 }
354
355=== modified file 'modules/Ubuntu/Components/1.3/Switch.qml'
356--- modules/Ubuntu/Components/1.3/Switch.qml 2015-04-25 08:54:58 +0000
357+++ modules/Ubuntu/Components/1.3/Switch.qml 2015-06-19 04:42:29 +0000
358@@ -40,5 +40,5 @@
359 */
360 CheckBox {
361 id: switchItem
362- style: theme.createStyleComponent("SwitchStyle.qml", switchItem)
363+ styleName: "SwitchStyle"
364 }
365
366=== modified file 'modules/Ubuntu/Components/1.3/TabBar.qml'
367--- modules/Ubuntu/Components/1.3/TabBar.qml 2015-04-25 08:54:58 +0000
368+++ modules/Ubuntu/Components/1.3/TabBar.qml 2015-06-19 04:42:29 +0000
369@@ -98,7 +98,7 @@
370 implicitHeight: units.gu(7.5)
371 activeFocusOnPress: true
372 theme.version: Toolkit.Ubuntu.toolkitVersion
373- style: theme.createStyleComponent("TabBarStyle.qml", tabBar)
374+ styleName: "TabBarStyle"
375
376 QtObject {
377 id: internal
378
379=== modified file 'modules/Ubuntu/Components/1.3/TextArea.qml'
380--- modules/Ubuntu/Components/1.3/TextArea.qml 2015-05-21 09:58:30 +0000
381+++ modules/Ubuntu/Components/1.3/TextArea.qml 2015-06-19 04:42:29 +0000
382@@ -892,5 +892,5 @@
383 }
384
385 theme.version: Ubuntu.Ubuntu.toolkitVersion
386- style: theme.createStyleComponent("TextAreaStyle.qml", control)
387+ styleName: "TextAreaStyle"
388 }
389
390=== modified file 'modules/Ubuntu/Components/1.3/TextCursor.qml'
391--- modules/Ubuntu/Components/1.3/TextCursor.qml 2015-05-15 10:35:06 +0000
392+++ modules/Ubuntu/Components/1.3/TextCursor.qml 2015-06-19 04:42:29 +0000
393@@ -42,7 +42,7 @@
394 __styleInstance.cursorDelegate
395
396 theme.version: Ubuntu.Ubuntu.toolkitVersion
397- style: theme.createStyleComponent("TextCursorStyle.qml", cursorItem);
398+ styleName: "TextCursorStyle"
399
400 objectName: "textCursor"
401 //Caret instance from the style.
402@@ -111,7 +111,7 @@
403
404 // if the cursor is out of the visible viewport, anchor the
405 // contextual menu to the input field
406- var anchor = fakeCursor.visible ? draggedItem : handler.main
407+ var anchor = caret.visible ? draggedItem : handler.main
408 var popup = PopupUtils.open(component, anchor, {
409 "target": handler.main,
410 });
411
412=== modified file 'modules/Ubuntu/Components/1.3/TextField.qml'
413--- modules/Ubuntu/Components/1.3/TextField.qml 2015-05-21 09:58:30 +0000
414+++ modules/Ubuntu/Components/1.3/TextField.qml 2015-06-19 04:42:29 +0000
415@@ -1020,5 +1020,5 @@
416 }
417
418 theme.version: Ubuntu.Ubuntu.toolkitVersion
419- style: theme.createStyleComponent("TextFieldStyle.qml", control)
420+ styleName: "TextFieldStyle"
421 }
422
423=== modified file 'modules/Ubuntu/Components/1.3/TextInputPopover.qml'
424--- modules/Ubuntu/Components/1.3/TextInputPopover.qml 2015-05-20 06:31:45 +0000
425+++ modules/Ubuntu/Components/1.3/TextInputPopover.qml 2015-06-19 04:42:29 +0000
426@@ -98,7 +98,7 @@
427 height: units.gu(6)
428 action: actions[modelData]
429 theme.version: Ubuntu.toolkitVersion
430- style: theme.createStyleComponent("ToolbarButtonStyle.qml", button)
431+ styleName: "ToolbarButtonStyle"
432 }
433 }
434 }
435
436=== modified file 'modules/Ubuntu/Components/1.3/Toolbar.qml'
437--- modules/Ubuntu/Components/1.3/Toolbar.qml 2015-04-25 08:54:58 +0000
438+++ modules/Ubuntu/Components/1.3/Toolbar.qml 2015-06-19 04:42:29 +0000
439@@ -136,7 +136,7 @@
440 property bool animating: toolbar.animating
441
442 theme.version: Toolkit.Ubuntu.toolkitVersion
443- style: theme.createStyleComponent("ToolbarStyle.qml", background)
444+ styleName: "ToolbarStyle"
445 }
446
447 Item {
448
449=== modified file 'modules/Ubuntu/Components/1.3/ToolbarButton.qml'
450--- modules/Ubuntu/Components/1.3/ToolbarButton.qml 2015-04-25 08:54:58 +0000
451+++ modules/Ubuntu/Components/1.3/ToolbarButton.qml 2015-06-19 04:42:29 +0000
452@@ -85,5 +85,5 @@
453 width: units.gu(5)
454
455 theme.version: Ubuntu.toolkitVersion
456- style: theme.createStyleComponent("ToolbarButtonStyle.qml", toolbarButton)
457+ styleName: "ToolbarButtonStyle"
458 }
459
460=== modified file 'modules/Ubuntu/Components/ListItems/1.2/Caption.qml'
461--- modules/Ubuntu/Components/ListItems/1.2/Caption.qml 2015-04-30 08:32:44 +0000
462+++ modules/Ubuntu/Components/ListItems/1.2/Caption.qml 2015-06-19 04:42:29 +0000
463@@ -38,7 +38,7 @@
464 \endqml
465 */
466 Item {
467- height: captionText.height + units.gu(1)
468+ height: captionText.contentHeight + units.gu(2) * 2
469 width: parent ? parent.width : units.gu(31)
470
471 /*!
472@@ -49,8 +49,14 @@
473
474 Label {
475 id: captionText
476- anchors.centerIn: parent
477- width: parent.width - units.gu(1)
478+ anchors {
479+ verticalCenter: parent.verticalCenter
480+ left: parent.left
481+ right: parent.right
482+ //Margins are currently hardcoded to avoid adding new API
483+ leftMargin: units.gu(2)
484+ rightMargin: units.gu(2)
485+ }
486 wrapMode: Text.Wrap
487 color: Theme.palette.normal.backgroundText
488 horizontalAlignment: Text.AlignLeft
489
490=== modified file 'modules/Ubuntu/Components/ListItems/1.3/Caption.qml'
491--- modules/Ubuntu/Components/ListItems/1.3/Caption.qml 2015-04-29 07:21:29 +0000
492+++ modules/Ubuntu/Components/ListItems/1.3/Caption.qml 2015-06-19 04:42:29 +0000
493@@ -38,7 +38,7 @@
494 \endqml
495 */
496 Item {
497- height: captionText.height + units.gu(1)
498+ height: captionText.contentHeight + units.gu(2) * 2
499 width: parent ? parent.width : units.gu(31)
500
501 /*!
502@@ -49,8 +49,14 @@
503
504 Label {
505 id: captionText
506- anchors.centerIn: parent
507- width: parent.width - units.gu(1)
508+ anchors {
509+ verticalCenter: parent.verticalCenter
510+ left: parent.left
511+ right: parent.right
512+ //Margins are currently hardcoded to avoid adding new API
513+ leftMargin: units.gu(2)
514+ rightMargin: units.gu(2)
515+ }
516 wrapMode: Text.Wrap
517 color: theme.palette.normal.backgroundText
518 horizontalAlignment: Text.AlignLeft
519
520=== modified file 'modules/Ubuntu/Components/ListItems/1.3/ItemSelector.qml'
521--- modules/Ubuntu/Components/ListItems/1.3/ItemSelector.qml 2015-04-29 07:21:29 +0000
522+++ modules/Ubuntu/Components/ListItems/1.3/ItemSelector.qml 2015-06-19 04:42:29 +0000
523@@ -217,7 +217,7 @@
524 }
525 state: itemSelector.expanded ? "expanded" : "collapsed"
526 theme.version: Ubuntu.toolkitVersion
527- style: theme.createStyleComponent("ListItemOptionSelectorStyle.qml", listContainer)
528+ styleName: "ListItemOptionSelectorStyle"
529
530 states: [ State {
531 name: "expanded"
532
533=== modified file 'modules/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml'
534--- modules/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml 2015-04-29 07:21:29 +0000
535+++ modules/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml 2015-06-19 04:42:29 +0000
536@@ -26,5 +26,5 @@
537 property real splitMargin
538
539 theme.version: Ubuntu.toolkitVersion
540- style: theme.createStyleComponent("ProgressionVisualStyle.qml", progressionVisual)
541+ styleName: "ProgressionVisualStyle"
542 }
543
544=== modified file 'modules/Ubuntu/Components/Pickers/1.3/DatePicker.qml'
545--- modules/Ubuntu/Components/Pickers/1.3/DatePicker.qml 2015-04-29 07:44:05 +0000
546+++ modules/Ubuntu/Components/Pickers/1.3/DatePicker.qml 2015-06-19 04:42:29 +0000
547@@ -421,7 +421,7 @@
548 }
549
550 theme.version: Ubuntu.toolkitVersion
551- style: theme.createStyleComponent("DatePickerStyle.qml", datePicker)
552+ styleName: "DatePickerStyle"
553 Binding {
554 target: __styleInstance
555 property: "view"
556
557=== modified file 'modules/Ubuntu/Components/Pickers/1.3/Dialer.qml'
558--- modules/Ubuntu/Components/Pickers/1.3/Dialer.qml 2015-04-29 07:44:05 +0000
559+++ modules/Ubuntu/Components/Pickers/1.3/Dialer.qml 2015-06-19 04:42:29 +0000
560@@ -146,7 +146,7 @@
561 activeFocusOnPress: true
562
563 theme.version: Ubuntu.toolkitVersion
564- style: theme.createStyleComponent("DialerStyle.qml", dialer)
565+ styleName: "DialerStyle"
566
567 Item {
568 id: internal
569
570=== modified file 'modules/Ubuntu/Components/Pickers/1.3/DialerHand.qml'
571--- modules/Ubuntu/Components/Pickers/1.3/DialerHand.qml 2015-04-29 07:44:05 +0000
572+++ modules/Ubuntu/Components/Pickers/1.3/DialerHand.qml 2015-06-19 04:42:29 +0000
573@@ -144,7 +144,7 @@
574 height: parent.height
575 activeFocusOnPress: true
576 theme.version: Ubuntu.toolkitVersion
577- style: theme.createStyleComponent("DialerHandStyle.qml", dialerHand)
578+ styleName: "DialerHandStyle"
579
580 /*! \internal */
581 onParentChanged: {
582
583=== modified file 'modules/Ubuntu/Components/Pickers/1.3/Picker.qml'
584--- modules/Ubuntu/Components/Pickers/1.3/Picker.qml 2015-04-29 07:44:05 +0000
585+++ modules/Ubuntu/Components/Pickers/1.3/Picker.qml 2015-06-19 04:42:29 +0000
586@@ -160,7 +160,7 @@
587 activeFocusOnPress: true
588
589 theme.version: Ubuntu.toolkitVersion
590- style: theme.createStyleComponent("PickerStyle.qml", picker)
591+ styleName: "PickerStyle"
592
593 /*! \internal */
594 property int __clickedIndex: -1
595
596=== modified file 'modules/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml'
597--- modules/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml 2015-04-29 07:44:05 +0000
598+++ modules/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml 2015-06-19 04:42:29 +0000
599@@ -48,7 +48,7 @@
600 }
601
602 theme.version: Ubuntu.toolkitVersion
603- style: theme.createStyleComponent("PickerDelegateStyle.qml", pickerDelegate)
604+ styleName: "PickerDelegateStyle"
605
606 QtObject {
607 id: internal
608
609=== modified file 'modules/Ubuntu/Components/Popups/1.3/Dialog.qml'
610--- modules/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-04-29 08:55:31 +0000
611+++ modules/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-06-19 04:42:29 +0000
612@@ -214,6 +214,6 @@
613 }
614
615 theme.version: Ubuntu.toolkitVersion
616- style: theme.createStyleComponent("DialogForegroundStyle.qml", foreground)
617+ styleName: "DialogForegroundStyle"
618 }
619 }
620
621=== modified file 'modules/Ubuntu/Components/Popups/1.3/Popover.qml'
622--- modules/Ubuntu/Components/Popups/1.3/Popover.qml 2015-04-29 08:55:31 +0000
623+++ modules/Ubuntu/Components/Popups/1.3/Popover.qml 2015-06-19 04:42:29 +0000
624@@ -238,7 +238,7 @@
625 signal hideCompleted()
626
627 theme.version: Ubuntu.toolkitVersion
628- style: theme.createStyleComponent("PopoverForegroundStyle.qml", foreground)
629+ styleName: "PopoverForegroundStyle"
630 }
631
632 QtObject {
633
634=== modified file 'modules/Ubuntu/Components/Popups/1.3/SheetBase.qml'
635--- modules/Ubuntu/Components/Popups/1.3/SheetBase.qml 2015-04-29 08:55:31 +0000
636+++ modules/Ubuntu/Components/Popups/1.3/SheetBase.qml 2015-06-19 04:42:29 +0000
637@@ -110,6 +110,6 @@
638 }
639
640 theme.version: Ubuntu.toolkitVersion
641- style: theme.createStyleComponent("SheetForegroundStyle.qml", sheet)
642+ styleName: "SheetForegroundStyle"
643 }
644 }
645
646=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml'
647--- modules/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2015-05-14 21:36:26 +0000
648+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2015-06-19 04:42:29 +0000
649@@ -58,19 +58,21 @@
650 Repeater {
651 objectName: "actions_repeater"
652 model: numberOfSlots.used
653- PageHeadButton {
654+ AbstractButton {
655+ style: IconButtonStyle { }
656 id: actionButton
657 objectName: action.objectName + "_action_button"
658+ height: actionsContainer.height
659 action: actionsContainer.visibleActions[index]
660- iconWidth: units.gu(2)
661 }
662 }
663
664- PageHeadButton {
665+ AbstractButton {
666+ style: IconButtonStyle { }
667 id: actionsOverflowButton
668 objectName: "actions_overflow_button"
669+ height: actionsContainer.height
670 visible: numberOfSlots.requested > numberOfSlots.available
671- iconWidth: units.gu(2)
672
673 // Ensure resetting of X when this button is not visible to avoid
674 // miscalculation of actionsContainer.width. Fixes bug #1408481.
675
676=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml'
677--- modules/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml 1970-01-01 00:00:00 +0000
678+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml 2015-06-19 04:42:29 +0000
679@@ -0,0 +1,80 @@
680+/*
681+ * Copyright 2015 Canonical Ltd.
682+ *
683+ * This program is free software; you can redistribute it and/or modify
684+ * it under the terms of the GNU Lesser General Public License as published by
685+ * the Free Software Foundation; version 3.
686+ *
687+ * This program is distributed in the hope that it will be useful,
688+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
689+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
690+ * GNU Lesser General Public License for more details.
691+ *
692+ * You should have received a copy of the GNU Lesser General Public License
693+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
694+ */
695+
696+import QtQuick 2.4
697+import Ubuntu.Components 1.3
698+
699+Item {
700+ id: iconButtonStyle
701+
702+ implicitWidth: units.gu(5)
703+ implicitHeight: units.gu(5)
704+
705+ /*!
706+ The color of the icons.
707+ */
708+ property color foregroundColor: "#808080"
709+
710+ /*!
711+ The background color of the button.
712+ */
713+ property color backgroundColor: styledItem.pressed ?
714+ theme.palette.selected.background :
715+ "transparent"
716+
717+ property real iconWidth: units.gu(2)
718+ property real iconHeight: iconWidth
719+
720+ /*!
721+ Show a text label under the icon.
722+ */
723+ property bool showLabel: false
724+
725+ Rectangle {
726+ id: background
727+ color: iconButtonStyle.backgroundColor
728+ anchors.fill: parent
729+ }
730+
731+ Icon {
732+ id: icon
733+ anchors.centerIn: parent
734+ width: iconButtonStyle.iconWidth
735+ height: iconButtonStyle.iconHeight
736+ source: styledItem.iconSource
737+ color: iconButtonStyle.foregroundColor
738+ opacity: styledItem.enabled ? 1.0 : 0.3
739+ }
740+
741+ Component {
742+ id: labelComponent
743+ Label {
744+ objectName: styledItem.objectName + "_label"
745+ color: iconButtonStyle.foregroundColor
746+ opacity: styledItem.enabled ? 1.0 : 0.3
747+ text: styledItem.text
748+ fontSize: "xx-small"
749+ }
750+ }
751+ Loader {
752+ anchors {
753+ top: icon.bottom
754+ topMargin: units.gu(0.5)
755+ horizontalCenter: parent.horizontalCenter
756+ }
757+ sourceComponent: iconButtonStyle.showLabel ? labelComponent : null
758+ }
759+}
760
761=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml'
762--- modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml 2015-05-12 15:05:28 +0000
763+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadButton.qml 2015-06-19 04:42:29 +0000
764@@ -17,6 +17,7 @@
765 import QtQuick 2.4
766 import Ubuntu.Components 1.3
767
768+// TODO: Remove this component when PageHeadStyle uses ActionBar
769 AbstractButton {
770 id: button
771
772
773=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml'
774--- modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2015-05-11 14:43:39 +0000
775+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2015-06-19 04:42:29 +0000
776@@ -106,7 +106,7 @@
777 // backgroundColor is used in the new HeadDividerStyle
778 property color backgroundColor: styledItem.dividerColor
779
780- style: theme.createStyleComponent("HeadDividerStyle.qml", divider)
781+ styleName: "HeadDividerStyle"
782
783 property PageHeadSections sections: styledItem.config.sections
784
785
786=== modified file 'modules/Ubuntu/Components/Themes/SuruDark/1.2/Palette.qml'
787--- modules/Ubuntu/Components/Themes/SuruDark/1.2/Palette.qml 2015-04-24 14:48:00 +0000
788+++ modules/Ubuntu/Components/Themes/SuruDark/1.2/Palette.qml 2015-06-19 04:42:29 +0000
789@@ -21,7 +21,7 @@
790 Palette {
791 normal: PaletteValues {
792 background: "#221E1C"
793- backgroundText: "#33F3F3E7"
794+ backgroundText: "#5D5D5D78"
795 base: "#19000000"
796 baseText: "#FFFFFF"
797 foreground: "#888888"
798
799=== modified file 'modules/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml'
800--- modules/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml 2015-04-24 14:34:39 +0000
801+++ modules/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml 2015-06-19 04:42:29 +0000
802@@ -22,7 +22,7 @@
803 Palette {
804 normal {
805 background: "#221E1C"
806- backgroundText: "#33F3F3E7"
807+ backgroundText: "#5D5D5D78"
808 base: "#19000000"
809 baseText: "#FFFFFF"
810 foreground: "#888888"
811
812=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
813--- modules/Ubuntu/Components/plugin/plugin.cpp 2015-04-27 07:06:30 +0000
814+++ modules/Ubuntu/Components/plugin/plugin.cpp 2015-06-19 04:42:29 +0000
815@@ -50,6 +50,7 @@
816 #include "ucinversemouse.h"
817 #include "sortfiltermodel.h"
818 #include "ucstyleditembase.h"
819+#include "ucstylehints.h"
820 #include "ucaction.h"
821 #include "ucactioncontext.h"
822 #include "ucactionmanager.h"
823@@ -210,6 +211,8 @@
824 qmlRegisterType<UCTheme>(uri, 1, 3, "ThemeSettings");
825 qmlRegisterType<UCStyledItemBase, 2>(uri, 1, 3, "StyledItem");
826 qmlRegisterSingletonType<UCNamespaceV13>(uri, 1, 3, "Ubuntu", registerUbuntuNamespace13);
827+ qmlRegisterType<UCStyledItemBase, 2>(uri, 1, 3, "StyledItem");
828+ qmlRegisterCustomType<UCStyleHints>(uri, 1, 3, "StyleHints", new UCStyleHintsParser);
829 }
830
831 void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
832
833=== modified file 'modules/Ubuntu/Components/plugin/plugin.pro'
834--- modules/Ubuntu/Components/plugin/plugin.pro 2015-03-13 09:27:53 +0000
835+++ modules/Ubuntu/Components/plugin/plugin.pro 2015-06-19 04:42:29 +0000
836@@ -80,7 +80,8 @@
837 privates/listitemdraghandler.h \
838 ucnamespace.h \
839 ucdeprecatedtheme.h \
840- ucdefaulttheme.h
841+ ucdefaulttheme.h \
842+ ucstylehints.h
843
844 SOURCES += plugin.cpp \
845 uctheme.cpp \
846@@ -128,7 +129,8 @@
847 privates/listitemdraghandler.cpp \
848 ucnamespace.cpp \
849 ucdeprecatedtheme.cpp \
850- ucdefaulttheme.cpp
851+ ucdefaulttheme.cpp \
852+ ucstylehints.cpp
853
854 # adapters
855 SOURCES += adapters/alarmsadapter_organizer.cpp
856
857=== modified file 'modules/Ubuntu/Components/plugin/propertychange_p.cpp'
858--- modules/Ubuntu/Components/plugin/propertychange_p.cpp 2015-01-27 18:14:44 +0000
859+++ modules/Ubuntu/Components/plugin/propertychange_p.cpp 2015-06-19 04:42:29 +0000
860@@ -28,6 +28,7 @@
861 PropertyChange::PropertyChange(QObject *item, const char *property, bool autoBackup)
862 : backedUp(false)
863 , qmlProperty(item, property, qmlContext(item))
864+ , backupBinding(Q_NULLPTR)
865 {
866 if (autoBackup) {
867 backup();
868@@ -41,6 +42,7 @@
869 void PropertyChange::backup()
870 {
871 if (!backedUp) {
872+ backupBinding = QQmlPropertyPrivate::setBinding(qmlProperty, Q_NULLPTR);
873 backupValue = qmlProperty.read();
874 backedUp = true;
875 }
876@@ -56,11 +58,24 @@
877 return;
878 }
879 change->backup();
880- // write using QQmlPropertyPrivate so we can keep the bindings
881- QQmlPropertyPrivate::write(change->qmlProperty,
882- value,
883- QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
884-}
885+ change->qmlProperty.write(value);
886+}
887+
888+/*
889+ * Same as setValue() but setting a binding.
890+ */
891+void PropertyChange::setBinding(PropertyChange *change, QQmlAbstractBinding *binding)
892+{
893+ if (!change) {
894+ return;
895+ }
896+ change->backup();
897+ QQmlAbstractBinding *prev = QQmlPropertyPrivate::setBinding(change->qmlProperty, binding);
898+ if (prev && prev != binding && prev != change->backupBinding) {
899+ prev->destroy();
900+ }
901+}
902+
903
904 /*
905 * Restore backed up value or binding.
906@@ -71,10 +86,16 @@
907 return;
908 }
909 if (change->backedUp) {
910- // write using QQmlPropertyPrivate to keep the bindings
911- QQmlPropertyPrivate::write(change->qmlProperty,
912- change->backupValue,
913- QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
914+ if (change->qmlProperty.isValid()) {
915+ if (change->backupBinding) {
916+ QQmlAbstractBinding *prev = QQmlPropertyPrivate::setBinding(change->qmlProperty, change->backupBinding);
917+ if (prev != change->backupBinding && prev) {
918+ prev->destroy();
919+ }
920+ } else {
921+ change->qmlProperty.write(change->backupValue);
922+ }
923+ }
924 change->backedUp = false;
925 }
926 }
927
928=== modified file 'modules/Ubuntu/Components/plugin/propertychange_p.h'
929--- modules/Ubuntu/Components/plugin/propertychange_p.h 2015-01-27 18:14:44 +0000
930+++ modules/Ubuntu/Components/plugin/propertychange_p.h 2015-06-19 04:42:29 +0000
931@@ -21,6 +21,7 @@
932 #include <QtCore/QObject>
933 #include <QtQml/QQmlProperty>
934
935+class QQmlAbstractBinding;
936 class PropertyChange
937 {
938 public:
939@@ -28,11 +29,19 @@
940 ~PropertyChange();
941
942 static void setValue(PropertyChange* change, const QVariant &value);
943+ static void setBinding(PropertyChange *change, QQmlAbstractBinding *binding);
944 static void restore(PropertyChange* change);
945+
946+ const QQmlProperty &property()
947+ {
948+ return qmlProperty;
949+ }
950+
951 private:
952 bool backedUp;
953 QQmlProperty qmlProperty;
954 QVariant backupValue;
955+ QQmlAbstractBinding *backupBinding;
956
957 void backup();
958 };
959
960=== modified file 'modules/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp'
961--- modules/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2015-05-18 05:42:05 +0000
962+++ modules/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2015-06-19 04:42:29 +0000
963@@ -23,6 +23,7 @@
964 #include <QtQml/QQmlComponent>
965 #include <QtQml/QQmlContext>
966 #include <QtQml/QQmlInfo>
967+#include <QtQml/QQmlEngine>
968
969 /*!
970 \qmltype Theme
971@@ -74,6 +75,14 @@
972
973 void UCDeprecatedTheme::showDeprecatedNote(QObject *onItem, const char *note)
974 {
975+ QQmlContext ctx(QQmlEngine::contextForObject(onItem));
976+ // No warnings due to deprecated code used in the components themselves
977+ if (ctx.baseUrl().toString().contains("/Ubuntu/Components/"))
978+ return;
979+ // Warnings without a filename are not helpful
980+ if (ctx.baseUrl().isEmpty())
981+ return;
982+
983 QString noteId(QString("%1.%2").arg(note).arg(onItem->metaObject()->className()));
984 if (m_notes.contains(noteId))
985 return;
986
987=== modified file 'modules/Ubuntu/Components/plugin/uclistitem.cpp'
988--- modules/Ubuntu/Components/plugin/uclistitem.cpp 2015-04-14 08:31:20 +0000
989+++ modules/Ubuntu/Components/plugin/uclistitem.cpp 2015-06-19 04:42:29 +0000
990@@ -185,7 +185,6 @@
991 , suppressClick(false)
992 , ready(false)
993 , customColor(false)
994- , customStyle(false)
995 , xAxisMoveThresholdGU(DEFAULT_SWIPE_THRESHOLD_GU)
996 , color(Qt::transparent)
997 , highlightColor(Qt::transparent)
998@@ -196,7 +195,6 @@
999 , trailingActions(0)
1000 , mainAction(0)
1001 {
1002- styleLoadingMethod = DelayTillExplicitRequested;
1003 }
1004 UCListItemPrivate::~UCListItemPrivate()
1005 {
1006@@ -229,6 +227,7 @@
1007 // watch grid unit size change and set implicit size
1008 QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(_q_updateSize()));
1009 _q_updateSize();
1010+ setStyleName("ListItemStyle");
1011 }
1012
1013 void UCListItemPrivate::_q_themeChanged()
1014@@ -260,12 +259,6 @@
1015 Q_Q(UCListItem);
1016 // update divider colors
1017 divider->paletteChanged();
1018- // if not using custom style, reload style component from theme
1019- if (!customStyle && componentComplete) {
1020- // use style setter but reset custom style flag
1021- setStyle(getTheme()->createStyleComponent("ListItemStyle.qml", q));
1022- customStyle = false;
1023- }
1024
1025 // update colors, panels
1026 if (!customColor) {
1027@@ -315,44 +308,35 @@
1028 Q_EMIT q->dragModeChanged();
1029 }
1030
1031-/*!
1032- * \qmlproperty Component ListItem::style
1033- * Holds the style of the component defining the components visualizing the leading/
1034- * trailing actions, selection and dragging mode handlers as well as different
1035- * animations. The component does not assume any visuals present in the style,
1036- * and will load its content only when requested.
1037- * \sa ListItemStyle
1038- */
1039 void UCListItemPrivate::preStyleChanged()
1040 {
1041 snapOut();
1042 UCStyledItemBasePrivate::preStyleChanged();
1043- // delete style if it was non-custom style
1044- if (!customStyle && styleComponent) {
1045- styleComponent->deleteLater();
1046- styleComponent = 0;
1047- }
1048- customStyle = true;
1049 }
1050
1051 // creates the style item, with altered default value of the animatePanels style property
1052 // the property is turned on after the panel initialization.
1053-void UCListItemPrivate::loadStyleItem(bool animated)
1054+bool UCListItemPrivate::loadStyleItem(bool animated)
1055 {
1056- if (!styleComponent) {
1057- // try to create the style if possible
1058- postThemeChanged();
1059- }
1060- UCStyledItemBasePrivate::loadStyleItem(animated);
1061+ // the style should be loaded only if one of the condition is satisfied
1062+ if (!swiped && !selectMode() && !dragMode()) {
1063+ return false;
1064+ }
1065+
1066+ if (!UCStyledItemBasePrivate::loadStyleItem(animated)) {
1067+ return false;
1068+ }
1069+
1070 UCListItemStyle *myStyle = qobject_cast<UCListItemStyle*>(styleItem);
1071 if (!myStyle) {
1072 // the style is not derived from ListItemStyle, clean
1073 preStyleChanged();
1074- return;
1075+ return false;
1076 }
1077 // bring the panels foreground
1078 styleItem->setZ(0);
1079 listItemStyle()->setAnimatePanels(true);
1080+ return true;
1081 }
1082
1083 // called when units size changes
1084@@ -885,6 +869,13 @@
1085 * \endqml
1086 *
1087 * \sa ViewItems::dragMode, ViewItems::dragUpdated
1088+ *
1089+ * \section2 Note on styling
1090+ * ListItem's styling differs from the other component sstyling, as ListItem loads
1091+ * the style only when either of the leadin/trailing panels are swiped, or when the
1092+ * item enters in select- or drag mode. The component does not assume any visuals
1093+ * to be present in the style.
1094+ * \sa ListItemStyle
1095 */
1096
1097 /*!
1098@@ -1134,6 +1125,7 @@
1099 d->parentAttached->disableInteractive(this, true);
1100 }
1101 d->setSwiped(true);
1102+ d->loadStyleItem();
1103 }
1104 }
1105
1106
1107=== modified file 'modules/Ubuntu/Components/plugin/uclistitem_p.h'
1108--- modules/Ubuntu/Components/plugin/uclistitem_p.h 2015-04-14 08:31:20 +0000
1109+++ modules/Ubuntu/Components/plugin/uclistitem_p.h 2015-06-19 04:42:29 +0000
1110@@ -74,7 +74,6 @@
1111 bool suppressClick:1;
1112 bool ready:1;
1113 bool customColor:1;
1114- bool customStyle:1;
1115 qreal xAxisMoveThresholdGU;
1116 QBasicTimer pressAndHoldTimer;
1117 QPointF lastPos;
1118@@ -98,7 +97,7 @@
1119 bool contentMoving() const;
1120 void setContentMoving(bool moved);
1121 virtual void preStyleChanged();
1122- virtual void loadStyleItem(bool animated = true);
1123+ virtual bool loadStyleItem(bool animated = true);
1124 bool dragging();
1125 bool dragMode();
1126 void setDragMode(bool draggable);
1127
1128=== modified file 'modules/Ubuntu/Components/plugin/ucstyleditembase.cpp'
1129--- modules/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-04-21 13:21:17 +0000
1130+++ modules/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-06-19 04:42:29 +0000
1131@@ -19,12 +19,12 @@
1132 #include "ucstyleditembase.h"
1133 #include "ucstyleditembase_p.h"
1134 #include "uctheme.h"
1135+#include "ucstylehints.h"
1136 #include <QtQml/QQmlEngine>
1137 #include <QtQuick/private/qquickanchors_p.h>
1138
1139 UCStyledItemBasePrivate::UCStyledItemBasePrivate()
1140 : activeFocusOnPress(false)
1141- , styleLoadingMethod(Immediate)
1142 , styleComponent(0)
1143 , styleItemContext(0)
1144 , styleItem(0)
1145@@ -41,8 +41,10 @@
1146 {
1147 Q_Q(UCStyledItemBase);
1148 q->setFlag(QQuickItem::ItemIsFocusScope);
1149- QObject::connect(&UCTheme::defaultTheme(), &UCTheme::nameChanged,
1150- q, &UCStyledItemBase::themeChanged);
1151+ QObject::connect(&UCTheme::defaultTheme(), SIGNAL(nameChanged()),
1152+ q, SLOT(_q_reloadStyle()));
1153+ QObject::connect(&UCTheme::defaultTheme(), SIGNAL(versionChanged()),
1154+ q, SLOT(_q_reloadStyle()));
1155 }
1156
1157
1158@@ -90,12 +92,17 @@
1159 * \qml
1160 * StyledItem {
1161 * id: myItem
1162- * style: theme.createStyleComponent("MyItemStyle.qml", myItem)
1163+ * styleName: "MyItemStyle"
1164 * }
1165 * \endqml
1166 *
1167- * The Component set on \l style is instantiated and placed below everything else
1168- * that the Item contains.
1169+ * The style set on \l styleName is instantiated and placed below everything else
1170+ * that the Item contains. When the style is defined in this way, the style is taken
1171+ * from the current theme the StyledItem is themed with. Another way tpo set the
1172+ * style of a component is to set the \l style property. This property expects a
1173+ * component and it has precedence over the \l styleName, meaning that when both
1174+ * \l styleName and \l style are set, the style will be created from the \l style
1175+ * componment.
1176 *
1177 * A reference to the Item being styled is accessible from the style and named
1178 * 'styledItem'.
1179@@ -201,7 +208,26 @@
1180
1181 /*!
1182 * \qmlproperty Component StyledItem::style
1183- * Component instantiated immediately and placed below everything else.
1184+ * Style component instantiated immediately and placed below everything else.
1185+ * Has precedence over the \l styleName. When both set, the style will be
1186+ * created from the component given as property value, and can be reset to the
1187+ * theme style when set to null or reset (set to undefined).
1188+ * \qml
1189+ * Button {
1190+ * text: "Press to reset"
1191+ * style: Rectangle {
1192+ * color: "tan"
1193+ * Label {
1194+ * anchors {
1195+ * fill: parent
1196+ * margins: units.gu(1)
1197+ * }
1198+ * text: styledItem.text
1199+ * }
1200+ * }
1201+ * onClicked: style = undefined
1202+ * }
1203+ * \endqml
1204 */
1205 QQmlComponent *UCStyledItemBasePrivate::style() const
1206 {
1207@@ -218,6 +244,42 @@
1208 postStyleChanged();
1209 loadStyleItem();
1210 }
1211+void UCStyledItemBasePrivate::resetStyle()
1212+{
1213+ setStyle(Q_NULLPTR);
1214+}
1215+
1216+/*!
1217+ * \qmlproperty string StyledItem::styleName
1218+ * The property specifies the component style name. The style name is a document
1219+ * in the current theme, and should not contain the qml file extension. If specified
1220+ * an error will be shown.
1221+ * \qml
1222+ * StyledItem {
1223+ * id: myItem
1224+ * styleName: "MyItemStyle"
1225+ * }
1226+ * \endqml
1227+ * \note \l style property has precedence over styleName.
1228+ */
1229+QString UCStyledItemBasePrivate::styleName() const
1230+{
1231+ return styleDocument;
1232+}
1233+void UCStyledItemBasePrivate::setStyleName(const QString &name)
1234+{
1235+ if (name == styleDocument) {
1236+ return;
1237+ }
1238+ QString prevName = styleDocument;
1239+ styleDocument = name;
1240+ if (prevName != styleDocument && !styleComponent) {
1241+ preStyleChanged();
1242+ postStyleChanged();
1243+ }
1244+ Q_EMIT q_func()->styleNameChanged();
1245+ loadStyleItem();
1246+}
1247
1248 // performs pre-style change actions, removes style item size change
1249 // connections and destroys the style component
1250@@ -236,36 +298,37 @@
1251 }
1252 }
1253
1254-// performs post-style change actions, creates the context object the
1255-// style item will be created in
1256-void UCStyledItemBasePrivate::postStyleChanged()
1257+// loads the style animated or not, depending on the loading time
1258+// returns true on successful style loading
1259+bool UCStyledItemBasePrivate::loadStyleItem(bool animated)
1260 {
1261- if (!styleComponent || styleItemContext) {
1262- return;
1263+ if (styleItem || (!styleComponent && styleDocument.isEmpty()) || !componentComplete) {
1264+ // the style loading is delayed
1265+ return false;
1266 }
1267 Q_Q(UCStyledItemBase);
1268+ // either styleComponent or styleName is valid
1269+ QQmlComponent *component = styleComponent;
1270+ if (!component) {
1271+ component = getTheme()->createStyleComponent(styleDocument + ".qml", q);
1272+ }
1273+ if (!component) {
1274+ return false;
1275+ }
1276+ // create context
1277 // use creation context as parent to create the context we load the style item with
1278- QQmlContext *creationContext = styleComponent->creationContext();
1279+ QQmlContext *creationContext = component->creationContext();
1280 if (!creationContext) {
1281 creationContext = qmlContext(q);
1282 }
1283 styleItemContext = new QQmlContext(creationContext);
1284 styleItemContext->setContextObject(q);
1285 styleItemContext->setContextProperty("styledItem", q);
1286-}
1287-
1288-// loads the style animated or not, depending on the loading time
1289-void UCStyledItemBasePrivate::loadStyleItem(bool animated)
1290-{
1291- if (styleItem || !styleComponent || !styleItemContext || (styleLoadingMethod != Immediate && !componentComplete)) {
1292- // the style loading is delayed
1293- return;
1294- }
1295- Q_Q(UCStyledItemBase);
1296 styleItemContext->setContextProperty("animated", animated);
1297- QObject *object = styleComponent->beginCreate(styleItemContext);
1298+ QObject *object = component->beginCreate(styleItemContext);
1299 if (!object) {
1300- return;
1301+ delete styleItemContext;
1302+ return false;
1303 }
1304 // link context to the style item to delete them together
1305 QQml_setParent_noEvent(styleItemContext, object);
1306@@ -281,7 +344,11 @@
1307 } else {
1308 delete object;
1309 }
1310- styleComponent->completeCreate();
1311+ component->completeCreate();
1312+ // delete temporary component
1313+ if (!styleComponent) {
1314+ delete component;
1315+ }
1316
1317 // make sure we reset the animated property to true
1318 if (!animated) {
1319@@ -292,6 +359,7 @@
1320 _q_styleResized();
1321 connectStyleSizeChanges(true);
1322 Q_EMIT q->styleInstanceChanged();
1323+ return true;
1324 }
1325
1326 /*!
1327@@ -339,6 +407,19 @@
1328 }
1329 }
1330
1331+// reloads style component due to theme, theme.name or theme.version change
1332+void UCStyledItemBasePrivate::_q_reloadStyle()
1333+{
1334+ if (styleComponent) {
1335+ return;
1336+ }
1337+ Q_Q(UCStyledItemBase);
1338+ preStyleChanged();
1339+ postStyleChanged();
1340+ loadStyleItem();
1341+ Q_EMIT q->themeChanged();
1342+}
1343+
1344 // handle implicit size changes implied by the style components
1345 void UCStyledItemBasePrivate::_q_styleResized()
1346 {
1347@@ -395,8 +476,10 @@
1348 theme :
1349 (!parentStyledItem ? &UCTheme::defaultTheme() : NULL);
1350 if (connectedSet) {
1351- QObject::disconnect(connectedSet, &UCTheme::nameChanged,
1352- q, &UCStyledItemBase::themeChanged);
1353+ QObject::disconnect(connectedSet, SIGNAL(nameChanged()),
1354+ q, SLOT(_q_reloadStyle()));
1355+ QObject::disconnect(connectedSet, SIGNAL(versionChanged()),
1356+ q, SLOT(_q_reloadStyle()));
1357 }
1358
1359 UCTheme *prevSet = theme;
1360@@ -419,8 +502,10 @@
1361 theme :
1362 (!parentStyledItem ? &UCTheme::defaultTheme() : NULL);
1363 if (connectedSet) {
1364- QObject::connect(connectedSet, &UCTheme::nameChanged,
1365- q, &UCStyledItemBase::themeChanged);
1366+ QObject::connect(connectedSet, SIGNAL(nameChanged()),
1367+ q, SLOT(_q_reloadStyle()));
1368+ QObject::connect(connectedSet, SIGNAL(versionChanged()),
1369+ q, SLOT(_q_reloadStyle()));
1370 }
1371 // detach previous set and attach the new one
1372 if (prevSet) {
1373@@ -437,6 +522,13 @@
1374 postThemeChanged();
1375
1376 Q_EMIT q->themeChanged();
1377+
1378+ // perform style reload
1379+ if (!styleComponent) {
1380+ preStyleChanged();
1381+ postStyleChanged();
1382+ loadStyleItem();
1383+ }
1384 }
1385 void UCStyledItemBasePrivate::resetTheme()
1386 {
1387@@ -542,10 +634,10 @@
1388 {
1389 QQuickItem::componentComplete();
1390 Q_D(UCStyledItemBase);
1391- if (d->styleLoadingMethod == UCStyledItemBasePrivate::DelayTillCompleted) {
1392- // the delayed completion disables animations
1393- d->loadStyleItem(false);
1394- }
1395+ // no animation at this time
1396+ // prepare style context if not been done yet
1397+ d->postStyleChanged();
1398+ d->loadStyleItem(false);
1399 }
1400
1401 // grab pressed state and focus if it can be
1402
1403=== modified file 'modules/Ubuntu/Components/plugin/ucstyleditembase.h'
1404--- modules/Ubuntu/Components/plugin/ucstyleditembase.h 2015-04-13 13:42:03 +0000
1405+++ modules/Ubuntu/Components/plugin/ucstyleditembase.h 2015-06-19 04:42:29 +0000
1406@@ -23,14 +23,16 @@
1407
1408 class UCStyledItemBasePrivate;
1409 class UCTheme;
1410+class UCStyleHints;
1411 class UCStyledItemBase : public QQuickItem
1412 {
1413 Q_OBJECT
1414 Q_PROPERTY(bool activeFocusOnPress
1415 READ activefocusOnPress WRITE setActiveFocusOnPress
1416 NOTIFY activeFocusOnPressChanged REVISION 1)
1417- Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QQmlComponent *style READ style WRITE setStyle NOTIFY styleChanged FINAL DESIGNABLE false)
1418+ Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QQmlComponent *style READ style WRITE setStyle RESET resetStyle NOTIFY styleChanged FINAL DESIGNABLE false)
1419 Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QQuickItem *__styleInstance READ styleInstance NOTIFY styleInstanceChanged FINAL DESIGNABLE false)
1420+ Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged FINAL REVISION 2)
1421 Q_PRIVATE_PROPERTY(d_func(), UCTheme *theme READ getTheme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL REVISION 2)
1422 public:
1423 explicit UCStyledItemBase(QQuickItem *parent = 0);
1424@@ -46,6 +48,7 @@
1425 void styleInstanceChanged();
1426 Q_REVISION(1) void activeFocusOnPressChanged();
1427 Q_REVISION(2) void themeChanged();
1428+ Q_REVISION(2) void styleNameChanged();
1429
1430 protected:
1431 UCStyledItemBase(UCStyledItemBasePrivate &, QQuickItem *parent);
1432@@ -60,6 +63,7 @@
1433 Q_PRIVATE_SLOT(d_func(), void _q_styleResized())
1434 Q_PRIVATE_SLOT(d_func(), void _q_ascendantChanged(QQuickItem*))
1435 Q_PRIVATE_SLOT(d_func(), void _q_parentStyleChanged())
1436+ Q_PRIVATE_SLOT(d_func(), void _q_reloadStyle())
1437 };
1438
1439 #endif // UCSTYLEDITEMBASE_H
1440
1441=== modified file 'modules/Ubuntu/Components/plugin/ucstyleditembase_p.h'
1442--- modules/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-04-14 07:46:04 +0000
1443+++ modules/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-06-19 04:42:29 +0000
1444@@ -29,16 +29,11 @@
1445 Q_DECLARE_PUBLIC(UCStyledItemBase)
1446 public:
1447
1448- enum StyleLoadingMethod {
1449- Immediate,
1450- DelayTillCompleted,
1451- DelayTillExplicitRequested
1452- };
1453-
1454 static UCStyledItemBasePrivate *get(UCStyledItemBase *item) {
1455 return item->d_func();
1456 }
1457
1458+ void _q_reloadStyle();
1459 void _q_styleResized();
1460 void _q_ascendantChanged(QQuickItem *ascendant);
1461 void _q_parentStyleChanged();
1462@@ -52,11 +47,15 @@
1463
1464 QQmlComponent *style() const;
1465 void setStyle(QQmlComponent *style);
1466+ void resetStyle();
1467 QQuickItem *styleInstance();
1468
1469+ QString styleName() const;
1470+ void setStyleName(const QString &name);
1471+
1472 virtual void preStyleChanged();
1473- virtual void postStyleChanged();
1474- virtual void loadStyleItem(bool animated = true);
1475+ virtual void postStyleChanged() {}
1476+ virtual bool loadStyleItem(bool animated = true);
1477
1478 UCTheme *getTheme() const;
1479 void setTheme(UCTheme *theme);
1480@@ -67,7 +66,7 @@
1481
1482 public:
1483 bool activeFocusOnPress:1;
1484- StyleLoadingMethod styleLoadingMethod;
1485+ QString styleDocument;
1486 QQmlComponent *styleComponent;
1487 QPointer<QQmlContext> styleItemContext;
1488 QQuickItem *styleItem;
1489
1490=== added file 'modules/Ubuntu/Components/plugin/ucstylehints.cpp'
1491--- modules/Ubuntu/Components/plugin/ucstylehints.cpp 1970-01-01 00:00:00 +0000
1492+++ modules/Ubuntu/Components/plugin/ucstylehints.cpp 2015-06-19 04:42:29 +0000
1493@@ -0,0 +1,259 @@
1494+/*
1495+ * Copyright 2015 Canonical Ltd.
1496+ *
1497+ * This program is free software; you can redistribute it and/or modify
1498+ * it under the terms of the GNU Lesser General Public License as published by
1499+ * the Free Software Foundation; version 3.
1500+ *
1501+ * This program is distributed in the hope that it will be useful,
1502+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1503+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1504+ * GNU Lesser General Public License for more details.
1505+ *
1506+ * You should have received a copy of the GNU Lesser General Public License
1507+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1508+ *
1509+ * Author: Zsombor Egri <zsombor.egri@canonical.com>
1510+ */
1511+
1512+#include "ucstylehints.h"
1513+#include "ucstyleditembase_p.h"
1514+#include "propertychange_p.h"
1515+#include <QtQml/QQmlInfo>
1516+
1517+// verifies property declaration correctness
1518+void UCStyleHintsParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
1519+{
1520+ Q_FOREACH(const QV4::CompiledData::Binding *binding, bindings) {
1521+ verifyProperty(qmlUnit, binding);
1522+ }
1523+}
1524+
1525+void UCStyleHintsParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
1526+{
1527+ if (binding->type == QV4::CompiledData::Binding::Type_Object) {
1528+ error(qmlUnit->objectAt(binding->value.objectIndex), "StyleHints does not support creating state-specific objects.");
1529+ return;
1530+ }
1531+
1532+ // group properties or attached properties, we do handle those as well
1533+ if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty
1534+ || binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
1535+ const QV4::CompiledData::Object *subObj = qmlUnit->objectAt(binding->value.objectIndex);
1536+ const QV4::CompiledData::Binding *subBinding = subObj->bindingTable();
1537+ for (quint32 i = 0; i < subObj->nBindings; ++i, ++subBinding) {
1538+ verifyProperty(qmlUnit, subBinding);
1539+ }
1540+ }
1541+
1542+ // filter out signals!
1543+ QString propertyName = qmlUnit->stringAt(binding->propertyNameIndex);
1544+ if (propertyName.startsWith("on") && propertyName.at(2).isUpper()) {
1545+ error(binding, "Signal properties are not supported.");
1546+ return;
1547+ }
1548+}
1549+
1550+// decodes property declarations, stores the bindings and values
1551+void UCStyleHintsParser::applyBindings(QObject *obj, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings)
1552+{
1553+ UCStyleHints *hints = static_cast<UCStyleHints*>(obj);
1554+ QV4::CompiledData::Unit *qmlUnit = cdata->compilationUnit->data;
1555+
1556+ UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(hints->parent());
1557+ if (!styledItem) {
1558+ // error will be reported in componentCompleted
1559+ return;
1560+ }
1561+
1562+ Q_FOREACH(const QV4::CompiledData::Binding *binding, bindings) {
1563+ hints->decodeBinding(QString(), qmlUnit, binding);
1564+ }
1565+
1566+ hints->m_cdata = cdata;
1567+ hints->m_decoded = true;
1568+}
1569+
1570+void UCStyleHints::decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
1571+{
1572+ QString propertyName = propertyPrefix + qmlUnit->stringAt(binding->propertyNameIndex);
1573+
1574+ // handle grouped properties first
1575+ if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty
1576+ || binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
1577+
1578+ const QV4::CompiledData::Object *subObj = qmlUnit->objectAt(binding->value.objectIndex);
1579+ const QV4::CompiledData::Binding *subBinding = subObj->bindingTable();
1580+ QString pre = propertyName + ".";
1581+ for (quint32 i = 0; i < subObj->nBindings; ++i, ++subBinding) {
1582+ decodeBinding(pre, qmlUnit, subBinding);
1583+ }
1584+ return;
1585+ }
1586+
1587+ switch (binding->type) {
1588+ case QV4::CompiledData::Binding::Type_Script:
1589+ {
1590+ QString expression = binding->valueAsScriptString(qmlUnit);
1591+ QUrl url = QUrl();
1592+ int line = -1;
1593+ int column = -1;
1594+
1595+ QQmlData *ddata = QQmlData::get(this);
1596+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
1597+ url = ddata->outerContext->url;
1598+ line = ddata->lineNumber;
1599+ column = ddata->columnNumber;
1600+ }
1601+ m_expressions << Expression(propertyName, binding->value.compiledScriptIndex, expression, url, line, column);
1602+ break;
1603+ }
1604+ case QV4::CompiledData::Binding::Type_Translation:
1605+ case QV4::CompiledData::Binding::Type_TranslationById:
1606+ case QV4::CompiledData::Binding::Type_String:
1607+ {
1608+ m_values << qMakePair(propertyName, binding->valueAsString(qmlUnit));
1609+ break;
1610+ }
1611+ case QV4::CompiledData::Binding::Type_Number:
1612+ {
1613+ m_values << qMakePair(propertyName, binding->valueAsNumber());
1614+ break;
1615+ }
1616+ case QV4::CompiledData::Binding::Type_Boolean:
1617+ {
1618+ m_values << qMakePair(propertyName, binding->valueAsBoolean());
1619+ break;
1620+ }
1621+ }
1622+}
1623+
1624+void UCStyleHints::propertyNotFound(const QString &styleName, const QString &property)
1625+{
1626+ if (!m_ignoreUnknownProperties) {
1627+ qmlInfo(this) << QString("Style '%1' has no property called '%2'.").arg(styleName).arg(property);
1628+ }
1629+}
1630+
1631+/*!
1632+ * \qmltype StyleHints
1633+ * \instantiates UCStyleHints
1634+ * \inmodule Ubuntu Components 1.3
1635+ * \ingroup ubuntu
1636+ * \since Ubuntu.Components 1.3
1637+ * \brief Component holding style specific properties to configure a particular
1638+ * StyledItem's style runtime.
1639+ *
1640+ * StyleHints is a custom parser, meaning style properties can be listed without
1641+ * any property declaration, same way as in PropertyChanges or Connections, which
1642+ * are similar custom parsers. Properties enumerated do not have to be present in
1643+ * the component's style as default, behavior which can be chenged by setting \l
1644+ * ignoreUnknownProperties to true. In this case properties not found in the style
1645+ * will be displayed as warnings.
1646+ *
1647+ * In the following example the Button will be drawn as white when not pressed, and
1648+ * colored as blue when pressed.
1649+ * \qml
1650+ * Button {
1651+ * id: button
1652+ * StyleHints {
1653+ * defaultColor: button.pressed ? "blue" : "white"
1654+ * }
1655+ * }
1656+ * \endqml
1657+ *
1658+ * StyleHints does not support signal properties (i.e signal handlers) and object
1659+ * declarations as property values.
1660+ *
1661+ * StyleHints can be only declared in a \l StyledItem or as a derivate of it.
1662+ */
1663+
1664+/*!
1665+ * \qmlproperty bool StyleHints::ignoreUnknownProperties
1666+ * The property drives whether component should warn on properties not found in
1667+ * the component's style. The default setting is not to warn.
1668+ */
1669+UCStyleHints::UCStyleHints(QObject *parent)
1670+ : QObject(parent)
1671+ , m_decoded(false)
1672+ , m_completed(false)
1673+ , m_ignoreUnknownProperties(true)
1674+{
1675+}
1676+
1677+UCStyleHints::~UCStyleHints()
1678+{
1679+ qDeleteAll(m_propertyBackup);
1680+ m_propertyBackup.clear();
1681+}
1682+
1683+void UCStyleHints::classBegin()
1684+{
1685+ m_styledItem = qobject_cast<UCStyledItemBase*>(parent());
1686+ if (m_styledItem) {
1687+ connect(m_styledItem, SIGNAL(styleInstanceChanged()),
1688+ this, SLOT(_q_applyStyleHints()));
1689+ } else {
1690+ qmlInfo(this) << "StyleHints must be declared in a StyledItem or a derivate of it.";
1691+ }
1692+}
1693+
1694+void UCStyleHints::componentComplete()
1695+{
1696+ m_completed = (m_styledItem != Q_NULLPTR);
1697+ _q_applyStyleHints();
1698+}
1699+
1700+// apply the style hints and check each property existence
1701+void UCStyleHints::_q_applyStyleHints()
1702+{
1703+ if (!m_completed || !m_decoded || !m_styledItem || !UCStyledItemBasePrivate::get(m_styledItem)->styleItem) {
1704+ return;
1705+ }
1706+
1707+ // restore properties first
1708+ qDeleteAll(m_propertyBackup);
1709+ m_propertyBackup.clear();
1710+
1711+ QQuickItem *item = UCStyledItemBasePrivate::get(m_styledItem)->styleItem;
1712+ const QMetaObject *mo = item->metaObject();
1713+ const QString styleName = UCStyledItemBasePrivate::get(m_styledItem)->styleName();
1714+ // apply values first
1715+ for (int i = 0; i < m_values.size(); i++) {
1716+ if (mo->indexOfProperty(m_values[i].first.toUtf8()) < 0) {
1717+ propertyNotFound(styleName, m_values[i].first);
1718+ continue;
1719+ }
1720+ PropertyChange *change = new PropertyChange(item, m_values[i].first.toUtf8());
1721+ PropertyChange::setValue(change, m_values[i].second);
1722+ m_propertyBackup << change;
1723+ }
1724+
1725+ QQmlContext *context = qmlContext(this);
1726+ // then apply expressions/bindings
1727+ for (int ii = 0; ii < m_expressions.count(); ii++) {
1728+ Expression e = m_expressions[ii];
1729+ PropertyChange *change = new PropertyChange(item, e.name.toUtf8());
1730+ if (!change->property().isValid()) {
1731+ propertyNotFound(styleName, e.name);
1732+ delete change;
1733+ continue;
1734+ }
1735+
1736+ // create a binding object from the expression using the palette context
1737+ QQmlContextData *cdata = QQmlContextData::get(context);
1738+ QQmlBinding *newBinding = 0;
1739+ if (e.id != QQmlBinding::Invalid) {
1740+ QV4::Scope scope(QQmlEnginePrivate::getV4Engine(qmlEngine(this)));
1741+ QV4::ScopedValue function(scope, QV4::QmlBindingWrapper::createQmlCallableForFunction(cdata, item, m_cdata->compilationUnit->runtimeFunctions[e.id]));
1742+ newBinding = new QQmlBinding(function, item, cdata);
1743+ }
1744+ if (!newBinding) {
1745+ newBinding = new QQmlBinding(e.expression, item, cdata, e.url.toString(), e.line, e.column);
1746+ }
1747+
1748+ newBinding->setTarget(change->property());
1749+ PropertyChange::setBinding(change, newBinding);
1750+ }
1751+}
1752+
1753
1754=== added file 'modules/Ubuntu/Components/plugin/ucstylehints.h'
1755--- modules/Ubuntu/Components/plugin/ucstylehints.h 1970-01-01 00:00:00 +0000
1756+++ modules/Ubuntu/Components/plugin/ucstylehints.h 2015-06-19 04:42:29 +0000
1757@@ -0,0 +1,92 @@
1758+/*
1759+ * Copyright 2015 Canonical Ltd.
1760+ *
1761+ * This program is free software; you can redistribute it and/or modify
1762+ * it under the terms of the GNU Lesser General Public License as published by
1763+ * the Free Software Foundation; version 3.
1764+ *
1765+ * This program is distributed in the hope that it will be useful,
1766+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1767+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1768+ * GNU Lesser General Public License for more details.
1769+ *
1770+ * You should have received a copy of the GNU Lesser General Public License
1771+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1772+ *
1773+ * Author: Zsombor Egri <zsombor.egri@canonical.com>
1774+ */
1775+
1776+#ifndef UCSTYLEHINTS_H
1777+#define UCSTYLEHINTS_H
1778+
1779+#include <QtCore/QObject>
1780+#define foreach Q_FOREACH
1781+#include <QtQml/private/qqmlcustomparser_p.h>
1782+#include <private/qv4engine_p.h>
1783+#include <private/qpodvector_p.h>
1784+#undef foreach
1785+#include <QtQml/private/qqmlcompiler_p.h>
1786+
1787+class UCStyleHintsParser;
1788+class UCStyledItemBase;
1789+class QQuickItem;
1790+class PropertyChange;
1791+class UCStyleHints : public QObject, public QQmlParserStatus
1792+{
1793+ Q_OBJECT
1794+ Q_INTERFACES(QQmlParserStatus)
1795+ Q_PROPERTY(bool ignoreUnknownProperties MEMBER m_ignoreUnknownProperties)
1796+
1797+public:
1798+ explicit UCStyleHints(QObject *parent = 0);
1799+ ~UCStyleHints();
1800+
1801+private Q_SLOTS:
1802+ void _q_applyStyleHints();
1803+
1804+protected:
1805+ void classBegin();
1806+ void componentComplete();
1807+
1808+private:
1809+ class Expression {
1810+ public:
1811+ Expression(const QString &name, QQmlBinding::Identifier id, const QString& expr,
1812+ const QUrl &url, int line, int column)
1813+ : name(name), id(id), expression(expr), url(url), line(line), column(column) {}
1814+ QString name;
1815+ QQmlBinding::Identifier id;
1816+ QString expression;
1817+ QUrl url;
1818+ int line;
1819+ int column;
1820+ };
1821+
1822+ bool m_decoded:1;
1823+ bool m_completed:1;
1824+ bool m_ignoreUnknownProperties:1;
1825+ QPointer<UCStyledItemBase> m_styledItem;
1826+ QList<Expression> m_expressions;
1827+ QList< QPair<QString, QVariant> > m_values;
1828+ QList< PropertyChange* > m_propertyBackup;
1829+ QQmlRefPointer<QQmlCompiledData> m_cdata;
1830+
1831+ friend class UCStyleHintsParser;
1832+
1833+ void propertyNotFound(const QString &styleName, const QString &property);
1834+ void decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
1835+};
1836+
1837+class UCStyleHintsParser : public QQmlCustomParser
1838+{
1839+public:
1840+ UCStyleHintsParser() : QQmlCustomParser(QQmlCustomParser::AcceptsSignalHandlers) {}
1841+
1842+ virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings);
1843+ virtual void applyBindings(QObject *obj, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings);
1844+
1845+private:
1846+ void verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
1847+};
1848+
1849+#endif // UCSTYLEHINTS_H
1850
1851=== modified file 'modules/Ubuntu/Components/plugin/uctheme.cpp'
1852--- modules/Ubuntu/Components/plugin/uctheme.cpp 2015-05-02 09:20:35 +0000
1853+++ modules/Ubuntu/Components/plugin/uctheme.cpp 2015-06-19 04:42:29 +0000
1854@@ -121,15 +121,18 @@
1855 * }
1856 * \endqml
1857 *
1858- * The \l createStyleComponent function can be used to create the style for a
1859- * component. The following example will create the style with the inherited
1860- * theme.
1861+ * The style can be set on a StyledItem either using \l StyledItem::styleName or
1862+ * \l StyledItem::style properties. When set through \l StyledItem::styleName,
1863+ * the component will load the style from the current theme set, and must be a
1864+ * QML document. The \l StyledItem::style property is a Component which can be
1865+ * declared local, or loaded with a Loader or created using Qt.createComponent()
1866+ * function.
1867+ * The following example will create the style with the inherited theme.
1868 * \qml
1869 * import QtQuick 2.4
1870 * import Ubuntu.Components 1.3
1871 * StyledItem {
1872- * id: myItem
1873- * style: theme.createStyleComponent("MyItemStyle.qml", myItem)
1874+ * styleName: "MyItemStyle"
1875 * }
1876 * \endqml
1877 * All styled toolkit components such as \l Button, \l CheckBox, \l Switch, etc.
1878@@ -642,24 +645,20 @@
1879 }
1880 m_version = version;
1881 Q_EMIT versionChanged();
1882- // emit also nameChanged() so we reload the theme/style
1883- Q_EMIT nameChanged();
1884 }
1885
1886-/*!
1887- * \qmlmethod Component ThemeSettings::createStyleComponent(string styleName, object parent)
1888+/*
1889 * Returns an instance of the style component named \a styleName and parented
1890 * to \a parent.
1891 */
1892-QQmlComponent* UCTheme::createStyleComponent(const QString& styleName, QObject* parent)
1893-{
1894- return createStyleComponent(styleName, parent, m_version);
1895-}
1896-
1897 QQmlComponent* UCTheme::createStyleComponent(const QString& styleName, QObject* parent, quint16 version)
1898 {
1899 QQmlComponent *component = NULL;
1900
1901+ if (!version) {
1902+ version = m_version;
1903+ }
1904+
1905 if (parent != NULL) {
1906 QQmlEngine* engine = qmlEngine(parent);
1907 if (engine != m_engine && !m_engine) {
1908@@ -681,6 +680,9 @@
1909 qmlInfo(parent) << component->errorString();
1910 delete component;
1911 component = NULL;
1912+ } else {
1913+ // set context for the component
1914+ QQmlEngine::setContextForObject(component, qmlContext(parent));
1915 }
1916 } else {
1917 qmlInfo(parent) <<
1918
1919=== modified file 'modules/Ubuntu/Components/plugin/uctheme.h'
1920--- modules/Ubuntu/Components/plugin/uctheme.h 2015-05-02 08:49:38 +0000
1921+++ modules/Ubuntu/Components/plugin/uctheme.h 2015-06-19 04:42:29 +0000
1922@@ -76,8 +76,7 @@
1923 void setVersion(quint16 version);
1924
1925 // internal, used by the deprecated Theme.createStyledComponent()
1926- QQmlComponent* createStyleComponent(const QString& styleName, QObject* parent, quint16 version);
1927- Q_INVOKABLE QQmlComponent* createStyleComponent(const QString& styleName, QObject* parent);
1928+ QQmlComponent* createStyleComponent(const QString& styleName, QObject* parent, quint16 version = 0);
1929 static void registerToContext(QQmlContext* context);
1930
1931 // helper functions
1932
1933=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushape.cpp'
1934--- modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-04-30 19:51:26 +0000
1935+++ modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-06-19 04:42:29 +0000
1936@@ -49,36 +49,8 @@
1937
1938 // --- Scene graph shader ---
1939
1940-// Factors used to know which screen-space derivatives must be used in the fragment shaders based on
1941-// the primary orientation and current orientation.
1942-static float dfdtFactors[2];
1943-
1944-static void orientationChanged(Qt::ScreenOrientation orientation)
1945-{
1946- const quint8 landscapeMask = Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation;
1947- const quint8 portraitMask = Qt::PortraitOrientation | Qt::InvertedPortraitOrientation;
1948- if (QGuiApplication::primaryScreen()->primaryOrientation() & landscapeMask) {
1949- const quint8 flippedMask =
1950- Qt::InvertedLandscapeOrientation | Qt::InvertedPortraitOrientation;
1951- dfdtFactors[0] = orientation & landscapeMask ? 0.0f : 1.0f;
1952- dfdtFactors[1] = orientation & flippedMask ? -1.0f : 1.0f;
1953- } else {
1954- const quint8 flippedMask = Qt::InvertedPortraitOrientation | Qt::LandscapeOrientation;
1955- dfdtFactors[0] = orientation & portraitMask ? 0.0f : 1.0f;
1956- dfdtFactors[1] = orientation & flippedMask ? -1.0f : 1.0f;
1957- }
1958-}
1959-
1960 ShapeShader::ShapeShader()
1961 {
1962- static bool once = true;
1963- if (once) {
1964- const QScreen* primaryScreen = QGuiApplication::primaryScreen();
1965- orientationChanged(primaryScreen->orientation());
1966- QObject::connect(primaryScreen, &QScreen::orientationChanged, orientationChanged);
1967- once = false;
1968- }
1969-
1970 setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/uc/shaders/shape.vert"));
1971 setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/uc/shaders/shape.frag"));
1972 }
1973@@ -168,9 +140,11 @@
1974
1975 // Send screen-space derivative factors. Note that when rendering is redirected to a
1976 // ShaderEffectSource (FBO), dFdy() sign is flipped.
1977- const bool flipped = dfdtFactors[0] != 1.0f && state.projectionMatrix()(1, 3) < 0.0f;
1978- const QVector2D dfdtFactorsVector(dfdtFactors[0], flipped ? -dfdtFactors[1] : dfdtFactors[1]);
1979- program()->setUniformValue(m_dfdtFactorsId, dfdtFactorsVector);
1980+ const float orientation = static_cast<float>(data->dfdtFactors & 0x4);
1981+ const float flip = static_cast<float>(data->dfdtFactors & 0x3) - 1.0f;
1982+ const bool flipped = orientation != 1.0f && state.projectionMatrix()(1, 3) < 0.0f;
1983+ const QVector2D dfdtFactors(orientation, flipped ? -flip : flip);
1984+ program()->setUniformValue(m_dfdtFactorsId, dfdtFactors);
1985
1986 // Update QtQuick engine uniforms.
1987 if (state.isMatrixDirty()) {
1988@@ -272,6 +246,7 @@
1989 // --- QtQuick item ---
1990
1991 static QHash<QOpenGLContext*, quint32> shapeTextureHash;
1992+static bool isPrimaryOrientationLandscape = false;
1993
1994 const float implicitWidthGU = 8.0f;
1995 const float implicitHeightGU = 8.0f;
1996@@ -331,6 +306,17 @@
1997 , m_sourceOpacity(255)
1998 , m_flags(Stretched)
1999 {
2000+ static bool once = true;
2001+ if (once) {
2002+ // Stored statically as the primary orientation is fixed and we don't support multiple
2003+ // screens for now.
2004+ if (QGuiApplication::primaryScreen()->primaryOrientation() &
2005+ (Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation)) {
2006+ isPrimaryOrientationLandscape = true;
2007+ }
2008+ once = false;
2009+ }
2010+
2011 setFlag(ItemHasContents);
2012 QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), this,
2013 SLOT(_q_gridUnitChanged()));
2014@@ -1236,6 +1222,25 @@
2015 materialData->distanceAAFactor = qMin(
2016 (radius / (end - start)) - (start / (end - start)), 1.0f) * 255.0f;
2017
2018+ // Screen-space derivatives factors for fragment shaders depend on the primary orientation and
2019+ // content orientation. A flag indicating a 90° rotation around the primary orientation is
2020+ // stored on the 3rd bit of dfdtFactors, the flip factor is stored on the first 2 bits as 0 for
2021+ // -1 and as 2 for 1 (efficiently converted using: float(x & 0x3) - 1.0f).
2022+ const Qt::ScreenOrientation contentOrientation = window()->contentOrientation();
2023+ if (isPrimaryOrientationLandscape) {
2024+ const quint8 portraitMask = Qt::PortraitOrientation | Qt::InvertedPortraitOrientation;
2025+ const quint8 flipMask = Qt::InvertedLandscapeOrientation | Qt::InvertedPortraitOrientation;
2026+ quint8 factors = contentOrientation & portraitMask ? 0x4 : 0x0;
2027+ factors |= contentOrientation & flipMask ? 0x0 : 0x2;
2028+ materialData->dfdtFactors = factors;
2029+ } else {
2030+ const quint8 landscapeMask = Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation;
2031+ const quint8 flipMask = Qt::InvertedPortraitOrientation | Qt::LandscapeOrientation;
2032+ quint8 factors = contentOrientation & landscapeMask ? 0x4 : 0x0;
2033+ factors |= contentOrientation & flipMask ? 0x0 : 0x2;
2034+ materialData->dfdtFactors = factors;
2035+ }
2036+
2037 // When the radius is equal to radiusSizeOffset (which means radius size is 0), no aspect is
2038 // flagged so that a dedicated (statically flow controlled) shaved off shader can be used for
2039 // optimal performance.
2040
2041=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushape.h'
2042--- modules/Ubuntu/Components/plugin/ucubuntushape.h 2015-04-22 19:33:39 +0000
2043+++ modules/Ubuntu/Components/plugin/ucubuntushape.h 2015-06-19 04:42:29 +0000
2044@@ -68,6 +68,7 @@
2045 quint32 shapeTexture;
2046 quint8 distanceAAFactor;
2047 quint8 sourceOpacity;
2048+ quint8 dfdtFactors;
2049 quint8 flags;
2050 };
2051
2052
2053=== modified file 'modules/Ubuntu/Test/plugin/uctestcase.cpp'
2054--- modules/Ubuntu/Test/plugin/uctestcase.cpp 2014-11-25 09:58:33 +0000
2055+++ modules/Ubuntu/Test/plugin/uctestcase.cpp 2015-06-19 04:42:29 +0000
2056@@ -32,7 +32,7 @@
2057 * \ingroup ubuntu
2058 * \brief UbuntuTestCase is the C++ pendant to the QML UbuntuTestCase.
2059 */
2060-UbuntuTestCase::UbuntuTestCase(const QString& file, QWindow* parent) : QQuickView(parent)
2061+UbuntuTestCase::UbuntuTestCase(const QString& file, bool assertOnFailure, QWindow* parent) : QQuickView(parent)
2062 {
2063 QString modules(UBUNTU_QML_IMPORT_PATH);
2064 Q_ASSERT(QDir(modules).exists());
2065@@ -45,10 +45,14 @@
2066
2067 Q_ASSERT(!file.isEmpty());
2068 setSource(QUrl::fromLocalFile(file));
2069- Q_ASSERT(status() == QQuickView::Ready);
2070- Q_ASSERT(rootObject());
2071- show();
2072- QTest::qWaitForWindowExposed(this);
2073+ if (assertOnFailure) {
2074+ Q_ASSERT(status() == QQuickView::Ready);
2075+ Q_ASSERT(rootObject());
2076+ }
2077+ if (rootObject()) {
2078+ show();
2079+ QTest::qWaitForWindowExposed(this);
2080+ }
2081 }
2082
2083 /*!
2084
2085=== modified file 'modules/Ubuntu/Test/plugin/uctestcase.h'
2086--- modules/Ubuntu/Test/plugin/uctestcase.h 2015-03-06 14:35:53 +0000
2087+++ modules/Ubuntu/Test/plugin/uctestcase.h 2015-06-19 04:42:29 +0000
2088@@ -28,7 +28,7 @@
2089 {
2090 Q_OBJECT
2091 public:
2092- UbuntuTestCase(const QString& file, QWindow* parent = 0);
2093+ UbuntuTestCase(const QString& file, bool assertOnFailure = true, QWindow* parent = 0);
2094 int warnings() const;
2095 // getter
2096 template<class T>
2097
2098=== modified file 'tests/apicheck/apicheck.cpp'
2099--- tests/apicheck/apicheck.cpp 2015-05-11 12:46:48 +0000
2100+++ tests/apicheck/apicheck.cpp 2015-06-19 04:42:29 +0000
2101@@ -1,6 +1,6 @@
2102 /*
2103 * Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2104- * Copyright (C) 2015 Christian Dywan
2105+ * Copyright (C) 2015 Canonical
2106 *
2107 * This program is free software; you can redistribute it and/or modify
2108 * it under the terms of the GNU Lesser General Public License as published by
2109
2110=== modified file 'tests/autopilot/ubuntuuitoolkit/fixture_setup.py'
2111--- tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2015-04-14 21:02:06 +0000
2112+++ tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2015-06-19 04:42:29 +0000
2113@@ -15,9 +15,11 @@
2114 # along with this program. If not, see <http://www.gnu.org/licenses/>.
2115
2116 import copy
2117+import json
2118 import logging
2119 import os
2120 import shutil
2121+import subprocess
2122 import tempfile
2123
2124 import fixtures
2125@@ -44,7 +46,7 @@
2126 DEFAULT_DESKTOP_FILE_DICT = {
2127 'Type': 'Application',
2128 'Name': 'test',
2129- 'Exec': '{qmlscene} {qml_file_path}',
2130+ 'Exec': '{launcher} {qml_file_path}',
2131 'Icon': 'Not important'
2132 }
2133
2134@@ -56,18 +58,24 @@
2135
2136 def __init__(
2137 self, qml_file_contents=DEFAULT_QML_FILE_CONTENTS,
2138- desktop_file_dict=None):
2139+ desktop_file_dict=None, url_dispatcher_protocols=None):
2140 super().__init__()
2141 self._qml_file_contents = qml_file_contents
2142 if desktop_file_dict is None:
2143 self._desktop_file_dict = copy.deepcopy(DEFAULT_DESKTOP_FILE_DICT)
2144 else:
2145 self._desktop_file_dict = copy.deepcopy(desktop_file_dict)
2146+ self.url_dispatcher_protocols = url_dispatcher_protocols
2147
2148 def setUp(self):
2149 super().setUp()
2150 self.qml_file_path, self.desktop_file_path = (
2151 self._create_test_application())
2152+ desktop_file_name = os.path.basename(self.desktop_file_path)
2153+ self.application_name, _ = os.path.splitext(desktop_file_name)
2154+ if self.url_dispatcher_protocols:
2155+ self.url_dispatcher_file_path = (
2156+ self._register_url_dispatcher_protocols(self.application_name))
2157
2158 def _create_test_application(self):
2159 qml_file_path = self._write_test_qml_file()
2160@@ -99,7 +107,7 @@
2161 dir=desktop_file_dir)
2162 self._desktop_file_dict['Exec'] = (
2163 self._desktop_file_dict['Exec'].format(
2164- qmlscene=base.get_qmlscene_launch_command(),
2165+ launcher=base.get_toolkit_launcher_command(),
2166 qml_file_path=qml_file_path))
2167 desktop_file.write('[Desktop Entry]\n')
2168 for key, value in self._desktop_file_dict.items():
2169@@ -111,6 +119,42 @@
2170 return os.path.join(
2171 os.environ.get('HOME'), '.local', 'share', 'applications')
2172
2173+ def _register_url_dispatcher_protocols(self, application_name):
2174+ url_dispatcher_file_path = self._write_url_dispatcher_file(
2175+ application_name)
2176+ self.addCleanup(os.remove, url_dispatcher_file_path)
2177+ self._update_url_dispatcher_directory(url_dispatcher_file_path)
2178+ return url_dispatcher_file_path
2179+
2180+ def _write_url_dispatcher_file(self, application_name):
2181+ url_dispatcher_dir = self._get_local_url_dispatcher_directory()
2182+ if not os.path.exists(url_dispatcher_dir):
2183+ os.makedirs(url_dispatcher_dir)
2184+
2185+ protocol_list = [
2186+ {'protocol': protocol}
2187+ for protocol in self.url_dispatcher_protocols]
2188+
2189+ url_dispatcher_file_path = os.path.join(
2190+ url_dispatcher_dir, application_name + '.url-dispatcher')
2191+ with open(url_dispatcher_file_path, 'w') as url_dispatcher_file:
2192+ url_dispatcher_file.write(json.dumps(protocol_list))
2193+
2194+ return url_dispatcher_file_path
2195+
2196+ def _get_local_url_dispatcher_directory(self):
2197+ return os.path.join(
2198+ os.environ.get('HOME'), '.config', 'url-dispatcher', 'urls')
2199+
2200+ def _update_url_dispatcher_directory(self, url_dispatcher_file_path):
2201+ # FIXME This should be updated calling
2202+ # initctl start url-dispatcher-update-user, but it is not working.
2203+ # https://bugs.launchpad.net/ubuntu/+source/url-dispatcher/+bug/1461496
2204+ # --elopio - 2015-06-02
2205+ subprocess.check_output(
2206+ '/usr/lib/*/url-dispatcher/update-directory ' +
2207+ url_dispatcher_file_path, shell=True)
2208+
2209
2210 class InitctlEnvironmentVariable(fixtures.Fixture):
2211 """Set the value of initctl environment variables."""
2212
2213=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.header.qml'
2214--- tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.header.qml 2015-03-10 16:29:24 +0000
2215+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.header.qml 2015-06-19 04:42:29 +0000
2216@@ -37,8 +37,6 @@
2217 inputMethodHints: Qt.ImhNoPredictiveText
2218 hasClearButton: false
2219
2220- text: "Then two bears came out of the woods and mauled forty-two of the youths."
2221-
2222 anchors {
2223 fill: parent
2224 leftMargin: units.gu(1)
2225
2226=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py'
2227--- tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py 2015-05-18 05:37:17 +0000
2228+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py 2015-06-19 04:42:29 +0000
2229@@ -80,9 +80,8 @@
2230 def test_caret_visible_on_focus(self):
2231 cursorName = 'text_cursor_style_caret_cursorPosition'
2232 self._assert_not_visible(objectName=cursorName)
2233+ self.textfield.write('Lorem ipsum')
2234 self.pointing_device.click_object(self.textfield)
2235- self.assertTrue(self.textfield.focus)
2236- self.textfield.keyboard.type('Lorem ipsum')
2237 self.main_view.select_single(objectName=cursorName)
2238
2239 def test_caret_hide_while_typing(self):
2240@@ -90,7 +89,7 @@
2241 self.assertTrue(self.textfield.focus)
2242 cursor = self.select_cursor('cursorPosition')
2243
2244- self.textfield.keyboard.type('Lorem ipsum')
2245+ self.textfield.write('Lorem ipsum')
2246 self.assertFalse(cursor.visible)
2247
2248 def test_caret_visible_after_tapping(self):
2249@@ -166,6 +165,7 @@
2250 objectName=positionProperty + '_draggeditem')
2251
2252 def test_popover_not_obscured(self):
2253+ self.textfield.write('Lorem ipsum')
2254 self.pointing_device.click_object(self.textfield)
2255 cursor = self.select_cursor('cursorPosition')
2256 self.pointing_device.click_object(cursor)
2257@@ -184,6 +184,7 @@
2258
2259 def test_popover_visible_after_tapping_caret(self):
2260 # Insert Mode
2261+ self.textfield.write('Lorem ipsum')
2262 self.pointing_device.click_object(self.textfield)
2263 cursor = self.select_cursor('cursorPosition')
2264 self.pointing_device.click_object(cursor)
2265@@ -192,8 +193,7 @@
2266
2267 def test_popover_visible_after_dragging_caret(self):
2268 # Insert Mode
2269- self.pointing_device.click_object(self.textfield)
2270- self.textfield.keyboard.type('Lorem ipsum')
2271+ self.textfield.write('Lorem ipsum')
2272 self.pointing_device.click_object(self.textfield)
2273 cursor = self.select_cursor('cursorPosition')
2274 x, y = get_center_point(cursor)
2275@@ -204,8 +204,7 @@
2276 @testtools.skipIf(platform.model() == 'Desktop', 'Touch only')
2277 def test_popover_visible_after_long_press(self):
2278 # Select Mode
2279- self.pointing_device.click_object(self.textfield)
2280- self.textfield.keyboard.type('Lorem ipsum')
2281+ self.textfield.write('Lorem ipsum')
2282 self.pointing_device.move(
2283 self.textfield.globalRect.x + self.textfield.width // 8,
2284 self.textfield.globalRect.y + self.textfield.height // 2)
2285
2286=== added file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.LaunchFakeApplicationTestCase.qml'
2287--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.LaunchFakeApplicationTestCase.qml 1970-01-01 00:00:00 +0000
2288+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.LaunchFakeApplicationTestCase.qml 2015-06-19 04:42:29 +0000
2289@@ -0,0 +1,30 @@
2290+/*
2291+ * Copyright 2015 Canonical Ltd.
2292+ *
2293+ * This program is free software; you can redistribute it and/or modify
2294+ * it under the terms of the GNU Lesser General Public License as published by
2295+ * the Free Software Foundation; version 3.
2296+ *
2297+ * This program is distributed in the hope that it will be useful,
2298+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2299+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2300+ * GNU Lesser General Public License for more details.
2301+ *
2302+ * You should have received a copy of the GNU Lesser General Public License
2303+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2304+ */
2305+
2306+import QtQuick 2.3
2307+import Ubuntu.Components 1.2
2308+
2309+MainView {
2310+ width: units.gu(48)
2311+ height: units.gu(60)
2312+ objectName: "mainView"
2313+
2314+ Label {
2315+ id: label
2316+ objectName: 'testLabel'
2317+ text: 'Test application.'
2318+ }
2319+}
2320
2321=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
2322--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2015-04-14 21:02:06 +0000
2323+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2015-06-19 04:42:29 +0000
2324@@ -15,6 +15,7 @@
2325 # along with this program. If not, see <http://www.gnu.org/licenses/>.
2326
2327 import os
2328+import subprocess
2329 import tempfile
2330
2331 from unittest import mock
2332@@ -22,6 +23,7 @@
2333 import testtools
2334 from autopilot import (
2335 display,
2336+ introspection,
2337 platform,
2338 testcase as autopilot_testcase
2339 )
2340@@ -78,10 +80,10 @@
2341 self.assert_desktop_file_contents(
2342 desktop_file_contents, test_desktop_file_dict)
2343
2344- def test_desktop_file_with_qmlscene_launch_command(self):
2345- test_desktop_file_dict = {'Exec': '{qmlscene} application'}
2346+ def test_desktop_file_with_launch_command(self):
2347+ test_desktop_file_dict = {'Exec': '{launcher} application'}
2348
2349- qmlscene = 'ubuntuuitoolkit.base.get_qmlscene_launch_command'
2350+ qmlscene = 'ubuntuuitoolkit.base.get_toolkit_launcher_command'
2351 with mock.patch(qmlscene) as mock_qmlscene:
2352 mock_qmlscene.return_value = 'test_qmlscene_command'
2353 fake_application = fixture_setup.FakeApplication(
2354@@ -111,9 +113,9 @@
2355 'Exec=qmlscene {}'.format(fake_application.qml_file_path)))
2356
2357 def test_desktop_file_with_default_contents(self):
2358- qmlscene = 'ubuntuuitoolkit.base.get_qmlscene_launch_command'
2359- with mock.patch(qmlscene) as mock_qmlscene:
2360- mock_qmlscene.return_value = 'qmlscene'
2361+ get_launcher = 'ubuntuuitoolkit.base.get_toolkit_launcher_command'
2362+ with mock.patch(get_launcher) as mock_launcher:
2363+ mock_launcher.return_value = 'testlauncher'
2364 fake_application = fixture_setup.FakeApplication()
2365 self.useFixture(fake_application)
2366
2367@@ -124,7 +126,7 @@
2368 'Type': 'Application',
2369 'Name': 'test',
2370 'Icon': 'Not important',
2371- 'Exec': 'qmlscene {}'.format(fake_application.qml_file_path),
2372+ 'Exec': 'testlauncher {}'.format(fake_application.qml_file_path),
2373 }
2374 self.assert_desktop_file_contents(
2375 desktop_file_contents, expected_desktop_file_dict)
2376@@ -140,7 +142,8 @@
2377 os.path.dirname(fake_application.desktop_file_path))
2378
2379 def test_fake_application_files_must_be_removed_after_test(self):
2380- fake_application = fixture_setup.FakeApplication()
2381+ fake_application = fixture_setup.FakeApplication(
2382+ url_dispatcher_protocols=['testprotocol'])
2383
2384 def inner_test():
2385 class TestWithFakeApplication(testtools.TestCase):
2386@@ -151,6 +154,8 @@
2387 inner_test().run()
2388 self.assertThat(fake_application.qml_file_path, Not(FileExists()))
2389 self.assertThat(fake_application.desktop_file_path, Not(FileExists()))
2390+ self.assertThat(
2391+ fake_application.url_dispatcher_file_path, Not(FileExists()))
2392
2393
2394 class LaunchFakeApplicationTestCase(autopilot_testcase.AutopilotTestCase):
2395@@ -159,7 +164,7 @@
2396 fake_application = fixture_setup.FakeApplication()
2397 self.useFixture(fake_application)
2398
2399- self.application = self.launch_test_application(
2400+ application = self.launch_test_application(
2401 base.get_qmlscene_launch_command(),
2402 fake_application.qml_file_path,
2403 '--desktop_file_hint={0}'.format(
2404@@ -167,7 +172,42 @@
2405 app_type='qt')
2406
2407 # We can select a component from the application.
2408- self.application.select_single('Label', objectName='testLabel')
2409+ application.select_single('Label', objectName='testLabel')
2410+
2411+ def test_launch_fake_application_from_url_dispatcher(self):
2412+ if platform.model() == 'Desktop':
2413+ self.skipTest('Not yet working on desktop')
2414+
2415+ path = os.path.abspath(__file__)
2416+ dir_path = os.path.dirname(path)
2417+ qml_file_path = os.path.join(
2418+ dir_path, 'test_fixture_setup.LaunchFakeApplicationTestCase.qml')
2419+ with open(qml_file_path) as qml_file:
2420+ qml_file_contents = qml_file.read()
2421+
2422+ fake_application = fixture_setup.FakeApplication(
2423+ qml_file_contents=qml_file_contents,
2424+ url_dispatcher_protocols=['testprotocol'])
2425+ self.useFixture(fake_application)
2426+
2427+ self.useFixture(fixture_setup.InitctlEnvironmentVariable(
2428+ QT_LOAD_TESTABILITY=1))
2429+
2430+ self.addCleanup(
2431+ subprocess.check_output,
2432+ ['ubuntu-app-stop', fake_application.application_name])
2433+
2434+ subprocess.check_output(
2435+ ['url-dispatcher', 'testprotocol://test'])
2436+
2437+ pid = int(subprocess.check_output(
2438+ ['ubuntu-app-pid', fake_application.application_name]).strip())
2439+
2440+ application = introspection.get_proxy_object_for_existing_process(
2441+ pid=pid)
2442+
2443+ # We can select a component from the application.
2444+ application.select_single('Label', objectName='testLabel')
2445
2446
2447 class InitctlEnvironmentVariableTestCase(testtools.TestCase):
2448
2449=== modified file 'tests/resources/navigation/tabs.qml'
2450--- tests/resources/navigation/tabs.qml 2015-04-24 10:45:31 +0000
2451+++ tests/resources/navigation/tabs.qml 2015-06-19 04:42:29 +0000
2452@@ -15,8 +15,8 @@
2453 */
2454
2455 import QtQuick 2.0
2456-import Ubuntu.Components 1.2
2457-import Ubuntu.Components.ListItems 1.0 as ListItem
2458+import Ubuntu.Components 1.3
2459+import Ubuntu.Components.ListItems 1.3 as ListItem
2460
2461 MainView {
2462 width: 800
2463
2464=== modified file 'tests/unit/runtest.sh'
2465--- tests/unit/runtest.sh 2015-05-05 09:06:13 +0000
2466+++ tests/unit/runtest.sh 2015-06-19 04:42:29 +0000
2467@@ -64,21 +64,20 @@
2468 QML2_IMPORT_PATH=${_IMPORT_PATH} UBUNTU_UI_TOOLKIT_THEMES_PATH=${_THEMES_PATH} \
2469 ALARM_BACKEND=memory SUPPRESS_DEPRECATED_NOTE=yes \
2470 $_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory'
2471- RESULT=0
2472 if [ "x$UITK_TEST_KEEP_RUNNING" != "x1" ]; then
2473 ${BUILD_DIR}/tests/checkresults.sh $_XML
2474 RESULT=$*
2475 fi
2476 else
2477 echo "Skipped because no DISPLAY available"
2478+ fi
2479+ if [ -z $RESULT ]; then
2480 RESULT=0
2481- fi
2482 # segfault
2483- if [ $RESULT -eq 139 ]; then
2484+ elif [ $RESULT -eq 139 ]; then
2485 RESULT=2
2486- fi
2487 # abort
2488- if [ $RESULT -eq 134 ]; then
2489+ elif [ $RESULT -eq 134 ]; then
2490 RESULT=2
2491 fi
2492 echo "$_TARGET_$_TESTFILE exited with $RESULT"
2493
2494=== modified file 'tests/unit/tst_performance/PaletteConfigurationAllColors.qml'
2495--- tests/unit/tst_performance/PaletteConfigurationAllColors.qml 2015-03-19 11:21:42 +0000
2496+++ tests/unit/tst_performance/PaletteConfigurationAllColors.qml 2015-06-19 04:42:29 +0000
2497@@ -16,7 +16,7 @@
2498
2499 import QtQuick 2.4
2500 import Ubuntu.Components 1.3
2501-import Ubuntu.Components.Themes 1.0
2502+import Ubuntu.Components.Themes 1.3
2503
2504 StyledItem {
2505 width: 100
2506
2507=== modified file 'tests/unit/tst_performance/PaletteConfigurationOneColor.qml'
2508--- tests/unit/tst_performance/PaletteConfigurationOneColor.qml 2015-03-19 11:21:42 +0000
2509+++ tests/unit/tst_performance/PaletteConfigurationOneColor.qml 2015-06-19 04:42:29 +0000
2510@@ -16,7 +16,7 @@
2511
2512 import QtQuick 2.4
2513 import Ubuntu.Components 1.3
2514-import Ubuntu.Components.Themes 1.0
2515+import Ubuntu.Components.Themes 1.3
2516
2517 StyledItem {
2518 width: 100
2519
2520=== modified file 'tests/unit_x11/tst_components/tst_actionbar.qml'
2521--- tests/unit_x11/tst_components/tst_actionbar.qml 2015-05-14 21:41:16 +0000
2522+++ tests/unit_x11/tst_components/tst_actionbar.qml 2015-06-19 04:42:29 +0000
2523@@ -30,7 +30,7 @@
2524 },
2525 Action {
2526 iconName: "appointment"
2527- text: "Appointment"
2528+ text: "Date"
2529 },
2530 Action {
2531 iconName: "attachment"
2532
2533=== modified file 'tests/unit_x11/tst_components/tst_header_presets.qml'
2534--- tests/unit_x11/tst_components/tst_header_presets.qml 2015-03-03 13:20:06 +0000
2535+++ tests/unit_x11/tst_components/tst_header_presets.qml 2015-06-19 04:42:29 +0000
2536@@ -1,5 +1,5 @@
2537 /*
2538- * Copyright 2014 Canonical Ltd.
2539+ * Copyright 2015 Canonical Ltd.
2540 *
2541 * This program is free software; you can redistribute it and/or modify
2542 * it under the terms of the GNU Lesser General Public License as published by
2543@@ -35,6 +35,13 @@
2544 objectName: "selectAction"
2545 text: "Select all"
2546 iconName: "select"
2547+ onTriggered: {
2548+ if (page.head.preset === "") {
2549+ page.head.preset = "select";
2550+ } else {
2551+ page.head.preset = "";
2552+ }
2553+ }
2554 }
2555 ]
2556 }
2557
2558=== modified file 'tests/unit_x11/tst_subtheming/DeprecatedTheme.qml'
2559--- tests/unit_x11/tst_subtheming/DeprecatedTheme.qml 2015-05-01 11:32:48 +0000
2560+++ tests/unit_x11/tst_subtheming/DeprecatedTheme.qml 2015-06-19 04:42:29 +0000
2561@@ -21,5 +21,5 @@
2562 width: units.gu(40)
2563 height: units.gu(40)
2564 theme.name: "Ubuntu.Components.Themes.SuruGradient"
2565- style: theme.createStyleComponent("OptionSelectorStyle.qml", item)
2566+ styleName: "OptionSelectorStyle"
2567 }
2568
2569=== added file 'tests/unit_x11/tst_subtheming/GroupPropertyBindingHints.qml'
2570--- tests/unit_x11/tst_subtheming/GroupPropertyBindingHints.qml 1970-01-01 00:00:00 +0000
2571+++ tests/unit_x11/tst_subtheming/GroupPropertyBindingHints.qml 2015-06-19 04:42:29 +0000
2572@@ -0,0 +1,32 @@
2573+/*
2574+ * Copyright 2015 Canonical Ltd.
2575+ *
2576+ * This program is free software; you can redistribute it and/or modify
2577+ * it under the terms of the GNU Lesser General Public License as published by
2578+ * the Free Software Foundation; version 3.
2579+ *
2580+ * This program is distributed in the hope that it will be useful,
2581+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2582+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2583+ * GNU Lesser General Public License for more details.
2584+ *
2585+ * You should have received a copy of the GNU Lesser General Public License
2586+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2587+ */
2588+
2589+import QtQuick 2.4
2590+import Ubuntu.Components 1.3
2591+
2592+Item {
2593+ width: units.gu(40)
2594+ height: units.gu(71)
2595+
2596+ HintedButton {
2597+ objectName: "Button"
2598+ id: button
2599+ gradient: UbuntuColors.greyGradient
2600+ StyleHints {
2601+ gradientProxy.topColor: button.pressed ? "tan" : "blue"
2602+ }
2603+ }
2604+}
2605
2606=== added file 'tests/unit_x11/tst_subtheming/HintedButton.qml'
2607--- tests/unit_x11/tst_subtheming/HintedButton.qml 1970-01-01 00:00:00 +0000
2608+++ tests/unit_x11/tst_subtheming/HintedButton.qml 2015-06-19 04:42:29 +0000
2609@@ -0,0 +1,24 @@
2610+/*
2611+ * Copyright 2015 Canonical Ltd.
2612+ *
2613+ * This program is free software; you can redistribute it and/or modify
2614+ * it under the terms of the GNU Lesser General Public License as published by
2615+ * the Free Software Foundation; version 3.
2616+ *
2617+ * This program is distributed in the hope that it will be useful,
2618+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2619+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2620+ * GNU Lesser General Public License for more details.
2621+ *
2622+ * You should have received a copy of the GNU Lesser General Public License
2623+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2624+ */
2625+
2626+import QtQuick 2.4
2627+import Ubuntu.Components 1.3
2628+
2629+Button {
2630+ StyleHints {
2631+ minimumWidth: units.gu(20)
2632+ }
2633+}
2634
2635=== added file 'tests/unit_x11/tst_subtheming/MoreStyleHints.qml'
2636--- tests/unit_x11/tst_subtheming/MoreStyleHints.qml 1970-01-01 00:00:00 +0000
2637+++ tests/unit_x11/tst_subtheming/MoreStyleHints.qml 2015-06-19 04:42:29 +0000
2638@@ -0,0 +1,34 @@
2639+/*
2640+ * Copyright 2015 Canonical Ltd.
2641+ *
2642+ * This program is free software; you can redistribute it and/or modify
2643+ * it under the terms of the GNU Lesser General Public License as published by
2644+ * the Free Software Foundation; version 3.
2645+ *
2646+ * This program is distributed in the hope that it will be useful,
2647+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2648+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2649+ * GNU Lesser General Public License for more details.
2650+ *
2651+ * You should have received a copy of the GNU Lesser General Public License
2652+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2653+ */
2654+
2655+import QtQuick 2.4
2656+import Ubuntu.Components 1.3
2657+
2658+Item {
2659+ width: units.gu(40)
2660+ height: units.gu(71)
2661+
2662+ Button {
2663+ objectName: "Button"
2664+ StyleHints {
2665+ minimumWidth: units.gu(20)
2666+ }
2667+
2668+ StyleHints {
2669+ defaultColor: "brown"
2670+ }
2671+ }
2672+}
2673
2674=== added file 'tests/unit_x11/tst_subtheming/OverrideStyleHints.qml'
2675--- tests/unit_x11/tst_subtheming/OverrideStyleHints.qml 1970-01-01 00:00:00 +0000
2676+++ tests/unit_x11/tst_subtheming/OverrideStyleHints.qml 2015-06-19 04:42:29 +0000
2677@@ -0,0 +1,30 @@
2678+/*
2679+ * Copyright 2015 Canonical Ltd.
2680+ *
2681+ * This program is free software; you can redistribute it and/or modify
2682+ * it under the terms of the GNU Lesser General Public License as published by
2683+ * the Free Software Foundation; version 3.
2684+ *
2685+ * This program is distributed in the hope that it will be useful,
2686+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2687+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2688+ * GNU Lesser General Public License for more details.
2689+ *
2690+ * You should have received a copy of the GNU Lesser General Public License
2691+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2692+ */
2693+
2694+import QtQuick 2.4
2695+import Ubuntu.Components 1.3
2696+
2697+Item {
2698+ width: units.gu(40)
2699+ height: units.gu(71)
2700+
2701+ HintedButton {
2702+ objectName: "Button"
2703+ StyleHints {
2704+ minimumWidth: 5
2705+ }
2706+ }
2707+}
2708
2709=== added file 'tests/unit_x11/tst_subtheming/PropertyBindingHints.qml'
2710--- tests/unit_x11/tst_subtheming/PropertyBindingHints.qml 1970-01-01 00:00:00 +0000
2711+++ tests/unit_x11/tst_subtheming/PropertyBindingHints.qml 2015-06-19 04:42:29 +0000
2712@@ -0,0 +1,31 @@
2713+/*
2714+ * Copyright 2015 Canonical Ltd.
2715+ *
2716+ * This program is free software; you can redistribute it and/or modify
2717+ * it under the terms of the GNU Lesser General Public License as published by
2718+ * the Free Software Foundation; version 3.
2719+ *
2720+ * This program is distributed in the hope that it will be useful,
2721+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2722+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2723+ * GNU Lesser General Public License for more details.
2724+ *
2725+ * You should have received a copy of the GNU Lesser General Public License
2726+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2727+ */
2728+
2729+import QtQuick 2.4
2730+import Ubuntu.Components 1.3
2731+
2732+Item {
2733+ width: units.gu(40)
2734+ height: units.gu(71)
2735+
2736+ Button {
2737+ objectName: "Button"
2738+ id: button
2739+ StyleHints {
2740+ defaultColor: button.pressed ? "tan" : "blue"
2741+ }
2742+ }
2743+}
2744
2745=== modified file 'tests/unit_x11/tst_subtheming/SimpleItem.qml'
2746--- tests/unit_x11/tst_subtheming/SimpleItem.qml 2015-03-12 20:11:38 +0000
2747+++ tests/unit_x11/tst_subtheming/SimpleItem.qml 2015-06-19 04:42:29 +0000
2748@@ -17,13 +17,9 @@
2749 import QtQuick 2.4
2750 import Ubuntu.Components 1.3
2751
2752-Item {
2753+StyledItem {
2754 id: item
2755- property ThemeSettings theme: ThemeSettings {}
2756- property Component style
2757-
2758- property string styleDocument
2759- onStyleDocumentChanged: style = theme.createStyleComponent(styleDocument, item)
2760+ theme: ThemeSettings {}
2761
2762 property string themeName
2763 onThemeNameChanged: theme.name = themeName;
2764
2765=== added file 'tests/unit_x11/tst_subtheming/SimplePropertyHints.qml'
2766--- tests/unit_x11/tst_subtheming/SimplePropertyHints.qml 1970-01-01 00:00:00 +0000
2767+++ tests/unit_x11/tst_subtheming/SimplePropertyHints.qml 2015-06-19 04:42:29 +0000
2768@@ -0,0 +1,30 @@
2769+/*
2770+ * Copyright 2015 Canonical Ltd.
2771+ *
2772+ * This program is free software; you can redistribute it and/or modify
2773+ * it under the terms of the GNU Lesser General Public License as published by
2774+ * the Free Software Foundation; version 3.
2775+ *
2776+ * This program is distributed in the hope that it will be useful,
2777+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2778+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2779+ * GNU Lesser General Public License for more details.
2780+ *
2781+ * You should have received a copy of the GNU Lesser General Public License
2782+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2783+ */
2784+
2785+import QtQuick 2.4
2786+import Ubuntu.Components 1.3
2787+
2788+Item {
2789+ width: units.gu(40)
2790+ height: units.gu(71)
2791+
2792+ Button {
2793+ objectName: "Button"
2794+ StyleHints {
2795+ defaultColor: "blue"
2796+ }
2797+ }
2798+}
2799
2800=== added file 'tests/unit_x11/tst_subtheming/StyleHintsElsewhere.qml'
2801--- tests/unit_x11/tst_subtheming/StyleHintsElsewhere.qml 1970-01-01 00:00:00 +0000
2802+++ tests/unit_x11/tst_subtheming/StyleHintsElsewhere.qml 2015-06-19 04:42:29 +0000
2803@@ -0,0 +1,27 @@
2804+/*
2805+ * Copyright 2015 Canonical Ltd.
2806+ *
2807+ * This program is free software; you can redistribute it and/or modify
2808+ * it under the terms of the GNU Lesser General Public License as published by
2809+ * the Free Software Foundation; version 3.
2810+ *
2811+ * This program is distributed in the hope that it will be useful,
2812+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2813+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2814+ * GNU Lesser General Public License for more details.
2815+ *
2816+ * You should have received a copy of the GNU Lesser General Public License
2817+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2818+ */
2819+
2820+import QtQuick 2.4
2821+import Ubuntu.Components 1.3
2822+
2823+Item {
2824+ width: units.gu(40)
2825+ height: units.gu(71)
2826+
2827+ StyleHints {
2828+ anyProperty: true
2829+ }
2830+}
2831
2832=== added file 'tests/unit_x11/tst_subtheming/StyleHintsInvalidProperty.qml'
2833--- tests/unit_x11/tst_subtheming/StyleHintsInvalidProperty.qml 1970-01-01 00:00:00 +0000
2834+++ tests/unit_x11/tst_subtheming/StyleHintsInvalidProperty.qml 2015-06-19 04:42:29 +0000
2835@@ -0,0 +1,30 @@
2836+/*
2837+ * Copyright 2015 Canonical Ltd.
2838+ *
2839+ * This program is free software; you can redistribute it and/or modify
2840+ * it under the terms of the GNU Lesser General Public License as published by
2841+ * the Free Software Foundation; version 3.
2842+ *
2843+ * This program is distributed in the hope that it will be useful,
2844+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2845+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846+ * GNU Lesser General Public License for more details.
2847+ *
2848+ * You should have received a copy of the GNU Lesser General Public License
2849+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2850+ */
2851+
2852+import QtQuick 2.4
2853+import Ubuntu.Components 1.3
2854+
2855+Item {
2856+ width: units.gu(40)
2857+ height: units.gu(71)
2858+
2859+ Button {
2860+ StyleHints {
2861+ ignoreUnknownProperties: false
2862+ invalidProperty: 10
2863+ }
2864+ }
2865+}
2866
2867=== added file 'tests/unit_x11/tst_subtheming/StyleHintsWithObject.qml'
2868--- tests/unit_x11/tst_subtheming/StyleHintsWithObject.qml 1970-01-01 00:00:00 +0000
2869+++ tests/unit_x11/tst_subtheming/StyleHintsWithObject.qml 2015-06-19 04:42:29 +0000
2870@@ -0,0 +1,29 @@
2871+/*
2872+ * Copyright 2015 Canonical Ltd.
2873+ *
2874+ * This program is free software; you can redistribute it and/or modify
2875+ * it under the terms of the GNU Lesser General Public License as published by
2876+ * the Free Software Foundation; version 3.
2877+ *
2878+ * This program is distributed in the hope that it will be useful,
2879+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2880+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2881+ * GNU Lesser General Public License for more details.
2882+ *
2883+ * You should have received a copy of the GNU Lesser General Public License
2884+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2885+ */
2886+
2887+import QtQuick 2.4
2888+import Ubuntu.Components 1.3
2889+
2890+Item {
2891+ width: units.gu(40)
2892+ height: units.gu(71)
2893+
2894+ Button {
2895+ StyleHints {
2896+ anyProperty: QtObject{}
2897+ }
2898+ }
2899+}
2900
2901=== added file 'tests/unit_x11/tst_subtheming/StyleHintsWithSignal.qml'
2902--- tests/unit_x11/tst_subtheming/StyleHintsWithSignal.qml 1970-01-01 00:00:00 +0000
2903+++ tests/unit_x11/tst_subtheming/StyleHintsWithSignal.qml 2015-06-19 04:42:29 +0000
2904@@ -0,0 +1,29 @@
2905+/*
2906+ * Copyright 2015 Canonical Ltd.
2907+ *
2908+ * This program is free software; you can redistribute it and/or modify
2909+ * it under the terms of the GNU Lesser General Public License as published by
2910+ * the Free Software Foundation; version 3.
2911+ *
2912+ * This program is distributed in the hope that it will be useful,
2913+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2914+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2915+ * GNU Lesser General Public License for more details.
2916+ *
2917+ * You should have received a copy of the GNU Lesser General Public License
2918+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2919+ */
2920+
2921+import QtQuick 2.4
2922+import Ubuntu.Components 1.3
2923+
2924+Item {
2925+ width: units.gu(40)
2926+ height: units.gu(71)
2927+
2928+ Button {
2929+ StyleHints {
2930+ onDefaultColorChanged: {}
2931+ }
2932+ }
2933+}
2934
2935=== added file 'tests/unit_x11/tst_subtheming/StyleKept.qml'
2936--- tests/unit_x11/tst_subtheming/StyleKept.qml 1970-01-01 00:00:00 +0000
2937+++ tests/unit_x11/tst_subtheming/StyleKept.qml 2015-06-19 04:42:29 +0000
2938@@ -0,0 +1,43 @@
2939+/*
2940+ * Copyright 2015 Canonical Ltd.
2941+ *
2942+ * This program is free software; you can redistribute it and/or modify
2943+ * it under the terms of the GNU Lesser General Public License as published by
2944+ * the Free Software Foundation; version 3.
2945+ *
2946+ * This program is distributed in the hope that it will be useful,
2947+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2948+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2949+ * GNU Lesser General Public License for more details.
2950+ *
2951+ * You should have received a copy of the GNU Lesser General Public License
2952+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2953+ */
2954+import QtQuick 2.4
2955+import Ubuntu.Components 1.3
2956+
2957+Item {
2958+ width: units.gu(40)
2959+ height: units.gu(40)
2960+
2961+ Button {
2962+ objectName: "TestButton"
2963+ text: "PressMe..."
2964+ style: Rectangle {
2965+ objectName: "TestStyle"
2966+ // FIXME: move these properties to the Style API
2967+ property color defaultColor: "blue"
2968+ property Gradient defaultGradient
2969+ property font defaultFont
2970+
2971+ anchors.fill: styledItem
2972+ color: defaultColor
2973+ Label {
2974+ anchors.fill: parent
2975+ horizontalAlignment: Text.AlignHCenter
2976+ verticalAlignment: Text.AlignVCenter
2977+ text: styledItem.text
2978+ }
2979+ }
2980+ }
2981+}
2982
2983=== added file 'tests/unit_x11/tst_subtheming/StyleOverride.qml'
2984--- tests/unit_x11/tst_subtheming/StyleOverride.qml 1970-01-01 00:00:00 +0000
2985+++ tests/unit_x11/tst_subtheming/StyleOverride.qml 2015-06-19 04:42:29 +0000
2986@@ -0,0 +1,46 @@
2987+/*
2988+ * Copyright 2015 Canonical Ltd.
2989+ *
2990+ * This program is free software; you can redistribute it and/or modify
2991+ * it under the terms of the GNU Lesser General Public License as published by
2992+ * the Free Software Foundation; version 3.
2993+ *
2994+ * This program is distributed in the hope that it will be useful,
2995+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2996+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2997+ * GNU Lesser General Public License for more details.
2998+ *
2999+ * You should have received a copy of the GNU Lesser General Public License
3000+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3001+ */
3002+import QtQuick 2.4
3003+import Ubuntu.Components 1.3
3004+
3005+Item {
3006+ width: units.gu(40)
3007+ height: units.gu(40)
3008+
3009+ Button {
3010+ objectName: "TestButton"
3011+ text: "PressMe..."
3012+ }
3013+
3014+ property Component customStyle: Component {
3015+ Rectangle {
3016+ objectName: "TestStyle"
3017+ // FIXME: move these properties to the Style API
3018+ property color defaultColor: "blue"
3019+ property Gradient defaultGradient
3020+ property font defaultFont
3021+
3022+ anchors.fill: styledItem
3023+ color: defaultColor
3024+ Label {
3025+ anchors.fill: parent
3026+ horizontalAlignment: Text.AlignHCenter
3027+ verticalAlignment: Text.AlignVCenter
3028+ text: styledItem.text
3029+ }
3030+ }
3031+ }
3032+}
3033
3034=== modified file 'tests/unit_x11/tst_subtheming/StyledItemAppThemeFallback.qml'
3035--- tests/unit_x11/tst_subtheming/StyledItemAppThemeFallback.qml 2015-04-27 16:25:09 +0000
3036+++ tests/unit_x11/tst_subtheming/StyledItemAppThemeFallback.qml 2015-06-19 04:42:29 +0000
3037@@ -20,5 +20,5 @@
3038 id: item
3039 theme.name: "themes.CustomTheme"
3040 theme.version: Ubuntu.version(1, 0)
3041- style: theme.createStyleComponent("TestStyle.qml", item)
3042+ styleName: "TestStyle"
3043 }
3044
3045=== modified file 'tests/unit_x11/tst_subtheming/StyledItemAppThemeVersioned.qml'
3046--- tests/unit_x11/tst_subtheming/StyledItemAppThemeVersioned.qml 2015-05-02 09:20:35 +0000
3047+++ tests/unit_x11/tst_subtheming/StyledItemAppThemeVersioned.qml 2015-06-19 04:42:29 +0000
3048@@ -20,5 +20,5 @@
3049 id: item
3050 theme.name: "themes.CustomTheme"
3051 theme.version: Ubuntu.toolkitVersion
3052- style: theme.createStyleComponent("TestStyle.qml", item)
3053+ styleName: "TestStyle"
3054 }
3055
3056=== modified file 'tests/unit_x11/tst_subtheming/StyledItemFallback.qml'
3057--- tests/unit_x11/tst_subtheming/StyledItemFallback.qml 2015-04-27 14:46:31 +0000
3058+++ tests/unit_x11/tst_subtheming/StyledItemFallback.qml 2015-06-19 04:42:29 +0000
3059@@ -20,5 +20,5 @@
3060 id: item
3061 theme.name: "TestModule.TestTheme"
3062 theme.version: Ubuntu.version(1, 0)
3063- style: theme.createStyleComponent("TestStyle.qml", item)
3064+ styleName: "TestStyle"
3065 }
3066
3067=== modified file 'tests/unit_x11/tst_subtheming/StyledItemV12.qml'
3068--- tests/unit_x11/tst_subtheming/StyledItemV12.qml 2015-04-27 12:46:28 +0000
3069+++ tests/unit_x11/tst_subtheming/StyledItemV12.qml 2015-06-19 04:42:29 +0000
3070@@ -20,5 +20,5 @@
3071 id: item
3072 theme.name: "themes.CustomTheme"
3073 theme.version: Ubuntu.version(1, 2)
3074- style: theme.createStyleComponent("TestStyle.qml", item)
3075+ styleName: "TestStyle"
3076 }
3077
3078=== modified file 'tests/unit_x11/tst_subtheming/StyledItemV13.qml'
3079--- tests/unit_x11/tst_subtheming/StyledItemV13.qml 2015-04-27 12:46:28 +0000
3080+++ tests/unit_x11/tst_subtheming/StyledItemV13.qml 2015-06-19 04:42:29 +0000
3081@@ -20,5 +20,5 @@
3082 id: item
3083 theme.name: "themes.CustomTheme"
3084 theme.version: Ubuntu.toolkitVersion
3085- style: theme.createStyleComponent("TestStyle.qml", item)
3086+ styleName: "TestStyle"
3087 }
3088
3089=== modified file 'tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.2/TestStyle.qml'
3090--- tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.2/TestStyle.qml 2015-04-27 12:46:28 +0000
3091+++ tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.2/TestStyle.qml 2015-06-19 04:42:29 +0000
3092@@ -17,4 +17,5 @@
3093 import QtQuick 2.0
3094
3095 Item {
3096+ objectName: "TestStyle"
3097 }
3098
3099=== modified file 'tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.3/TestStyle.qml'
3100--- tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.3/TestStyle.qml 2015-04-25 06:35:16 +0000
3101+++ tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.3/TestStyle.qml 2015-06-19 04:42:29 +0000
3102@@ -17,5 +17,6 @@
3103 import QtQuick 2.0
3104
3105 Item {
3106+ objectName: "TestStyle"
3107 property string newProperty: "version1.3"
3108 }
3109
3110=== modified file 'tests/unit_x11/tst_subtheming/tst_subtheming.cpp'
3111--- tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-05-02 09:20:35 +0000
3112+++ tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-06-19 04:42:29 +0000
3113@@ -21,16 +21,18 @@
3114 #include <QtQml/QQmlContext>
3115 #include <QtQml/QQmlComponent>
3116 #include "uctheme.h"
3117+#include "quickutils.h"
3118 #include "uctestcase.h"
3119 #include "ucstyleditembase_p.h"
3120 #include "ucnamespace.h"
3121+#include "ucunits.h"
3122
3123 class ThemeTestCase : public UbuntuTestCase
3124 {
3125 Q_OBJECT
3126 public:
3127- ThemeTestCase(const QString& file, QWindow* parent = 0)
3128- : UbuntuTestCase(file, parent)
3129+ ThemeTestCase(const QString& file, bool assertOnFailure = true, QWindow* parent = 0)
3130+ : UbuntuTestCase(file, assertOnFailure, parent)
3131 {
3132 }
3133
3134@@ -62,12 +64,6 @@
3135 QTest::waitForEvents();
3136 }
3137
3138- void setStyle(const QString &style)
3139- {
3140- rootObject()->setProperty("styleDocument", style);
3141- QTest::waitForEvents();
3142- }
3143-
3144 UCTheme *theme()
3145 {
3146 return rootObject()->property("theme").value<UCTheme*>();
3147@@ -134,25 +130,27 @@
3148 QTest::addColumn<QString>("styleName");
3149 QTest::addColumn<QString>("parentName");
3150 QTest::addColumn<bool>("success");
3151- QTest::newRow("Existing style") << "TestStyle.qml" << "SimpleItem.qml" << true;
3152- QTest::newRow("Non existing style") << "NotExistingTestStyle.qml" << "SimpleItem.qml" << false;
3153+ QTest::addColumn<QString>("warning");
3154+ QTest::newRow("Existing style") << "TestStyle" << "SimpleItem.qml" << true << QString();
3155+ QTest::newRow("Non existing style") << "NotExistingTestStyle" << "SimpleItem.qml" << false << "QML SimpleItem: Warning: Style NotExistingTestStyle.qml not found in theme TestModule.TestTheme";
3156 }
3157 void test_create_style_component()
3158 {
3159 QFETCH(QString, styleName);
3160 QFETCH(QString, parentName);
3161 QFETCH(bool, success);
3162+ QFETCH(QString, warning);
3163
3164- if (styleName == "NotExistingTestStyle.qml") {
3165- ThemeTestCase::ignoreWarning(parentName, 20, 1, "QML SimpleItem: Warning: Style NotExistingTestStyle.qml not found in theme TestModule.TestTheme");
3166+ if (!warning.isEmpty()) {
3167+ ThemeTestCase::ignoreWarning(parentName, 20, 1, warning);
3168 }
3169 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "./themes");
3170
3171 QScopedPointer<ThemeTestCase> view(new ThemeTestCase(parentName));
3172 view->setTheme("TestModule.TestTheme");
3173- view->setStyle(styleName);
3174- QQmlComponent *style = view->rootObject()->property("style").value<QQmlComponent*>();
3175- QCOMPARE(style != NULL, success);
3176+ view->rootObject()->setProperty("styleName", styleName);
3177+ QQuickItem *testStyle = view->rootObject()->findChild<QQuickItem*>("TestStyle");
3178+ QCOMPARE(testStyle != NULL, success);
3179 }
3180
3181 void test_relative_theme_paths_environment_variables_data()
3182@@ -166,23 +164,23 @@
3183
3184 QTest::newRow("One toolkit theme path")
3185 << "./themes" << ""
3186- << "TestModule.TestTheme" << "TestStyle.qml"
3187+ << "TestModule.TestTheme" << "TestStyle"
3188 << "" << true;
3189 QTest::newRow("Two toolkit theme paths")
3190 << "./themes:./themes/TestModule" << ""
3191- << "CustomTheme" << "TestStyle.qml"
3192+ << "CustomTheme" << "TestStyle"
3193 << "" << true;
3194 QTest::newRow("One XDG path")
3195 << "" << "./themes"
3196- << "TestModule.TestTheme" << "TestStyle.qml"
3197+ << "TestModule.TestTheme" << "TestStyle"
3198 << "" << true;
3199 QTest::newRow("Two XDG paths")
3200 << "" << "./themes:./themes/TestModule"
3201- << "CustomTheme" << "TestStyle.qml"
3202+ << "CustomTheme" << "TestStyle"
3203 << "" << true;
3204 QTest::newRow("No variables")
3205 << "" << ""
3206- << QString() << "TestStyle.qml"
3207+ << QString() << "TestStyle"
3208 << "QML SimpleItem: Warning: Style TestStyle.qml not found in theme Ubuntu.Components.Themes.Ambiance" << false;
3209 }
3210
3211@@ -206,9 +204,9 @@
3212 if (!theme.isEmpty()) {
3213 view->setTheme(theme);
3214 }
3215- view->setStyle(style);
3216- QQmlComponent *styleComponent = view->rootObject()->property("style").value<QQmlComponent*>();
3217- QCOMPARE(styleComponent != NULL, success);
3218+ view->rootObject()->setProperty("styleName", style);
3219+ QQuickItem *styleItem = view->rootObject()->findChild<QQuickItem*>("TestStyle");
3220+ QCOMPARE(styleItem != NULL, success);
3221 }
3222
3223 void test_import_path()
3224@@ -662,7 +660,7 @@
3225 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");
3226 qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule");
3227 if (!warning.isEmpty()) {
3228- ThemeTestCase::ignoreWarning(document, row, column, warning, 2);
3229+ ThemeTestCase::ignoreWarning(document, row, column, warning);
3230 }
3231 QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document));
3232 UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(view->rootObject());
3233@@ -683,6 +681,162 @@
3234 // which will cause a warning; therefore we mark the warning to be ignored
3235 ThemeTestCase::ignoreWarning("DeprecatedTheme.qml", 19, 1, "QML StyledItem: Theme 'Ubuntu.Components.Themes.Ambiance' has no 'OptionSelectorStyle.qml' style for version 1.0, fall back to version 1.3.");
3236 }
3237+
3238+ void test_style_change_has_precedence()
3239+ {
3240+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("StyleOverride.qml"));
3241+ QQmlComponent *style = view->rootObject()->property("customStyle").value<QQmlComponent*>();
3242+ QQuickItem *button = view->findItem<QQuickItem*>("TestButton");
3243+
3244+ button->setProperty("style", QVariant::fromValue(style));
3245+ QVERIFY(button->findChild<QQuickItem*>("TestStyle"));
3246+ }
3247+
3248+ void test_style_kept_when_stylename_changes_data()
3249+ {
3250+ QTest::addColumn<QString>("styleName");
3251+
3252+ QTest::newRow("Empty style name") << QString();
3253+ QTest::newRow("Any style name") << "Bumblebee";
3254+ }
3255+ void test_style_kept_when_stylename_changes()
3256+ {
3257+ QFETCH(QString, styleName);
3258+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("StyleKept.qml"));
3259+ QQuickItem *button = view->findItem<QQuickItem*>("TestButton");
3260+
3261+ button->setProperty("styleName", styleName);
3262+ QVERIFY(button->findChild<QQuickItem*>("TestStyle"));
3263+ }
3264+
3265+ void test_style_kept_when_theme_changes()
3266+ {
3267+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("StyleKept.qml"));
3268+ QQuickItem *button = view->findItem<QQuickItem*>("TestButton");
3269+ UCTheme *theme = button->property("theme").value<UCTheme*>();
3270+ QVERIFY(theme);
3271+
3272+ theme->setName("Ubuntu.Components.Themes.SuruDark");
3273+ QVERIFY(button->findChild<QQuickItem*>("TestStyle"));
3274+ }
3275+
3276+ void test_style_reset_to_theme_style()
3277+ {
3278+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("StyleKept.qml"));
3279+ UCStyledItemBase *button = view->findItem<UCStyledItemBase*>("TestButton");
3280+ UCTheme *theme = UCStyledItemBasePrivate::get(button)->getTheme();
3281+ QVERIFY(theme);
3282+
3283+ QVERIFY(button->findChild<QQuickItem*>("TestStyle"));
3284+ // reset style property, which should reset style to the theme style
3285+ UCStyledItemBasePrivate::get(button)->resetStyle();
3286+ QQuickItem *styleItem = UCStyledItemBasePrivate::get(button)->styleInstance();
3287+ QCOMPARE(QuickUtils::className(styleItem), QString("ButtonStyle"));
3288+ }
3289+
3290+ void test_stylename_extension_failure()
3291+ {
3292+ ThemeTestCase::ignoreWarning("DeprecatedTheme.qml", 19, 1, "QML StyledItem: Warning: Style OptionSelectorStyle.qml.qml not found in theme Ubuntu.Components.Themes.SuruGradient");
3293+ // add also for Ambiance, as ThemeTestCase destructor resets the theme, which will cause style warning for the default theme
3294+ ThemeTestCase::ignoreWarning("DeprecatedTheme.qml", 19, 1, "QML StyledItem: Warning: Style OptionSelectorStyle.qml.qml not found in theme Ubuntu.Components.Themes.Ambiance");
3295+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("DeprecatedTheme.qml"));
3296+ view->rootObject()->setProperty("styleName", "OptionSelectorStyle.qml");
3297+ }
3298+
3299+ void test_stylehints_errors_data()
3300+ {
3301+ QTest::addColumn<QString>("document");
3302+ QTest::addColumn<int>("row");
3303+ QTest::addColumn<int>("col");
3304+ QTest::addColumn<QString>("xfail");
3305+
3306+ QTest::newRow("No signals")
3307+ << "StyleHintsWithSignal.qml" << 26 << 13 << "Signal properties are not supported. \n" \
3308+" onDefaultColorChanged: {} \n" \
3309+" ^";
3310+ QTest::newRow("No embedded objects")
3311+ << "StyleHintsWithObject.qml" << 26 << 26 << "StyleHints does not support creating state-specific objects. \n" \
3312+" anyProperty: QtObject{} \n" \
3313+" ^";
3314+ QTest::newRow("StyleHints declared elsewhere")
3315+ << "StyleHintsElsewhere.qml" << 24 << 5 << "QML StyleHints: StyleHints must be declared in a StyledItem or a derivate of it.";
3316+ QTest::newRow("Invalid property")
3317+ << "StyleHintsInvalidProperty.qml" << 25 << 9 << "QML StyleHints: Style 'ButtonStyle' has no property called 'invalidProperty'.";
3318+ }
3319+ void test_stylehints_errors()
3320+ {
3321+ QFETCH(QString, document);
3322+ QFETCH(int, row);
3323+ QFETCH(int, col);
3324+ QFETCH(QString, xfail);
3325+
3326+ if (!xfail.isEmpty()) {
3327+ ThemeTestCase::ignoreWarning(document, row, col, xfail);
3328+ }
3329+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document, false));
3330+ }
3331+
3332+ void test_stylehints_simple_property()
3333+ {
3334+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("SimplePropertyHints.qml"));
3335+ QQuickItem *button = view->findItem<QQuickItem*>("Button");
3336+ QColor color = button->property("color").value<QColor>();
3337+ QCOMPARE(color, QColor("blue"));
3338+ }
3339+
3340+ void test_stylehints_bindings()
3341+ {
3342+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("PropertyBindingHints.qml"));
3343+ QQuickItem *button = view->findItem<QQuickItem*>("Button");
3344+ QColor color = button->property("color").value<QColor>();
3345+ QCOMPARE(color, QColor("blue"));
3346+ // press the button
3347+ QPointF pressPt(button->width()/2, button->height()/2);
3348+ pressPt = view->rootObject()->mapFromItem(button, pressPt);
3349+ QTest::mousePress(view.data(), Qt::LeftButton, 0, pressPt.toPoint());
3350+ color = button->property("color").value<QColor>();
3351+ QCOMPARE(color, QColor("tan"));
3352+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, pressPt.toPoint());
3353+ }
3354+
3355+ void test_stylehints_multiple_data()
3356+ {
3357+ QTest::addColumn<QString>("document");
3358+ QTest::addColumn<QString>("colorProperty");
3359+ QTest::addColumn<QColor>("colorReleased");
3360+ QTest::addColumn<QColor>("colorPressed");
3361+ QTest::addColumn<QString>("widthProperty");
3362+ QTest::addColumn<float>("width");
3363+
3364+ QTest::newRow("Same document")
3365+ << "MoreStyleHints.qml" << "defaultColor" << QColor("brown") << QColor("brown") << "minimumWidth" << UCUnits::instance().gu(20);
3366+ QTest::newRow("Different document")
3367+ << "GroupPropertyBindingHints.qml" << "gradientProxy.topColor" << QColor("blue") << QColor("tan") << "minimumWidth" << UCUnits::instance().gu(20);
3368+ }
3369+ void test_stylehints_multiple()
3370+ {
3371+ QFETCH(QString, document);
3372+ QFETCH(QString, colorProperty);
3373+ QFETCH(QColor, colorReleased);
3374+ QFETCH(QColor, colorPressed);
3375+ QFETCH(QString, widthProperty);
3376+ QFETCH(float, width);
3377+
3378+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document));
3379+ UCStyledItemBase *button = view->findItem<UCStyledItemBase*>("Button");
3380+ QQuickItem *styleItem = UCStyledItemBasePrivate::get(button)->styleItem;
3381+ QVERIFY(styleItem);
3382+ QQmlProperty qmlProperty(styleItem, colorProperty, qmlContext(styleItem));
3383+ QCOMPARE(qmlProperty.read().value<QColor>(), colorReleased);
3384+ QCOMPARE(styleItem->property(widthProperty.toUtf8()).toReal(), width);
3385+
3386+ QPointF pressPt(button->width()/2, button->height()/2);
3387+ pressPt = view->rootObject()->mapFromItem(button, pressPt);
3388+ QTest::mousePress(view.data(), Qt::LeftButton, 0, pressPt.toPoint());
3389+ QColor pressedColor = qmlProperty.read().value<QColor>();
3390+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, pressPt.toPoint());
3391+ QCOMPARE(pressedColor, colorPressed);
3392+ }
3393 };
3394
3395 QTEST_MAIN(tst_Subtheming)
3396
3397=== modified file 'tests/unit_x11/tst_subtheming/tst_subtheming.pro'
3398--- tests/unit_x11/tst_subtheming/tst_subtheming.pro 2015-05-02 09:20:35 +0000
3399+++ tests/unit_x11/tst_subtheming/tst_subtheming.pro 2015-06-19 04:42:29 +0000
3400@@ -31,6 +31,18 @@
3401 StyledItemFallback.qml \
3402 StyledItemAppThemeFallback.qml \
3403 DeprecatedTheme.qml \
3404- StyledItemAppThemeVersioned.qml
3405+ StyledItemAppThemeVersioned.qml \
3406+ StyleOverride.qml \
3407+ StyleKept.qml \
3408+ SimplePropertyHints.qml \
3409+ StyleHintsWithSignal.qml \
3410+ StyleHintsWithObject.qml \
3411+ StyleHintsElsewhere.qml \
3412+ StyleHintsInvalidProperty.qml \
3413+ PropertyBindingHints.qml \
3414+ MoreStyleHints.qml \
3415+ GroupPropertyBindingHints.qml \
3416+ OverrideStyleHints.qml \
3417+ HintedButton.qml
3418
3419

Subscribers

People subscribed via source and target branches

to status/vote changes: