2020-10-11 15:50:13 +02:00
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Controls 2.9
|
|
|
|
import QtQuick.Layouts 1.0
|
2020-10-13 01:58:14 +02:00
|
|
|
import QtQuick.Controls.Material 2.0
|
2020-10-17 03:22:37 +02:00
|
|
|
import QtGraphicalEffects 1.0
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-18 15:08:12 +02:00
|
|
|
import de.itsblue.LedDisplayController 1.0
|
2020-10-11 15:50:13 +02:00
|
|
|
import de.itsblue.bluetoothleuart 1.0
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: root
|
|
|
|
|
2020-10-17 21:51:33 +02:00
|
|
|
property bool actionButtonVisible: true
|
|
|
|
property bool backButtonVisible: true
|
|
|
|
|
|
|
|
title: backend.bleClient.currentDevice === null ? "":backend.bleClient.currentDevice.name
|
|
|
|
|
2020-10-18 01:39:59 +02:00
|
|
|
signal opened()
|
|
|
|
|
2020-10-17 21:51:33 +02:00
|
|
|
function backButtonClicked() {
|
|
|
|
backend.bleClient.disconnectFromDevice()
|
|
|
|
}
|
|
|
|
|
|
|
|
function actionButtonClicked() {
|
|
|
|
displayEditDialog.edit()
|
|
|
|
}
|
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
ColumnLayout {
|
2020-10-17 21:51:33 +02:00
|
|
|
id: mainLayout
|
2020-10-13 01:58:14 +02:00
|
|
|
anchors {
|
|
|
|
fill: parent
|
2020-10-17 21:51:33 +02:00
|
|
|
margins: Math.min(parent.height, parent.width) * 0.05
|
2020-10-13 01:58:14 +02:00
|
|
|
}
|
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
DisplayTextModelListView {
|
|
|
|
id: displayTextModelListView
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
Layout.fillHeight: true
|
2020-10-13 01:58:14 +02:00
|
|
|
Layout.alignment: Layout.Center
|
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
header: Item {
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
width: parent.width
|
|
|
|
height: 100 + mainLayout.anchors.margins
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
Chip {
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
2020-10-17 03:22:37 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
height: 100
|
|
|
|
radius: height * 0.2
|
|
|
|
|
|
|
|
interactive: false
|
|
|
|
|
|
|
|
color: "white"
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: height * 0.05
|
2020-10-17 03:22:37 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
SwitchDelegate {
|
|
|
|
id: autoBrightnessSwitch
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height / 2
|
2020-10-17 03:22:37 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
checked: backend.displayBrightness.automaticBrightnessAdjustment
|
2020-10-17 03:22:37 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
text: qsTr("Automically adjust brightness")
|
2020-10-17 03:22:37 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
onCheckedChanged: {
|
2020-10-18 16:26:24 +02:00
|
|
|
backend.displayBrightness = {
|
2020-10-18 22:42:42 +02:00
|
|
|
"displayBrightness": brightnessSlider.value,
|
|
|
|
"automaticBrightnessAdjustment": autoBrightnessSwitch.checked
|
2020-10-18 16:26:24 +02:00
|
|
|
}
|
2020-10-18 22:42:42 +02:00
|
|
|
|
2020-10-18 16:26:24 +02:00
|
|
|
}
|
2020-10-17 21:51:33 +02:00
|
|
|
}
|
2020-10-18 01:39:59 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
RowLayout {
|
|
|
|
width: parent.width - autoBrightnessSwitch.padding * 2
|
|
|
|
height: parent.height / 2
|
|
|
|
spacing: mainLayout.anchors.margins
|
2020-10-17 03:22:37 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
Text {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
font.pixelSize: parent.height * 0.5
|
|
|
|
font.family: fontAwesome.name
|
|
|
|
text: "\uf186"
|
|
|
|
}
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
Slider {
|
|
|
|
id: brightnessSlider
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
from: 0
|
|
|
|
to: 50
|
|
|
|
stepSize: 1
|
|
|
|
|
|
|
|
value: backend.displayBrightness.displayBrightness
|
|
|
|
|
|
|
|
onPressedChanged: {
|
|
|
|
if(!pressed) {
|
|
|
|
backend.displayBrightness = {
|
|
|
|
"displayBrightness": value,
|
|
|
|
"automaticBrightnessAdjustment": autoBrightnessSwitch.checked
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-18 22:42:42 +02:00
|
|
|
ToolTip {
|
|
|
|
parent: brightnessSlider.handle
|
|
|
|
visible: brightnessSlider.pressed
|
|
|
|
text: brightnessSlider.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
font.pixelSize: parent.height * 0.5
|
|
|
|
font.family: fontAwesome.name
|
|
|
|
text: "\uf185"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-13 01:58:14 +02:00
|
|
|
}
|
2020-10-11 15:50:13 +02:00
|
|
|
}
|
2020-10-14 23:54:12 +02:00
|
|
|
|
2020-10-17 03:22:37 +02:00
|
|
|
DisplayEditDialog {
|
|
|
|
id: displayEditDialog
|
2020-10-18 15:20:55 +02:00
|
|
|
|
|
|
|
Material.theme: root.Material.theme
|
|
|
|
Material.accent: root.Material.accent
|
2020-10-17 03:22:37 +02:00
|
|
|
}
|
|
|
|
|
2020-10-14 23:54:12 +02:00
|
|
|
Dialog {
|
|
|
|
id: loadingDialog
|
|
|
|
|
|
|
|
property bool shouldBeOpen: false
|
|
|
|
|
|
|
|
onShouldBeOpenChanged: {
|
|
|
|
if(shouldBeOpen)
|
|
|
|
open()
|
|
|
|
else
|
|
|
|
close()
|
|
|
|
}
|
|
|
|
|
|
|
|
parent: Overlay.overlay
|
|
|
|
|
|
|
|
x: (parent.width - width) / 2
|
|
|
|
y: (parent.height - height) / 2
|
|
|
|
|
|
|
|
closePolicy: Popup.NoAutoClose
|
|
|
|
modal: true
|
|
|
|
|
2020-10-18 15:20:55 +02:00
|
|
|
Material.theme: root.Material.theme
|
|
|
|
Material.accent: root.Material.accent
|
|
|
|
|
2020-10-14 23:54:12 +02:00
|
|
|
contentItem: ColumnLayout {
|
|
|
|
BusyIndicator {
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
Layout.alignment: Layout.Center
|
|
|
|
text: qsTr("loading...")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Connected
|
2020-10-14 23:54:12 +02:00
|
|
|
},
|
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Loading
|
2020-10-14 23:54:12 +02:00
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: loadingDialog
|
|
|
|
shouldBeOpen: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2020-10-11 15:50:13 +02:00
|
|
|
}
|