added restapi

This commit is contained in:
2026-11-02 16:46:20 +03:00
parent 9d74d06ce3
commit 588c2e0135
74 changed files with 7253 additions and 129 deletions
+82 -30
View File
@@ -16,6 +16,11 @@ Window {
property bool darkMode: true
function hideSensorsIfDisabled() {
if (!settingsContainer.collectorEnabled && mainTabs.currentIndex > 0)
mainTabs.currentIndex = 0
}
BackgroundLayer {
id: bg
anchors.fill: parent
@@ -30,7 +35,6 @@ Window {
id: mainTabs
Layout.fillWidth: true
Layout.preferredHeight: 36
Layout.rightMargin: settingsBtn.width + 8
background: Rectangle {
color: "#161628"
@@ -53,8 +57,10 @@ Window {
}
}
TabButton {
id: sensorsTabBtn
text: "Датчики"
width: implicitWidth
visible: settingsContainer.collectorEnabled
width: visible ? implicitWidth : 0
contentItem: Text {
text: parent.text
color: parent.checked ? "#ffffff" : "#aaaaaa"
@@ -163,34 +169,33 @@ Window {
}
}
// Settings gear (top-right)
Rectangle {
id: settingsBtn
// Hidden hotspot: double-tap the top-right corner to open settings.
MouseArea {
id: settingsHotspot
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 8
width: Math.max(40, parent.width / 14)
height: width
color: "transparent"
opacity: 0.85
z: 10
width: 72
height: 72
z: 20
onDoubleClicked: passwordDialog.open()
}
Rectangle {
anchors.fill: parent
radius: width / 2
color: root.darkMode ? "#40ffffff" : "#40000000"
}
Connections {
target: settingsContainer
onChanged: root.hideSensorsIfDisabled()
}
Component.onCompleted: hideSensorsIfDisabled()
Text {
anchors.centerIn: parent
text: "\u2699"
font.pixelSize: parent.width * 0.6
color: root.darkMode ? "white" : "black"
}
readonly property bool secureDialogOpen: passwordDialog.opened || settingsDialog.opened
onSecureDialogOpenChanged: uiIdle.active = secureDialogOpen
MouseArea {
anchors.fill: parent
onClicked: passwordDialog.open()
Connections {
target: uiIdle
onIdle: {
if (passwordDialog.opened)
passwordDialog.close()
if (settingsDialog.opened)
settingsDialog.close()
}
}
@@ -205,12 +210,50 @@ Window {
contentItem: ColumnLayout {
spacing: 8
TextField {
id: pwdField
Item {
Layout.fillWidth: true
placeholderText: "Введите пароль"
echoMode: TextInput.Password
onAccepted: passwordDialog.accept()
Layout.preferredHeight: 40
TextField {
id: pwdField
anchors.fill: parent
placeholderText: "Введите пароль"
echoMode: TextInput.Password
selectByMouse: false
onAccepted: passwordDialog.accept()
onTextChanged: {
passwordDialog.showLast = length > 0
if (length === 0)
maskTimer.stop()
else
maskTimer.restart()
if (cursorPosition !== length)
cursorPosition = length
}
onCursorPositionChanged: {
if (cursorPosition !== length)
cursorPosition = length
}
}
Rectangle {
visible: passwordDialog.showLast && pwdField.length > 0
color: pwdField.palette.base
readonly property real cell: Math.max(
lastChar.implicitWidth,
(pwdField.cursorRectangle.x - pwdField.leftPadding) / pwdField.length)
x: pwdField.cursorRectangle.x - cell
y: pwdField.cursorRectangle.y
width: cell
height: pwdField.cursorRectangle.height
Text {
id: lastChar
anchors.centerIn: parent
text: pwdField.text.charAt(pwdField.text.length - 1)
font: pwdField.font
color: pwdField.palette.text
}
}
}
Text {
id: wrongPwd
@@ -221,8 +264,17 @@ Window {
}
}
property bool showLast: false
Timer {
id: maskTimer
interval: 1000
onTriggered: passwordDialog.showLast = false
}
onOpened: {
pwdField.text = ""
showLast = false
wrongPwd.visible = false
pwdField.forceActiveFocus()
}