@@ -0,0 +1,186 @@
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.0
18+import Ubuntu.Components 0.1
19+import "../Components"
20+
21+Item {
22+ id: root
23+
24+ property real progress: 0
25+ property var scope: null
26+
27+ signal done
28+
29+ Image {
30+ anchors.fill: parent
31+ source: parent.width > parent.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png"
32+ fillMode: Image.PreserveAspectCrop
33+ horizontalAlignment: Image.AlignRight
34+ verticalAlignment: Image.AlignTop
35+ }
36+
37+ Rectangle {
38+ color: "black"
39+ anchors.fill: parent
40+ opacity: 0.6
41+ }
42+
43+ Item {
44+ id: topBar
45+ width: parent.width
46+ height: childrenRect.height
47+
48+ y: {
49+ if (root.progress < 0.5) {
50+ return -height;
51+ } else {
52+ return -height + (root.progress - 0.5) * height * 2;
53+ }
54+ }
55+
56+ PageHeader {
57+ id: pageHeader
58+ width: parent.width
59+ clip: true
60+ title: i18n.tr("Manage Dash")
61+ scopeStyle: QtObject {
62+ property string headerLogo: ""
63+ property color foreground: "white"
64+ }
65+ showSignatureLine: false
66+ searchEntryEnabled: true
67+// searchInProgress: scope ? scope.searchInProgress : false
68+ }
69+
70+ Item {
71+ id: tabBarHolder
72+
73+ property int currentTab: 0
74+
75+ anchors {
76+ left: parent.left
77+ right: parent.right
78+ top: pageHeader.bottom
79+ margins: units.gu(2)
80+ }
81+ height: units.gu(4)
82+
83+ AbstractButton {
84+ id: tab1
85+ height: parent.height
86+ width: parent.width / 2
87+ Rectangle {
88+ anchors.fill: parent
89+ color: tabBarHolder.currentTab == 0 ? "white" : "transparent"
90+ radius: units.dp(10)
91+ }
92+ Label {
93+ anchors.centerIn: parent
94+ text: i18n.tr("Favourites")
95+ color: tabBarHolder.currentTab == 0 ? "black" : "white"
96+ }
97+ onClicked: tabBarHolder.currentTab = 0
98+ }
99+ AbstractButton {
100+ id: tab2
101+ x: width
102+ height: parent.height
103+ width: parent.width / 2
104+ Rectangle {
105+ anchors.fill: parent
106+ color: tabBarHolder.currentTab == 1 ? "white" : "transparent"
107+ radius: units.dp(10)
108+ }
109+ Label {
110+ anchors.centerIn: parent
111+ text: i18n.tr("All")
112+ color: tabBarHolder.currentTab == 1 ? "black" : "white"
113+ }
114+ onClicked: tabBarHolder.currentTab = 1
115+ }
116+ Rectangle {
117+ id: centerPiece
118+ width: units.dp(10)
119+ height: parent.height
120+ color: "white"
121+ x: tabBarHolder.currentTab == 1 ? tab2.x : tab2.x - width
122+ }
123+ Rectangle {
124+ id: border
125+ anchors.fill: parent
126+ radius: units.dp(10)
127+ color: "transparent"
128+ border.color: centerPiece.color
129+ border.width: units.dp(1)
130+ }
131+ }
132+ }
133+
134+ Repeater {
135+ id: middleItems
136+ model: scope ? scope.categories : null
137+ delegate: Loader {
138+ source: {
139+ if (index == 0) return "ScopesOverviewFavourites.qml";
140+ else if (index == 1) return "ScopesOverviewAll.qml";
141+ else {
142+ console.log("WARNING: ScopesOverview scope is not supposed to have more than 2 categories");
143+ return "";
144+ }
145+ }
146+ }
147+ }
148+
149+ Rectangle {
150+ id: bottomBar
151+ color: "black"
152+ height: units.gu(6)
153+ width: parent.width
154+ y: {
155+ if (root.progress < 0.5) {
156+ return parent.height;
157+ } else {
158+ return parent.height - (root.progress - 0.5) * height * 2;
159+ }
160+ }
161+
162+ AbstractButton {
163+ width: Math.max(label.width + units.gu(2), units.gu(10))
164+ height: units.gu(4)
165+ anchors {
166+ left: parent.left
167+ leftMargin: units.gu(2)
168+ verticalCenter: parent.verticalCenter
169+ }
170+ Rectangle {
171+ anchors.fill: parent
172+ border.color: "white"
173+ border.width: units.dp(1)
174+ radius: units.dp(10)
175+ color: parent.pressed ? "gray" : "transparent"
176+ }
177+ Label {
178+ id: label
179+ anchors.centerIn: parent
180+ text: i18n.tr("Done")
181+ color: parent.pressed ? "black" : "white"
182+ }
183+ onClicked: root.done()
184+ }
185+ }
186+}