132 lines
3.8 KiB
QML
132 lines
3.8 KiB
QML
import QtQuick 2.12
|
|
import QtQuick.Controls 2.12
|
|
import QtQuick.Layouts 1.12
|
|
import "../components"
|
|
|
|
Item {
|
|
id: page
|
|
|
|
property string deviceIp: "…"
|
|
|
|
function refreshIp() {
|
|
var devs = systemInfo.networkInfo()
|
|
for (var i = 0; i < devs.length; ++i) {
|
|
var addrs = devs[i].addresses
|
|
if (!addrs || devs[i].state !== "connected")
|
|
continue
|
|
var a = String(addrs).split(",")[0].trim()
|
|
var slash = a.indexOf("/")
|
|
if (slash >= 0)
|
|
a = a.substring(0, slash)
|
|
if (a.length > 0) {
|
|
deviceIp = a
|
|
return
|
|
}
|
|
}
|
|
deviceIp = "—"
|
|
}
|
|
|
|
Component.onCompleted: refreshIp()
|
|
|
|
Timer {
|
|
interval: 5000
|
|
running: true
|
|
repeat: true
|
|
onTriggered: page.refreshIp()
|
|
}
|
|
|
|
signal openButtons()
|
|
signal openLayout()
|
|
signal openBackground()
|
|
signal openFeedback()
|
|
signal openNetwork()
|
|
signal openUpdate()
|
|
signal changePassword()
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: "#161628"
|
|
}
|
|
|
|
ScrollView {
|
|
anchors.fill: parent
|
|
clip: true
|
|
contentWidth: availableWidth
|
|
contentHeight: menuColumn.implicitHeight + 16
|
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
|
|
|
ColumnLayout {
|
|
id: menuColumn
|
|
width: page.width - 16
|
|
x: 8
|
|
y: 8
|
|
spacing: 8
|
|
|
|
SettingsButton {
|
|
Layout.fillWidth: true
|
|
text: "Кнопки (CRUD + порядок)"
|
|
onClicked: page.openButtons()
|
|
}
|
|
SettingsButton {
|
|
Layout.fillWidth: true
|
|
text: "Расположение: " + settingsContainer.layoutMode +
|
|
" (" + (settingsContainer.layoutMode === "grid"
|
|
? settingsContainer.layoutColumns + " колонок"
|
|
: "список") + ")"
|
|
onClicked: page.openLayout()
|
|
}
|
|
SettingsButton {
|
|
Layout.fillWidth: true
|
|
text: "Фон"
|
|
onClicked: page.openBackground()
|
|
}
|
|
SettingsButton {
|
|
Layout.fillWidth: true
|
|
text: "Обводка отклика (ОК / Ошибка)"
|
|
onClicked: page.openFeedback()
|
|
}
|
|
SettingsButton {
|
|
Layout.fillWidth: true
|
|
text: "Сеть"
|
|
onClicked: page.openNetwork()
|
|
}
|
|
SettingsButton {
|
|
Layout.fillWidth: true
|
|
text: "Обновление ПО"
|
|
onClicked: page.openUpdate()
|
|
}
|
|
SettingsButton {
|
|
Layout.fillWidth: true
|
|
text: "Сменить пароль"
|
|
onClicked: page.changePassword()
|
|
}
|
|
|
|
Text {
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: 8
|
|
text: "IP: " + page.deviceIp
|
|
color: "#cccccc"
|
|
font.pixelSize: 12
|
|
horizontalAlignment: Text.AlignHCenter
|
|
}
|
|
Text {
|
|
Layout.fillWidth: true
|
|
text: "Веб-конфигуратор: http://" + page.deviceIp + ":" + settingsContainer.webPort
|
|
color: "#cccccc"
|
|
font.pixelSize: 12
|
|
horizontalAlignment: Text.AlignHCenter
|
|
}
|
|
Text {
|
|
Layout.fillWidth: true
|
|
text: "Конфиг: " + config.configPath
|
|
color: "#cccccc"
|
|
font.pixelSize: 11
|
|
elide: Text.ElideMiddle
|
|
horizontalAlignment: Text.AlignHCenter
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 8 }
|
|
}
|
|
}
|
|
}
|