@@ -41,11 +41,6 @@ Item {
42 property real viewWidth
42 property real viewWidth
45− \brief Scaling factor of selected Carousel item.
47− readonly property real carouselSelectedItemScaleFactor: 1.38 // XXX assuming 1.38 carousel scaling factor for cards
50 \brief Template supplied for the category.
45 \brief Template supplied for the category.
@@ -56,10 +51,25 @@ Item {
57 property var components
52 property var components
55+ \brief The Scope this cardTool is representing
57+ property string scopeId
60+ \brief The Scope category this cardTool is representing
62+ property string categoryId
65+ \brief Scaling factor of selected Carousel item.
67+ readonly property real carouselSelectedItemScaleFactor: 1.38 // XXX assuming 1.38 carousel scaling factor for cards
60 \brief The category layout for this card tool.
70 \brief The category layout for this card tool.
62− property string categoryLayout: {
72+ readonly property string categoryLayout: {
63 var layout = template["category-layout"];
73 var layout = template["category-layout"];
65 // carousel fallback mode to grid
75 // carousel fallback mode to grid
@@ -67,9 +77,17 @@ Item {
67 return layout;
77 return layout;
80+ readonly property bool isAppLikeScope: scopeId === "clickscope" || scopeId === "libertine-scope.ubuntu_libertine-scope"
81+ readonly property bool isAppLikeScopeAppCategory: ((scopeId === "clickscope" && (categoryId === "predefined" || categoryId === "local"))
82+ || (scopeId === "libertine-scope.ubuntu_libertine-scope" && categoryId !== "hint"))
71− // Not readonly because gets overwritten from GenericScopeView in some cases
84+ readonly property string artShapeStyle: {
85+ if (isAppLikeScope) {
86+ return isAppLikeScopeAppCategory ? "icon" : "flat";
72− property string artShapeStyle: categoryLayout === "carousel" ? "shadow" : "inset"
88+ return categoryLayout === "carousel" ? "shadow" : "inset"
74 // FIXME ? This seems like it should not be needed, but on Qt 5.4 + phone
92 // FIXME ? This seems like it should not be needed, but on Qt 5.4 + phone
75 // we are doing unneeded calls to getCardComponent with artShapeStyle and categoryLayout being empty
93 // we are doing unneeded calls to getCardComponent with artShapeStyle and categoryLayout being empty
@@ -90,12 +108,31 @@ Item {
90 height: 0
108 height: 0
91 clip: true
109 clip: true
111+ // We have 3 view "widths"
115+ readonly property bool isWideView: viewWidth >= units.gu(70)
116+ readonly property bool isNarrowView: viewWidth <= units.gu(45)
94 type:real \brief Width to be enforced on the card in this configuration.
119 type:real \brief Width to be enforced on the card in this configuration.
96 If -1, should use implicit width of the actual card.
121 If -1, should use implicit width of the actual card.
98− property real cardWidth: {
123+ readonly property real cardWidth: {
124+ if (isAppLikeScopeAppCategory) {
125+ if (!isNarrowView) {
127+ return units.gu(11);
129+ return units.gu(10);
132+ return units.gu(12);
99 switch (categoryLayout) {
136 switch (categoryLayout) {
100 case "grid":
137 case "grid":
101 case "vertical-journal":
138 case "vertical-journal":
@@ -103,16 +140,16 @@ Item {
103 if (template["card-layout"] === "horizontal") size = "large";
140 if (template["card-layout"] === "horizontal") size = "large";
104 switch (size) {
141 switch (size) {
105 case "small": {
142 case "small": {
106− if (viewWidth <= units.gu(45)) return units.gu(12);
143+ if (isNarrowView) return units.gu(12);
107 else return units.gu(14);
144 else return units.gu(14);
109 case "large": {
146 case "large": {
110− if (viewWidth >= units.gu(70)) return units.gu(42);
147+ if (isWideView) return units.gu(42);
111 else return viewWidth - units.gu(2);
148 else return viewWidth - units.gu(2);
114− if (viewWidth <= units.gu(45)) return units.gu(18);
151+ if (isNarrowView) return units.gu(18);
115− else if (viewWidth >= units.gu(70)) return units.gu(20);
152+ else if (isWideView) return units.gu(20);
116 else return units.gu(23);
153 else return units.gu(23);
117 case "carousel":
154 case "carousel":
118 case "horizontal-list":
155 case "horizontal-list":
@@ -152,12 +189,19 @@ Item {
152 type:real \brief Height of the card's header.
189 type:real \brief Height of the card's header.
154 readonly property int headerHeight: cardLoader.item ? cardLoader.item.headerHeight : 0
191 readonly property int headerHeight: cardLoader.item ? cardLoader.item.headerHeight : 0
193+ readonly property size artShapeSize: {
194+ if (isAppLikeScopeAppCategory) {
195+ return Qt.size(units.gu(8), units.gu(7.5));
155− property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : Qt.size(0, 0)
197+ return cardLoader.item ? cardLoader.item.artShapeSize : Qt.size(0, 0)
157 QtObject {
201 QtObject {
158 id: carouselTool
202 id: carouselTool
160− property real minimumTileWidth: {
204+ readonly property real minimumTileWidth: {
161 if (cardTool.viewWidth === undefined) return undefined;
205 if (cardTool.viewWidth === undefined) return undefined;
162 if (cardTool.viewWidth <= units.gu(40)) return units.gu(18);
206 if (cardTool.viewWidth <= units.gu(40)) return units.gu(18);
163 if (cardTool.viewWidth >= units.gu(128)) return units.gu(26);
207 if (cardTool.viewWidth >= units.gu(128)) return units.gu(26);
@@ -166,7 +210,7 @@ Item {
167 readonly property real pathItemCount: 4.8457 /// (848 / 175) reference values
211 readonly property real pathItemCount: 4.8457 /// (848 / 175) reference values
169− property real realPathItemCount: {
213+ readonly property real realPathItemCount: {
170 var scaledMinimumTileWidth = minimumTileWidth / cardTool.carouselSelectedItemScaleFactor;
214 var scaledMinimumTileWidth = minimumTileWidth / cardTool.carouselSelectedItemScaleFactor;
171 var tileWidth = Math.max(cardTool.viewWidth / pathItemCount, scaledMinimumTileWidth);
215 var tileWidth = Math.max(cardTool.viewWidth / pathItemCount, scaledMinimumTileWidth);
172 return Math.min(cardTool.viewWidth / tileWidth, pathItemCount);
216 return Math.min(cardTool.viewWidth / tileWidth, pathItemCount);