on xenial help sign in
Add shadows
1bc5ffdAndrea 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+ UbuntuShapeIcon { source: artShapeSource; } \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/Components/ResponsiveGridView.qml+1
@@ -50,6 +50,7 @@ Item {
50 property alias highlightIndex: gridView.highlightIndex
50 property alias highlightIndex: gridView.highlightIndex
51 property alias cacheBuffer: gridView.cacheBuffer
51 property alias cacheBuffer: gridView.cacheBuffer
52 readonly property alias currentItem: gridView.currentItem
52 readonly property alias currentItem: gridView.currentItem
53+ property alias topMargin: gridView.topMargin
53
54
54 function contentHeightForRows(rows, height) {
55 function contentHeightForRows(rows, height) {
55 return rows * height
56 return rows * height
qml/Dash/CardCarousel.qml+1−10
@@ -64,18 +64,9 @@ DashRenderer {
64 item.components = Qt.binding(function() { return cardTool.components; });
64 item.components = Qt.binding(function() { return cardTool.components; });
65 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
65 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
66 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
66 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
67− item.artShapeStyle = "flat";
67+ item.artShapeStyle = "shadow";
68 item.scopeStyle = cardCarousel.scopeStyle;
68 item.scopeStyle = cardCarousel.scopeStyle;
69 }
69 }
70−
71− BorderImage {
72− anchors {
73− fill: parent
74− margins: -units.gu(1)
75− }
76− z: -1
77− source: "graphics/carousel_dropshadow.sci"
78− }
79 }
70 }
80 }
71 }
81}
72}
qml/Dash/CardGrid.qml+5−1
@@ -24,7 +24,9 @@ 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−
27+ // hackish, relies on GenericScopeView.qml:335 tweak to detect application icons in click scope
28+ readonly property var artShapeStyle: cardTool.artShapeSize === Qt.size(units.gu(8), units.gu(7.5)) ? "icon" : "inset";
29+
28 expandedHeight: grid.totalContentHeight
30 expandedHeight: grid.totalContentHeight
29 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight)
31 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight)
30 collapsedItemCount: collapsedRows * grid.columns
32 collapsedItemCount: collapsedRows * grid.columns
@@ -52,6 +54,7 @@ DashRenderer {
52 displayMarginEnd: root.displayMarginEnd
54 displayMarginEnd: root.displayMarginEnd
53 cacheBuffer: root.cacheBuffer
55 cacheBuffer: root.cacheBuffer
54 interactive: false
56 interactive: false
57+ topMargin: root.artShapeStyle === "icon" ? units.gu(0.1) : 0 // otherwise when we have a shadow, its top is clipped
55 delegate: Item {
58 delegate: Item {
56 width: grid.cellWidth
59 width: grid.cellWidth
57 height: grid.cellHeight
60 height: grid.cellHeight
@@ -69,6 +72,7 @@ DashRenderer {
69 item.components = Qt.binding(function() { return cardTool.components; });
72 item.components = Qt.binding(function() { return cardTool.components; });
70 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
73 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
71 item.scopeStyle = root.scopeStyle;
74 item.scopeStyle = root.scopeStyle;
75+ item.artShapeStyle = root.artShapeStyle;
72 }
76 }
73 Connections {
77 Connections {
74 target: loader.item
78 target: loader.item
qml/Launcher/LauncherDelegate.qml+3−14
@@ -46,13 +46,10 @@ Item {
46 height: parent.itemHeight + units.gu(1)
46 height: parent.itemHeight + units.gu(1)
47 anchors.centerIn: parent
47 anchors.centerIn: parent
48
48
49− UbuntuShape {
49+ UbuntuShapeIcon {
50 id: iconShape
50 id: iconShape
51− anchors.fill: parent
51+ anchors.centerIn: parent
52− anchors.margins: units.gu(1)
52+ width: parent.width - units.gu(2);
53− radius: "medium"
54− aspect: UbuntuShape.Flat
55− sourceFillMode: UbuntuShape.PreserveAspectCrop
56 source: Image {
53 source: Image {
57 id: iconImage
54 id: iconImage
58 sourceSize.width: iconShape.width
55 sourceSize.width: iconShape.width
@@ -61,14 +58,6 @@ Item {
61 }
58 }
62 }
59 }
63
60
64− BorderImage {
65− id: itemGlow
66− anchors.centerIn: iconItem
67− source: "graphics/icon-top-highlight.png"
68− width: root.itemWidth - units.gu(1)
69− height: root.itemHeight - units.gu(1)
70− }
71−
72 UbuntuShape {
61 UbuntuShape {
73 id: countEmblem
62 id: countEmblem
74 objectName: "countEmblem"
63 objectName: "countEmblem"
tests/mocks/Unity/fake_categories.cpp+5−1
@@ -52,7 +52,11 @@ Categories::data(const QModelIndex& index, int role) const
52 ResultsModel *resultsModel = resultModel(index.row());
52 ResultsModel *resultsModel = resultModel(index.row());
53 switch (role) {
53 switch (role) {
54 case RoleCategoryId:
54 case RoleCategoryId:
55+ if (index.row() == 0) {
55− return QString("%1").arg(index.row());
56+ return QString("predefined");
57+ } else if (index.row() == 2) {
58+ return QString("local");
59+ }
56 case RoleName:
60 case RoleName:
57 return QString("Category %1").arg(index.row());
61 return QString("Category %1").arg(index.row());
58 case RoleIcon:
62 case RoleIcon: