diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-27 13:21:14 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-27 13:21:14 +1000 |
| commit | dd0c3a5a87c9ea8fe10764c60be3a58ce2eaf119 (patch) | |
| tree | cf3979c2f6cfbf25dcdb71581a49644075ef86ad | |
| parent | dcontent: add adapter name editing (diff) | |
| download | caelestia-shell-dd0c3a5a87c9ea8fe10764c60be3a58ce2eaf119.tar.gz caelestia-shell-dd0c3a5a87c9ea8fe10764c60be3a58ce2eaf119.tar.bz2 caelestia-shell-dd0c3a5a87c9ea8fe10764c60be3a58ce2eaf119.zip | |
dcontent: add discovery toggle to bt
Also show number of devices
| -rw-r--r-- | modules/detachedcontent/bluetooth/DeviceList.qml | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/modules/detachedcontent/bluetooth/DeviceList.qml b/modules/detachedcontent/bluetooth/DeviceList.qml index 91fca23..26495f1 100644 --- a/modules/detachedcontent/bluetooth/DeviceList.qml +++ b/modules/detachedcontent/bluetooth/DeviceList.qml @@ -51,16 +51,60 @@ ColumnLayout { } } - StyledText { + RowLayout { Layout.topMargin: Appearance.spacing.large - text: qsTr("Devices") - font.pointSize: Appearance.font.size.large - font.weight: 500 - } + Layout.fillWidth: true + spacing: Appearance.spacing.normal - StyledText { - text: qsTr("All available bluetooth devices") - color: Colours.palette.m3outline + ColumnLayout { + Layout.fillWidth: true + spacing: Appearance.spacing.small + + StyledText { + Layout.fillWidth: true + text: qsTr("Devices (%1)").arg(Bluetooth.devices.values.length) + font.pointSize: Appearance.font.size.large + font.weight: 500 + } + + StyledText { + Layout.fillWidth: true + text: qsTr("All available bluetooth devices") + color: Colours.palette.m3outline + } + } + + StyledRect { + implicitWidth: implicitHeight + implicitHeight: scanIcon.implicitHeight + Appearance.padding.normal * 2 + + radius: Bluetooth.defaultAdapter?.discovering ? Appearance.rounding.normal : implicitHeight / 2 + color: Bluetooth.defaultAdapter?.discovering ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer + + StateLayer { + color: Bluetooth.defaultAdapter?.discovering ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer + + function onClicked(): void { + const adapter = Bluetooth.defaultAdapter; + if (adapter) + adapter.discovering = !adapter.discovering; + } + } + + MaterialIcon { + id: scanIcon + + anchors.centerIn: parent + animate: true + text: "bluetooth_searching" + color: Bluetooth.defaultAdapter?.discovering ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer + fill: Bluetooth.defaultAdapter?.discovering ? 1 : 0 + } + + Behavior on radius { + Anim {} + } + } } StyledListView { |