on xenial help sign in
ListItem reworks to match the visuals from design
commit6dc4854a3731aa05cab0e9b6ed56dd1c49241daa authorAlbert Astals Cid <albert.astals@canonical.com> dateTue 10 Nov 2015, 15:32 (11 years ago) parentc215251
5 files changed+74−47
qml/Dash/DashNavigation.qml−12 qml/Dash/DashNavigationHeader.qml+1−3 qml/Dash/DashNavigationList.qml+30−19 qml/Dash/GenericScopeView.qml−1 qml/Dash/PageHeaderExtraPanel.qml+43−12
qml/Dash/DashNavigation.qml−12
@@ -24,7 +24,6 @@ Item {
2424
2525 // set by parent
2626 property var scope: null
27− property var scopeStyle: null
2827 property real availableHeight
2928
3029 signal leafClicked()
@@ -43,13 +42,6 @@ Item {
4342 }
4443 }
4544
46− QtObject {
47− id: d
48− readonly property color foregroundColor: root.scopeStyle
49− ? root.scopeStyle.getTextColor(backgroundItem.luminance)
50− : theme.palette.normal.baseText
51− }
52−
5345 Column {
5446 id: headersColumn
5547 anchors {
@@ -86,7 +78,6 @@ Item {
8678
8779 backVisible: index != 0
8880 text: headerText
89− foregroundColor: d.foregroundColor
9081
9182 onBackClicked: {
9283 scope.setNavigationState(parentNavigationId);
@@ -143,9 +134,6 @@ Item {
143134 objectName: "navigation" + index
144135 visible: height > 0
145136 width: navigationListView.width
146− itemsIndent: index != 0 ? units.gu(5) : 0
147− scopeStyle: root.scopeStyle
148− foregroundColor: d.foregroundColor
149137 property real desiredHeight: {
150138 if (navigation && navigation.loaded && x == navigationListView.contentX)
151139 {
qml/Dash/DashNavigationHeader.qml+1−3
@@ -22,7 +22,6 @@ Row {
2222 id: root
2323
2424 property alias backVisible: backImageItem.visible
25− property alias foregroundColor: backImage.color
2625 property alias textEnabled: textItem.enabled
2726 property alias text: textLabel.text
2827
@@ -63,8 +62,7 @@ Row {
6362 leftMargin: backImageItem.visible ? 0 : units.gu(2)
6463 rightMargin: units.gu(2)
6564 }
66− font.bold: true
67− color: root.foregroundColor
65+ color: "#5D5D5D"
6866 wrapMode: Text.Wrap
6967 maximumLineCount: 2
7068 elide: Text.ElideMiddle
qml/Dash/DashNavigationList.qml+30−19
@@ -16,16 +16,12 @@
1616
1717import QtQuick 2.4
1818import Ubuntu.Components 1.3
19−import Ubuntu.Components.ListItems 1.3 as ListItem
2019import "../Components"
2120
2221Item {
2322 id: root
24− property real itemsIndent: 0
2523 property var navigation: null
2624 property var currentNavigation: null
27− property var scopeStyle: null
28− property color foregroundColor: theme.palette.normal.baseText
2925 signal enterNavigation(var newNavigationId, string newNavigationLabel, bool hasChildren)
3026
3127 readonly property int itemHeight: units.gu(5)
@@ -56,27 +52,42 @@ Item {
5652 Repeater {
5753 model: navigation && navigation.loaded ? navigation : null
5854 clip: true
59− delegate: ListItem.Standard {
55+ delegate: ListItem {
6056 objectName: root.objectName + "child" + index
6157 height: root.itemHeight
62− showDivider: index != navigation.count - 1
63− selected: isActive
64− anchors.left: parent.left
65− anchors.leftMargin: itemsIndent
66− anchors.right: parent.right
58+ width: parent.width
59+ anchors {
60+ left: parent.left
61+ right: parent.right
62+ leftMargin: units.gu(2)
63+ rightMargin: units.gu(2)
64+ }
6765
6866 onClicked: root.enterNavigation(navigationId, allLabel != "" ? allLabel : label, hasChildren)
6967
70− Label {
68+ Icon {
69+ id: leftIcon
7170 anchors {
7271 verticalCenter: parent.verticalCenter
7372 left: parent.left
74− leftMargin: itemsIndent > 0 ? 0 : units.gu(2)
75− right: rightIcon.visible ? rightIcon.left : parent.right
76− rightMargin: rightIcon.visible ? units.gu(0.5) : units.gu(2)
73+ }
74+ height: units.gu(2)
75+ width: height
76+ name: "tick"
77+ color: "#3EB34F"
78+ visible: isActive
79+ }
80+
81+ Label {
82+ anchors {
83+ verticalCenter: parent.verticalCenter
84+ left: leftIcon.right
85+ leftMargin: units.gu(1)
86+ right: rightIcon.left
87+ rightMargin: units.gu(2)
7788 }
7889 text: label
79− color: root.foregroundColor
90+ color: isActive ? "#333333" : "#888888"
8091 wrapMode: Text.Wrap
8192 maximumLineCount: 2
8293 elide: Text.ElideMiddle
@@ -87,14 +98,14 @@ Item {
8798 anchors {
8899 verticalCenter: parent.verticalCenter
89100 right: parent.right
90− rightMargin: units.gu(2)
91101 }
92102 height: units.gu(2)
93103 width: height
94− name: hasChildren ? "go-next" : "tick"
95− color: root.foregroundColor
96− visible: hasChildren || isActive
104+ name: "go-next"
105+ visible: hasChildren
97106 }
107+
108+ divider.visible: index != navigation.count - 1
98109 }
99110 }
100111 }
qml/Dash/GenericScopeView.qml−1
@@ -665,7 +665,6 @@ FocusScope {
665665
666666 searchHistory: SearchHistoryModel
667667 scope: scopeView.scope
668− scopeStyle: scopeView.scopeStyle
669668 windowHeight: scopeView.height
670669
671670 onHistoryItemClicked: {
qml/Dash/PageHeaderExtraPanel.qml+43−12
@@ -16,7 +16,7 @@
1616
1717import QtQuick 2.4
1818import Ubuntu.Components 1.3
19−import Ubuntu.Components.ListItems 1.3
19+import Ubuntu.Components.ListItems 1.3 as ListItems
2020import "Filters" as Filters
2121
2222Item {
@@ -24,12 +24,11 @@ Item {
2424
2525 readonly property real searchesHeight: recentSearchesRepeater.count > 0 ? searchColumn.height + recentSearchesLabels.height + recentSearchesLabels.anchors.margins : 0
2626
27− implicitHeight: searchesHeight + dashNavigation.implicitHeight + primaryFilter.height
27+ implicitHeight: searchesHeight + dashNavigation.implicitHeight + dashNavigation.anchors.topMargin + primaryFilter.height + primaryFilter.anchors.topMargin
2828
2929 // Set by parent
3030 property ListModel searchHistory
3131 property var scope: null
32− property var scopeStyle: null
3332 property real windowHeight
3433
3534 // Used by PageHeader
@@ -47,6 +46,10 @@ Item {
4746 anchors.fill: parent
4847 }
4948
49+ ListItems.ThinDivider {
50+ anchors.top: parent.top
51+ }
52+
5053 Label {
5154 id: recentSearchesLabels
5255 text: i18n.tr("Recent Searches")
@@ -54,7 +57,7 @@ Item {
5457 anchors {
5558 top: parent.top
5659 left: parent.left
57− margins: units.gu(1)
60+ margins: units.gu(2)
5861 }
5962 }
6063
@@ -65,7 +68,7 @@ Item {
6568 anchors {
6669 top: parent.top
6770 right: parent.right
68− margins: units.gu(1)
71+ margins: units.gu(2)
6972 }
7073
7174 AbstractButton {
@@ -87,12 +90,39 @@ Item {
8790 objectName: "recentSearchesRepeater"
8891 model: searchHistory
8992
90− delegate: Standard {
91− showDivider: index < recentSearchesRepeater.count - 1
92− height: units.gu(4)
93− text: query
94− iconName: "search"
95− iconFrame: false
93+ delegate: ListItem {
94+ anchors {
95+ left: parent.left
96+ right: parent.right
97+ leftMargin: units.gu(2)
98+ rightMargin: units.gu(2)
99+ }
100+ height: units.gu(5)
101+
102+ Icon {
103+ id: searchIcon
104+ anchors {
105+ verticalCenter: parent.verticalCenter
106+ left: parent.left
107+ }
108+ height: units.gu(1.5)
109+ width: height
110+ name: "search"
111+ }
112+
113+ Label {
114+ anchors {
115+ verticalCenter: parent.verticalCenter
116+ left: searchIcon.right
117+ leftMargin: units.gu(1)
118+ right: parent.right
119+ }
120+ text: query
121+ color: "#888888"
122+ }
123+
124+ divider.visible: index != repeater.count - 1 || (scope && scope.hasNavigation) || primaryFilter.active
125+
96126 onClicked: root.historyItemClicked(text)
97127 }
98128 }
@@ -103,10 +133,10 @@ Item {
103133 scope: root.scope
104134 anchors {
105135 top: recentSearchesRepeater.count > 0 ? searchColumn.bottom : parent.top
136+ topMargin: implicitHeight && recentSearchesRepeater.count > 0 ? units.gu(2) : 0
106137 left: parent.left
107138 right: parent.right
108139 }
109− scopeStyle: root.scopeStyle
110140 availableHeight: windowHeight * 4 / 6 - searchesHeight
111141
112142 onLeafClicked: root.dashNavigationLeafClicked();
@@ -120,6 +150,7 @@ Item {
120150
121151 anchors {
122152 top: recentSearchesRepeater.count > 0 ? searchColumn.bottom : parent.top
153+ topMargin: active && recentSearchesRepeater.count > 0 ? units.gu(2) : 0
123154 left: parent.left
124155 right: parent.right
125156 }