dcontent: add discovery toggle to bt
Also show number of devices
This commit is contained in:
parent
3055f53b97
commit
dd0c3a5a87
1 changed files with 52 additions and 8 deletions
|
|
@ -51,17 +51,61 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
RowLayout {
|
||||||
Layout.topMargin: Appearance.spacing.large
|
Layout.topMargin: Appearance.spacing.large
|
||||||
text: qsTr("Devices")
|
Layout.fillWidth: true
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
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.pointSize: Appearance.font.size.large
|
||||||
font.weight: 500
|
font.weight: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
Layout.fillWidth: true
|
||||||
text: qsTr("All available bluetooth devices")
|
text: qsTr("All available bluetooth devices")
|
||||||
color: Colours.palette.m3outline
|
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 {
|
StyledListView {
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue