on xenial help sign in
Support Alt Navigation
commit713e430146af5d2b194953e4874993793cb48289 authorAlbert Astals <albert.astals@canonical.com> dateMon 4 Aug 2014, 15:01 (12 years ago) parenta3af675
1 file changed+95
qml/Dash/DashNavigation.qml+95
qml/Dash/DashNavigation.qmlnew file+95
@@ -0,0 +1,95 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
19+
20+Item {
21+ id: root
22+ objectName: "dashNavigation"
23+
24+ property var scope: null
25+
26+ property alias windowWidth: blackRect.width
27+ property alias windowHeight: blackRect.height
28+ property var scopeStyle: null
29+ readonly property var openList: {
30+ if (navigationButton.showList) return navigationButton.listView;
31+ if (altNavigationButton.showList) return altNavigationButton.listView;
32+ return null;
33+ }
34+
35+ visible: navigationButton.currentNavigation || altNavigationButton.currentNavigation
36+
37+ height: visible ? units.gu(5) : 0
38+
39+ Rectangle {
40+ id: blackRect
41+ color: "black"
42+ opacity: openList && openList.currentItem && openList.currentItem.visible ? 0.3 : 0
43+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
44+ // Doesn't matter if navigationButton or altNavigationButton list, they are both at the same y
45+ y: navigationButton.listView.y
46+ anchors.right: parent.right
47+ visible: opacity != 0
48+ }
49+
50+ Image {
51+ id: topGradient
52+ anchors.top: parent.top
53+ fillMode: Image.Stretch
54+ source: "graphics/dash_divider_top_lightgrad.png"
55+ z: -1
56+
57+ readonly property bool bothVisible: navigationButton.visible & altNavigationButton.visible
58+ width: root.openList && bothVisible ? navigationButton.width : root.width
59+ x: !bothVisible ? 0 :
60+ navigationButton.showList ? altNavigationButton.x :
61+ altNavigationButton.showList ? navigationButton.x : 0
62+ }
63+
64+ Image {
65+ anchors {
66+ bottom: parent.bottom
67+ left: topGradient.left
68+ right: topGradient.right
69+ }
70+ fillMode: Image.Stretch
71+ source: "graphics/dash_divider_top_darkgrad.png"
72+ z: -1
73+ }
74+
75+ DashNavigationButton {
76+ id: altNavigationButton
77+ height: root.height
78+ width: navigationButton.visible ? root.width / 2 : root.width
79+ scope: root.scope
80+ scopeStyle: root.scopeStyle
81+ listView.width: root.width
82+ isAltNavigation: true
83+ }
84+
85+ DashNavigationButton {
86+ id: navigationButton
87+ height: root.height
88+ width: altNavigationButton.visible ? root.width / 2 : root.width
89+ x: altNavigationButton.visible ? root.width / 2 : 0
90+ scope: root.scope
91+ scopeStyle: root.scopeStyle
92+ listView.width: root.width
93+ listView.x: -x
94+ }
95+}