on xenial help sign in
Shadows in launcher and dash using UbuntuShapeIcon

Approved by: Michael Zanetti, Albert Astals Cid

commit7f706a0d7a9ff5b8a1568d4f19c6e2487e0b7c8a authorAndrea Cimitan <andrea.cimitan@gmail.com> dateThu 26 Nov 2015, 13:51 (11 years ago) parent56355c8709ca5d
17 files changed+122−69
plugins/Dash/CardCreator.js+24−7 qml/Dash/CardCarousel.qml+1−10 qml/Dash/CardGrid.qml+2 qml/Dash/GenericScopeView.qml+1 qml/Dash/graphics/carousel_dropshadow@27.png qml/Dash/graphics/carousel_dropshadow@27.sci−5 qml/Launcher/LauncherDelegate.qml+4−14 qml/Launcher/graphics/icon-top-highlight.png tests/mocks/Unity/fake_categories.cpp+7−1 tests/plugins/Dash/cardcreator/1.res+24−7 tests/plugins/Dash/cardcreator/2.res+1−1 tests/plugins/Dash/cardcreator/3.res+24−7 tests/plugins/Dash/cardcreator/4.res+1−1 tests/plugins/Dash/cardcreator/5.res+24−7 tests/plugins/Dash/cardcreator/6.res+1−1 tests/plugins/Dash/cardcreator/7.res+1−1 tests/plugins/Dash/cardcreator/8.res+7−7
plugins/Dash/CardCreator.js+24−7
@@ -78,13 +78,30 @@ var kArtShapeHolderCode = 'Item { \n\
7878 height: 1; \n\
7979 hideSource: doShapeItem; \n\
8080 } \n\
81− UbuntuShape { \n\
82− id: artShapeShape; \n\
83− source: artShapeSource; \n\
81+ Loader { \n\
8482 anchors.fill: parent; \n\
85− visible: doShapeItem; \n\
86− radius: "medium"; \n\
87− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat; \n\
83+ visible: artShape.doShapeItem; \n\
84+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
85+ Component { \n\
86+ id: artShapeShapeComponent; \n\
87+ UbuntuShape { \n\
88+ source: artShapeSource; \n\
89+ sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
90+ radius: "medium"; \n\
91+ aspect: { \n\
92+ switch (root.artShapeStyle) { \n\
93+ case "inset": return UbuntuShape.Inset; \n\
94+ case "shadow": return UbuntuShape.DropShadow; \n\
95+ default: \n\
96+ case "flat": return UbuntuShape.Flat; \n\
97+ } \n\
98+ } \n\
99+ } \n\
100+ } \n\
101+ Component { \n\
102+ id: artShapeIconComponent; \n\
103+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } \n\
104+ } \n\
88105 } \n\
89106 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
90107 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
@@ -236,7 +253,7 @@ var kTouchdownCode = 'UbuntuShape { \n\
236253 id: touchdown; \n\
237254 objectName: "touchdown"; \n\
238255 anchors { %1 } \n\
239− visible: root.pressed; \n\
256+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; \n\
240257 radius: "medium"; \n\
241258 borderSource: "radius_pressed.sci" \n\
242259 }\n';
qml/Dash/CardCarousel.qml+1−10
@@ -68,18 +68,9 @@ DashRenderer {
6868 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
6969 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
7070 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
71− item.artShapeStyle = "flat";
71+ item.artShapeStyle = "shadow";
7272 item.scopeStyle = cardCarousel.scopeStyle;
7373 }
74−
75− BorderImage {
76− anchors {
77− fill: parent
78− margins: -units.gu(1)
79− }
80− z: -1
81− source: "graphics/carousel_dropshadow.sci"
82− }
8374 }
8475 }
8576}
qml/Dash/CardGrid.qml+2
@@ -24,6 +24,7 @@ DashRenderer {
2424 if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
2525 return cardTool.template["collapsed-rows"];
2626 }
27+ property string artShapeStyle: "inset";
2728
2829 expandedHeight: grid.totalContentHeight
2930 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight)
@@ -69,6 +70,7 @@ DashRenderer {
6970 item.components = Qt.binding(function() { return cardTool.components; });
7071 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
7172 item.scopeStyle = root.scopeStyle;
73+ item.artShapeStyle = root.artShapeStyle;
7274 }
7375 Connections {
7476 target: loader.item
qml/Dash/GenericScopeView.qml+1
@@ -370,6 +370,7 @@ FocusScope {
370370 }
371371 }
372372 cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5));
373+ item.artShapeStyle = "icon";
373374 }
374375 item.cardTool = cardTool;
375376 }
qml/Dash/graphics/carousel_dropshadow@27.pngdeleted

Binary file not shown.

qml/Dash/graphics/carousel_dropshadow@27.scideleted−5
@@ -1,5 +0,0 @@
1−border.left: 108
2−border.top: 108
3−border.bottom: 108
4−border.right: 108
5−source: carousel_dropshadow@27.png
qml/Launcher/LauncherDelegate.qml+4−14
@@ -125,13 +125,11 @@ Item {
125125 height: parent.itemHeight + units.gu(1)
126126 anchors.centerIn: parent
127127
128− UbuntuShape {
128+ ProportionalShape {
129129 id: iconShape
130− anchors.fill: parent
131− anchors.margins: units.gu(1)
132− radius: "medium"
133− aspect: UbuntuShape.Flat
134− sourceFillMode: UbuntuShape.PreserveAspectCrop
130+ anchors.centerIn: parent
131+ width: parent.width - units.gu(2)
132+ aspect: UbuntuShape.DropShadow
135133 source: Image {
136134 id: iconImage
137135 sourceSize.width: iconShape.width
@@ -140,14 +138,6 @@ Item {
140138 }
141139 }
142140
143− BorderImage {
144− id: itemGlow
145− anchors.centerIn: iconItem
146− source: "graphics/icon-top-highlight.png"
147− width: root.itemWidth - units.gu(1)
148− height: root.itemHeight - units.gu(1)
149− }
150−
151141 UbuntuShape {
152142 id: countEmblem
153143 objectName: "countEmblem"
qml/Launcher/graphics/icon-top-highlight.pngdeleted

Binary file not shown.

tests/mocks/Unity/fake_categories.cpp+7−1
@@ -47,7 +47,13 @@ Categories::data(const QModelIndex& index, int role) const
4747 ResultsModel *resultsModel = resultModel(index.row());
4848 switch (role) {
4949 case RoleCategoryId:
50− return QString("%1").arg(index.row());
50+ if (index.row() == 6) {
51+ return QString("predefined");
52+ } else if (index.row() == 8) {
53+ return QString("local");
54+ } else {
55+ return QString("%1").arg(index.row());
56+ }
5157 case RoleName:
5258 return QString("Category %1").arg(index.row());
5359 case RoleIcon:
tests/plugins/Dash/cardcreator/1.res+24−7
@@ -40,13 +40,30 @@ Item {
4040 height: 1;
4141 hideSource: doShapeItem;
4242 }
43− UbuntuShape {
44− id: artShapeShape;
45− source: artShapeSource;
43+ Loader {
4644 anchors.fill: parent;
47− visible: doShapeItem;
48− radius: "medium";
49− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
45+ visible: artShape.doShapeItem;
46+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
47+ Component {
48+ id: artShapeShapeComponent;
49+ UbuntuShape {
50+ source: artShapeSource;
51+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
52+ radius: "medium";
53+ aspect: {
54+ switch (root.artShapeStyle) {
55+ case "inset": return UbuntuShape.Inset;
56+ case "shadow": return UbuntuShape.DropShadow;
57+ default:
58+ case "flat": return UbuntuShape.Flat;
59+ }
60+ }
61+ }
62+ }
63+ Component {
64+ id: artShapeIconComponent;
65+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
66+ }
5067 }
5168 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
5269 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
@@ -97,7 +114,7 @@ UbuntuShape {
97114 id: touchdown;
98115 objectName: "touchdown";
99116 anchors { fill: artShapeHolder }
100− visible: root.pressed;
117+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
101118 radius: "medium";
102119 borderSource: "radius_pressed.sci"
103120}
tests/plugins/Dash/cardcreator/2.res+1−1
@@ -124,7 +124,7 @@ UbuntuShape {
124124 id: touchdown;
125125 objectName: "touchdown";
126126 anchors { fill: backgroundLoader }
127− visible: root.pressed;
127+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
128128 radius: "medium";
129129 borderSource: "radius_pressed.sci"
130130}
tests/plugins/Dash/cardcreator/3.res+24−7
@@ -40,13 +40,30 @@ Item {
4040 height: 1;
4141 hideSource: doShapeItem;
4242 }
43− UbuntuShape {
44− id: artShapeShape;
45− source: artShapeSource;
43+ Loader {
4644 anchors.fill: parent;
47− visible: doShapeItem;
48− radius: "medium";
49− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
45+ visible: artShape.doShapeItem;
46+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
47+ Component {
48+ id: artShapeShapeComponent;
49+ UbuntuShape {
50+ source: artShapeSource;
51+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
52+ radius: "medium";
53+ aspect: {
54+ switch (root.artShapeStyle) {
55+ case "inset": return UbuntuShape.Inset;
56+ case "shadow": return UbuntuShape.DropShadow;
57+ default:
58+ case "flat": return UbuntuShape.Flat;
59+ }
60+ }
61+ }
62+ }
63+ Component {
64+ id: artShapeIconComponent;
65+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
66+ }
5067 }
5168 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
5269 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
@@ -115,7 +132,7 @@ UbuntuShape {
115132 id: touchdown;
116133 objectName: "touchdown";
117134 anchors { fill: artShapeHolder }
118− visible: root.pressed;
135+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
119136 radius: "medium";
120137 borderSource: "radius_pressed.sci"
121138}
tests/plugins/Dash/cardcreator/4.res+1−1
@@ -105,7 +105,7 @@ UbuntuShape {
105105 id: touchdown;
106106 objectName: "touchdown";
107107 anchors { fill: root }
108− visible: root.pressed;
108+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
109109 radius: "medium";
110110 borderSource: "radius_pressed.sci"
111111}
tests/plugins/Dash/cardcreator/5.res+24−7
@@ -40,13 +40,30 @@ Item {
4040 height: 1;
4141 hideSource: doShapeItem;
4242 }
43− UbuntuShape {
44− id: artShapeShape;
45− source: artShapeSource;
43+ Loader {
4644 anchors.fill: parent;
47− visible: doShapeItem;
48− radius: "medium";
49− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
45+ visible: artShape.doShapeItem;
46+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
47+ Component {
48+ id: artShapeShapeComponent;
49+ UbuntuShape {
50+ source: artShapeSource;
51+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
52+ radius: "medium";
53+ aspect: {
54+ switch (root.artShapeStyle) {
55+ case "inset": return UbuntuShape.Inset;
56+ case "shadow": return UbuntuShape.DropShadow;
57+ default:
58+ case "flat": return UbuntuShape.Flat;
59+ }
60+ }
61+ }
62+ }
63+ Component {
64+ id: artShapeIconComponent;
65+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
66+ }
5067 }
5168 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
5269 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
@@ -134,7 +151,7 @@ UbuntuShape {
134151 id: touchdown;
135152 objectName: "touchdown";
136153 anchors { fill: artShapeHolder }
137− visible: root.pressed;
154+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
138155 radius: "medium";
139156 borderSource: "radius_pressed.sci"
140157}
tests/plugins/Dash/cardcreator/6.res+1−1
@@ -113,7 +113,7 @@ UbuntuShape {
113113 id: touchdown;
114114 objectName: "touchdown";
115115 anchors { fill: backgroundLoader }
116− visible: root.pressed;
116+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
117117 radius: "medium";
118118 borderSource: "radius_pressed.sci"
119119}
tests/plugins/Dash/cardcreator/7.res+1−1
@@ -137,7 +137,7 @@ UbuntuShape {
137137 id: touchdown;
138138 objectName: "touchdown";
139139 anchors { fill: backgroundLoader }
140− visible: root.pressed;
140+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
141141 radius: "medium";
142142 borderSource: "radius_pressed.sci"
143143}
tests/plugins/Dash/cardcreator/8.res+7−7
@@ -92,12 +92,12 @@ left: parent.left;
9292 ]
9393 }
9494UbuntuShape {
95− id: touchdown;
96− objectName: "touchdown";
97− anchors { fill: backgroundLoader }
98− visible: root.pressed;
99− radius: "medium";
100− borderSource: "radius_pressed.sci"
101− }
95+ id: touchdown;
96+ objectName: "touchdown";
97+ anchors { fill: backgroundLoader }
98+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
99+ radius: "medium";
100+ borderSource: "radius_pressed.sci"
101+}
102102implicitHeight: row.y + row.height + units.gu(1);
103103}