bluetooth donesies i think
This commit is contained in:
@@ -121,30 +121,79 @@ Container {
|
|||||||
rightMargin: devicePlaqueRoot.margin
|
rightMargin: devicePlaqueRoot.margin
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
RowLayout {
|
||||||
anchors.fill: parent
|
id: deviceInfoRow
|
||||||
|
|
||||||
|
property double margin: 7
|
||||||
|
|
||||||
|
spacing: margin * 2
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
leftMargin: margin
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: iconContainer
|
id: iconContainer
|
||||||
|
|
||||||
property double margin: 7
|
property double boxRadius: 4
|
||||||
|
|
||||||
color: Colors.text
|
color: Colors.text
|
||||||
implicitWidth: deviceListRoot.plaqueHeight - (margin * 2)
|
implicitHeight: deviceListRoot.plaqueHeight - (deviceInfoRow.margin * 2)
|
||||||
radius: 4
|
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 {
|
anchors {
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
margins: iconContainer.margin
|
right: parent.right
|
||||||
top: parent.top
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
id: batteryHoverHandler
|
||||||
|
|
||||||
|
onHoveredChanged: {
|
||||||
|
if (batteryHoverHandler.hovered == true) {
|
||||||
|
batteryText.text = devicePlaqueRoot.deviceText["battery"];
|
||||||
|
} else {
|
||||||
|
batteryText.text = devicePlaqueRoot.deviceText["icon"];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CenteredText {
|
CenteredText {
|
||||||
|
id: batteryText
|
||||||
|
|
||||||
fontSize: 17
|
fontSize: 17
|
||||||
text: devicePlaqueRoot.deviceText["icon"]
|
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) {
|
function getDeviceText(device) {
|
||||||
let deviceName = device.deviceName;
|
let deviceName = device.deviceName;
|
||||||
|
|
||||||
let deviceIcon = getIcon(device.icon);
|
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 {
|
return {
|
||||||
"icon": deviceIcon,
|
"icon": deviceIcon,
|
||||||
"name": deviceName
|
"name": deviceName,
|
||||||
|
"mac": deviceMac,
|
||||||
|
"hasBattery": hasBattery,
|
||||||
|
"battery": deviceBattery,
|
||||||
|
"batteryRaw": deviceBatteryRaw
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user