From 11a8f032152d2d225942e75634e4a0b4be5dc609 Mon Sep 17 00:00:00 2001 From: voidarc Date: Fri, 7 Aug 2026 14:49:49 +0100 Subject: [PATCH] bluetooth menu coming along --- Bar/Bluetooth.qml | 50 ++++++++++++++++++++++++++++++++--- Services/BluetoothManager.qml | 11 ++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/Bar/Bluetooth.qml b/Bar/Bluetooth.qml index e0e0b7e..42c45b4 100644 --- a/Bar/Bluetooth.qml +++ b/Bar/Bluetooth.qml @@ -1,3 +1,4 @@ +pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts import Quickshell @@ -10,6 +11,8 @@ import "../Services/" Container { id: root + property double devicePlaqeuSpacing + property double devicePlaqueHeight required property HyprlandMonitor monitor property bool opened: false @@ -38,6 +41,7 @@ Container { PropertyChanges { root.boxHeight: 300 + root.boxRadius: 12 root.boxWidth: 350 } @@ -78,9 +82,18 @@ Container { id: deviceList Column { - property string component: "deviceList" + id: deviceListRoot - spacing: 3 + property string component: "deviceList" + property double plaqueHeight: 60 + property double plaqueSpacing: 4 + + spacing: plaqueSpacing + + Item { + implicitHeight: 1 + implicitWidth: 10 + } Repeater { delegate: devicePlaque @@ -93,14 +106,45 @@ Container { Rectangle { id: devicePlaqueRoot + readonly property variant deviceText: BluetoothManager.getDeviceText(modelData) + readonly property double margin: 5 required property var modelData color: Colors.surface1 - implicitHeight: 10 + implicitHeight: deviceListRoot.plaqueHeight + radius: 10 anchors { left: parent.left + leftMargin: devicePlaqueRoot.margin right: parent.right + rightMargin: devicePlaqueRoot.margin + } + + Item { + anchors.fill: parent + + Rectangle { + id: iconContainer + + property double margin: 7 + + color: Colors.text + implicitWidth: deviceListRoot.plaqueHeight - (margin * 2) + radius: 4 + + anchors { + bottom: parent.bottom + left: parent.left + margins: iconContainer.margin + top: parent.top + } + + CenteredText { + fontSize: 17 + text: devicePlaqueRoot.deviceText["icon"] + } + } } } } diff --git a/Services/BluetoothManager.qml b/Services/BluetoothManager.qml index ed23df7..6805eb4 100644 --- a/Services/BluetoothManager.qml +++ b/Services/BluetoothManager.qml @@ -31,6 +31,17 @@ Singleton { return connectedList; } + function getDeviceText(device) { + let deviceName = device.deviceName; + + let deviceIcon = getIcon(device.icon); + + return { + "icon": deviceIcon, + "name": deviceName + }; + } + function getDevicesList() { return root.defaultAdapter.devices.values; }