bluetooth donesies i think
This commit is contained in:
@@ -121,30 +121,79 @@ Container {
|
||||
rightMargin: devicePlaqueRoot.margin
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
RowLayout {
|
||||
id: deviceInfoRow
|
||||
|
||||
property double margin: 7
|
||||
|
||||
spacing: margin * 2
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: margin
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: iconContainer
|
||||
|
||||
property double margin: 7
|
||||
property double boxRadius: 4
|
||||
|
||||
color: Colors.text
|
||||
implicitWidth: deviceListRoot.plaqueHeight - (margin * 2)
|
||||
radius: 4
|
||||
implicitHeight: deviceListRoot.plaqueHeight - (deviceInfoRow.margin * 2)
|
||||
implicitWidth: deviceListRoot.plaqueHeight - (deviceInfoRow.margin * 2)
|
||||
radius: boxRadius
|
||||
|
||||
Rectangle {
|
||||
id: batteryIndicator
|
||||
|
||||
color: Colors.green
|
||||
implicitHeight: (deviceListRoot.plaqueHeight - (deviceInfoRow.margin * 2))
|
||||
* devicePlaqueRoot.deviceText["batteryRaw"]
|
||||
radius: iconContainer.boxRadius
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
margins: iconContainer.margin
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: batteryHoverHandler
|
||||
|
||||
onHoveredChanged: {
|
||||
if (batteryHoverHandler.hovered == true) {
|
||||
batteryText.text = devicePlaqueRoot.deviceText["battery"];
|
||||
} else {
|
||||
batteryText.text = devicePlaqueRoot.deviceText["icon"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CenteredText {
|
||||
id: batteryText
|
||||
|
||||
fontSize: 17
|
||||
text: devicePlaqueRoot.deviceText["icon"]
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
StyledText {
|
||||
color: Colors.text
|
||||
fontSize: 14
|
||||
text: devicePlaqueRoot.deviceText["name"]
|
||||
}
|
||||
|
||||
StyledText {
|
||||
color: Colors.subtext1
|
||||
fontSize: 10
|
||||
text: devicePlaqueRoot.deviceText["mac"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,23 @@ Singleton {
|
||||
|
||||
function getDeviceText(device) {
|
||||
let deviceName = device.deviceName;
|
||||
|
||||
let deviceIcon = getIcon(device.icon);
|
||||
let deviceMac = device.address;
|
||||
let hasBattery = device.batteryAvailable;
|
||||
let deviceBattery = deviceIcon;
|
||||
let deviceBatteryRaw = 0;
|
||||
if (hasBattery) {
|
||||
deviceBattery = device.battery * 100;
|
||||
deviceBatteryRaw = device.battery;
|
||||
}
|
||||
|
||||
return {
|
||||
"icon": deviceIcon,
|
||||
"name": deviceName
|
||||
"name": deviceName,
|
||||
"mac": deviceMac,
|
||||
"hasBattery": hasBattery,
|
||||
"battery": deviceBattery,
|
||||
"batteryRaw": deviceBatteryRaw
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user