Mobile/filtering: simple busy indicator

Filtering takes a noticeable time on mobile, so lets show the user we are doing
something.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-10-20 05:01:11 -04:00
parent 52ec544c3b
commit e4e0c608e1

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
import QtQuick 2.6 import QtQuick 2.6
import QtQuick.Controls 2.2 as Controls import QtQuick.Controls 2.4 as Controls
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
@ -19,6 +19,7 @@ Kirigami.ScrollablePage {
property color secondaryTextColor: subsurfaceTheme.secondaryTextColor property color secondaryTextColor: subsurfaceTheme.secondaryTextColor
property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1 property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1
property string activeTrip property string activeTrip
property bool showBusy: false
supportsRefreshing: true supportsRefreshing: true
onRefreshingChanged: { onRefreshingChanged: {
@ -324,6 +325,13 @@ Kirigami.ScrollablePage {
} }
} }
Controls.BusyIndicator {
running: showBusy
z: 10
anchors.fill: parent
anchors.margins: Kirigami.Units.gridUnit
}
StartPage { StartPage {
id: startPage id: startPage
anchors.fill: parent anchors.fill: parent
@ -412,8 +420,12 @@ Kirigami.ScrollablePage {
text: "" text: ""
placeholderText: "Full text search" placeholderText: "Full text search"
onAccepted: { onAccepted: {
showBusy = true
console.log("show busy")
rootItem.filterPattern = text rootItem.filterPattern = text
diveModel.setFilter(text) diveModel.setFilter(text)
console.log("back from setFilter")
showBusy = false
numShown.text = diveModel.shown() numShown.text = diveModel.shown()
} }
onVisibleChanged: { onVisibleChanged: {