on xenial help sign in
Match design visuals for the new dash navigation/page header popup

Approved by: Andrea Cimitan

commit5fda13fb9d8d53d83d21759edb5c0342c9542bd6 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 23 Mar 2016, 09:51 (11 years ago) parentb851f5b5012c16
9 files changed+154−106
plugins/Dash/ScopeStyle.qml+1−1 qml/Dash/DashNavigation.qml+2−20 qml/Dash/DashNavigationHeader.qml+1−3 qml/Dash/DashNavigationList.qml+30−19 qml/Dash/DashPageHeader.qml+70−48 qml/Dash/Filters/FilterOptionSelector.qml+1 qml/Dash/FiltersPopover.qml+1 qml/Dash/GenericScopeView.qml+1−1 qml/Dash/PageHeaderExtraPanel.qml+47−14
plugins/Dash/ScopeStyle.qml+1−1
@@ -58,7 +58,7 @@ QtObject {
5858 readonly property url headerLogo: "logo" in d.headerStyle ? d.headerStyle["logo"] : ""
5959
6060 /// Background style for the header
61− readonly property url headerBackground: "background" in d.headerStyle ? d.headerStyle["background"] : "color:///#f5f5f5"
61+ readonly property url headerBackground: "background" in d.headerStyle ? d.headerStyle["background"] : "color:///#ffffff"
6262
6363 /// Foreground color for the header
6464 readonly property color headerForeground: "foreground-color" in d.headerStyle ? d.headerStyle["foreground-color"] : foreground
qml/Dash/DashNavigation.qml+2−20
@@ -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 {
@@ -82,11 +74,10 @@ Item {
8274 delegate: DashNavigationHeader {
8375 objectName: "dashNavigationHeader" + index
8476 height: index == 0 && headersModel.count > 1 ? 0 : units.gu(5)
85− width: parent.width
77+ width: headersColumn.width
8678
8779 backVisible: index != 0
8880 text: headerText
89− foregroundColor: d.foregroundColor
9081
9182 onBackClicked: {
9283 scope.setNavigationState(parentNavigationId);
@@ -124,12 +115,7 @@ Item {
124115 left: parent.left
125116 right: parent.right
126117 }
127− property int maxHeight: -1
128− Component.onCompleted: updateMaxHeight();
129− function updateMaxHeight()
130− {
131− maxHeight = root.availableHeight - mapToItem(root, 0, 0).y;
132− }
118+ readonly property int maxHeight: root.availableHeight - navigationListView.y
133119 property int prevHeight: maxHeight
134120 height: currentItem ? currentItem.height : maxHeight
135121
@@ -143,13 +129,9 @@ Item {
143129 objectName: "navigation" + index
144130 visible: height > 0
145131 width: navigationListView.width
146− itemsIndent: index != 0 ? units.gu(5) : 0
147− scopeStyle: root.scopeStyle
148− foregroundColor: d.foregroundColor
149132 property real desiredHeight: {
150133 if (navigation && navigation.loaded && x == navigationListView.contentX)
151134 {
152− navigationListView.updateMaxHeight();
153135 return Math.min(implicitHeight, navigationListView.maxHeight);
154136 } else {
155137 return navigationListView.prevHeight;
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: column.width
59+ anchors {
60+ left: column.left
61+ right: column.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/DashPageHeader.qml+70−48
@@ -202,51 +202,43 @@ Item {
202202 left: parent.left
203203 bottom: parent.bottom
204204 bottomMargin: units.gu(1)
205− right: cancelLabel.left
206− rightMargin: units.gu(1)
205+ right: settingsButton.left
206+ rightMargin: settingsButton.visible ? 0 : units.gu(2)
207207 }
208208
209− readonly property bool clearIsSettings: !searchTextField.focus && root.scopeHasFilters
210−
211− primaryItem: Label {
212− text: root.navigationTag
209+ primaryItem: Rectangle {
210+ color: "#F5F4F5"
211+ width: root.navigationTag != "" ? tagLabel.width + units.gu(2) : 0
212+ height: root.navigationTag != "" ? tagLabel.height + units.gu(1) : 0
213+ radius: units.gu(0.5)
214+ Label {
215+ id: tagLabel
216+ text: root.navigationTag
217+ anchors.centerIn: parent
218+ color: "#333333"
219+ }
213220 }
214221
215− secondaryItem: Row {
222+ secondaryItem: AbstractButton {
223+ id: clearButton
216224 height: searchTextField.height
217−
218− AbstractButton {
219− id: clearOrSettingsButton
220− height: parent.height
221− width: height
222− enabled: searchTextField.text.length > 0 || root.navigationTag != ""
223−
224− Image {
225− objectName: "clearIcon"
226− anchors.fill: parent
227− anchors.margins: units.gu(.75)
228− source: searchTextField.clearIsSettings ? "image://theme/settings" : "image://theme/clear"
229− opacity: parent.enabled
230− visible: opacity > 0
231− Behavior on opacity {
232− UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
233− }
234− }
235−
236− onClicked: {
237− if (searchTextField.clearIsSettings) {
238− root.showFiltersPopup(clearOrSettingsButton);
239− } else {
240− root.clearSearch(true);
241− }
225+ width: height
226+ enabled: searchTextField.text.length > 0 || root.navigationTag != ""
227+
228+ Image {
229+ objectName: "clearIcon"
230+ anchors.fill: parent
231+ anchors.margins: units.gu(1)
232+ source: "image://theme/clear"
233+ opacity: parent.enabled
234+ visible: opacity > 0
235+ Behavior on opacity {
236+ UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
242237 }
243238 }
244239
245− Label {
246− visible: searchTextField.clearIsSettings && root.activeFiltersCount > 0
247− height: parent.height
248− text: root.activeFiltersCount
249− verticalAlignment: Text.AlignVCenter
240+ onClicked: {
241+ root.clearSearch(true);
250242 }
251243 }
252244
@@ -264,22 +256,52 @@ Item {
264256 }
265257 }
266258
267− Label {
268− id: cancelLabel
269− text: i18n.tr("Cancel")
270− color: header.panelForegroundColor
271− verticalAlignment: Text.AlignVCenter
259+ AbstractButton {
260+ id: settingsButton
261+
262+ width: root.scopeHasFilters ? height : 0
263+ visible: width > 0
272264 anchors {
273265 top: parent.top
274− right: parent.right
266+ right: cancelButton.left
275267 bottom: parent.bottom
276− margins: units.gu(1)
268+ rightMargin: units.gu(-1)
277269 }
278− AbstractButton {
270+
271+ Icon {
279272 anchors.fill: parent
280− onClicked: {
281− root.clearSearch(false);
282− headerContainer.showSearch = false;
273+ anchors.margins: units.gu(2)
274+ name: "filters"
275+ color: root.activeFiltersCount > 0 ? UbuntuColors.orange : Qt.rgba(0.0, 0.0, 0.0, 0.0)
276+ }
277+
278+ onClicked: {
279+ root.showFiltersPopup(settingsButton);
280+ }
281+ }
282+
283+ AbstractButton {
284+ id: cancelButton
285+ width: cancelLabel.width + cancelLabel.anchors.rightMargin + cancelLabel.anchors.leftMargin
286+ anchors {
287+ top: parent.top
288+ right: parent.right
289+ bottom: parent.bottom
290+ }
291+ onClicked: {
292+ root.clearSearch(false);
293+ headerContainer.showSearch = false;
294+ }
295+ Label {
296+ id: cancelLabel
297+ text: i18n.tr("Cancel")
298+ color: header.panelForegroundColor
299+ verticalAlignment: Text.AlignVCenter
300+ anchors {
301+ verticalCenter: parent.verticalCenter
302+ right: parent.right
303+ rightMargin: units.gu(2)
304+ leftMargin: units.gu(1)
283305 }
284306 }
285307 }
qml/Dash/Filters/FilterOptionSelector.qml+1
@@ -34,6 +34,7 @@ FilterWidget {
3434
3535 onClicked: {
3636 expanded = !expanded;
37+ forceActiveFocus();
3738 }
3839
3940 Item {
qml/Dash/FiltersPopover.qml+1
@@ -37,6 +37,7 @@ Popover {
3737 var parentAndKeyboard = root.parent.height - posToRootParent - (Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height + units.gu(3) : 0)
3838 return Math.min(parentAndKeyboard, Math.min(threeQuartersParent, column.height));
3939 }
40+ clip: true
4041 contentHeight: column.height
4142 contentWidth: width
4243
qml/Dash/GenericScopeView.qml+1−1
@@ -651,6 +651,7 @@ FocusScope {
651651 }
652652 }
653653 onShowFiltersPopup: { // item
654+ extraPanel.visible = false;
654655 scopeView.filtersPopover = PopupUtils.open(Qt.resolvedUrl("FiltersPopover.qml"), item, { "contentWidth": scopeView.width - units.gu(2) } );
655656 }
656657 }
@@ -668,7 +669,6 @@ FocusScope {
668669
669670 searchHistory: SearchHistoryModel
670671 scope: scopeView.scope
671− scopeStyle: scopeView.scopeStyle
672672 windowHeight: scopeView.height
673673
674674 onHistoryItemClicked: {
qml/Dash/PageHeaderExtraPanel.qml+47−14
@@ -16,20 +16,19 @@
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 {
2323 id: root
2424
25− readonly property real searchesHeight: recentSearchesRepeater.count > 0 ? searchColumn.height + recentSearchesLabels.height + recentSearchesLabels.anchors.margins : 0
25+ readonly property real searchesHeight: recentSearchesRepeater.count > 0 ? searchColumn.height + recentSearchesLabels.height + recentSearchesLabels.anchors.topMargin : 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,8 @@ Item {
5457 anchors {
5558 top: parent.top
5659 left: parent.left
57− margins: units.gu(1)
60+ margins: units.gu(2)
61+ topMargin: units.gu(3)
5862 }
5963 }
6064
@@ -65,7 +69,8 @@ Item {
6569 anchors {
6670 top: parent.top
6771 right: parent.right
68− margins: units.gu(1)
72+ margins: units.gu(2)
73+ topMargin: units.gu(3)
6974 }
7075
7176 AbstractButton {
@@ -87,13 +92,40 @@ Item {
8792 objectName: "recentSearchesRepeater"
8893 model: searchHistory
8994
90− delegate: Standard {
91− showDivider: index < recentSearchesRepeater.count - 1
92− height: units.gu(4)
93− text: query
94− iconName: "search"
95− iconFrame: false
96− onClicked: root.historyItemClicked(text)
95+ delegate: ListItem {
96+ anchors {
97+ left: parent.left
98+ right: parent.right
99+ leftMargin: units.gu(2)
100+ rightMargin: units.gu(2)
101+ }
102+ height: units.gu(5)
103+
104+ Icon {
105+ id: searchIcon
106+ anchors {
107+ verticalCenter: parent.verticalCenter
108+ left: parent.left
109+ }
110+ height: units.gu(1.5)
111+ width: height
112+ name: "search"
113+ }
114+
115+ Label {
116+ anchors {
117+ verticalCenter: parent.verticalCenter
118+ left: searchIcon.right
119+ leftMargin: units.gu(1)
120+ right: parent.right
121+ }
122+ text: query
123+ color: "#888888"
124+ }
125+
126+ divider.visible: index != repeater.count - 1 || (scope && scope.hasNavigation) || primaryFilter.active
127+
128+ onClicked: root.historyItemClicked(query)
97129 }
98130 }
99131 }
@@ -103,10 +135,10 @@ Item {
103135 scope: root.scope
104136 anchors {
105137 top: recentSearchesRepeater.count > 0 ? searchColumn.bottom : parent.top
138+ topMargin: implicitHeight && recentSearchesRepeater.count > 0 ? units.gu(2) : 0
106139 left: parent.left
107140 right: parent.right
108141 }
109− scopeStyle: root.scopeStyle
110142 availableHeight: windowHeight * 4 / 6 - searchesHeight
111143
112144 onLeafClicked: root.dashNavigationLeafClicked();
@@ -120,6 +152,7 @@ Item {
120152
121153 anchors {
122154 top: recentSearchesRepeater.count > 0 ? searchColumn.bottom : parent.top
155+ topMargin: active && recentSearchesRepeater.count > 0 ? units.gu(2) : 0
123156 left: parent.left
124157 right: parent.right
125158 }