on xenial help sign in
Added search indicator.
commit1ddc0e4be95f53100ec35639055c1fb8235c6cde authorNicolas d'Offay <nicolas.doffay@canonical.com> dateMon 30 Sep 2013, 10:59 (13 years ago) parenta5a966b
2 files changed+30−1
Components/PageHeader.qml+29−1 Dash/GenericScopeView.qml+1
Components/PageHeader.qml+29−1
@@ -18,6 +18,7 @@ import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import Ubuntu.Components.Popups 0.1
2020import Ubuntu.Components.ListItems 0.1 as ListItem
21+import Unity 0.1
2122
2223Item {
2324 /*!
@@ -30,6 +31,8 @@ Item {
3031 property bool searchEntryEnabled: false
3132 property alias searchQuery: searchField.text
3233 property ListModel searchHistory: SearchHistoryModel {}
34+ property Scope scope
35+ property bool searchInProgress: false
3336
3437 height: units.gu(8.5)
3538 implicitHeight: units.gu(8.5)
@@ -46,6 +49,11 @@ Item {
4649 searchField.focus = false;
4750 }
4851
52+ Connections {
53+ target: scope
54+ onSearchInProgressChanged: searchInProgress = scope.searchInProgress
55+ }
56+
4957 Connections {
5058 target: greeter
5159 onShownChanged: if (shown) resetSearch()
@@ -148,7 +156,7 @@ Item {
148156 hasClearButton: false
149157
150158 primaryItem: AbstractButton {
151− enabled: searchField.text != ""
159+ enabled: searchField.text != "" && !searchIndicator.running
152160 onClicked: {
153161 if (searchField.text != "") {
154162 searchHistory.addQuery(searchField.text)
@@ -158,6 +166,22 @@ Item {
158166 height: parent.height
159167 width: height
160168
169+ ActivityIndicator {
170+ id: searchIndicator
171+ objectName: "searchIndicator"
172+
173+ anchors {
174+ verticalCenter: parent.verticalCenter
175+ left: parent.left
176+ leftMargin: units.gu(0.5)
177+ }
178+
179+ running: searchInProgress && searchField.text !== ""
180+ opacity: running ? 1 : 0
181+
182+ Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing.type: Easing.Linear } }
183+ }
184+
161185 Image {
162186 id: primaryImage
163187 anchors {
@@ -167,6 +191,10 @@ Item {
167191 }
168192 width: units.gu(3)
169193 height: units.gu(3)
194+ visible: opacity > 0
195+ opacity: searchIndicator.running ? 0 : 1
196+
197+ Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing.type: Easing.Linear } }
170198 }
171199
172200 Item {
Dash/GenericScopeView.qml+1
@@ -176,6 +176,7 @@ ScopeView {
176176 width: categoryView.width
177177 text: scopeView.scope.name
178178 searchEntryEnabled: true
179+ scope: scopeView.scope
179180 }
180181 }
181182