diff --git a/beerlog_ru_RU.ts b/beerlog_ru_RU.ts
index 50e128e..4c056ff 100644
--- a/beerlog_ru_RU.ts
+++ b/beerlog_ru_RU.ts
@@ -6,7 +6,7 @@
BeerLog v0.1
-
+
@@ -17,20 +17,26 @@
-
+
BeerLog v0.1
BeerLog v1.0.0
-
+
Settings
Настройки
-
+
+
Quit
Выход
+
+
+ Realy quit the application?
+ Действительно выйти из приложения?
+
diff --git a/qml/Views/OrdersView.qml b/qml/Views/OrdersView.qml
new file mode 100644
index 0000000..9dec0d1
--- /dev/null
+++ b/qml/Views/OrdersView.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+
+Page {
+
+ Label {
+ anchors.centerIn: parent
+
+ text: "Orders"
+ }
+
+}
diff --git a/qml/Views/SettingsView.qml b/qml/Views/SettingsView.qml
new file mode 100644
index 0000000..ed62c36
--- /dev/null
+++ b/qml/Views/SettingsView.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+
+Page {
+
+ Label {
+ anchors.centerIn: parent
+ text: "Settings"
+ }
+
+}
diff --git a/qml/main.qml b/qml/main.qml
index c650d47..5e094a7 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -17,11 +17,9 @@ ApplicationWindow {
RowLayout {
anchors.fill: parent
MenuBackButton {
- state: "menu"//stackView.depth > 1 ? "back" : "menu"
+ state: stackView.depth > 1 ? "back" : "menu"
onClicked: mainMenu.open()
- onBack: {
- state = "menu"
- }
+ onBack: stackView.pop()
}
ToolButton {
text: usersModel.selectedUserName
@@ -55,7 +53,7 @@ ApplicationWindow {
id: mainMenu
readonly property var actions: {
- "settings": () => { stackView.openPage("SettingsForm.qml") },
+ "settings": () => { stackView.openPage("Views/SettingsView.qml") },
"quit": () => { Qt.quit() }
}
@@ -78,4 +76,58 @@ ApplicationWindow {
onActionSelected: (action) => actions[action]()
}
+
+ StackView {
+ id: stackView
+ initialItem: "Views/OrdersView.qml"
+ anchors.fill: parent
+
+ function openPage(page) {
+ if (depth > 1) {
+ pop()
+ }
+
+ push(page)
+ mainMenu.close()
+ }
+
+ function showError(text) {
+ ToolTip.show(text, 1000)
+ }
+ }
+
+ Dialog {
+ id: quitDialog
+
+ property bool quitAccepted: false
+
+ anchors.centerIn: parent
+ parent: Overlay.overlay
+
+ modal: true
+ title: qsTr("Quit")
+ standardButtons: Dialog.Yes | Dialog.No
+
+ Label {
+ text: qsTr("Realy quit the application?")
+ }
+
+ onAccepted: {
+ quitAccepted = true
+ Qt.quit()
+ }
+ }
+
+ onClosing: (close) => {
+ if (stackView.depth > 1) {
+ close.accepted = false
+ stackView.pop()
+ return
+ }
+
+ if (!quitDialog.quitAccepted) {
+ close.accepted = false
+ quitDialog.open()
+ }
+ }
}
diff --git a/qml/qml.qrc b/qml/qml.qrc
index e3bd633..c5d13fd 100644
--- a/qml/qml.qrc
+++ b/qml/qml.qrc
@@ -6,5 +6,7 @@
logo.png
beerlog_ru_RU.qm
Components/MainMenu.qml
+ Views/OrdersView.qml
+ Views/SettingsView.qml