minor fixess
This commit is contained in:
+109
-61
@@ -1,10 +1,40 @@
|
||||
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()
|
||||
@@ -13,71 +43,89 @@ Item {
|
||||
signal openUpdate()
|
||||
signal changePassword()
|
||||
|
||||
ColumnLayout {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 8
|
||||
color: "#161628"
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Кнопки (CRUD + порядок)"
|
||||
onClicked: page.openButtons()
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Расположение: " + settingsContainer.layoutMode +
|
||||
" (" + (settingsContainer.layoutMode === "grid"
|
||||
? settingsContainer.layoutColumns + " колонок"
|
||||
: "список") + ")"
|
||||
onClicked: page.openLayout()
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Фон"
|
||||
onClicked: page.openBackground()
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Обводка отклика (ОК / Ошибка)"
|
||||
onClicked: page.openFeedback()
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Сеть"
|
||||
onClicked: page.openNetwork()
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Обновление ПО"
|
||||
onClicked: page.openUpdate()
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Тема: " + (settingsContainer.darkMode ? "тёмная" : "светлая")
|
||||
onClicked: btnController.setDarkMode(!settingsContainer.darkMode)
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Сменить пароль"
|
||||
onClicked: page.changePassword()
|
||||
}
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentWidth: availableWidth
|
||||
contentHeight: menuColumn.implicitHeight + 16
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
ColumnLayout {
|
||||
id: menuColumn
|
||||
width: page.width - 16
|
||||
x: 8
|
||||
y: 8
|
||||
spacing: 8
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: "Веб-конфигуратор: порт " + settingsContainer.webPort
|
||||
color: settingsContainer.darkMode ? "#cccccc" : "#444444"
|
||||
font.pixelSize: 12
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: "Конфиг: " + config.configPath
|
||||
color: settingsContainer.darkMode ? "#cccccc" : "#444444"
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideMiddle
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user