on xenial help sign in
Simplify the Tiles.
9f9ab4cMichał Sawicz
Components/Tile.qml+4−3
@@ -19,12 +19,13 @@ import Ubuntu.Components 0.1
19
19
20AbstractButton {
20AbstractButton {
21 property url source
21 property url source
22− property int fillMode
22+ property int fillMode: Image.PreserveAspectCrop
23− property int horizontalAlignment
23+ property int horizontalAlignment: Image.AlignHCenter
24− property int verticalAlignment
24+ property int verticalAlignment: Image.AlignVCenter
25 property string text
25 property string text
26 property int imageWidth
26 property int imageWidth
27 property int imageHeight
27 property int imageHeight
28+ property int maximumLineCount: 1
28
29
29 style: TileStyle {}
30 style: TileStyle {}
30}
31}
Components/TileStyle.qml+16−23
@@ -55,33 +55,26 @@ Item {
55 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
55 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
56 }
56 }
57
57
58− Item {
58+ Label {
59+ id: label
60+ objectName: "label"
59 anchors {
61 anchors {
62+ baseline: icon.bottom
63+ baselineOffset: units.gu(2)
60 left: parent.left
64 left: parent.left
61 right: parent.right
65 right: parent.right
62− top: icon.bottom
66+ leftMargin: units.gu(1)
67+ rightMargin: units.gu(1)
63 }
68 }
64− height: units.gu(2)
65
69
66− Label {
67− id: label
68− objectName: "label"
69− anchors {
70− baseline: parent.bottom
71− left: parent.left
72− right: parent.right
73− leftMargin: units.gu(1)
74− rightMargin: units.gu(1)
75− }
76−
77− color: Theme.palette.selected.backgroundText
70+ color: Theme.palette.selected.backgroundText
78− opacity: 0.9
71+ opacity: 0.9
79− style: Text.Raised
72+ style: Text.Raised
80− styleColor: "black"
73+ styleColor: "black"
81− fontSize: "small"
74+ fontSize: "small"
82− elide: Text.ElideMiddle
75+ elide: Text.ElideMiddle
83− horizontalAlignment: Text.AlignHCenter
76+ horizontalAlignment: Text.AlignHCenter
84− text: styledItem.text
77+ text: styledItem.text
85− }
78+ maximumLineCount: styledItem.maximumLineCount
86 }
79 }
87}
80}
Dash/Generic/FlatTileStyle.qml+16−23
@@ -53,33 +53,26 @@ Item {
53 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
53 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
54 }
54 }
55
55
56− Item {
56+ Label {
57+ id: label
58+ objectName: "label"
57 anchors {
59 anchors {
60+ baseline: icon.bottom
61+ baselineOffset: units.gu(2)
58 left: parent.left
62 left: parent.left
59 right: parent.right
63 right: parent.right
60− top: icon.bottom
64+ leftMargin: units.gu(1)
65+ rightMargin: units.gu(1)
61 }
66 }
62− height: units.gu(2)
63
67
64− Label {
65− id: label
66− objectName: "label"
67− anchors {
68− baseline: parent.bottom
69− left: parent.left
70− right: parent.right
71− leftMargin: units.gu(1)
72− rightMargin: units.gu(1)
73− }
74−
75− color: Theme.palette.selected.backgroundText
68+ color: Theme.palette.selected.backgroundText
76− opacity: 0.9
69+ opacity: 0.9
77− style: Text.Raised
70+ style: Text.Raised
78− styleColor: "black"
71+ styleColor: "black"
79− fontSize: "small"
72+ fontSize: "small"
80− elide: Text.ElideMiddle
73+ elide: Text.ElideMiddle
81− horizontalAlignment: Text.AlignHCenter
74+ horizontalAlignment: Text.AlignHCenter
82− text: styledItem.text
75+ text: styledItem.text
83− }
76+ maximumLineCount: styledItem.maximumLineCount
84 }
77 }
85}
78}
Dash/Generic/WeatherFilterGrid.qml+3
@@ -21,6 +21,8 @@ import "../../Components"
21GenericFilterGrid {
21GenericFilterGrid {
22 id: filtergrid
22 id: filtergrid
23
23
24+ delegateHeight: units.gu(11.5)
25+
24 delegate: Tile {
26 delegate: Tile {
25 id: tile
27 id: tile
26 objectName: "delegate" + index
28 objectName: "delegate" + index
@@ -31,6 +33,7 @@ GenericFilterGrid {
31 imageHeight: filtergrid.iconHeight
33 imageHeight: filtergrid.iconHeight
32 source: model.icon
34 source: model.icon
33 fillMode: Image.PreserveAspectCrop
35 fillMode: Image.PreserveAspectCrop
36+ maximumLineCount: 2
34
37
35 style: FlatTileStyle {}
38 style: FlatTileStyle {}
36
39