add paired devices
This commit is contained in:
parent
149dae4c2e
commit
1cdec64535
2 changed files with 70 additions and 4 deletions
|
|
@ -62,10 +62,12 @@ StyledPopupWindow {
|
||||||
text: "Paired Devices"
|
text: "Paired Devices"
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceList {
|
ColumnLayout {
|
||||||
devices: Bluetooth.pairedDevices
|
Repeater {
|
||||||
onDeviceActivated: device => {
|
model: Bluetooth.pairedDevices
|
||||||
device.connect();
|
delegate: PairedDevice {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
64
modules/bar/components/bluetooth/PairedDevice.qml
Normal file
64
modules/bar/components/bluetooth/PairedDevice.qml
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.config
|
||||||
|
import qs.constants
|
||||||
|
import qs.widgets
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Bluetooth
|
||||||
|
import Quickshell.Widgets
|
||||||
|
|
||||||
|
StyledLabel {
|
||||||
|
id: device
|
||||||
|
required property BluetoothDevice modelData
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: row
|
||||||
|
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: modelData.icon != undefined
|
||||||
|
sourceComponent: IconImage {
|
||||||
|
implicitSize: 18
|
||||||
|
source: Quickshell.iconPath(device.modelData.icon)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: device.modelData.deviceName
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
StyledButton {
|
||||||
|
hoverEnabled: device.modelData.state == BluetoothDeviceState.Disconnected
|
||||||
|
color: containsMouse ? Theme.palette.info : Theme.palette.base200
|
||||||
|
content: StyledText {
|
||||||
|
text: 'Connect'
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
if (!hoverEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
device.modelData.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledButton {
|
||||||
|
hoverEnabled: device.modelData.state == BluetoothDeviceState.Disconnected
|
||||||
|
color: containsMouse ? Theme.palette.error : Theme.palette.base200
|
||||||
|
content: StyledText {
|
||||||
|
text: 'Unpair'
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
if (!hoverEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
device.modelData.forget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue