Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show BusyIndicator in kirigami (refactor _placeholderText) #407

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ui/qml/components/platform.qtcontrols/BusyIndicatorPL.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ import QtQuick.Layouts 1.12
BusyIndicator {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
// anchors.centerIn: parent
height: styler.themeFontSizeHuge
width: height
}

8 changes: 8 additions & 0 deletions ui/qml/components/platform.silica/PageListPL.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,20 @@ Page {
property alias pageMenu: menuLoader.sourceComponent
property alias placeholderEnabled: viewPlaceholder.enabled
property alias placeholderText: viewPlaceholder.hintText
property alias background: backgroundLoader.sourceComponent
property string title

signal pageStatusActivating
signal pageStatusActive
signal pageStatusInactive


Loader {
id: backgroundLoader
active: sourceComponent ? true : false
anchors.centerIn: parent
}

SilicaListView {
id: listView
anchors.fill: parent
Expand Down
19 changes: 11 additions & 8 deletions ui/qml/pages/PairPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ PageListPL {
//backNavigation: !DaemonInterfaceInstance.pairing
title: qsTr("Pair Device")

placeholderText: _placeholderText || qsTr("No devices found")
placeholderEnabled: devicesModel.rowCount() > 0
placeholderText: qsTr("No devices found")
placeholderEnabled: (delegateModel.count === 0) && !busy
property bool busy: (adapter && adapter.discovering && !page.count) || DaemonInterfaceInstance.connectionState == "pairing"
//busy: discoveryModel.running || DaemonInterfaceInstance.pairing

property string deviceType
property variant aliases
property string _placeholderText
property string _deviceName
property string _deviceAddress
property QtObject adapter: _bluetoothManager ? _bluetoothManager.usableAdapter : null
Expand Down Expand Up @@ -156,7 +157,7 @@ PageListPL {
}

// Set to undefined when pairing to show busy indicator only
model: !DaemonInterfaceInstance.pairing && !_placeholderText
model: (DaemonInterfaceInstance !== undefined) && !DaemonInterfaceInstance.pairing && delegateModel.count > 0
? delegateModel
: undefined

Expand All @@ -165,13 +166,12 @@ PageListPL {
//busy: discoveryModel.running || DaemonInterfaceInstance.pairing

PageMenuItemPL {
enabled: !DaemonInterfaceInstance.pairing
enabled: (DaemonInterfaceInstance !== undefined) && !DaemonInterfaceInstance.pairing
iconSource: adapter && adapter.discovering ? "" : (styler.iconDeviceScan !== undefined ? styler.iconDeviceScan : "")
text: adapter && adapter.discovering
? qsTr("Stop scanning")
: qsTr("Scan for devices")
onClicked: {
_placeholderText = ""
if (adapter && adapter.discovering) {
stopDiscovery();
} else {
Expand All @@ -191,10 +191,13 @@ PageListPL {
}
}

BusyIndicatorPL {
background: BusyIndicatorPL {
id: busyIndicator
anchors.centerIn: parent
running: (adapter && adapter.discovering && !page.count) || DaemonInterfaceInstance.connectionState == "pairing"
running: busy
}



}

Loading