on xenial help sign in
Shadows in launcher and dash using UbuntuShapeIcon
7f706a0Andrea Cimitan
plugins/Dash/CardCreator.js+24−7
@@ -78,13 +78,30 @@ var kArtShapeHolderCode = 'Item { \n\
78 height: 1; \n\
78 height: 1; \n\
79 hideSource: doShapeItem; \n\
79 hideSource: doShapeItem; \n\
80 } \n\
80 } \n\
81− UbuntuShape { \n\
81+ Loader { \n\
82− id: artShapeShape; \n\
83− source: artShapeSource; \n\
84 anchors.fill: parent; \n\
82 anchors.fill: parent; \n\
85− visible: doShapeItem; \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\
86− radius: "medium"; \n\
90+ radius: "medium"; \n\
91+ aspect: { \n\
92+ switch (root.artShapeStyle) { \n\
87− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat; \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\
88 } \n\
105 } \n\
89 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
106 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
90 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
107 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
@@ -236,7 +253,7 @@ var kTouchdownCode = 'UbuntuShape { \n\
236 id: touchdown; \n\
253 id: touchdown; \n\
237 objectName: "touchdown"; \n\
254 objectName: "touchdown"; \n\
238 anchors { %1 } \n\
255 anchors { %1 } \n\
239− visible: root.pressed; \n\
256+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; \n\
240 radius: "medium"; \n\
257 radius: "medium"; \n\
241 borderSource: "radius_pressed.sci" \n\
258 borderSource: "radius_pressed.sci" \n\
242 }\n';
259 }\n';
qml/Dash/CardCarousel.qml+1−10
@@ -68,18 +68,9 @@ DashRenderer {
68 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
68 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
69 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
69 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
70 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
70 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
71− item.artShapeStyle = "flat";
71+ item.artShapeStyle = "shadow";
72 item.scopeStyle = cardCarousel.scopeStyle;
72 item.scopeStyle = cardCarousel.scopeStyle;
73 }
73 }
74−
75− BorderImage {
76− anchors {
77− fill: parent
78− margins: -units.gu(1)
79− }
80− z: -1
81− source: "graphics/carousel_dropshadow.sci"
82− }
83 }
74 }
84 }
75 }
85}
76}
qml/Dash/CardGrid.qml+2
@@ -24,6 +24,7 @@ DashRenderer {
24 if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
24 if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
25 return cardTool.template["collapsed-rows"];
25 return cardTool.template["collapsed-rows"];
26 }
26 }
27+ property string artShapeStyle: "inset";
27
28
28 expandedHeight: grid.totalContentHeight
29 expandedHeight: grid.totalContentHeight
29 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight)
30 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight)
@@ -69,6 +70,7 @@ DashRenderer {
69 item.components = Qt.binding(function() { return cardTool.components; });
70 item.components = Qt.binding(function() { return cardTool.components; });
70 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
71 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
71 item.scopeStyle = root.scopeStyle;
72 item.scopeStyle = root.scopeStyle;
73+ item.artShapeStyle = root.artShapeStyle;
72 }
74 }
73 Connections {
75 Connections {
74 target: loader.item
76 target: loader.item
qml/Dash/GenericScopeView.qml+1
@@ -370,6 +370,7 @@ FocusScope {
370 }
370 }
371 }
371 }
372 cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5));
372 cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5));
373+ item.artShapeStyle = "icon";
373 }
374 }
374 item.cardTool = cardTool;
375 item.cardTool = cardTool;
375 }
376 }
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 {
125 height: parent.itemHeight + units.gu(1)
125 height: parent.itemHeight + units.gu(1)
126 anchors.centerIn: parent
126 anchors.centerIn: parent
127
127
128− UbuntuShape {
128+ ProportionalShape {
129 id: iconShape
129 id: iconShape
130− anchors.fill: parent
130+ anchors.centerIn: parent
131− anchors.margins: units.gu(1)
131+ width: parent.width - units.gu(2)
132− radius: "medium"
133− aspect: UbuntuShape.Flat
132+ aspect: UbuntuShape.DropShadow
134− sourceFillMode: UbuntuShape.PreserveAspectCrop
135 source: Image {
133 source: Image {
136 id: iconImage
134 id: iconImage
137 sourceSize.width: iconShape.width
135 sourceSize.width: iconShape.width
@@ -140,14 +138,6 @@ Item {
140 }
138 }
141 }
139 }
142
140
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−
151 UbuntuShape {
141 UbuntuShape {
152 id: countEmblem
142 id: countEmblem
153 objectName: "countEmblem"
143 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
47 ResultsModel *resultsModel = resultModel(index.row());
47 ResultsModel *resultsModel = resultModel(index.row());
48 switch (role) {
48 switch (role) {
49 case RoleCategoryId:
49 case RoleCategoryId:
50+ if (index.row() == 6) {
51+ return QString("predefined");
52+ } else if (index.row() == 8) {
53+ return QString("local");
54+ } else {
50− return QString("%1").arg(index.row());
55+ return QString("%1").arg(index.row());
56+ }
51 case RoleName:
57 case RoleName:
52 return QString("Category %1").arg(index.row());
58 return QString("Category %1").arg(index.row());
53 case RoleIcon:
59 case RoleIcon:
tests/plugins/Dash/cardcreator/1.res+24−7
@@ -40,13 +40,30 @@ Item {
40 height: 1;
40 height: 1;
41 hideSource: doShapeItem;
41 hideSource: doShapeItem;
42 }
42 }
43− UbuntuShape {
43+ Loader {
44− id: artShapeShape;
45− source: artShapeSource;
46 anchors.fill: parent;
44 anchors.fill: parent;
47− visible: doShapeItem;
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;
48− radius: "medium";
52+ radius: "medium";
53+ aspect: {
54+ switch (root.artShapeStyle) {
49− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
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+ }
50 }
67 }
51 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
68 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
52 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
69 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
@@ -97,7 +114,7 @@ UbuntuShape {
97 id: touchdown;
114 id: touchdown;
98 objectName: "touchdown";
115 objectName: "touchdown";
99 anchors { fill: artShapeHolder }
116 anchors { fill: artShapeHolder }
100− visible: root.pressed;
117+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
101 radius: "medium";
118 radius: "medium";
102 borderSource: "radius_pressed.sci"
119 borderSource: "radius_pressed.sci"
103}
120}
tests/plugins/Dash/cardcreator/2.res+1−1
@@ -124,7 +124,7 @@ UbuntuShape {
124 id: touchdown;
124 id: touchdown;
125 objectName: "touchdown";
125 objectName: "touchdown";
126 anchors { fill: backgroundLoader }
126 anchors { fill: backgroundLoader }
127− visible: root.pressed;
127+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
128 radius: "medium";
128 radius: "medium";
129 borderSource: "radius_pressed.sci"
129 borderSource: "radius_pressed.sci"
130}
130}
tests/plugins/Dash/cardcreator/3.res+24−7
@@ -40,13 +40,30 @@ Item {
40 height: 1;
40 height: 1;
41 hideSource: doShapeItem;
41 hideSource: doShapeItem;
42 }
42 }
43− UbuntuShape {
43+ Loader {
44− id: artShapeShape;
45− source: artShapeSource;
46 anchors.fill: parent;
44 anchors.fill: parent;
47− visible: doShapeItem;
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;
48− radius: "medium";
52+ radius: "medium";
53+ aspect: {
54+ switch (root.artShapeStyle) {
49− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
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+ }
50 }
67 }
51 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
68 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
52 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
69 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
@@ -115,7 +132,7 @@ UbuntuShape {
115 id: touchdown;
132 id: touchdown;
116 objectName: "touchdown";
133 objectName: "touchdown";
117 anchors { fill: artShapeHolder }
134 anchors { fill: artShapeHolder }
118− visible: root.pressed;
135+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
119 radius: "medium";
136 radius: "medium";
120 borderSource: "radius_pressed.sci"
137 borderSource: "radius_pressed.sci"
121}
138}
tests/plugins/Dash/cardcreator/4.res+1−1
@@ -105,7 +105,7 @@ UbuntuShape {
105 id: touchdown;
105 id: touchdown;
106 objectName: "touchdown";
106 objectName: "touchdown";
107 anchors { fill: root }
107 anchors { fill: root }
108− visible: root.pressed;
108+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
109 radius: "medium";
109 radius: "medium";
110 borderSource: "radius_pressed.sci"
110 borderSource: "radius_pressed.sci"
111}
111}
tests/plugins/Dash/cardcreator/5.res+24−7
@@ -40,13 +40,30 @@ Item {
40 height: 1;
40 height: 1;
41 hideSource: doShapeItem;
41 hideSource: doShapeItem;
42 }
42 }
43− UbuntuShape {
43+ Loader {
44− id: artShapeShape;
45− source: artShapeSource;
46 anchors.fill: parent;
44 anchors.fill: parent;
47− visible: doShapeItem;
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;
48− radius: "medium";
52+ radius: "medium";
53+ aspect: {
54+ switch (root.artShapeStyle) {
49− aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
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+ }
50 }
67 }
51 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
68 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
52 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
69 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
@@ -134,7 +151,7 @@ UbuntuShape {
134 id: touchdown;
151 id: touchdown;
135 objectName: "touchdown";
152 objectName: "touchdown";
136 anchors { fill: artShapeHolder }
153 anchors { fill: artShapeHolder }
137− visible: root.pressed;
154+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
138 radius: "medium";
155 radius: "medium";
139 borderSource: "radius_pressed.sci"
156 borderSource: "radius_pressed.sci"
140}
157}
tests/plugins/Dash/cardcreator/6.res+1−1
@@ -113,7 +113,7 @@ UbuntuShape {
113 id: touchdown;
113 id: touchdown;
114 objectName: "touchdown";
114 objectName: "touchdown";
115 anchors { fill: backgroundLoader }
115 anchors { fill: backgroundLoader }
116− visible: root.pressed;
116+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
117 radius: "medium";
117 radius: "medium";
118 borderSource: "radius_pressed.sci"
118 borderSource: "radius_pressed.sci"
119}
119}
tests/plugins/Dash/cardcreator/7.res+1−1
@@ -137,7 +137,7 @@ UbuntuShape {
137 id: touchdown;
137 id: touchdown;
138 objectName: "touchdown";
138 objectName: "touchdown";
139 anchors { fill: backgroundLoader }
139 anchors { fill: backgroundLoader }
140− visible: root.pressed;
140+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
141 radius: "medium";
141 radius: "medium";
142 borderSource: "radius_pressed.sci"
142 borderSource: "radius_pressed.sci"
143}
143}
tests/plugins/Dash/cardcreator/8.res+7−7
@@ -92,12 +92,12 @@ left: parent.left;
92 ]
92 ]
93 }
93 }
94UbuntuShape {
94UbuntuShape {
95− id: touchdown;
95+ id: touchdown;
96− objectName: "touchdown";
96+ objectName: "touchdown";
97− anchors { fill: backgroundLoader }
97+ anchors { fill: backgroundLoader }
98− visible: root.pressed;
98+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
99− radius: "medium";
99+ radius: "medium";
100− borderSource: "radius_pressed.sci"
100+ borderSource: "radius_pressed.sci"
101− }
101+}
102implicitHeight: row.y + row.height + units.gu(1);
102implicitHeight: row.y + row.height + units.gu(1);
103}
103}