|
|
@@ -2,6 +2,8 @@ import QtQuick 2.9
|
|
|
import QtQuick.Controls 2.2
|
|
|
import Qt.labs.settings 1.0
|
|
|
|
|
|
+import ru.ded.components 1.0
|
|
|
+
|
|
|
ApplicationWindow {
|
|
|
id: window
|
|
|
|
|
|
@@ -34,13 +36,10 @@ ApplicationWindow {
|
|
|
anchors.left: parent.left
|
|
|
anchors.leftMargin: 8
|
|
|
|
|
|
- width: 24
|
|
|
- height: 24
|
|
|
-
|
|
|
state: stackView.depth > 1 ? "back" : "menu"
|
|
|
|
|
|
onClicked: {
|
|
|
- drawer.open()
|
|
|
+ mainMenu.open()
|
|
|
}
|
|
|
|
|
|
onBack: {
|
|
|
@@ -54,56 +53,34 @@ ApplicationWindow {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Drawer {
|
|
|
- id: drawer
|
|
|
- width: window.width * 0.66
|
|
|
- height: window.height
|
|
|
-
|
|
|
- Column {
|
|
|
- anchors.fill: parent
|
|
|
-
|
|
|
- Row {
|
|
|
- width: parent.width
|
|
|
- height: 100
|
|
|
-
|
|
|
- Image {
|
|
|
- anchors.top: parent.top
|
|
|
- anchors.bottom: parent.bottom
|
|
|
- anchors.margins: 10
|
|
|
- source: "lamp.png"
|
|
|
- }
|
|
|
-
|
|
|
- Label {
|
|
|
- anchors.verticalCenter: parent.verticalCenter
|
|
|
- font.pointSize: 20
|
|
|
- text: qsTr("nooLight v0.1")
|
|
|
- }
|
|
|
- }
|
|
|
+ MainMenu {
|
|
|
+ id: mainMenu
|
|
|
|
|
|
- ItemDelegate {
|
|
|
- text: qsTr("Service")
|
|
|
- width: parent.width
|
|
|
- onClicked: {
|
|
|
- stackView.openPage("ServiceForm.qml")
|
|
|
- }
|
|
|
- }
|
|
|
+ readonly property var actions: {
|
|
|
+ "service": () => { stackView.openPage("ServiceForm.qml") },
|
|
|
+ "settings": () => { stackView.openPage("SettingsForm.qml") },
|
|
|
+ "quit": () => { Qt.quit() }
|
|
|
+ }
|
|
|
|
|
|
- ItemDelegate {
|
|
|
- text: qsTr("Settings")
|
|
|
- width: parent.width
|
|
|
- onClicked: {
|
|
|
- stackView.openPage("SettingsForm.qml")
|
|
|
- }
|
|
|
- }
|
|
|
+ logo: "qrc:/lamp.png"
|
|
|
+ appName: qsTr("nooLight v1.0")
|
|
|
|
|
|
- ItemDelegate {
|
|
|
- text: qsTr("Quit")
|
|
|
- width: parent.width
|
|
|
- onClicked: {
|
|
|
- Qt.quit()
|
|
|
- }
|
|
|
+ model: ListModel {
|
|
|
+ ListElement {
|
|
|
+ title: qsTr("Service")
|
|
|
+ action: "service"
|
|
|
+ }
|
|
|
+ ListElement {
|
|
|
+ title: qsTr("Settings")
|
|
|
+ action: "settings"
|
|
|
+ }
|
|
|
+ ListElement {
|
|
|
+ title: qsTr("Quit")
|
|
|
+ action: "quit"
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ onActionSelected: (action) => actions[action]()
|
|
|
}
|
|
|
|
|
|
StackView {
|
|
|
@@ -117,7 +94,7 @@ ApplicationWindow {
|
|
|
}
|
|
|
|
|
|
push(page)
|
|
|
- drawer.close()
|
|
|
+ mainMenu.close()
|
|
|
}
|
|
|
|
|
|
function showError(text) {
|