Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntu-shape-icon into lp:ubuntu-ui-toolkit/staging
- ubuntu-ui-toolkit-ubuntu-shape-icon
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Tim Peeters |
Approved revision: | 1592 |
Merged at revision: | 1594 |
Proposed branch: | lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntu-shape-icon |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
460 lines (+331/-6) 10 files modified
components.api (+1/-0) examples/ubuntu-ui-toolkit-gallery/ShellIcon.qml (+49/-0) examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml (+5/-0) src/Ubuntu/Components/plugin/plugin.cpp (+2/-0) src/Ubuntu/Components/plugin/plugin.pri (+2/-0) src/Ubuntu/Components/plugin/ucshellicon.cpp (+60/-0) src/Ubuntu/Components/plugin/ucshellicon.h (+41/-0) src/Ubuntu/Components/plugin/ucubuntushape.cpp (+4/-5) src/Ubuntu/Components/plugin/ucubuntushape.h (+2/-1) tests/resources/ubuntushape/ShellIconTest.qml (+165/-0) |
To merge this branch: | bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntu-shape-icon |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Tim Peeters | Approve | ||
Review via email: mp+267191@code.launchpad.net |
This proposal supersedes a proposal from 2015-07-24.
Commit message
[UbuntuShape] Added an ShellIcon item.
Description of the change
[UbuntuShape] Added an ShellIcon item.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1583
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1584
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1586
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1587
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
Are the changes to ucubuntushape.
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
142 + radius, a drop shadow aspect and a PereserveAspectCrop source fill mode. Changing the width
*PreserveAspectCrop
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
The implementation itself looks fine, but I don't think we should add this new component without an API discussion. Can you create one here? https:/
If I ignore the implementation+
Loïc Molinari (loic.molinari) wrote : Posted in a previous version of this proposal | # |
> Are the changes to ucubuntushape.
> branch need to sync with another branch/staging?
The relative radius needed by UbuntuShapeIcon requires a higher bound whic hexplains the changes there.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1588
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
what about naming it StandardFrame?
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
should we have this component in the UITK component gallery?
Loïc Molinari (loic.molinari) wrote : Posted in a previous version of this proposal | # |
So let's call it ShellIcon and put it in the gallery.
Loïc Molinari (loic.molinari) wrote : | # |
Resubmitted removing the now useless prerequisite and changing the naming.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1591
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1592. By Loïc Molinari
-
Fixed components.api.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1592
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'components.api' |
2 | --- components.api 2015-08-04 20:07:41 +0000 |
3 | +++ components.api 2015-08-06 14:21:03 +0000 |
4 | @@ -826,6 +826,7 @@ |
5 | property double contentsWidth |
6 | property bool modal |
7 | property string title |
8 | +Ubuntu.Components.ShellIcon 1.3: UbuntuShape |
9 | Ubuntu.Components.ListItems.SingleControl 1.0 0.1: Empty |
10 | property Item control |
11 | Ubuntu.Components.ListItems.SingleControl 1.3: Empty |
12 | |
13 | === added file 'examples/ubuntu-ui-toolkit-gallery/ShellIcon.qml' |
14 | --- examples/ubuntu-ui-toolkit-gallery/ShellIcon.qml 1970-01-01 00:00:00 +0000 |
15 | +++ examples/ubuntu-ui-toolkit-gallery/ShellIcon.qml 2015-08-06 14:21:03 +0000 |
16 | @@ -0,0 +1,49 @@ |
17 | +/* |
18 | + * Copyright 2015 Canonical Ltd. |
19 | + * |
20 | + * This program is free software; you can redistribute it and/or modify |
21 | + * it under the terms of the GNU Lesser General Public License as published by |
22 | + * the Free Software Foundation; version 3. |
23 | + * |
24 | + * This program is distributed in the hope that it will be useful, |
25 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
26 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
27 | + * GNU Lesser General Public License for more details. |
28 | + * |
29 | + * You should have received a copy of the GNU Lesser General Public License |
30 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
31 | + */ |
32 | + |
33 | +import QtQuick 2.4 |
34 | +import Ubuntu.Components 1.3 |
35 | + |
36 | +Template { |
37 | + objectName: "shellIconsTemplate" |
38 | + |
39 | + TemplateSection { |
40 | + title: "Shell Icon" |
41 | + className: "ShellIcon" |
42 | + |
43 | + TemplateRow { |
44 | + title: i18n.tr("Sizes") |
45 | + titleWidth: units.gu(8) |
46 | + height: units.gu(14) |
47 | + |
48 | + ShellIcon { |
49 | + objectName: "shellicon_size1" |
50 | + source: Image { source: "map_icon.png" } |
51 | + width: units.gu(6) |
52 | + } |
53 | + ShellIcon { |
54 | + objectName: "shellicon_size2" |
55 | + source: Image { source: "map_icon.png" } |
56 | + width: units.gu(10) |
57 | + } |
58 | + ShellIcon { |
59 | + objectName: "shellicon_size3" |
60 | + source: Image { source: "map_icon.png" } |
61 | + width: units.gu(14) |
62 | + } |
63 | + } |
64 | + } |
65 | +} |
66 | |
67 | === modified file 'examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml' |
68 | --- examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2015-08-03 14:20:21 +0000 |
69 | +++ examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2015-08-06 14:21:03 +0000 |
70 | @@ -87,6 +87,11 @@ |
71 | source: "Icons.qml" |
72 | } |
73 | ListElement { |
74 | + objectName: "shellIconsElement" |
75 | + label: "Shell Icons" |
76 | + source: "ShellIcon.qml" |
77 | + } |
78 | + ListElement { |
79 | objectName: "labelsElement" |
80 | label: "Label" |
81 | source: "Label.qml" |
82 | |
83 | === modified file 'src/Ubuntu/Components/plugin/plugin.cpp' |
84 | --- src/Ubuntu/Components/plugin/plugin.cpp 2015-07-23 11:49:38 +0000 |
85 | +++ src/Ubuntu/Components/plugin/plugin.cpp 2015-08-06 14:21:03 +0000 |
86 | @@ -33,6 +33,7 @@ |
87 | #include "quickutils.h" |
88 | #include "ucubuntushape.h" |
89 | #include "ucubuntushapeoverlay.h" |
90 | +#include "ucshellicon.h" |
91 | #include "inversemouseareatype.h" |
92 | #include "qquickclipboard.h" |
93 | #include "qquickmimedata.h" |
94 | @@ -216,6 +217,7 @@ |
95 | qmlRegisterCustomType<UCStyleHints>(uri, 1, 3, "StyleHints", new UCStyleHintsParser); |
96 | qmlRegisterType<UCAction, 1>(uri, 1, 3, "Action"); |
97 | qmlRegisterType<UCUbuntuShape, 2>(uri, 1, 3, "UbuntuShape"); |
98 | + qmlRegisterType<UCShellIcon>(uri, 1, 3, "ShellIcon"); |
99 | } |
100 | |
101 | void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
102 | |
103 | === modified file 'src/Ubuntu/Components/plugin/plugin.pri' |
104 | --- src/Ubuntu/Components/plugin/plugin.pri 2015-07-30 09:57:45 +0000 |
105 | +++ src/Ubuntu/Components/plugin/plugin.pri 2015-08-06 14:21:03 +0000 |
106 | @@ -30,6 +30,7 @@ |
107 | $$PWD/ucubuntushapetexture.h \ |
108 | $$PWD/ucubuntushape.h \ |
109 | $$PWD/ucubuntushapeoverlay.h \ |
110 | + $$PWD/ucshellicon.h \ |
111 | $$PWD/inversemouseareatype.h \ |
112 | $$PWD/qquickclipboard.h \ |
113 | $$PWD/qquickmimedata.h \ |
114 | @@ -88,6 +89,7 @@ |
115 | $$PWD/quickutils.cpp \ |
116 | $$PWD/ucubuntushape.cpp \ |
117 | $$PWD/ucubuntushapeoverlay.cpp \ |
118 | + $$PWD/ucshellicon.cpp \ |
119 | $$PWD/inversemouseareatype.cpp \ |
120 | $$PWD/qquickclipboard.cpp \ |
121 | $$PWD/qquickmimedata.cpp \ |
122 | |
123 | === added file 'src/Ubuntu/Components/plugin/ucshellicon.cpp' |
124 | --- src/Ubuntu/Components/plugin/ucshellicon.cpp 1970-01-01 00:00:00 +0000 |
125 | +++ src/Ubuntu/Components/plugin/ucshellicon.cpp 2015-08-06 14:21:03 +0000 |
126 | @@ -0,0 +1,60 @@ |
127 | +/* |
128 | + * Copyright 2015 Canonical Ltd. |
129 | + * |
130 | + * This program is free software; you can redistribute it and/or modify |
131 | + * it under the terms of the GNU Lesser General Public License as published by |
132 | + * the Free Software Foundation; version 3. |
133 | + * |
134 | + * This program is distributed in the hope that it will be useful, |
135 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
136 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
137 | + * GNU Lesser General Public License for more details. |
138 | + * |
139 | + * You should have received a copy of the GNU Lesser General Public License |
140 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
141 | + * |
142 | + * Author: Loïc Molinari <loic.molinari@canonical.com> |
143 | + */ |
144 | + |
145 | +#include "ucshellicon.h" |
146 | + |
147 | +const qreal aspectRatio = 16.0 / 15.0; |
148 | +const qreal invAspectRatio = 1.0 / aspectRatio; |
149 | + |
150 | +/*! \qmltype ShellIcon |
151 | + \instantiates UCShellIcon |
152 | + \inqmlmodule Ubuntu.Components 1.3 |
153 | + \ingroup ubuntu |
154 | + \brief Extended UbuntuShape mostly used for icons and vignettes. |
155 | + |
156 | + The ShellIcon is an extended \l UbuntuShape with a fixed aspect ratio (16:15), a relative |
157 | + radius, a drop shadow aspect and a PreserveAspectCrop source fill mode. Changing the width |
158 | + implies an update of height and radius, and changing the height implies an update of width and |
159 | + radius. The goal being to keep the same proportion between width, height and radius whatever the |
160 | + size. |
161 | +*/ |
162 | +UCShellIcon::UCShellIcon(QQuickItem* parent) |
163 | + : UCUbuntuShape(parent) |
164 | +{ |
165 | + setAspect(UCUbuntuShape::DropShadow); |
166 | + setRelativeRadius(0.67); |
167 | + setSourceFillMode(UCUbuntuShape::PreserveAspectCrop); |
168 | + connect(this, SIGNAL(widthChanged()), this, SLOT(_q_updateHeight())); |
169 | + connect(this, SIGNAL(heightChanged()), this, SLOT(_q_updateWidth())); |
170 | +} |
171 | + |
172 | +void UCShellIcon::_q_updateWidth() |
173 | +{ |
174 | + const qreal newWidth = height() * aspectRatio; |
175 | + if (qAbs(newWidth - width()) > 0.5) { |
176 | + setWidth(newWidth); |
177 | + } |
178 | +} |
179 | + |
180 | +void UCShellIcon::_q_updateHeight() |
181 | +{ |
182 | + const qreal newHeight = width() * invAspectRatio; |
183 | + if (qAbs(newHeight - height()) > 0.5) { |
184 | + setHeight(newHeight); |
185 | + } |
186 | +} |
187 | |
188 | === added file 'src/Ubuntu/Components/plugin/ucshellicon.h' |
189 | --- src/Ubuntu/Components/plugin/ucshellicon.h 1970-01-01 00:00:00 +0000 |
190 | +++ src/Ubuntu/Components/plugin/ucshellicon.h 2015-08-06 14:21:03 +0000 |
191 | @@ -0,0 +1,41 @@ |
192 | +/* |
193 | + * Copyright 2015 Canonical Ltd. |
194 | + * |
195 | + * This program is free software; you can redistribute it and/or modify |
196 | + * it under the terms of the GNU Lesser General Public License as published by |
197 | + * the Free Software Foundation; version 3. |
198 | + * |
199 | + * This program is distributed in the hope that it will be useful, |
200 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
201 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
202 | + * GNU Lesser General Public License for more details. |
203 | + * |
204 | + * You should have received a copy of the GNU Lesser General Public License |
205 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
206 | + * |
207 | + * Author: Loïc Molinari <loic.molinari@canonical.com> |
208 | + */ |
209 | + |
210 | +#ifndef UCSHELLICON_H |
211 | +#define UCSHELLICON_H |
212 | + |
213 | +#include "ucubuntushape.h" |
214 | + |
215 | +class UCShellIcon : public UCUbuntuShape |
216 | +{ |
217 | + Q_OBJECT |
218 | + |
219 | +public: |
220 | + UCShellIcon(QQuickItem* parent=0); |
221 | + |
222 | +private Q_SLOTS: |
223 | + void _q_updateWidth(); |
224 | + void _q_updateHeight(); |
225 | + |
226 | +private: |
227 | + Q_DISABLE_COPY(UCShellIcon) |
228 | +}; |
229 | + |
230 | +QML_DECLARE_TYPE(UCShellIcon) |
231 | + |
232 | +#endif // UCSHELLICON_H |
233 | |
234 | === modified file 'src/Ubuntu/Components/plugin/ucubuntushape.cpp' |
235 | --- src/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-31 09:40:26 +0000 |
236 | +++ src/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-08-06 14:21:03 +0000 |
237 | @@ -291,8 +291,8 @@ |
238 | , m_sourceScale(1.0f, 1.0f) |
239 | , m_sourceTranslation(0.0f, 0.0f) |
240 | , m_sourceTransform(1.0f, 1.0f, 0.0f, 0.0f) |
241 | + , m_relativeRadius(0) |
242 | , m_radius(Small) |
243 | - , m_relativeRadius(0) |
244 | , m_aspect(Inset) |
245 | , m_imageHorizontalAlignment(AlignHCenter) |
246 | , m_imageVerticalAlignment(AlignVCenter) |
247 | @@ -366,15 +366,14 @@ |
248 | \since Ubuntu.Components 1.3 |
249 | |
250 | This property defines a radius relative to the size of the UbuntuShape. It is specified as a |
251 | - number between 0.0 (0%) and 0.5 (50%) corresponding to the proportion of the radius with regards |
252 | - to the smallest side (divided by 2 since a side has 2 angles). The default value is 0.0. |
253 | + number between 0.0 (0%) and 0.75 (75%) corresponding to the proportion of the radius with |
254 | + regards to the smallest side (divided by 2 since a side has 2 angles). The default value is 0.0. |
255 | |
256 | \note Setting a non-zero value takes over the \l radius property. |
257 | */ |
258 | void UCUbuntuShape::setRelativeRadius(qreal relativeRadius) |
259 | { |
260 | - // m_relativeRadius is on 6 bits, increasing the higher bound might require higher precision. |
261 | - const quint8 relativeRadiusPacked = qRound(qBound(0.0, relativeRadius, 0.5) * 100.0); |
262 | + const quint8 relativeRadiusPacked = qRound(qBound(0.0, relativeRadius, 0.75) * 100.0); |
263 | if (m_relativeRadius != relativeRadiusPacked) { |
264 | m_relativeRadius = relativeRadiusPacked; |
265 | update(); |
266 | |
267 | === modified file 'src/Ubuntu/Components/plugin/ucubuntushape.h' |
268 | --- src/Ubuntu/Components/plugin/ucubuntushape.h 2015-07-31 09:40:26 +0000 |
269 | +++ src/Ubuntu/Components/plugin/ucubuntushape.h 2015-08-06 14:21:03 +0000 |
270 | @@ -330,8 +330,8 @@ |
271 | QVector2D m_sourceScale; |
272 | QVector2D m_sourceTranslation; |
273 | QVector4D m_sourceTransform; |
274 | + quint8 m_relativeRadius; |
275 | Radius m_radius : 2; |
276 | - quint8 m_relativeRadius : 6; |
277 | quint8 m_aspect : 3; |
278 | HAlignment m_imageHorizontalAlignment : 2; |
279 | VAlignment m_imageVerticalAlignment : 2; |
280 | @@ -341,6 +341,7 @@ |
281 | FillMode m_sourceFillMode : 2; |
282 | WrapMode m_sourceHorizontalWrapMode : 1; |
283 | WrapMode m_sourceVerticalWrapMode : 1; |
284 | + quint8 __explicit_padding : 6; |
285 | quint8 m_sourceOpacity; |
286 | quint8 m_flags; |
287 | |
288 | |
289 | === added file 'tests/resources/ubuntushape/ShellIconTest.qml' |
290 | --- tests/resources/ubuntushape/ShellIconTest.qml 1970-01-01 00:00:00 +0000 |
291 | +++ tests/resources/ubuntushape/ShellIconTest.qml 2015-08-06 14:21:03 +0000 |
292 | @@ -0,0 +1,165 @@ |
293 | +/* |
294 | + * Copyright 2015 Canonical Ltd. |
295 | + * |
296 | + * This program is free software; you can redistribute it and/or modify |
297 | + * it under the terms of the GNU Lesser General Public License as published by |
298 | + * the Free Software Foundation; version 3. |
299 | + * |
300 | + * This program is distributed in the hope that it will be useful, |
301 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
302 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
303 | + * GNU Lesser General Public License for more details. |
304 | + * |
305 | + * You should have received a copy of the GNU Lesser General Public License |
306 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
307 | + */ |
308 | + |
309 | +import QtQuick 2.0 |
310 | +import Ubuntu.Components 1.3 |
311 | + |
312 | +Item { |
313 | + id: root |
314 | + width: 500 |
315 | + height: width * (15.0 / 16.0) |
316 | + focus: true |
317 | + |
318 | + // Zoom properties. |
319 | + property variant translation: Qt.point(0.0, 0.0) |
320 | + property real scaleBase: 1.1 |
321 | + property real scaleExponent: 0.0 |
322 | + property real minScaleExponent: 0.0 |
323 | + property real maxScaleExponent: 48.317715856 // Logarithm of 100 to base 1.1 (scaleBase). |
324 | + property real scaleFactor: 1.0 |
325 | + property real scale: 1.0 |
326 | + |
327 | + // Overlay text properties. |
328 | + property string textOverlayString: |
329 | + "Zoom (scroll): x " + root.scaleFactor.toFixed(1) + "\n" + |
330 | + "Width (a): " + shape.width.toFixed(2) + "\n" + |
331 | + "Height (z): " + shape.height.toFixed(2) |
332 | + |
333 | + // Main scene. |
334 | + Item { |
335 | + id: scene |
336 | + anchors.fill: parent |
337 | + |
338 | + Rectangle { |
339 | + id: background |
340 | + anchors.fill: parent |
341 | + color: "white" |
342 | + } |
343 | + |
344 | + ShellIcon { |
345 | + id: shape |
346 | + anchors.centerIn: parent |
347 | + width: 300 |
348 | + source: Image { source: "music-app.png" } |
349 | + } |
350 | + } |
351 | + |
352 | + // Zoom support. |
353 | + ShaderEffectSource { |
354 | + id: shaderEffectSource |
355 | + anchors.fill: scene |
356 | + sourceItem: scene |
357 | + hideSource: true |
358 | + visible: false |
359 | + smooth: false |
360 | + } |
361 | + ShaderEffect { |
362 | + anchors.fill: scene |
363 | + property variant tex: shaderEffectSource |
364 | + property variant translation: root.translation |
365 | + property real scaleFactor: root.scale |
366 | + vertexShader: " |
367 | + uniform mat4 qt_Matrix; |
368 | + uniform float scaleFactor; |
369 | + uniform vec2 translation; |
370 | + attribute vec4 qt_Vertex; |
371 | + attribute vec2 qt_MultiTexCoord0; |
372 | + varying vec2 texCoord; |
373 | + void main() { |
374 | + texCoord = vec2(scaleFactor) * qt_MultiTexCoord0 + translation; |
375 | + gl_Position = qt_Matrix * qt_Vertex; |
376 | + }" |
377 | + fragmentShader: " |
378 | + uniform sampler2D tex; |
379 | + uniform float qt_Opacity; |
380 | + varying vec2 texCoord; |
381 | + void main() { |
382 | + gl_FragColor = texture2D(tex, texCoord) * qt_Opacity; |
383 | + }" |
384 | + } |
385 | + |
386 | + // Text overlay. |
387 | + Text { |
388 | + id: textOverlay |
389 | + width:200 |
390 | + anchors.top: parent.top |
391 | + anchors.topMargin: 10 |
392 | + anchors.left: parent.left |
393 | + anchors.leftMargin: 10 |
394 | + font.family: "Ubuntu Mono" |
395 | + font.pixelSize: 14 |
396 | + font.weight: Font.Bold |
397 | + color: "black" |
398 | + text: textOverlayString |
399 | + } |
400 | + |
401 | + // Mouse handling. |
402 | + MouseArea { |
403 | + id: mouseArea |
404 | + anchors.fill: parent |
405 | + acceptedButtons: Qt.LeftButton |
406 | + hoverEnabled: true |
407 | + |
408 | + property real lastX: 0.0 |
409 | + property real lastY: 0.0 |
410 | + |
411 | + onPressed: { |
412 | + if (pressedButtons & Qt.LeftButton) { |
413 | + lastX = mouseX; |
414 | + lastY = mouseY; |
415 | + } |
416 | + } |
417 | + onPositionChanged: { |
418 | + if (pressedButtons & Qt.LeftButton) { |
419 | + var tx = root.translation.x; |
420 | + var ty = root.translation.y; |
421 | + var sx = root.scale / root.width; |
422 | + var sy = root.scale / root.height; |
423 | + var x = mouseX - lastX; |
424 | + var y = mouseY - lastY; |
425 | + root.translation = Qt.point(Math.max(0.0, Math.min(1.0 - root.scale, tx - sx * x)), |
426 | + Math.max(0.0, Math.min(1.0 - root.scale, ty - sy * y))); |
427 | + lastX = mouseX; |
428 | + lastY = mouseY; |
429 | + } |
430 | + } |
431 | + onWheel: { |
432 | + root.scaleExponent = Math.max(minScaleExponent, Math.min(maxScaleExponent, |
433 | + root.scaleExponent + (wheel.angleDelta.y < 0.0 ? -1.0 : 1.0))); |
434 | + root.scaleFactor = Math.pow(root.scaleBase, root.scaleExponent); |
435 | + var oldScale = root.scale; |
436 | + root.scale = 1.0 / root.scaleFactor; |
437 | + var s = oldScale - root.scale; |
438 | + var tx = root.translation.x; |
439 | + var ty = root.translation.y; |
440 | + var x = mouseX / root.width; |
441 | + var y = mouseY / root.height; |
442 | + root.translation = Qt.point(Math.max(0.0, Math.min(1.0 - root.scale, tx + s * x)), |
443 | + Math.max(0.0, Math.min(1.0 - root.scale, ty + s * y))); |
444 | + } |
445 | + } |
446 | + |
447 | + // Keyboard handling. |
448 | + Keys.onPressed: { |
449 | + var shift = Qt.ShiftModifier; |
450 | + |
451 | + if (event.key == Qt.Key_A) { |
452 | + shape.width = Math.max(0.0, shape.width + ((event.modifiers & shift) ? 2.0 : -2.0)); |
453 | + } else if (event.key == Qt.Key_Z) { |
454 | + shape.height = Math.max(0.0, shape.height + ((event.modifiers & shift) ? 2.0 : -2.0)); |
455 | + } |
456 | + } |
457 | +} |
458 | |
459 | === added file 'tests/resources/ubuntushape/music-app.png' |
460 | Binary files tests/resources/ubuntushape/music-app.png 1970-01-01 00:00:00 +0000 and tests/resources/ubuntushape/music-app.png 2015-08-06 14:21:03 +0000 differ |
FAILED: Continuous integration, rev:1581 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2047/ jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-amd64- ci/775/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/777/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-i386- ci/774/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2047/ rebuild
http://