on xenial help sign in
Add the processing indicator.
9339209Michał Sawicz
qml/Components/PageHeader.qml−1
@@ -32,7 +32,6 @@ Item {
32 property bool searchEntryEnabled: false
32 property bool searchEntryEnabled: false
33 property ListModel searchHistory: SearchHistoryModel
33 property ListModel searchHistory: SearchHistoryModel
34 property alias searchQuery: searchTextField.text
34 property alias searchQuery: searchTextField.text
35− property bool searchInProgress: false
36
35
37 property alias bottomItem: bottomContainer.children
36 property alias bottomItem: bottomContainer.children
38
37
qml/Dash/Dash.qml+68
@@ -126,4 +126,72 @@ Showable {
126 }
126 }
127 }
127 }
128 }
128 }
129+
130+ Rectangle {
131+ id: indicator
132+ anchors {
133+ left: parent.left
134+ right: parent.right
135+ bottom: parent.bottom
136+ }
137+ clip: true
138+ height: units.dp(3)
139+ color: scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff"
140+ visible: opacity > 0
141+
142+ readonly property bool processing: dashContent.processing || scopeItem.processing
143+
144+ Behavior on opacity {
145+ UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
146+ }
147+
148+ onProcessingChanged: {
149+ if (processing) delay.start();
150+ else if (!persist.running) indicator.opacity = 0;
151+ }
152+
153+ Timer {
154+ id: delay
155+ interval: 200
156+ onTriggered: if (indicator.processing) {
157+ persist.restart();
158+ indicator.opacity = 1;
159+ }
160+ }
161+
162+
163+ Timer {
164+ id: persist
165+ interval: 2 * UbuntuAnimation.SleepyDuration - UbuntuAnimation.FastDuration
166+ onTriggered: if (!indicator.processing) indicator.opacity = 0
167+ }
168+
169+ Rectangle {
170+ id: orange
171+ anchors { top: parent.top; bottom: parent.bottom }
172+ width: parent.width / 4
173+ color: Theme.palette.selected.foreground
174+
175+ SequentialAnimation {
176+ running: indicator.visible
177+ loops: Animation.Infinite
178+ PropertyAnimation {
179+ from: -orange.width / 2
180+ to: indicator.width - orange.width / 2
181+ duration: UbuntuAnimation.SleepyDuration
182+ easing.type: Easing.InOutSine
183+ target: orange
184+ property: "x"
185+ }
186+ PropertyAnimation {
187+ to: -orange.width / 2
188+ duration: UbuntuAnimation.SleepyDuration
189+ easing.type: Easing.InOutSine
190+ target: orange
191+ property: "x"
192+ }
193+ }
194+ }
195+ }
196+
129}
197}
qml/Dash/DashContent.qml+2
@@ -26,6 +26,8 @@ Item {
26 property var model: null
26 property var model: null
27 property var scopes: null
27 property var scopes: null
28 readonly property alias currentIndex: dashContentList.currentIndex
28 readonly property alias currentIndex: dashContentList.currentIndex
29+ readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item
30+ && dashContentList.currentItem.item.processing || false
29
31
30 signal scopeLoaded(string scopeId)
32 signal scopeLoaded(string scopeId)
31 signal gotoScope(string scopeId)
33 signal gotoScope(string scopeId)
qml/Dash/DashDepartmentsList.qml−5
@@ -35,11 +35,6 @@ Item {
35 anchors.fill: parent
35 anchors.fill: parent
36 }
36 }
37
37
38− ActivityIndicator {
39− id: loadingIndicator
40− anchors.centerIn: parent
41− running: !(department && department.loaded)
42− }
43 clip: true
38 clip: true
44
39
45 Behavior on height {
40 Behavior on height {
qml/Dash/GenericScopeView.qml+2−43
@@ -38,6 +38,8 @@ FocusScope {
38 style: scope ? scope.customizations : {}
38 style: scope ? scope.customizations : {}
39 }
39 }
40
40
41+ readonly property bool processing: scope ? scope.searchInProgress || previewListView.processing : false
42+
41 signal backClicked()
43 signal backClicked()
42
44
43 onScopeChanged: {
45 onScopeChanged: {
@@ -396,7 +398,6 @@ FocusScope {
396 title: scopeView.scope ? scopeView.scope.name : ""
398 title: scopeView.scope ? scopeView.scope.name : ""
397 showBackButton: scopeView.hasBackAction
399 showBackButton: scopeView.hasBackAction
398 searchEntryEnabled: true
400 searchEntryEnabled: true
399− searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false
400 scopeStyle: scopeView.scopeStyle
401 scopeStyle: scopeView.scopeStyle
401
402
402 bottomItem: DashDepartments {
403 bottomItem: DashDepartments {
@@ -431,46 +432,4 @@ FocusScope {
431 pageHeader.unfocus();
432 pageHeader.unfocus();
432 }
433 }
433 }
434 }
434−
435− Rectangle {
436− id: indicator
437− anchors {
438− left: parent.left
439− right: parent.right
440− bottom: parent.bottom
441− }
442− clip: true
443− height: units.dp(3)
444− color: scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff"
445− visible: opacity > 0
446− opacity: scope && scope.searchInProgress && !departments.showList ? 1.0 : 0.0
447− Behavior on opacity {
448− UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
449− }
450−
451− Rectangle {
452− id: orange
453− anchors { top: parent.top; bottom: parent.bottom }
454− width: parent.width / 4
455− color: Theme.palette.selected.foreground
456−
457− SequentialAnimation on x {
458− running: visible
459− loops: Animation.Infinite
460− PropertyAnimation {
461− from: -orange.width / 2
462− to: indicator.width - orange.width / 2
463− duration: UbuntuAnimation.SleepyDuration
464− easing.type: Easing.InOutSine
465− }
466− PropertyAnimation {
467− from: indicator.width - orange.width / 2
468− to: -orange.width / 2
469− duration: UbuntuAnimation.SleepyDuration
470− easing.type: Easing.InOutSine
471− }
472− }
473− }
474− }
475−
476}
435}
qml/Dash/PreviewListView.qml+18−28
@@ -32,6 +32,9 @@ Item {
32 property alias currentItem: previewListView.currentItem
32 property alias currentItem: previewListView.currentItem
33 property alias count: previewListView.count
33 property alias count: previewListView.count
34
34
35+ readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
36+ || currentItem.previewModel.processingAction)
37+
35 PageHeader {
38 PageHeader {
36 id: header
39 id: header
37 objectName: "pageHeader"
40 objectName: "pageHeader"
@@ -83,39 +86,26 @@ Item {
83 }
86 }
84 }
87 }
85
88
86− delegate: Item {
89+ delegate: Previews.Preview {
90+ id: preview
87− objectName: "previewItem" + index
91+ objectName: "preview" + index
88 height: previewListView.height
92 height: previewListView.height
89 width: previewListView.width
93 width: previewListView.width
90
94
91− readonly property bool ready: preview.previewModel.loaded
92−
93− Previews.Preview {
94− id: preview
95− objectName: "preview" + index
96− anchors.fill: parent
97−
98− isCurrent: parent.ListView.isCurrentItem
95+ isCurrent: parent.ListView.isCurrentItem
99−
100− previewModel: {
101− var previewStack = root.scope.preview(result);
102− return previewStack.getPreviewModel(0);
103− }
104− scopeStyle: root.scopeStyle
105− }
106−
107− MouseArea {
108− id: processingMouseArea
109− objectName: "processingMouseArea"
110− anchors.fill: parent
111− enabled: !preview.previewModel.loaded || preview.previewModel.processingAction
112
96
113− ActivityIndicator {
97+ previewModel: {
114− anchors.centerIn: parent
98+ var previewStack = root.scope.preview(result);
115− visible: root.open && parent.enabled
99+ return previewStack.getPreviewModel(0);
116− running: visible
117− }
118 }
100 }
101+ scopeStyle: root.scopeStyle
119 }
102 }
120 }
103 }
104+
105+ MouseArea {
106+ id: processingMouseArea
107+ objectName: "processingMouseArea"
108+ anchors.fill: parent
109+ enabled: root.processing
110+ }
121}
111}