Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-overlaygeometry-to-overlayrect-renaming into lp:ubuntu-ui-toolkit/staging

Proposed by Loïc Molinari
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1444
Merged at revision: 1445
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-overlaygeometry-to-overlayrect-renaming
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-qml-code-snippets-indentation
Diff against target: 204 lines (+34/-35)
6 files modified
components.api (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml (+1/-1)
modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.cpp (+11/-11)
modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.h (+4/-5)
tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml (+16/-16)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-overlaygeometry-to-overlayrect-renaming
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zsombor Egri Approve
Review via email: mp+252425@code.launchpad.net

Commit message

[UbuntuShapeOverlay] Renamed the overlayGeometry property to overlayRect.

overlayGeometry being of type QRect, using overlayRect instead makes it more precise, less generic.

Description of the change

[UbuntuShapeOverlay] Renamed the overlayGeometry property to overlayRect.

overlayGeometry being of type QRect, using overlayRect instead makes it more precise, less generic.

To post a comment you must log in.
Revision history for this message
Zsombor Egri (zsombi) wrote :

Ok, it's fine now, thanks!

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

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-03-04 19:13:15 +0000
3+++ components.api 2015-03-10 12:21:55 +0000
4@@ -1110,7 +1110,7 @@
5 name: "UCUbuntuShapeOverlay"
6 prototype: "UCUbuntuShape"
7 exports: ["UbuntuShapeOverlay 1.2"]
8- Property { name: "overlayGeometry"; type: "QRectF" }
9+ Property { name: "overlayRect"; type: "QRectF" }
10 Property { name: "overlayColor"; type: "QColor" }
11 name: "UCUnits"
12 prototype: "QObject"
13
14=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml'
15--- modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml 2015-03-09 12:05:40 +0000
16+++ modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml 2015-03-10 12:21:55 +0000
17@@ -35,7 +35,7 @@
18 anchors.fill: parent
19 backgroundColor: progressBarStyle.backgroundColor
20 overlayColor: foregroundColor
21- overlayGeometry: Qt.application.layoutDirection == Qt.LeftToRight ?
22+ overlayRect: Qt.application.layoutDirection == Qt.LeftToRight ?
23 Qt.rect(0.0, 0.0, progressBarStyle.progress, 1.0) :
24 Qt.rect(1.0 - progressBarStyle.progress, 0.0, 1.0, 1.0)
25 }
26
27=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml'
28--- modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml 2015-03-09 12:05:40 +0000
29+++ modules/Ubuntu/Components/Themes/Ambiance/SliderStyle.qml 2015-03-10 12:21:55 +0000
30@@ -46,7 +46,7 @@
31 height: units.dp(4)
32 backgroundColor: sliderStyle.backgroundColor
33 overlayColor: sliderStyle.foregroundColor
34- overlayGeometry: Qt.application.layoutDirection == Qt.LeftToRight ?
35+ overlayRect: Qt.application.layoutDirection == Qt.LeftToRight ?
36 Qt.rect(0.0, 0.0, thumb.x / thumb.barMinusThumbWidth, 1.0) :
37 Qt.rect(1.0 - (thumb.x / thumb.barMinusThumbWidth), 0.0, 1.0, 1.0)
38 }
39
40=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.cpp'
41--- modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.cpp 2015-03-10 12:21:55 +0000
42+++ modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.cpp 2015-03-10 12:21:55 +0000
43@@ -107,7 +107,7 @@
44 UbuntuShapeOverlay {
45 backgroundColor: "white"
46 overlayColor: "black"
47- overlayGeometry: Qt.rect(0.25, 0.25, 0.5, 0.5)
48+ overlayRect: Qt.rect(0.25, 0.25, 0.5, 0.5)
49 }
50 \endqml
51 */
52@@ -121,7 +121,7 @@
53 {
54 }
55
56-/*! \qmlproperty rect UbuntuShapeOverlay::overlayGeometry
57+/*! \qmlproperty rect UbuntuShapeOverlay::overlayRect
58 \since Ubuntu.Components 1.2
59
60 This property sets the overlay rectangle. The default value is the empty rectangle.
61@@ -134,7 +134,7 @@
62 UbuntuShapeOverlay {
63 width: 200; height: 200
64 overlayColor: Qt.rgba(0.0, 0.0, 0.5, 0.5)
65- overlayGeometry: Qt.rect(0.0, 0.5, 1.0, 0.5)
66+ overlayRect: Qt.rect(0.0, 0.5, 1.0, 0.5)
67 }
68 \endqml
69
70@@ -145,22 +145,22 @@
71 UbuntuShapeOverlay {
72 width: 200; height: 200
73 overlayColor: Qt.rgba(0.0, 0.0, 0.5, 0.5)
74- overlayGeometry: Qt.rect(100.0/width, 100.0/height, 200.0/width, 100.0/height)
75+ overlayRect: Qt.rect(100.0/width, 100.0/height, 200.0/width, 100.0/height)
76 }
77 \endqml
78
79 A geometry exceeding the item area is cropped.
80 */
81-void UCUbuntuShapeOverlay::setOverlayGeometry(const QRectF& overlayGeometry)
82+void UCUbuntuShapeOverlay::setOverlayRect(const QRectF& overlayRect)
83 {
84 // Crop rectangle and pack to 16-bit unsigned integers.
85- const float x = qBound(0.0f, static_cast<float>(overlayGeometry.x()), 1.0f);
86- float width = qMax(0.0f, static_cast<float>(overlayGeometry.width()));
87+ const float x = qBound(0.0f, static_cast<float>(overlayRect.x()), 1.0f);
88+ float width = qMax(0.0f, static_cast<float>(overlayRect.width()));
89 if ((x + width) > 1.0f) {
90 width += 1.0f - (x + width);
91 }
92- const float y = qBound(0.0f, static_cast<float>(overlayGeometry.y()), 1.0f);
93- float height = qMax(0.0f, static_cast<float>(overlayGeometry.height()));
94+ const float y = qBound(0.0f, static_cast<float>(overlayRect.y()), 1.0f);
95+ float height = qMax(0.0f, static_cast<float>(overlayRect.height()));
96 if ((y + height) > 1.0f) {
97 height += 1.0f - (y + height);
98 }
99@@ -177,14 +177,14 @@
100 m_overlayWidth = overlayWidth;
101 m_overlayHeight = overlayHeight;
102 update();
103- Q_EMIT overlayGeometryChanged();
104+ Q_EMIT overlayRectChanged();
105 }
106 }
107
108 /*! \qmlproperty color UbuntuShapeOverlay::overlayColor
109 \since Ubuntu.Components 1.2
110
111- This property sets the color of the overlay rectangle defined by \l overlayGeometry. The default
112+ This property sets the color of the overlay rectangle defined by \l overlayRect. The default
113 value is transparent black.
114 */
115 void UCUbuntuShapeOverlay::setOverlayColor(const QColor& overlayColor)
116
117=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.h'
118--- modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.h 2015-01-29 19:51:53 +0000
119+++ modules/Ubuntu/Components/plugin/ucubuntushapeoverlay.h 2015-03-10 12:21:55 +0000
120@@ -70,24 +70,23 @@
121 Q_OBJECT
122
123 // Overlay properties.
124- Q_PROPERTY(QRectF overlayGeometry READ overlayGeometry WRITE setOverlayGeometry
125- NOTIFY overlayGeometryChanged)
126+ Q_PROPERTY(QRectF overlayRect READ overlayRect WRITE setOverlayRect NOTIFY overlayRectChanged)
127 Q_PROPERTY(QColor overlayColor READ overlayColor WRITE setOverlayColor
128 NOTIFY overlayColorChanged)
129
130 public:
131 UCUbuntuShapeOverlay(QQuickItem* parent=0);
132
133- QRectF overlayGeometry() const {
134+ QRectF overlayRect() const {
135 const float u16ToF32 = 1.0f / static_cast<float>(0xffff);
136 return QRectF(m_overlayX * u16ToF32, m_overlayY * u16ToF32, m_overlayWidth * u16ToF32,
137 m_overlayHeight * u16ToF32); }
138- void setOverlayGeometry(const QRectF& overlayGeometry);
139+ void setOverlayRect(const QRectF& overlayRect);
140 QColor overlayColor() const { return m_overlayColor; }
141 void setOverlayColor(const QColor& overlayColor);
142
143 Q_SIGNALS:
144- void overlayGeometryChanged();
145+ void overlayRectChanged();
146 void overlayColorChanged();
147
148 protected:
149
150=== modified file 'tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml'
151--- tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-01-29 19:06:02 +0000
152+++ tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-03-10 12:21:55 +0000
153@@ -59,7 +59,7 @@
154 "Background colors (a/z): " + shape.backgroundColor + ", " + shape.secondaryBackgroundColor + "\n" +
155 "Background mode (e): " + root.backgroundModeTable[shape.backgroundMode] + "\n\n" +
156 "Overlay color (r): " + shape.overlayColor + "\n" +
157- "Overlay geometry (t/y/u/i): " + shape.overlayGeometry.x.toFixed(2) + ", " + shape.overlayGeometry.y.toFixed(2) + ", " + shape.overlayGeometry.width.toFixed(2) + ", " + shape.overlayGeometry.height.toFixed(2) + "\n\n" +
158+ "Overlay geometry (t/y/u/i): " + shape.overlayRect.x.toFixed(2) + ", " + shape.overlayRect.y.toFixed(2) + ", " + shape.overlayRect.width.toFixed(2) + ", " + shape.overlayRect.height.toFixed(2) + "\n\n" +
159 "Source (o): " + shape.source + "\n" +
160 "Source opacity (p): " + shape.sourceOpacity.toFixed(2) + "\n" +
161 "Source fill (q): " + root.sourceFillModeTable[shape.sourceFillMode] + "\n" +
162@@ -220,27 +220,27 @@
163 Math.random(), Math.random(), Math.random(), Math.random());
164 } else if (event.key == Qt.Key_T) {
165 var x = Math.max(0.0, Math.min(1.0,
166- shape.overlayGeometry.x + ((event.modifiers & shift) ? 0.005 : -0.005)));
167- shape.overlayGeometry = Qt.rect(
168- x, shape.overlayGeometry.y, shape.overlayGeometry.width,
169- shape.overlayGeometry.height);
170+ shape.overlayRect.x + ((event.modifiers & shift) ? 0.005 : -0.005)));
171+ shape.overlayRect = Qt.rect(
172+ x, shape.overlayRect.y, shape.overlayRect.width,
173+ shape.overlayRect.height);
174 } else if (event.key == Qt.Key_Y) {
175 var y = Math.max(0.0, Math.min(1.0,
176- shape.overlayGeometry.y + ((event.modifiers & shift) ? 0.005 : -0.005)));
177- shape.overlayGeometry = Qt.rect(
178- shape.overlayGeometry.x, y, shape.overlayGeometry.width,
179- shape.overlayGeometry.height);
180+ shape.overlayRect.y + ((event.modifiers & shift) ? 0.005 : -0.005)));
181+ shape.overlayRect = Qt.rect(
182+ shape.overlayRect.x, y, shape.overlayRect.width,
183+ shape.overlayRect.height);
184 } else if (event.key == Qt.Key_U) {
185 var width = Math.max(0.0, Math.min(1.0,
186- shape.overlayGeometry.width + ((event.modifiers & shift) ? 0.005 : -0.005)));
187- shape.overlayGeometry = Qt.rect(
188- shape.overlayGeometry.x, shape.overlayGeometry.y, width,
189- shape.overlayGeometry.height);
190+ shape.overlayRect.width + ((event.modifiers & shift) ? 0.005 : -0.005)));
191+ shape.overlayRect = Qt.rect(
192+ shape.overlayRect.x, shape.overlayRect.y, width,
193+ shape.overlayRect.height);
194 } else if (event.key == Qt.Key_I) {
195 var height = Math.max(0.0, Math.min(1.0,
196- shape.overlayGeometry.height + ((event.modifiers & shift) ? 0.005 : -0.005)));
197- shape.overlayGeometry = Qt.rect(
198- shape.overlayGeometry.x, shape.overlayGeometry.y, shape.overlayGeometry.width,
199+ shape.overlayRect.height + ((event.modifiers & shift) ? 0.005 : -0.005)));
200+ shape.overlayRect = Qt.rect(
201+ shape.overlayRect.x, shape.overlayRect.y, shape.overlayRect.width,
202 height);
203
204 // Source.

Subscribers

People subscribed via source and target branches