1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-07 05:58:28 -04:00

fix(Bluetooth): update codec selection and error handling

Fixes #2240
This commit is contained in:
purian23
2026-07-04 21:48:34 -04:00
parent 8f100960cf
commit c5c3105469
5 changed files with 138 additions and 119 deletions
@@ -23,12 +23,47 @@ Rectangle {
color: Theme.nestedSurface
border.color: Theme.outlineMedium
border.width: Theme.layerOutlineWidth
focus: true
property var bluetoothCodecModalRef: null
property var devicesBeingPaired: new Set()
signal showCodecSelector(var device)
Component.onDestruction: closeTransientSurfaces()
onVisibleChanged: {
if (!visible)
closeTransientSurfaces();
}
Connections {
target: PopoutService.controlCenterPopout
function onShouldBeVisibleChanged() {
const popout = PopoutService.controlCenterPopout;
if (!popout || !popout.shouldBeVisible)
root.closeTransientSurfaces();
}
}
Keys.onPressed: event => {
if (event.key !== Qt.Key_Escape)
return;
if (bluetoothContextMenu.visible) {
bluetoothContextMenu.close();
event.accepted = true;
return;
}
PopoutService.closeControlCenter();
event.accepted = true;
}
function closeTransientSurfaces() {
if (bluetoothContextMenu.visible)
bluetoothContextMenu.close();
if (bluetoothCodecModalRef?.modalVisible)
bluetoothCodecModalRef.hide();
}
function isDeviceBeingPaired(deviceAddress) {
return devicesBeingPaired.has(deviceAddress);
}
@@ -600,6 +635,8 @@ Rectangle {
width: 150
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
onClosed: Qt.callLater(() => root.forceActiveFocus())
property var currentDevice: null
readonly property bool hasDevice: currentDevice !== null
@@ -607,10 +644,10 @@ Rectangle {
readonly property bool showCodecOption: hasDevice && deviceConnected && BluetoothService.isAudioDevice(currentDevice)
background: Rectangle {
color: BlurService.enabled ? Theme.surfaceContainer : Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
color: Theme.withAlpha(Theme.surfaceContainer, BlurService.enabled ? 0.96 : Theme.popupTransparency)
radius: Theme.cornerRadius
border.width: 0
border.color: Theme.outlineStrong
border.width: BlurService.enabled ? BlurService.borderWidth : 0
border.color: BlurService.enabled ? BlurService.borderColor : Theme.outlineStrong
}
MenuItem {