Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-big-radius into lp:ubuntu-ui-toolkit/staging

Proposed by Loïc Molinari
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1569
Merged at revision: 1575
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-big-radius
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 106 lines (+14/-12)
4 files modified
modules/Ubuntu/Components/plugin/ucubuntushape.cpp (+5/-7)
modules/Ubuntu/Components/plugin/ucubuntushape.h (+5/-3)
tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml (+2/-1)
tests/resources/ubuntushape/UbuntuShapeTest.qml (+2/-1)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-big-radius
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+265494@code.launchpad.net

Commit message

[UbuntuShape] Added a big radius.

Description of the change

[UbuntuShape] Added a big radius.

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

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushape.cpp'
--- modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-06-02 13:37:30 +0000
+++ modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-22 09:27:27 +0000
@@ -250,8 +250,7 @@
250250
251const float implicitWidthGU = 8.0f;251const float implicitWidthGU = 8.0f;
252const float implicitHeightGU = 8.0f;252const float implicitHeightGU = 8.0f;
253const float smallRadiusGU = 1.45f;253const float radiusGuMap[3] = { 1.45f, 2.55f, 3.65f };
254const float mediumRadiusGU = 2.55f;
255254
256/*! \qmltype UbuntuShape255/*! \qmltype UbuntuShape
257 \instantiates UCUbuntuShape256 \instantiates UCUbuntuShape
@@ -328,12 +327,12 @@
328327
329/*! \qmlproperty string UbuntuShape::radius328/*! \qmlproperty string UbuntuShape::radius
330329
331 This property defines the corner radius. Two fixed values are supported: \c "small" and \c330 This property defines the corner radius. Three fixed values are supported: \c "small",
332 "medium". The default value is \c "small".331 \c "medium" and \c "large". The default value is \c "small".
333*/332*/
334void UCUbuntuShape::setRadius(const QString& radius)333void UCUbuntuShape::setRadius(const QString& radius)
335{334{
336 const Radius newRadius = (radius == "medium") ? Medium : Small;335 const Radius newRadius = (radius == "medium") ? Medium : ((radius == "large") ? Large : Small);
337 if (m_radius != newRadius) {336 if (m_radius != newRadius) {
338 m_radius = newRadius;337 m_radius = newRadius;
339 update();338 update();
@@ -1133,8 +1132,7 @@
1133 // scaled down accordingly. The shape was using a fixed image for the corner before switching to1132 // scaled down accordingly. The shape was using a fixed image for the corner before switching to
1134 // a distance field, since the corner wasn't taking the whole image (ending at ~80%) we need1133 // a distance field, since the corner wasn't taking the whole image (ending at ~80%) we need
1135 // to take that into account when the size is scaled down.1134 // to take that into account when the size is scaled down.
1136 float radius = UCUnits::instance().gridUnit()1135 float radius = UCUnits::instance().gridUnit() * radiusGuMap[m_radius];
1137 * (m_radius == Small ? smallRadiusGU : mediumRadiusGU);
1138 const float scaledDownRadius = qMin(itemSize.width(), itemSize.height()) * 0.5f * 0.8f;1136 const float scaledDownRadius = qMin(itemSize.width(), itemSize.height()) * 0.5f * 0.8f;
1139 if (radius > scaledDownRadius) {1137 if (radius > scaledDownRadius) {
1140 radius = scaledDownRadius;1138 radius = scaledDownRadius;
11411139
=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushape.h'
--- modules/Ubuntu/Components/plugin/ucubuntushape.h 2015-06-02 13:37:30 +0000
+++ modules/Ubuntu/Components/plugin/ucubuntushape.h 2015-07-22 09:27:27 +0000
@@ -183,7 +183,8 @@
183 enum FillMode { Stretch = 0, PreserveAspectFit = 1, PreserveAspectCrop = 2, Pad = 3 };183 enum FillMode { Stretch = 0, PreserveAspectFit = 1, PreserveAspectCrop = 2, Pad = 3 };
184 enum WrapMode { Transparent = 0, Repeat = 1 };184 enum WrapMode { Transparent = 0, Repeat = 1 };
185185
186 QString radius() const { return (m_radius == Small) ? "small" : "medium"; }186 QString radius() const {
187 return (m_radius == Small) ? "small" : ((m_radius == Medium) ? "medium" : "large"); }
187 void setRadius(const QString& radius);188 void setRadius(const QString& radius);
188 Aspect aspect() const { return (m_flags & AspectSet) ? static_cast<Aspect>(m_aspect) : Flat; }189 Aspect aspect() const { return (m_flags & AspectSet) ? static_cast<Aspect>(m_aspect) : Flat; }
189 void setAspect(Aspect aspect);190 void setAspect(Aspect aspect);
@@ -305,7 +306,7 @@
305 float itemWidth, float itemHeight, FillMode fillMode, HAlignment horizontalAlignment,306 float itemWidth, float itemHeight, FillMode fillMode, HAlignment horizontalAlignment,
306 VAlignment verticalAlignment, const QSize& textureSize);307 VAlignment verticalAlignment, const QSize& textureSize);
307308
308 enum Radius { Small = 0, Medium = 1 };309 enum Radius { Small = 0, Medium = 1, Large = 2 };
309 enum { Pressed = 2 }; // Aspect extension (to keep support for deprecated aspects).310 enum { Pressed = 2 }; // Aspect extension (to keep support for deprecated aspects).
310 enum {311 enum {
311 AspectSet = (1 << 0),312 AspectSet = (1 << 0),
@@ -323,7 +324,7 @@
323 QVector2D m_sourceScale;324 QVector2D m_sourceScale;
324 QVector2D m_sourceTranslation;325 QVector2D m_sourceTranslation;
325 QVector4D m_sourceTransform;326 QVector4D m_sourceTransform;
326 Radius m_radius : 1;327 Radius m_radius : 2;
327 quint8 m_aspect : 2;328 quint8 m_aspect : 2;
328 HAlignment m_imageHorizontalAlignment : 2;329 HAlignment m_imageHorizontalAlignment : 2;
329 VAlignment m_imageVerticalAlignment : 2;330 VAlignment m_imageVerticalAlignment : 2;
@@ -333,6 +334,7 @@
333 FillMode m_sourceFillMode : 2;334 FillMode m_sourceFillMode : 2;
334 WrapMode m_sourceHorizontalWrapMode : 1;335 WrapMode m_sourceHorizontalWrapMode : 1;
335 WrapMode m_sourceVerticalWrapMode : 1;336 WrapMode m_sourceVerticalWrapMode : 1;
337 quint8 __explicit_padding : 7;
336 quint8 m_sourceOpacity;338 quint8 m_sourceOpacity;
337 quint8 m_flags;339 quint8 m_flags;
338340
339341
=== modified file 'tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml'
--- tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-03-25 17:10:43 +0000
+++ tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-07-22 09:27:27 +0000
@@ -221,7 +221,8 @@
221221
222 // Styling.222 // Styling.
223 } else if (event.key == Qt.Key_R) {223 } else if (event.key == Qt.Key_R) {
224 shape.radius = (shape.radius == "medium") ? "small" : "medium";224 shape.radius = (shape.radius == "large") ? "small" :
225 ((shape.radius == "small") ? "medium" : "large");
225 } else if (event.key == Qt.Key_T) {226 } else if (event.key == Qt.Key_T) {
226 shape.aspect = (shape.aspect + 1) % 2;227 shape.aspect = (shape.aspect + 1) % 2;
227228
228229
=== modified file 'tests/resources/ubuntushape/UbuntuShapeTest.qml'
--- tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-03-25 17:10:43 +0000
+++ tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-07-22 09:27:27 +0000
@@ -218,7 +218,8 @@
218218
219 // Styling.219 // Styling.
220 } else if (event.key == Qt.Key_R) {220 } else if (event.key == Qt.Key_R) {
221 shape.radius = (shape.radius == "medium") ? "small" : "medium";221 shape.radius = (shape.radius == "large") ? "small" :
222 ((shape.radius == "small") ? "medium" : "large");
222 } else if (event.key == Qt.Key_T) {223 } else if (event.key == Qt.Key_T) {
223 shape.aspect = (shape.aspect + 1) % 2;224 shape.aspect = (shape.aspect + 1) % 2;
224225

Subscribers

People subscribed via source and target branches