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
1=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushape.cpp'
2--- modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-06-02 13:37:30 +0000
3+++ modules/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-22 09:27:27 +0000
4@@ -250,8 +250,7 @@
5
6 const float implicitWidthGU = 8.0f;
7 const float implicitHeightGU = 8.0f;
8-const float smallRadiusGU = 1.45f;
9-const float mediumRadiusGU = 2.55f;
10+const float radiusGuMap[3] = { 1.45f, 2.55f, 3.65f };
11
12 /*! \qmltype UbuntuShape
13 \instantiates UCUbuntuShape
14@@ -328,12 +327,12 @@
15
16 /*! \qmlproperty string UbuntuShape::radius
17
18- This property defines the corner radius. Two fixed values are supported: \c "small" and \c
19- "medium". The default value is \c "small".
20+ This property defines the corner radius. Three fixed values are supported: \c "small",
21+ \c "medium" and \c "large". The default value is \c "small".
22 */
23 void UCUbuntuShape::setRadius(const QString& radius)
24 {
25- const Radius newRadius = (radius == "medium") ? Medium : Small;
26+ const Radius newRadius = (radius == "medium") ? Medium : ((radius == "large") ? Large : Small);
27 if (m_radius != newRadius) {
28 m_radius = newRadius;
29 update();
30@@ -1133,8 +1132,7 @@
31 // scaled down accordingly. The shape was using a fixed image for the corner before switching to
32 // a distance field, since the corner wasn't taking the whole image (ending at ~80%) we need
33 // to take that into account when the size is scaled down.
34- float radius = UCUnits::instance().gridUnit()
35- * (m_radius == Small ? smallRadiusGU : mediumRadiusGU);
36+ float radius = UCUnits::instance().gridUnit() * radiusGuMap[m_radius];
37 const float scaledDownRadius = qMin(itemSize.width(), itemSize.height()) * 0.5f * 0.8f;
38 if (radius > scaledDownRadius) {
39 radius = scaledDownRadius;
40
41=== modified file 'modules/Ubuntu/Components/plugin/ucubuntushape.h'
42--- modules/Ubuntu/Components/plugin/ucubuntushape.h 2015-06-02 13:37:30 +0000
43+++ modules/Ubuntu/Components/plugin/ucubuntushape.h 2015-07-22 09:27:27 +0000
44@@ -183,7 +183,8 @@
45 enum FillMode { Stretch = 0, PreserveAspectFit = 1, PreserveAspectCrop = 2, Pad = 3 };
46 enum WrapMode { Transparent = 0, Repeat = 1 };
47
48- QString radius() const { return (m_radius == Small) ? "small" : "medium"; }
49+ QString radius() const {
50+ return (m_radius == Small) ? "small" : ((m_radius == Medium) ? "medium" : "large"); }
51 void setRadius(const QString& radius);
52 Aspect aspect() const { return (m_flags & AspectSet) ? static_cast<Aspect>(m_aspect) : Flat; }
53 void setAspect(Aspect aspect);
54@@ -305,7 +306,7 @@
55 float itemWidth, float itemHeight, FillMode fillMode, HAlignment horizontalAlignment,
56 VAlignment verticalAlignment, const QSize& textureSize);
57
58- enum Radius { Small = 0, Medium = 1 };
59+ enum Radius { Small = 0, Medium = 1, Large = 2 };
60 enum { Pressed = 2 }; // Aspect extension (to keep support for deprecated aspects).
61 enum {
62 AspectSet = (1 << 0),
63@@ -323,7 +324,7 @@
64 QVector2D m_sourceScale;
65 QVector2D m_sourceTranslation;
66 QVector4D m_sourceTransform;
67- Radius m_radius : 1;
68+ Radius m_radius : 2;
69 quint8 m_aspect : 2;
70 HAlignment m_imageHorizontalAlignment : 2;
71 VAlignment m_imageVerticalAlignment : 2;
72@@ -333,6 +334,7 @@
73 FillMode m_sourceFillMode : 2;
74 WrapMode m_sourceHorizontalWrapMode : 1;
75 WrapMode m_sourceVerticalWrapMode : 1;
76+ quint8 __explicit_padding : 7;
77 quint8 m_sourceOpacity;
78 quint8 m_flags;
79
80
81=== modified file 'tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml'
82--- tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-03-25 17:10:43 +0000
83+++ tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-07-22 09:27:27 +0000
84@@ -221,7 +221,8 @@
85
86 // Styling.
87 } else if (event.key == Qt.Key_R) {
88- shape.radius = (shape.radius == "medium") ? "small" : "medium";
89+ shape.radius = (shape.radius == "large") ? "small" :
90+ ((shape.radius == "small") ? "medium" : "large");
91 } else if (event.key == Qt.Key_T) {
92 shape.aspect = (shape.aspect + 1) % 2;
93
94
95=== modified file 'tests/resources/ubuntushape/UbuntuShapeTest.qml'
96--- tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-03-25 17:10:43 +0000
97+++ tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-07-22 09:27:27 +0000
98@@ -218,7 +218,8 @@
99
100 // Styling.
101 } else if (event.key == Qt.Key_R) {
102- shape.radius = (shape.radius == "medium") ? "small" : "medium";
103+ shape.radius = (shape.radius == "large") ? "small" :
104+ ((shape.radius == "small") ? "medium" : "large");
105 } else if (event.key == Qt.Key_T) {
106 shape.aspect = (shape.aspect + 1) % 2;
107

Subscribers

People subscribed via source and target branches