2020-10-17 03:22:37 +02:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.9
|
|
|
|
import QtQuick.Controls.Material 2.0
|
|
|
|
|
2020-10-18 15:08:12 +02:00
|
|
|
import de.itsblue.LedDisplayController 1.0
|
2020-10-17 03:22:37 +02:00
|
|
|
|
|
|
|
Dialog {
|
|
|
|
id: control
|
|
|
|
|
|
|
|
parent: Overlay.overlay
|
|
|
|
|
|
|
|
x: (parent.width - width) / 2
|
|
|
|
y: (parent.height - height) / 2
|
|
|
|
|
|
|
|
width: parent.width * 0.9
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
|
|
|
|
title: qsTr("Edit display settings")
|
|
|
|
|
|
|
|
onAccepted: {
|
|
|
|
backend.setDisplayCode(codeTextField.value)
|
|
|
|
backend.setDisplayName(nameTextField.value)
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
id: dataFieldsGridLayout
|
|
|
|
|
|
|
|
width: control.width * 0.9
|
|
|
|
|
|
|
|
TextInputDelegate {
|
|
|
|
id: nameTextField
|
|
|
|
Layout.fillWidth: true
|
|
|
|
required: true
|
|
|
|
text: qsTr("Display name\n(needs restart)")
|
|
|
|
}
|
|
|
|
|
|
|
|
PasswordInputDelegate {
|
|
|
|
id: codeTextField
|
|
|
|
Layout.fillWidth: true
|
|
|
|
required: true
|
|
|
|
text: qsTr("Display code (4 digits)")
|
|
|
|
placeholderText: qsTr("Enter new display code")
|
|
|
|
repeatPlaceholderText: qsTr("Enter new display code again")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
footer: DialogButtonBox {
|
|
|
|
|
|
|
|
// alignment: Qt.AlignHCenter
|
|
|
|
buttonLayout: DialogButtonBox.GnomeLayout
|
|
|
|
|
|
|
|
Material.background: "transparent"
|
|
|
|
|
|
|
|
Button {
|
|
|
|
flat: true
|
|
|
|
enabled: nameTextField.value !== ""
|
2020-10-18 22:42:42 +02:00
|
|
|
text: qsTr("save")
|
2020-10-17 03:22:37 +02:00
|
|
|
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
flat: true
|
2020-10-18 22:42:42 +02:00
|
|
|
text: qsTr("cancel")
|
2020-10-17 03:22:37 +02:00
|
|
|
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function edit() {
|
|
|
|
|
|
|
|
reset()
|
|
|
|
|
2020-10-17 21:51:33 +02:00
|
|
|
nameTextField.value = backend.bleClient.currentDevice.name
|
2020-10-17 03:22:37 +02:00
|
|
|
|
|
|
|
open()
|
|
|
|
}
|
|
|
|
|
|
|
|
function add(model) {
|
|
|
|
editingModel = model
|
|
|
|
editing = false
|
|
|
|
reset()
|
|
|
|
open()
|
|
|
|
}
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
nameTextField.value = ""
|
|
|
|
codeTextField.value = ""
|
|
|
|
}
|
|
|
|
}
|