Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-dont-use-deprecated-shape-properties into lp:ubuntu-ui-toolkit/staging

Proposed by Loïc Molinari
Status: Superseded
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-dont-use-deprecated-shape-properties
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-resolution-independance
Diff against target: 415 lines (+61/-40)
16 files modified
examples/ubuntu-ui-toolkit-gallery/Colors.qml (+7/-7)
examples/ubuntu-ui-toolkit-gallery/ListItems.qml (+2/-2)
modules/Ubuntu/Components/ListItems/1.3/IconVisual.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml (+3/-3)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ButtonStyle.qml (+10/-8)
modules/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml (+1/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/DatePickerStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/DialogForegroundStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml (+5/-5)
modules/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml (+1/-1)
modules/Ubuntu/Components/plugin/ucubuntushape.cpp (+20/-0)
tests/unit_x11/tst_layouts/Visibility.qml (+3/-3)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-dont-use-deprecated-shape-properties
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Tim Peeters Approve
Zsombor Egri Approve
Review via email: mp+254427@code.launchpad.net

This proposal has been superseded by a proposal from 2015-07-22.

Commit message

Ensured components, styles, examples and tests use the new UbuntuShape properties (not deprecated).

Description of the change

Ensured components, styles, examples and tests use the new UbuntuShape properties (not deprecated).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Second nobrainer :)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

1.2.1458+15.04.20150327bzr1354pkg0vivid200/modules/Ubuntu/Components/Themes/Ambiance/ButtonStyle.qml:136:5: QML UbuntuShape: 'borderSource' is deprecated. Use 'aspect' instead.
Layout change should not happen when component is not defined
Layout change should not happen when component is not defined
file:///tmp/buildd/ubuntu-ui-toolkit-1.2.1458+15.04.20150327bzr1354pkg0vivid200/tests/unit_x11/tst_layouts/Visibility.qml:64:29: "UbuntuShape.backgroundColor" is not available in Ubuntu.Components 1.1.
                                 backgroundColor: "red"
                                 ^

The error must be fixed by updating the import version in Visibility.qml

It would be nice to fix the warnings as well.

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

Thanks, happroving.

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

Conflicts!

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/ubuntu-ui-toolkit-gallery/Colors.qml'
2--- examples/ubuntu-ui-toolkit-gallery/Colors.qml 2015-04-25 08:18:45 +0000
3+++ examples/ubuntu-ui-toolkit-gallery/Colors.qml 2015-07-22 13:15:37 +0000
4@@ -29,43 +29,43 @@
5 TemplateRow {
6 title: i18n.tr("Orange")
7 UbuntuShape {
8- color: UbuntuColors.orange
9+ backgroundColor: UbuntuColors.orange
10 }
11 }
12 TemplateRow {
13 title: i18n.tr("Light grey")
14 UbuntuShape {
15- color: UbuntuColors.lightGrey
16+ backgroundColor: UbuntuColors.lightGrey
17 }
18 }
19 TemplateRow {
20 title: i18n.tr("Dark grey")
21 UbuntuShape {
22- color: UbuntuColors.darkGrey
23+ backgroundColor: UbuntuColors.darkGrey
24 }
25 }
26 TemplateRow {
27 title: i18n.tr("Red")
28 UbuntuShape {
29- color: UbuntuColors.red
30+ backgroundColor: UbuntuColors.red
31 }
32 }
33 TemplateRow {
34 title: i18n.tr("Green")
35 UbuntuShape {
36- color: UbuntuColors.green
37+ backgroundColor: UbuntuColors.green
38 }
39 }
40 TemplateRow {
41 title: i18n.tr("Blue")
42 UbuntuShape {
43- color: UbuntuColors.blue
44+ backgroundColor: UbuntuColors.blue
45 }
46 }
47 TemplateRow {
48 title: i18n.tr("Purple")
49 UbuntuShape {
50- color: UbuntuColors.purple
51+ backgroundColor: UbuntuColors.purple
52 }
53 }
54 }
55
56=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItems.qml'
57--- examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2015-04-29 07:21:29 +0000
58+++ examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2015-07-22 13:15:37 +0000
59@@ -352,7 +352,7 @@
60 Toolkit.UbuntuShape {
61 anchors { left: parent.left; right: parent.right }
62 height: index % 2 == 0 ? units.gu(6) : units.gu(18)
63- color: "khaki"
64+ backgroundColor: "khaki"
65 }
66 }
67 }
68@@ -393,7 +393,7 @@
69 Toolkit.UbuntuShape {
70 anchors { left: parent.left; right: parent.right }
71 height: index % 2 == 0 ? units.gu(6) : units.gu(18)
72- color: "khaki"
73+ backgroundColor: "khaki"
74 }
75 }
76 }
77
78=== modified file 'modules/Ubuntu/Components/ListItems/1.3/IconVisual.qml'
79--- modules/Ubuntu/Components/ListItems/1.3/IconVisual.qml 2015-04-29 07:21:29 +0000
80+++ modules/Ubuntu/Components/ListItems/1.3/IconVisual.qml 2015-07-22 13:15:37 +0000
81@@ -53,6 +53,6 @@
82 id: shape
83 visible: iconVisual.hasFrame
84 anchors.fill: parent
85- image: icon
86+ source: icon
87 }
88 }
89
90=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml'
91--- modules/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml 2015-04-24 14:07:02 +0000
92+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml 2015-07-22 13:15:37 +0000
93@@ -110,9 +110,9 @@
94
95 UbuntuShape {
96 anchors.fill: parent
97- borderSource: "none"
98- color: theme.palette.normal.overlay
99- image: bubbleShape.clipContent ? shapeSource : null
100+ aspect: UbuntuShape.Flat
101+ backgroundColor: theme.palette.normal.overlay
102+ source: bubbleShape.clipContent ? shapeSource : null
103 visible: !square
104 }
105
106
107=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/ButtonStyle.qml'
108--- modules/Ubuntu/Components/Themes/Ambiance/1.3/ButtonStyle.qml 2015-04-25 07:36:13 +0000
109+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/ButtonStyle.qml 2015-07-22 13:15:37 +0000
110@@ -123,21 +123,23 @@
111 UbuntuShape {
112 id: background
113 anchors.fill: parent
114- borderSource: "radius_idle.sci"
115- visible: stroke ? false : ((color.a != 0.0) || backgroundSource)
116- image: backgroundSource
117+ borderSource: "radius_idle.sci" // Deprecated, use a dedicated shape.
118+ visible: stroke ? false : ((backgroundColor.a != 0.0) || backgroundSource)
119+ source: backgroundSource
120
121- color: stroke ? "" : (backgroundSource ? "#00000000" : (isGradient ? __colorHack(gradientProxy.topColor) : __colorHack(button.color)))
122+ backgroundColor: backgroundSource ? "#00000000" : (isGradient ? __colorHack(gradientProxy.topColor) : __colorHack(button.color))
123+ secondaryBackgroundColor: backgroundSource ? "#00000000" : (isGradient ? __colorHack(gradientProxy.bottomColor) : __colorHack(button.color))
124+ backgroundMode: isGradient ? UbuntuShape.VerticalGradient : UbuntuShape.SolidColor
125 opacity: styledItem.enabled ? 1.0 : 0.6
126- gradientColor: stroke ? "" : (backgroundSource ? "#00000000" : (isGradient ? __colorHack(gradientProxy.bottomColor) : __colorHack(button.color)))
127 }
128
129 UbuntuShape {
130 id: backgroundPressed
131 anchors.fill: parent
132- color: stroke ? button.strokeColor : background.color
133- gradientColor: stroke ? button.strokeColor : background.gradientColor
134- borderSource: "radius_pressed.sci"
135+ backgroundColor: stroke ? button.strokeColor : background.backgroundColor
136+ secondaryBackgroundColor: background.secondaryBackgroundColor
137+ backgroundMode: stroke ? UbuntuShape.SolidColor : UbuntuShape.VerticalGradient
138+ borderSource: "radius_pressed.sci" // Deprecated, use a dedicated shape.
139 opacity: button.pressed ? 1.0 : 0.0
140 Behavior on opacity {
141 NumberAnimation {
142
143=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml'
144--- modules/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml 2015-04-24 14:07:02 +0000
145+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml 2015-07-22 13:15:37 +0000
146@@ -86,7 +86,7 @@
147 }
148 PropertyChanges {
149 target: background
150- color: checkBoxStyle.checkedBackgroundColor
151+ backgroundColor: checkBoxStyle.checkedBackgroundColor
152 }
153 },
154 State {
155@@ -97,7 +97,7 @@
156 }
157 PropertyChanges {
158 target: background
159- color: checkBoxStyle.uncheckedBackgroundColor
160+ backgroundColor: checkBoxStyle.uncheckedBackgroundColor
161 }
162 }
163 ]
164
165=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml'
166--- modules/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml 2015-04-25 07:36:13 +0000
167+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml 2015-07-22 13:15:37 +0000
168@@ -165,8 +165,7 @@
169 topMargin: comboListMargin
170 }
171 visible: true
172- borderSource: "radius_idle.sci"
173- image: listContent
174+ source: listContent
175 }
176
177 Image {
178
179=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/DatePickerStyle.qml'
180--- modules/Ubuntu/Components/Themes/Ambiance/1.3/DatePickerStyle.qml 2015-04-29 07:21:29 +0000
181+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/DatePickerStyle.qml 2015-07-22 13:15:37 +0000
182@@ -61,7 +61,7 @@
183 UbuntuShape {
184 anchors.fill: parent
185 radius: "medium"
186- image: shapeSource
187+ source: shapeSource
188 }
189
190 ShaderEffectSource {
191
192=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/DialogForegroundStyle.qml'
193--- modules/Ubuntu/Components/Themes/Ambiance/1.3/DialogForegroundStyle.qml 2015-04-25 07:36:13 +0000
194+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/DialogForegroundStyle.qml 2015-07-22 13:15:37 +0000
195@@ -23,6 +23,6 @@
196 UbuntuShape {
197 id: background
198 anchors.fill: parent
199- color: "white"
200+ backgroundColor: "white"
201 }
202 }
203
204=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml'
205--- modules/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml 2015-04-25 07:36:13 +0000
206+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml 2015-07-22 13:15:37 +0000
207@@ -32,6 +32,6 @@
208 height: styledItem.height
209 radius: "medium"
210
211- color: Qt.rgba(0, 0, 0, 0.05)
212+ backgroundColor: Qt.rgba(0, 0, 0, 0.05)
213 }
214 }
215
216=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml'
217--- modules/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml 2015-04-29 07:21:29 +0000
218+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml 2015-07-22 13:15:37 +0000
219@@ -59,8 +59,8 @@
220 UbuntuShape {
221 anchors.fill: parent
222 radius: "medium"
223- color: theme.palette.normal.overlay
224- image: shapeSource
225+ backgroundColor: theme.palette.normal.overlay
226+ source: shapeSource
227 }
228
229 ShaderEffectSource {
230
231=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml'
232--- modules/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml 2015-04-24 14:07:02 +0000
233+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml 2015-07-22 13:15:37 +0000
234@@ -81,7 +81,7 @@
235 width: units.gu(2)
236 height: units.gu(2)
237 opacity: 0.97
238- color: theme.palette.normal.overlay
239+ backgroundColor: theme.palette.normal.overlay
240 }
241
242 BubbleShape {
243
244=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml'
245--- modules/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml 2015-04-24 14:07:02 +0000
246+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml 2015-07-22 13:15:37 +0000
247@@ -74,7 +74,7 @@
248 UbuntuShape {
249 id: background
250 anchors.fill: parent
251- color: switchStyle.backgroundColor
252+ backgroundColor: switchStyle.backgroundColor
253 clip: true
254
255 UbuntuShape {
256@@ -86,7 +86,7 @@
257 PropertyChanges {
258 target: thumb
259 x: rightThumbPosition.x
260- color: switchStyle.checkedThumbColor
261+ backgroundColor: switchStyle.checkedThumbColor
262 }
263 },
264 State {
265@@ -95,7 +95,7 @@
266 PropertyChanges {
267 target: thumb
268 x: leftThumbPosition.x
269- color: switchStyle.uncheckedThumbColor
270+ backgroundColor: switchStyle.uncheckedThumbColor
271 }
272 }
273 ]
274@@ -114,7 +114,7 @@
275 }
276 ColorAnimation {
277 target: thumb
278- properties: "color"
279+ properties: "backgroundColor"
280 duration: UbuntuAnimation.FastDuration
281 easing: UbuntuAnimation.StandardEasing
282 }
283@@ -130,7 +130,7 @@
284 }
285 ColorAnimation {
286 target: thumb
287- properties: "color"
288+ properties: "backgroundColor"
289 duration: UbuntuAnimation.FastDuration
290 easing: UbuntuAnimation.StandardEasing
291 }
292
293=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml'
294--- modules/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml 2015-04-24 14:07:02 +0000
295+++ modules/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml 2015-07-22 13:15:37 +0000
296@@ -53,7 +53,7 @@
297 property Component background: UbuntuShape {
298 property bool error: (styledItem.hasOwnProperty("errorHighlight") && styledItem.errorHighlight && !styledItem.acceptableInput)
299 onErrorChanged: (error) ? visuals.errorColor : visuals.backgroundColor;
300- color: visuals.backgroundColor;
301+ backgroundColor: visuals.backgroundColor
302 anchors.fill: parent
303 visible: !styledItem.readOnly
304 }
305
306=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushape.cpp'
307--- modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-06-02 13:37:30 +0000
308+++ modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-22 13:15:37 +0000
309@@ -35,6 +35,7 @@
310 #include <QtQuick/QSGTextureProvider>
311 #include <QtQuick/private/qquickimage_p.h>
312 #include <QtQuick/private/qsgadaptationlayer_p.h>
313+#include <QtQml/qqmlinfo.h>
314 #include <math.h>
315
316 // Anti-aliasing distance of the contour in pixels.
317@@ -751,6 +752,11 @@
318 */
319 void UCUbuntuShape::setBorderSource(const QString& borderSource)
320 {
321+ // FIXME(loicm) Commented for now since even if it's deprecated, buttons have to use it in order
322+ // to get a pressed aspect. This is a temporary solution before using a dedicated button
323+ // shape.
324+ // qmlInfo(this) << "'borderSource' is deprecated. Use 'aspect' instead.";
325+
326 if (!(m_flags & AspectSet)) {
327 quint8 aspect;
328 if (borderSource.endsWith(QString("radius_idle.sci"))) {
329@@ -779,6 +785,9 @@
330 */
331 void UCUbuntuShape::setColor(const QColor& color)
332 {
333+ qmlInfo(this) << "'color' is deprecated. Use 'backgroundColor', 'secondaryBackgroundColor' and "
334+ "'backgroundMode' instead.";
335+
336 if (!(m_flags & BackgroundApiSet)) {
337 const QRgb colorRgb = qRgba(color.red(), color.green(), color.blue(), color.alpha());
338 if (m_backgroundColor != colorRgb) {
339@@ -805,6 +814,9 @@
340 */
341 void UCUbuntuShape::setGradientColor(const QColor& gradientColor)
342 {
343+ qmlInfo(this) << "'gradientColor' is deprecated. Use 'backgroundColor', "
344+ "'secondaryBackgroundColor' and 'backgroundMode' instead.";
345+
346 if (!(m_flags & BackgroundApiSet)) {
347 m_flags |= GradientColorSet;
348 const QRgb gradientColorRgb = qRgba(
349@@ -829,6 +841,8 @@
350 */
351 void UCUbuntuShape::setImage(const QVariant& image)
352 {
353+ qmlInfo(this) << "'image' is deprecated. Use 'source' instead.";
354+
355 if (!(m_flags & SourceApiSet)) {
356 QQuickItem* newImage = qobject_cast<QQuickItem*>(qvariant_cast<QObject*>(image));
357 if (m_source != newImage) {
358@@ -856,6 +870,8 @@
359 // maintain it for a while for compatibility reasons.
360 void UCUbuntuShape::setStretched(bool stretched)
361 {
362+ qmlInfo(this) << "'stretched' is deprecated. Use 'sourceFillMode' instead";
363+
364 if (!(m_flags & SourceApiSet)) {
365 if (!!(m_flags & Stretched) != stretched) {
366 if (stretched) {
367@@ -873,6 +889,8 @@
368 // Deprecation layer. Same comment as setStretched().
369 void UCUbuntuShape::setHorizontalAlignment(HAlignment horizontalAlignment)
370 {
371+ qmlInfo(this) << "'horizontalAlignment' is deprecated. Use 'sourceHorizontalAlignment' instead";
372+
373 if (!(m_flags & SourceApiSet)) {
374 if (m_imageHorizontalAlignment != horizontalAlignment) {
375 m_imageHorizontalAlignment = horizontalAlignment;
376@@ -886,6 +904,8 @@
377 // Deprecation layer. Same comment as setStretched().
378 void UCUbuntuShape::setVerticalAlignment(VAlignment verticalAlignment)
379 {
380+ qmlInfo(this) << "'horizontalAlignment' is deprecated. Use 'sourceVerticalAlignment' instead";
381+
382 if (!(m_flags & SourceApiSet)) {
383 if (m_imageVerticalAlignment != verticalAlignment) {
384 m_imageVerticalAlignment = verticalAlignment;
385
386=== modified file 'tests/unit_x11/tst_layouts/Visibility.qml'
387--- tests/unit_x11/tst_layouts/Visibility.qml 2015-03-03 13:20:06 +0000
388+++ tests/unit_x11/tst_layouts/Visibility.qml 2015-07-22 13:15:37 +0000
389@@ -15,7 +15,7 @@
390 */
391
392 import QtQuick 2.0
393-import Ubuntu.Components 1.1
394+import Ubuntu.Components 1.3
395 import Ubuntu.Layouts 1.0
396
397 MainView {
398@@ -61,7 +61,7 @@
399 UbuntuShape {
400 width: units.gu(20)
401 height: units.gu(20)
402- color: "red"
403+ backgroundColor: "red"
404 Label { text: "wide" }
405 }
406 }
407@@ -74,7 +74,7 @@
408 objectName: "DefaultLayout"
409 width: units.gu(20)
410 height: units.gu(20)
411- color: "green"
412+ backgroundColor: "green"
413 visible: main.boundValue
414 Label { text: "default" }
415 }

Subscribers

People subscribed via source and target branches