131 lines
3.7 KiB
QML
131 lines
3.7 KiB
QML
import QtQuick 2.12
|
|
import QtQuick.Controls 2.12
|
|
import QtQuick.Layouts 1.12
|
|
import "settings"
|
|
|
|
Dialog {
|
|
id: dlg
|
|
modal: true
|
|
title: "Настройки"
|
|
width: Math.min(720, parent ? parent.width * 0.95 : 720)
|
|
height: Math.min(560, parent ? parent.height * 0.95 : 560)
|
|
anchors.centerIn: parent
|
|
standardButtons: Dialog.Close
|
|
|
|
readonly property color panelBg: "#161628"
|
|
readonly property color panelFg: "#ffffff"
|
|
readonly property color panelMuted: "#cccccc"
|
|
readonly property color controlBg: "#2a2a40"
|
|
|
|
palette.button: controlBg
|
|
palette.buttonText: panelFg
|
|
palette.window: panelBg
|
|
palette.windowText: panelFg
|
|
palette.text: panelFg
|
|
palette.base: "#222236"
|
|
palette.alternateBase: controlBg
|
|
palette.highlight: "#4a4a70"
|
|
palette.highlightedText: panelFg
|
|
|
|
background: Rectangle {
|
|
color: panelBg
|
|
radius: 4
|
|
}
|
|
|
|
StackView {
|
|
id: stack
|
|
anchors.fill: parent
|
|
initialItem: mainPageComp
|
|
|
|
background: Rectangle {
|
|
color: panelBg
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: mainPageComp
|
|
MainPage {
|
|
onOpenButtons: stack.push(buttonsPageComp)
|
|
onOpenLayout: stack.push(layoutPageComp)
|
|
onOpenBackground: stack.push(backgroundPageComp)
|
|
onOpenFeedback: stack.push(feedbackPageComp)
|
|
onOpenNetwork: stack.push(networkPageComp)
|
|
onOpenUpdate: stack.push(updatePageComp)
|
|
onChangePassword: changePwdDialog.open()
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: buttonsPageComp
|
|
ButtonsPage {
|
|
onCreateRequested: editorDialog.openForCreate()
|
|
onEditRequested: function(data) { editorDialog.openForEdit(data) }
|
|
}
|
|
}
|
|
|
|
Component { id: layoutPageComp; LayoutPage {} }
|
|
Component { id: backgroundPageComp; BackgroundPage {} }
|
|
Component { id: feedbackPageComp; FeedbackPage {} }
|
|
Component { id: networkPageComp; NetworkInfoPage {} }
|
|
Component { id: updatePageComp; UpdatePage {} }
|
|
|
|
ButtonEditorDialog { id: editorDialog }
|
|
|
|
Dialog {
|
|
id: changePwdDialog
|
|
modal: true
|
|
parent: Overlay.overlay
|
|
title: "Сменить пароль"
|
|
anchors.centerIn: parent
|
|
width: Math.min(420, dlg.width * 0.9)
|
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
|
|
|
palette.button: dlg.controlBg
|
|
palette.buttonText: dlg.panelFg
|
|
palette.window: dlg.panelBg
|
|
palette.windowText: dlg.panelFg
|
|
palette.text: dlg.panelFg
|
|
palette.base: "#222236"
|
|
|
|
background: Rectangle {
|
|
color: dlg.panelBg
|
|
radius: 4
|
|
}
|
|
|
|
contentItem: ColumnLayout {
|
|
spacing: 8
|
|
TextField {
|
|
id: newPwdField
|
|
Layout.fillWidth: true
|
|
Layout.preferredHeight: 40
|
|
placeholderText: "Новый пароль"
|
|
onAccepted: changePwdDialog.accept()
|
|
}
|
|
Text {
|
|
id: pwdEmptyHint
|
|
Layout.fillWidth: true
|
|
visible: false
|
|
color: "red"
|
|
text: "Введите новый пароль"
|
|
}
|
|
}
|
|
|
|
onOpened: {
|
|
newPwdField.text = ""
|
|
pwdEmptyHint.visible = false
|
|
newPwdField.forceActiveFocus()
|
|
}
|
|
onAccepted: {
|
|
var p = newPwdField.text.trim()
|
|
if (p.length === 0) {
|
|
pwdEmptyHint.visible = true
|
|
Qt.callLater(changePwdDialog.open)
|
|
return
|
|
}
|
|
btnController.setPassword(p)
|
|
newPwdField.text = ""
|
|
pwdEmptyHint.visible = false
|
|
}
|
|
}
|
|
}
|