Добавлены настройки login и password

This commit is contained in:
2024-05-18 13:40:15 +02:00
parent e793c1a375
commit 5443c573e2
8 changed files with 122 additions and 41 deletions

View File

@@ -69,7 +69,7 @@ Item {
Label {
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.horizontalCenter
horizontalAlignment: Qt.horizontalCenter
text: name
}
}

View File

@@ -1,6 +1,9 @@
import QtQuick 2.0
import QtQuick.Controls 2.2
import ru.ded.noolight 1.0
import ru.ded.components 1.0
Page {
id: root
@@ -14,6 +17,16 @@ Page {
title: qsTr("nooLite service URL")
inputMethodHint: Qt.ImhUrlCharactersOnly
}
ListElement {
name: "login"
title: qsTr("Login")
inputMethodHint: Qt.ImhLatinOnly
}
ListElement {
name: "password"
title: qsTr("Password")
hideText: true
}
}
ListView {
@@ -24,15 +37,14 @@ Page {
delegate: SubtitledItemDelegate {
width: parent.width
text: model.title
subtitle: settings[model.name]
subtitle: model.hideText && Settings[model.name] ? qsTr("Hidden") : Settings[model.name]
onClicked: inputDialog.open()
Dialog {
id: inputDialog
x: (parent.width - width) / 2
y: (parent.height - height) / 2
anchors.centerIn: parent
parent: ApplicationWindow.overlay
focus: true
@@ -49,14 +61,15 @@ Page {
width: parent.width
focus: true
inputMethodHints: Qt.ImhNoAutoUppercase | model.inputMethodHint
inputMethodHints: model.inputMethodHint
echoMode: model.hideText ? TextInput.Password : TextInput.Normal
placeholderText: model.title
text: settings[model.name]
text: Settings[model.name]
}
}
onAccepted: {
settings[model.name] = textField.text
Settings[model.name] = textField.text
}
}
}

View File

@@ -1,24 +0,0 @@
import QtQuick 2.0
import QtQuick.Controls 2.2
ItemDelegate {
id: root
property string subtitle: ""
contentItem: Column {
Label {
id: titleLabel
width: parent.width
text: root.text
}
Label {
width: parent.width
font.pixelSize: titleLabel.font.pixelSize - 2
text: root.subtitle ? root.subtitle : qsTr("undefined")
opacity: 0.8
}
}
}

View File

@@ -1,7 +1,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import Qt.labs.settings 1.0
import ru.ded.noolight 1.0
import ru.ded.components 1.0
ApplicationWindow {
@@ -12,16 +12,10 @@ ApplicationWindow {
height: 480
title: qsTr("Stack")
Settings {
id: settings
property string serviceUrl: ""
}
LightsModel {
id: lightsModel
serviceUrl: settings.serviceUrl
serviceUrl: Settings.serviceUrl
onError: (text) => stackView.showError(text)
}
@@ -102,7 +96,7 @@ ApplicationWindow {
}
}
onClosing: {
onClosing: (close) => {
if (stackView.depth > 1) {
close.accepted = false
stackView.pop()