on xenial help sign in
Add support and test for the new layout in CardTool.
commitf2a55dc1f8f27aa5337791ec52245f2bcac55665 authorMichał Sawicz <michal.sawicz@canonical.com> dateMon 11 Aug 2014, 13:10 (12 years ago) parentc94ad4b
2 files changed+8
qml/Dash/CardTool.qml+2 tests/qmltests/Dash/tst_CardTool.qml+6
qml/Dash/CardTool.qml+2
@@ -91,6 +91,7 @@ Item {
9191 }
9292 return units.gu(18.5);
9393 case "carousel":
94+ case "horizontal-list":
9495 return carouselTool.minimumTileWidth;
9596 case undefined:
9697 case "organic-grid":
@@ -111,6 +112,7 @@ Item {
111112 if (template["card-size"] >= 12 && template["card-size"] <= 38) return units.gu(template["card-size"]);
112113 return units.gu(18.5);
113114 case "grid":
115+ case "horizontal-list":
114116 return cardLoader.item ? cardLoader.item.implicitHeight : 0
115117 case "carousel":
116118 return cardWidth / (components ? components["art"]["aspect-ratio"] : 1)
tests/qmltests/Dash/tst_CardTool.qml+6
@@ -163,6 +163,7 @@ Rectangle {
163163 { label: "Horizontal Journal", layout: "journal" },
164164 { label: "Vertical Journal", layout: "vertical-journal" },
165165 { label: "Carousel", layout: "carousel" },
166+ { label: "Horizontal List", layout: "horizontal-list" },
166167 ]
167168 delegate: OptionSelectorDelegate { text: modelData.label }
168169 onSelectedIndexChanged: {
@@ -226,6 +227,7 @@ Rectangle {
226227 case "journal": layoutSelector.selectedIndex = 2; break;
227228 case "vertical-journal": layoutSelector.selectedIndex = 3; break;
228229 case "carousel": layoutSelector.selectedIndex = 4; break;
230+ case "horizontal-list": layoutSelector.selectedIndex = 5; break;
229231 case "grid":
230232 default: layoutSelector.selectedIndex = 0; break;
231233 }
@@ -270,6 +272,10 @@ Rectangle {
270272 { tag: "MediumCarousel", width: units.gu(22), height: units.gu(22), viewWidth: 84, index: 0, layout_index: 4},
271273 { tag: "LargeCarousel", width: units.gu(26), height: units.gu(26), viewWidth: 140, index: 0, layout_index: 4},
272274 { tag: "PortraitCarousel", width: units.gu(22), height: units.gu(44), viewWidth: 84, index: 10, layout_index: 4},
275+ { tag: "SmallHorizontalList", width: units.gu(18), height: units.gu(39.5), viewWidth: 30, index: 0, layout_index: 5},
276+ { tag: "MediumHorizontalList", width: units.gu(22), height: units.gu(43.5), viewWidth: 84, index: 0, layout_index: 5},
277+ { tag: "LargeHorizontalList", width: units.gu(26), height: units.gu(47.5), viewWidth: 140, index: 0, layout_index: 5},
278+ { tag: "PortraitHorizontalList", width: units.gu(22), height: units.gu(65.5), viewWidth: 84, index: 10, layout_index: 5},
273279 ]
274280 }
275281