From 4945818ec1b950081926431dbda093372824b364 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Thu, 1 Jul 2021 18:05:40 +0200 Subject: Introduce add_server_wizard placeholder scenes; Add independent functions for scene operations. --- qml.qrc | 3 ++ src/main.qml | 42 +++++++++++++------- src/scenes/add_server_wizard/Scene_step_1.qml | 55 +++++++++++++++++++++++++++ src/scenes/add_server_wizard/Scene_step_2.qml | 55 +++++++++++++++++++++++++++ src/scenes/add_server_wizard/Scene_step_3.qml | 54 ++++++++++++++++++++++++++ 5 files changed, 195 insertions(+), 14 deletions(-) create mode 100644 src/scenes/add_server_wizard/Scene_step_1.qml create mode 100644 src/scenes/add_server_wizard/Scene_step_2.qml create mode 100644 src/scenes/add_server_wizard/Scene_step_3.qml diff --git a/qml.qrc b/qml.qrc index cefe120..527f4f3 100644 --- a/qml.qrc +++ b/qml.qrc @@ -23,5 +23,8 @@ src/ToastManager.qml src/Toast.qml qtquickcontrols2.conf + src/scenes/add_server_wizard/Scene_step_1.qml + src/scenes/add_server_wizard/Scene_step_2.qml + src/scenes/add_server_wizard/Scene_step_3.qml diff --git a/src/main.qml b/src/main.qml index 4a0706f..a30ed35 100644 --- a/src/main.qml +++ b/src/main.qml @@ -67,6 +67,27 @@ ApplicationWindow { console.log("Opening window now..."); } + function main_content_pop(item, operation) { + if(item) { + if(item.search(main_content.currentItem.objectName) >= 0) return + } + return main_content.pop(item, operation) + } + + function main_content_push(item, operation) { + if(item) { + if(item.search(main_content.currentItem.objectName) >= 0) return + } + return main_content.push(item, operation) + } + + function main_content_replace(item, operation) { + if(item) { + if(item.search(main_content.currentItem.objectName) >= 0) return + } + return main_content.replace(item, operation) + } + MessageDialog { id: message_dialog objectName: "message_dialog" @@ -89,9 +110,10 @@ ApplicationWindow { } } - StackView { id: main_content + objectName: "main_content" + anchors.top: top_menu_bar_frame.bottom anchors.right: parent.right anchors.bottom: parent.bottom @@ -191,9 +213,7 @@ ApplicationWindow { header_text.text = qsTr("Settings") if(inPortrait) sidebar_drawer.close() - if(scene_url.search(main_content.currentItem.objectName) <= 0) { - main_content.replace(scene_url) - } + main_content_replace(scene_url, StackView.Transition) } MenuSeparator { @@ -212,9 +232,7 @@ ApplicationWindow { header_text.text = qsTr("Allow remote control") if(inPortrait) sidebar_drawer.close() - if(scene_url.search(main_content.currentItem.objectName) <= 0) { - main_content.replace(scene_url) - } + main_content_replace(scene_url, StackView.Transition) } } ListItem { @@ -224,21 +242,17 @@ ApplicationWindow { header_text.text = qsTr("Allow remote view") if(inPortrait) sidebar_drawer.close() - if(scene_url.search(main_content.currentItem.objectName) <= 0) { - main_content.replace(scene_url) - } + main_content_replace(scene_url, StackView.Transition) } } ListItem { text: " " + qsTr("Add RWA-Server") - scene_url: "scenes/Scene_placeholder.qml" + scene_url: "scenes/add_server_wizard/Scene_step_1.qml" onListItemClick: { header_text.text = qsTr("Server addition wizard") if(inPortrait) sidebar_drawer.close() - if(scene_url.search(main_content.currentItem.objectName) <= 0) { - main_content.replace(scene_url) - } + main_content_replace(scene_url, StackView.Transition) } } } diff --git a/src/scenes/add_server_wizard/Scene_step_1.qml b/src/scenes/add_server_wizard/Scene_step_1.qml new file mode 100644 index 0000000..2061db1 --- /dev/null +++ b/src/scenes/add_server_wizard/Scene_step_1.qml @@ -0,0 +1,55 @@ +import QtQuick 2.9 +import QtQuick.Window 2.2 +import QtQuick.Extras 1.4 +import QtQuick.Controls 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Controls.Material 2.3 + +/*! + This .qml file is a Scene which can be loaded through for example a StackView (main_content in main.qml). + */ + +Item { + id: scene_server_wizard_step_1 + objectName: "Scene_server_wizard_step_1" + + Rectangle { + id: rectangle + anchors.fill: parent + color: Material.background + + Text { + color: Material.foreground + id: title + + text: qsTr("Step 1") + font.pointSize: 18 + wrapMode: Text.WordWrap + + font.bold: true + horizontalAlignment: Text.AlignHCenter + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 5 + } + + Button { + id: next_step1_button + text: qsTr("Next Step") + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + + onClicked: { + main_content_push("scenes/add_server_wizard/Scene_step_2.qml", StackView.Transition) + } + } + } +} + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ diff --git a/src/scenes/add_server_wizard/Scene_step_2.qml b/src/scenes/add_server_wizard/Scene_step_2.qml new file mode 100644 index 0000000..acc2a20 --- /dev/null +++ b/src/scenes/add_server_wizard/Scene_step_2.qml @@ -0,0 +1,55 @@ +import QtQuick 2.9 +import QtQuick.Window 2.2 +import QtQuick.Extras 1.4 +import QtQuick.Controls 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Controls.Material 2.3 + +/*! + This .qml file is a Scene which can be loaded through for example a StackView (main_content in main.qml). + */ + +Item { + id: scene_server_wizard_step_2 + objectName: "Scene_server_wizard_step_2" + + Rectangle { + id: rectangle + anchors.fill: parent + color: Material.background + + Text { + color: Material.foreground + id: title + + text: qsTr("Step 2") + font.pointSize: 18 + wrapMode: Text.WordWrap + + font.bold: true + horizontalAlignment: Text.AlignHCenter + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 5 + } + + Button { + id: next_step2_button + text: qsTr("Next Step") + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + + onClicked: { + main_content_push("scenes/add_server_wizard/Scene_step_3.qml", StackView.Transition) + } + } + } +} + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ diff --git a/src/scenes/add_server_wizard/Scene_step_3.qml b/src/scenes/add_server_wizard/Scene_step_3.qml new file mode 100644 index 0000000..337537d --- /dev/null +++ b/src/scenes/add_server_wizard/Scene_step_3.qml @@ -0,0 +1,54 @@ +import QtQuick 2.9 +import QtQuick.Window 2.2 +import QtQuick.Extras 1.4 +import QtQuick.Controls 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Controls.Material 2.3 + +/*! + This .qml file is a Scene which can be loaded through for example a StackView (main_content in main.qml). + */ + +Item { + id: scene_server_wizard_step_3 + objectName: "Scene_server_wizard_step_3" + + Rectangle { + id: rectangle + anchors.fill: parent + color: Material.background + + Text { + color: Material.foreground + id: title + + text: qsTr("Step 3") + font.pointSize: 18 + wrapMode: Text.WordWrap + + font.bold: true + horizontalAlignment: Text.AlignHCenter + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 5 + } + + Button { + id: next_step3_button + text: qsTr("<- First step") + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 10 + + onClicked: { + main_content_pop(null, StackView.Transition) + } + } + } +} + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ -- cgit v1.2.3