@@ -38,14 +38,23 @@ Item {
3838
3939 height: visible ? units.gu(5) : 0
4040
41+ QtObject {
42+ id: d
43+ readonly property color foregroundColor: {
44+ if (scopeStyle) return background.luminance > scopeStyle.threshold ? scopeStyle.dark : ScopeStyle.light;
45+ else return background.luminance > 0.7 ? Theme.palette.normal.baseText : "white"
46+ }
47+ readonly property bool bothVisible: altNavigationButton.visible && navigationButton.visible
48+ readonly property real navigationWidth: root.width >= units.gu(60) ? units.gu(40) : root.width
49+ readonly property real buttonWidth: navigationWidth / (bothVisible ? 2 : 1)
50+ }
51+
4152 Rectangle {
4253 id: blackRect
4354 color: "black"
4455 opacity: openList && openList.currentItem && openList.currentItem.visible ? 0.3 : 0
4556 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
46− // Doesn't matter if navigationButton or altNavigationButton list, they are both at the same y
47− y: navigationButton.listView.y
48− anchors.right: parent.right
57+ anchors { left: parent.left; right: parent.right }
4958 visible: opacity != 0
5059 }
5160
@@ -59,71 +68,43 @@ Item {
5968 id: altNavigationButton
6069 objectName: "altNavigationButton"
6170 height: root.height
62− width: navigationButton.visible ? root.width / 2 : root.width
71+ width: d.buttonWidth
6372 scope: root.scope
6473 scopeStyle: root.scopeStyle
65− listView.width: root.width
74+ foregroundColor: d.foregroundColor
75+ listView.width: d.navigationWidth
6676 isAltNavigation: true
67− }
68−
69− Rectangle {
70− visible: navigationButton.visible && altNavigationButton.visible
71− anchors {
72− top: parent.top
73− bottom: parent.bottom
74− right: navigationButton.left
75− rightMargin: -units.dp(1)
76− }
77− width: units.dp(2)
78− color: scopeStyle ? (background.luminance > scopeStyle.threshold ? scopeStyle.dark : scopeStyle.light) : Theme.palette.normal.baseText
79− opacity: 0.3
77+ showDivider: navigationButton.visible || root.width > d.navigationWidth
8078 }
8179
8280 DashNavigationButton {
8381 id: navigationButton
8482 objectName: "navigationButton"
8583 height: root.height
86− width: altNavigationButton.visible ? root.width / 2 : root.width
87− x: altNavigationButton.visible ? root.width / 2 : 0
84+ width: altNavigationButton.visible ? d.buttonWidth : d.navigationWidth
85+ x: altNavigationButton.visible ? d.buttonWidth : 0
8886 scope: root.scope
8987 scopeStyle: root.scopeStyle
90− listView.width: root.width
88+ foregroundColor: d.foregroundColor
89+ listView.width: d.navigationWidth
9190 listView.x: -x
91+ showDivider: root.width > d.navigationWidth
9292 }
9393
9494 Image {
95− id: dropShadow
9695 fillMode: Image.Stretch
9796 source: "graphics/navigation_shadow.png"
97+ anchors { top: parent.bottom; left: parent.left; right: parent.right }
98+ z: d.bothVisible ? -1 : 0
99+ }
98100
99− readonly property bool bothVisible: navigationButton.visible & altNavigationButton.visible
100−
101− state: "default"
102−
103− states: [
104− State {
105− name: "default"
106− when: !dropShadow.bothVisible || (!altNavigationButton.showList && !navigationButton.showList)
107− PropertyChanges { target: dropShadow; width: root.width; x: 0; rotation: 0 }
108− AnchorChanges { target: dropShadow; anchors.top: parent.bottom; anchors.bottom: undefined }
109− },
110− State {
111− name: "open"
112− PropertyChanges { target: dropShadow; width: navigationButton.width; rotation: 180 }
113− AnchorChanges { target: dropShadow; anchors.bottom: parent.bottom; anchors.top: undefined }
114− },
115− State {
116− name: "mainOpen"
117− extend: "open"
118− when: dropShadow.bothVisible && navigationButton.showList
119− PropertyChanges { target: dropShadow; x: altNavigationButton.x }
120− },
121− State {
122− name: "altOpen"
123− extend: "open"
124− when: dropShadow.bothVisible && altNavigationButton.showList
125− PropertyChanges { target: dropShadow; x: navigationButton.x }
126− }
127− ]
101+ Image {
102+ fillMode: Image.Stretch
103+ source: "graphics/navigation_shadow.png"
104+ x: navigationButton.listView.height > 0 ? altNavigationButton.x : navigationButton.x
105+ width: d.buttonWidth
106+ rotation: 180
107+ anchors.bottom: parent.bottom
108+ visible: d.bothVisible && (navigationButton.listView.height > 0 || altNavigationButton.listView.height > 0)
128109 }
129110}