on xenial help sign in
Put in a different file
commit4d53fabd7d60c4aaac907031479ad160e097b26c authorAlbert Astals <albert.astals@canonical.com> dateMon 14 Jul 2014, 16:14 (12 years ago) parent37dac80
2 files changed+74−53
qml/Dash/ScopesOverview.qml+1−53 qml/Dash/ScopesOverviewTab.qml+73
qml/Dash/ScopesOverview.qml+1−53
@@ -99,11 +99,8 @@ Item {
9999 searchInProgress: root.scope ? root.scope.searchInProgress : false
100100 }
101101
102− Item {
102+ ScopesOverviewTab {
103103 id: tabBarHolder
104−
105− property int currentTab: 0
106−
107104 anchors {
108105 left: parent.left
109106 right: parent.right
@@ -111,55 +108,6 @@ Item {
111108 margins: units.gu(2)
112109 }
113110 height: units.gu(4)
114−
115− AbstractButton {
116− id: tab1
117− height: parent.height
118− width: parent.width / 2
119− Rectangle {
120− anchors.fill: parent
121− color: tabBarHolder.currentTab == 0 ? "white" : "transparent"
122− radius: units.dp(10)
123− }
124− Label {
125− anchors.centerIn: parent
126− text: i18n.tr("Favourites")
127− color: tabBarHolder.currentTab == 0 ? "black" : "white"
128− }
129− onClicked: tabBarHolder.currentTab = 0
130− }
131− AbstractButton {
132− id: tab2
133− x: width
134− height: parent.height
135− width: parent.width / 2
136− Rectangle {
137− anchors.fill: parent
138− color: tabBarHolder.currentTab == 1 ? "white" : "transparent"
139− radius: units.dp(10)
140− }
141− Label {
142− anchors.centerIn: parent
143− text: i18n.tr("All")
144− color: tabBarHolder.currentTab == 1 ? "black" : "white"
145− }
146− onClicked: tabBarHolder.currentTab = 1
147− }
148− Rectangle {
149− id: centerPiece
150− width: units.dp(10)
151− height: parent.height
152− color: "white"
153− x: tabBarHolder.currentTab == 1 ? tab2.x : tab2.x - width
154− }
155− Rectangle {
156− id: border
157− anchors.fill: parent
158− radius: units.dp(10)
159− color: "transparent"
160− border.color: centerPiece.color
161− border.width: units.dp(1)
162− }
163111 }
164112 }
165113
qml/Dash/ScopesOverviewTab.qmlnew file+73
@@ -0,0 +1,73 @@
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.3
18+import Ubuntu.Components 0.1
19+
20+Item {
21+ id: root
22+
23+ property int currentTab: 0
24+
25+ AbstractButton {
26+ id: tab1
27+ height: parent.height
28+ width: parent.width / 2
29+ Rectangle {
30+ anchors.fill: parent
31+ color: root.currentTab == 0 ? "white" : "transparent"
32+ radius: units.dp(10)
33+ }
34+ Label {
35+ anchors.centerIn: parent
36+ text: i18n.tr("Favourites")
37+ color: root.currentTab == 0 ? "black" : "white"
38+ }
39+ onClicked: root.currentTab = 0
40+ }
41+ AbstractButton {
42+ id: tab2
43+ x: width
44+ height: parent.height
45+ width: parent.width / 2
46+ Rectangle {
47+ anchors.fill: parent
48+ color: root.currentTab == 1 ? "white" : "transparent"
49+ radius: units.dp(10)
50+ }
51+ Label {
52+ anchors.centerIn: parent
53+ text: i18n.tr("All")
54+ color: root.currentTab == 1 ? "black" : "white"
55+ }
56+ onClicked: root.currentTab = 1
57+ }
58+ Rectangle {
59+ id: centerPiece
60+ width: units.dp(10)
61+ height: parent.height
62+ color: "white"
63+ x: root.currentTab == 1 ? tab2.x : tab2.x - width
64+ }
65+ Rectangle {
66+ id: border
67+ anchors.fill: parent
68+ radius: units.dp(10)
69+ color: "transparent"
70+ border.color: centerPiece.color
71+ border.width: units.dp(1)
72+ }
73+}