on xenial help sign in
Make the card sizes a bit dependant on the total of gu of the dash
commit879503f4ac1c0eb5f737179dcd7da712d7fbdb4a authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 3 Jul 2015, 16:24 (11 years ago) parentf8d5c56
2 files changed+22−6
qml/Dash/CardTool.qml+15−6 qml/Dash/GenericScopeView.qml+7
qml/Dash/CardTool.qml+15−6
@@ -80,16 +80,25 @@ Item {
8080
8181 If undefined, should use implicit width of the actual card.
8282 */
83− readonly property var cardWidth: {
83+ property var cardWidth: {
8484 switch (categoryLayout) {
8585 case "grid":
8686 case "vertical-journal":
87− if (template["card-layout"] === "horizontal") return units.gu(38);
88− switch (template["card-size"]) {
89− case "small": return units.gu(12);
90− case "large": return units.gu(38);
87+ var size = template["card-size"];
88+ if (template["card-layout"] === "horizontal") size = "large";
89+ switch (size) {
90+ case "small": {
91+ if (viewWidth <= units.gu(45)) return units.gu(12);
92+ else return units.gu(14);
93+ }
94+ case "large": {
95+ if (viewWidth >= units.gu(70)) return units.gu(42);
96+ else return viewWidth - units.gu(2);
97+ }
9198 }
92− return units.gu(18.5);
99+ if (viewWidth <= units.gu(45)) return units.gu(18);
100+ else if (viewWidth >= units.gu(70)) return units.gu(20);
101+ else return units.gu(23);
93102 case "carousel":
94103 case "horizontal-list":
95104 return carouselTool.minimumTileWidth;
qml/Dash/GenericScopeView.qml+7
@@ -332,6 +332,13 @@ FocusScope {
332332 updateRanges();
333333 if (scope && scope.id === "clickscope" && (categoryId === "predefined" || categoryId === "local")) {
334334 // Yeah, hackish :/
335+ if (scopeView.width > units.gu(45)) {
336+ if (scopeView.width >= units.gu(70)) {
337+ cardTool.cardWidth = units.gu(9);
338+ } else {
339+ cardTool.cardWidth = units.gu(10);
340+ }
341+ }
335342 cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5));
336343 }
337344 item.cardTool = cardTool;