Compare commits

..

No commits in common. "3003dc1435e2cc964842991ebb01e2f849a5a9a3" and "0bbb0328237b30b3beb4dc5d6629c7165e057c4a" have entirely different histories.

5 changed files with 31 additions and 85 deletions

View file

@ -10,7 +10,7 @@ import Quickshell.Widgets
StyledLabel {
id: root
property BluetoothDevice device
required property BluetoothDevice modelData
RowLayout {
id: row
@ -18,20 +18,20 @@ StyledLabel {
spacing: 8
Loader {
active: root.device?.icon != undefined
active: root.modelData?.icon != undefined
sourceComponent: IconImage {
implicitSize: 22
source: Quickshell.iconPath(root.device.icon, "device-support-unknown-symbolic")
source: Quickshell.iconPath(root.modelData.icon, "device-support-unknown-symbolic")
}
}
StyledText {
text: root.device.deviceName
text: root.modelData.deviceName
}
StyledButton {
Layout.alignment: Qt.AlignRight
hoverEnabled: !root.device.pairing
hoverEnabled: !root.modelData.pairing
color: containsMouse ? Theme.palette.primary : Theme.palette.base200
content: StyledText {
text: 'Pair'
@ -41,8 +41,8 @@ StyledLabel {
if (!hoverEnabled) {
return;
}
root.device.trusted = true;
root.device.pair();
root.modelData.trusted = true;
root.modelData.pair();
}
}
}

View file

@ -42,7 +42,8 @@ StyledPopupWindow {
Switch {
checked: Bluetooth.defaultAdapter.discovering
onClicked: Bluetooth.defaultAdapter.discovering = checked
onClicked: Bluetooth.defaultAdapter.discovering = true;
}
}
}
@ -56,89 +57,44 @@ StyledPopupWindow {
spacing: 8
StyledText {
Layout.topMargin: 8
Layout.minimumWidth: 320
font.bold: true
font.pixelSize: 14
text: "Connected Devices"
}
ColumnLayout {
Loader {
active: Bluetooth.connectedDevices.length == 0
sourceComponent: StyledText {
font.italic: true
text: "No devices connected..."
}
}
Repeater {
model: Bluetooth.connectedDevices
delegate: Loader {
id: connectedDeviceLoader
required property var modelData
delegate: ConnectedDevice {
Layout.fillWidth: true
active: modelData != null
sourceComponent: ConnectedDevice {
device: connectedDeviceLoader.modelData
}
}
}
}
StyledText {
Layout.topMargin: 8
font.bold: true
font.pixelSize: 14
text: "Paired Devices"
}
ColumnLayout {
Loader {
active: Bluetooth.availableDevices.length == 0
sourceComponent: StyledText {
font.italic: true
text: "No paired devices..."
}
}
Repeater {
model: Bluetooth.pairedDevices
delegate: Loader {
id: pairedDeviceLoader
required property var modelData
delegate: PairedDevice {
Layout.fillWidth: true
active: modelData != null
sourceComponent: PairedDevice {
device: pairedDeviceLoader.modelData
}
}
}
}
StyledText {
Layout.topMargin: 8
font.bold: true
font.pixelSize: 14
text: "Available Devices"
}
ColumnLayout {
Loader {
active: Bluetooth.availableDevices.length == 0
sourceComponent: StyledText {
font.italic: true
text: Bluetooth.defaultAdapter.discovering ? "No devices found..." : "Scan to find devices..."
}
}
Repeater {
model: Bluetooth.availableDevices
delegate: Loader {
id: availableDeviceLoader
required property var modelData
delegate: AvailableDevice {
Layout.fillWidth: true
active: modelData != null
sourceComponent: AvailableDevice {
device: availableDeviceLoader.modelData
}
}
}
}

View file

@ -11,7 +11,7 @@ import Quickshell.Widgets
StyledLabel {
id: root
required property BluetoothDevice device
required property BluetoothDevice modelData
RowLayout {
id: row
@ -19,19 +19,19 @@ StyledLabel {
spacing: 8
Loader {
active: root.device?.icon != undefined
active: root.modelData?.icon != undefined
sourceComponent: IconImage {
implicitSize: 22
source: Quickshell.iconPath(root.device.icon, "device-support-unknown-symbolic")
source: Quickshell.iconPath(root.modelData.icon, "device-support-unknown-symbolic")
}
}
StyledText {
text: root.device.deviceName
text: root.modelData.deviceName
}
Loader {
active: root.device.batteryAvailable
active: root.modelData.batteryAvailable
sourceComponent: RowLayout {
StyledText {
id: icon
@ -42,11 +42,11 @@ StyledLabel {
states: [
State {
name: "full"
when: root.device.battery > 0.66
when: root.modelData.battery > 0.66
},
State {
name: "medium"
when: root.device.battery > 0.33
when: root.modelData.battery > 0.33
PropertyChanges {
icon {
text: Icons.batteryFull
@ -55,7 +55,7 @@ StyledLabel {
},
State {
name: "low"
when: root.device.battery > 0.10
when: root.modelData.battery > 0.10
PropertyChanges {
icon {
text: Icons.batteryFull
@ -64,7 +64,7 @@ StyledLabel {
},
State {
name: "critical"
when: root.device.battery > 0.10
when: root.modelData.battery > 0.10
PropertyChanges {
icon {
text: Icons.batteryWarning
@ -85,10 +85,10 @@ StyledLabel {
font.pixelSize: 12
}
onClicked: {
if (root.device.state != BluetoothDeviceState.Connected) {
if (root.modelData.state != BluetoothDeviceState.Connected) {
return;
}
root.device.connected = false;
root.modelData.connected = false;
}
}
}

View file

@ -10,7 +10,7 @@ import Quickshell.Widgets
StyledLabel {
id: root
required property BluetoothDevice device
required property BluetoothDevice modelData
RowLayout {
id: row
@ -18,21 +18,21 @@ StyledLabel {
spacing: 8
Loader {
active: root.device?.icon != undefined
active: root.modelData?.icon != undefined
sourceComponent: IconImage {
implicitSize: 22
source: Quickshell.iconPath(root.device.icon, "device-support-unknown-symbolic")
source: Quickshell.iconPath(root.modelData.icon, "device-support-unknown-symbolic")
}
}
StyledText {
text: root.device.deviceName
text: root.modelData.deviceName
}
RowLayout {
Layout.alignment: Qt.AlignRight
StyledButton {
hoverEnabled: root.device.state == BluetoothDeviceState.Disconnected
hoverEnabled: root.modelData.state == BluetoothDeviceState.Disconnected
color: containsMouse ? Theme.palette.primary : Theme.palette.base200
content: StyledText {
text: 'Connect'
@ -42,12 +42,12 @@ StyledLabel {
if (!hoverEnabled) {
return;
}
root.device.connect();
root.modelData.connect();
}
}
StyledButton {
hoverEnabled: root.device.state == BluetoothDeviceState.Disconnected
hoverEnabled: root.modelData.state == BluetoothDeviceState.Disconnected
color: containsMouse ? Theme.palette.error : Theme.palette.base200
content: StyledText {
text: 'Unpair'
@ -57,7 +57,7 @@ StyledLabel {
if (!hoverEnabled) {
return;
}
root.device.forget();
root.modelData.forget();
}
}
}

View file

@ -14,17 +14,7 @@ PopupWindow {
color: "transparent"
implicitWidth: background.width
Behavior on implicitWidth {
NumberAnimation {
duration: 100
}
}
implicitHeight: background.height
Behavior on implicitHeight {
NumberAnimation {
duration: 100
}
}
WrapperRectangle {
id: background