Skip to content

Commit

Permalink
Use background property for BusyIndicator to make it work with kirigami
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlich committed Nov 15, 2024
1 parent ad3e9e1 commit fd41d47
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
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
21 changes: 12 additions & 9 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 @@ -111,7 +112,7 @@ PageListPL {
delegate: ListItemPL {
id: listItem
contentHeight: styler.themeItemSizeLarge
// visible: model.FriendlyName.indexOf(deviceType) >= 0
visible: model.FriendlyName.indexOf(deviceType) >= 0
onClicked: {
AmazfishConfig.pairedAddress = "";
AmazfishConfig.pairedName = "";
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
}



}

0 comments on commit fd41d47

Please sign in to comment.