@@ -24,6 +24,10 @@ Item {
24 property real progress: 0
24 property real progress: 0
25 property var scope: null
25 property var scope: null
26 property real scopeScale: 1
26 property real scopeScale: 1
27+ property QtObject scopeStyle: QtObject {
28+ property string headerLogo: ""
29+ property color foreground: "white"
28 signal done()
32 signal done()
29 signal favoriteSelected(int index)
33 signal favoriteSelected(int index)
@@ -39,218 +43,240 @@ Item {
42− id: topBar
46+ id: scopesOverviewContent
47+ x: previewListView.open ? -width : 0
48+ Behavior on x { UbuntuNumberAnimation { } }
43 width: parent.width
49 width: parent.width
44− height: childrenRect.height
50+ height: parent.height
55+ height: childrenRect.height
47− if (root.progress < 0.5) {
58+ if (root.progress < 0.5) {
48− return -height;
59+ return -height;
50− return -height + (root.progress - 0.5) * height * 2;
61+ return -height + (root.progress - 0.5) * height * 2;
54− PageHeader {
65+ PageHeader {
55− id: pageHeader
66+ id: pageHeader
56− width: parent.width
67+ width: parent.width
57− clip: true
68+ clip: true
58− title: i18n.tr("Manage Dash")
69+ title: i18n.tr("Manage Dash")
59− scopeStyle: QtObject {
70+ scopeStyle: root.scopeStyle
60− property string headerLogo: ""
71+ showSignatureLine: false
61− property color foreground: "white"
72+ searchEntryEnabled: true
73+ // searchInProgress: scope ? scope.searchInProgress : false
63− showSignatureLine: false
64− searchEntryEnabled: true
65−// searchInProgress: scope ? scope.searchInProgress : false
69− id: tabBarHolder
77+ id: tabBarHolder
71− property int currentTab: 0
79+ property int currentTab: 0
73− anchors {
81+ anchors {
74− left: parent.left
82+ left: parent.left
75− right: parent.right
83+ right: parent.right
76− top: pageHeader.bottom
84+ top: pageHeader.bottom
77− margins: units.gu(2)
85+ margins: units.gu(2)
79− height: units.gu(4)
87+ height: units.gu(4)
81− AbstractButton {
89+ AbstractButton {
83− height: parent.height
91+ height: parent.height
84− width: parent.width / 2
92+ width: parent.width / 2
85− Rectangle {
93+ Rectangle {
86− anchors.fill: parent
94+ anchors.fill: parent
87− color: tabBarHolder.currentTab == 0 ? "white" : "transparent"
95+ color: tabBarHolder.currentTab == 0 ? "white" : "transparent"
88− radius: units.dp(10)
96+ radius: units.dp(10)
99+ anchors.centerIn: parent
100+ text: i18n.tr("Favourites")
101+ color: tabBarHolder.currentTab == 0 ? "black" : "white"
103+ onClicked: tabBarHolder.currentTab = 0
108+ height: parent.height
109+ width: parent.width / 2
111+ anchors.fill: parent
112+ color: tabBarHolder.currentTab == 1 ? "white" : "transparent"
113+ radius: units.dp(10)
91− anchors.centerIn: parent
116+ anchors.centerIn: parent
92− text: i18n.tr("Favourites")
117+ text: i18n.tr("All")
93− color: tabBarHolder.currentTab == 0 ? "black" : "white"
118+ color: tabBarHolder.currentTab == 1 ? "black" : "white"
120+ onClicked: tabBarHolder.currentTab = 1
125+ height: parent.height
127+ x: tabBarHolder.currentTab == 1 ? tab2.x : tab2.x - width
95− onClicked: tabBarHolder.currentTab = 0
100− height: parent.height
101− width: parent.width / 2
102 Rectangle {
129 Rectangle {
103 anchors.fill: parent
131 anchors.fill: parent
104− color: tabBarHolder.currentTab == 1 ? "white" : "transparent"
105 radius: units.dp(10)
132 radius: units.dp(10)
133+ color: "transparent"
134+ border.color: centerPiece.color
135+ border.width: units.dp(1)
108− anchors.centerIn: parent
109− text: i18n.tr("All")
110− color: tabBarHolder.currentTab == 1 ? "black" : "white"
112− onClicked: tabBarHolder.currentTab = 1
117− height: parent.height
119− x: tabBarHolder.currentTab == 1 ? tab2.x : tab2.x - width
123− anchors.fill: parent
124− radius: units.dp(10)
125− color: "transparent"
126− border.color: centerPiece.color
127− border.width: units.dp(1)
132− Repeater {
140+ Repeater {
133− id: middleItems
141+ id: middleItems
134− model: scope ? scope.categories : null
142+ model: scope ? scope.categories : null
135− delegate: Loader {
143+ delegate: Loader {
136− id: loader
144+ id: loader
138− height: {
146+ height: {
139− if (index == 0) {
147+ if (index == 0) {
140− return parent.height;
148+ return parent.height;
141− } else {
149+ } else {
142− return parent.height - topBar.height - units.gu(2)
150+ return parent.height - topBar.height - units.gu(2)
145− width: {
153+ width: {
146− if (index == 0) {
154+ if (index == 0) {
147− return parent.width / scopeScale
155+ return parent.width / scopeScale
148− } else {
156+ } else {
149− return parent.width
157+ return parent.width
153− if (index == 0) {
161+ if (index == 0) {
154− return (root.width - width) / 2;
162+ return (root.width - width) / 2;
155− } else {
163+ } else {
156− return 0;
164+ return 0;
168+ bottom: parent.bottom
160− bottom: parent.bottom
163− scale: index == 0 ? scopeScale : 1
171+ scale: index == 0 ? scopeScale : 1
165− opacity: tabBarHolder.currentTab == index ? 1 : 0
173+ opacity: tabBarHolder.currentTab == index ? 1 : 0
166− Behavior on opacity { UbuntuNumberAnimation { } }
174+ Behavior on opacity { UbuntuNumberAnimation { } }
167− enabled: opacity == 1
175+ enabled: opacity == 1
169− clip: index == 1
177+ clip: index == 1
171− CardTool {
179+ CardTool {
172− id: cardTool
180+ id: cardTool
173− objectName: "cardTool"
181+ objectName: "cardTool"
174− count: results.count
182+ count: results.count
175− template: model.renderer
183+ template: model.renderer
176− components: model.components
184+ components: model.components
177− viewWidth: parent.width
185+ viewWidth: parent.width
180− source: {
188+ source: {
181− if (index == 0) return "ScopesOverviewFavourites.qml";
189+ if (index == 0) return "ScopesOverviewFavourites.qml";
182− else if (index == 1) return "ScopesOverviewAll.qml";
190+ else if (index == 1) return "ScopesOverviewAll.qml";
184− console.log("WARNING: ScopesOverview scope is not supposed to have more than 2 categories");
192+ console.log("WARNING: ScopesOverview scope is not supposed to have more than 2 categories");
185− return "";
193+ return "";
189− onLoaded: {
197+ onLoaded: {
190− item.model = Qt.binding(function() { return results })
198+ item.model = Qt.binding(function() { return results })
191− item.cardTool = cardTool;
199+ item.cardTool = cardTool;
192− if (index == 0) {
200+ if (index == 0) {
193− item.scopeWidth = root.width;
201+ item.scopeWidth = root.width;
194− item.scopeHeight = root.height;
202+ item.scopeHeight = root.height;
195− } else if (index == 1) {
203+ } else if (index == 1) {
196− item.extraHeight = bottomBar.height;
204+ item.extraHeight = bottomBar.height;
200− Connections {
208+ Connections {
201− target: loader.item
209+ target: loader.item
202− onClicked: {
210+ onClicked: {
203− if (tabBarHolder.currentTab == 0) {
211+ if (tabBarHolder.currentTab == 0) {
204− root.favoriteSelected(index)
212+ root.favoriteSelected(index)
205− } else {
213+ } else {
206− // This will result in an openScope
214+ // This will result in an openScope
207− // that we handle in Dash.qml
215+ // that we handle in Dash.qml
208− scope.activate(result)
216+ scope.activate(result)
220+ previewListView.model = target.model;
221+ previewListView.currentIndex = -1
222+ previewListView.currentIndex = index;
223+ previewListView.open = true
215− Rectangle {
229+ Rectangle {
216− id: bottomBar
230+ id: bottomBar
217− color: "black"
231+ color: "black"
218− height: units.gu(6)
232+ height: units.gu(6)
219− width: parent.width
233+ width: parent.width
220− opacity: 0.4
234+ opacity: 0.4
222− if (root.progress < 0.5) {
236+ if (root.progress < 0.5) {
223− return parent.height;
237+ return parent.height;
224− } else {
238+ } else {
225− return parent.height - (root.progress - 0.5) * height * 2;
239+ return parent.height - (root.progress - 0.5) * height * 2;
229− AbstractButton {
243+ AbstractButton {
230− width: Math.max(label.width + units.gu(2), units.gu(10))
244+ width: Math.max(label.width + units.gu(2), units.gu(10))
231− height: units.gu(4)
245+ height: units.gu(4)
232− anchors {
246+ anchors {
233− left: parent.left
247+ left: parent.left
234− leftMargin: units.gu(2)
248+ leftMargin: units.gu(2)
235− verticalCenter: parent.verticalCenter
249+ verticalCenter: parent.verticalCenter
237− Rectangle {
251+ Rectangle {
238− anchors.fill: parent
252+ anchors.fill: parent
239− border.color: "white"
253+ border.color: "white"
240− border.width: units.dp(1)
254+ border.width: units.dp(1)
241− radius: units.dp(10)
255+ radius: units.dp(10)
242− color: parent.pressed ? "gray" : "transparent"
256+ color: parent.pressed ? "gray" : "transparent"
245− id: label
259+ id: label
246− anchors.centerIn: parent
260+ anchors.centerIn: parent
247− text: i18n.tr("Done")
261+ text: i18n.tr("Done")
248− color: parent.pressed ? "black" : "white"
262+ color: parent.pressed ? "black" : "white"
250− onClicked: {
264+ onClicked: {
251− root.done();
265+ root.done();
252− tabBarHolder.currentTab = 0;
266+ tabBarHolder.currentTab = 0;
274+ objectName: "scopesOverviewPreviewListView"
276+ scopeStyle: root.scopeStyle
279+ height: parent.height
280+ anchors.left: scopesOverviewContent.right