From cc61c6919738e310cc393bfeeab1a43eceaf5c29 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Tue, 29 Jun 2021 17:01:19 +0200 Subject: Add docstrings; remove unnecessary code & comments --- src/main.qml | 111 ++++++--------------------------------- src/scenes/Scene_placeholder.qml | 4 ++ 2 files changed, 20 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/main.qml b/src/main.qml index e94b291..d91c962 100644 --- a/src/main.qml +++ b/src/main.qml @@ -34,6 +34,10 @@ import QtQuick.Controls.Material 2.3 import "scenes" as Scenes //import "ListItem.qml" +/*! + The main.qml file contains the window, with its header, sidebar, toast and main_content. + */ + ApplicationWindow { readonly property int normal_width: 650 readonly property int normal_height: 500 @@ -94,47 +98,14 @@ ApplicationWindow { anchors.left: parent.left anchors.leftMargin: !inPortrait ? sidebar_drawer.width : 0 anchors.topMargin: 0 - initialItem: "scenes/Scene_placeholder.qml" -// Scenes.Scene_remote_control { -// id: scene_remote_control -// anchors.bottom: parent.bottom -// anchors.bottomMargin: 0 -// anchors.left: parent.left -// anchors.right: parent.right -// anchors.rightMargin: 0 -// anchors.top: parent.top -// anchors.topMargin: 0 -// visible: false -// } - -// Scenes.Scene_remote_view { -// id: scene_remote_view -// anchors.bottom: parent.bottom -// anchors.bottomMargin: 0 -// anchors.left: parent.left -// anchors.right: parent.right -// anchors.rightMargin: 0 -// anchors.top: parent.top -// anchors.topMargin: 0 -// visible: false -// } - -// Scenes.Scene_settings { -// id: scene_settings -// anchors.bottom: parent.bottom -// anchors.bottomMargin: 0 -// anchors.left: parent.left -// anchors.right: parent.right -// anchors.rightMargin: 0 -// anchors.top: parent.top -// anchors.topMargin: 0 -// visible: false -// } + // Our Application will start with the following content: + initialItem: "scenes/Scene_placeholder.qml" } ToastManager { id: toast + anchors.leftMargin: inPortrait ? 0 : sidebar_drawer.width anchors.left: parent.left anchors.right: parent.right @@ -163,6 +134,14 @@ ApplicationWindow { } } + /*! + This is our sidebar (sidemenu) for navigation purposes. + It will collapse if the window gets resized to a portrait format. + Then it can be opened using the now visible button in the header + or by swiping from left to right. + main_content's leftMargin depends on sidebar_drawers's width + We don't want them to overlap on different window heights und widths. + */ Drawer { id: sidebar_drawer y: top_menu_bar_frame.height @@ -185,63 +164,6 @@ ApplicationWindow { anchors.fill: parent model: mainModel - /*header: ItemDelegate { - id: header - width: parent.width - height: server_chooser.height + server_chooser_label.height - - Text { - id: server_chooser_label - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: 0 - padding: 15 - height: 35 - color: Material.foreground - text: qsTr("RWA-Server:") - font.bold: true - } - - ComboBox { - id: server_chooser - width: parent.width - parent: header - height: 50 - anchors.left: parent.left - anchors.leftMargin: 15 - anchors.right: parent.right - anchors.rightMargin: 15 - anchors.bottom: header_seperator.top - model: [ "example.com/rwa", "rwa-server.example.org:1000", "rwa.example.com:1337" ] - - popup.width: Math.min(500, server_chooser.contentItem.childrenRect.width) - } - -// Image { -// id: rwa_logo -// anchors.left: parent.left -// anchors.leftMargin: 15 -// anchors.verticalCenter: parent.verticalCenter -// source: "../images/RWA-logo.png" -// height: parent.height -// fillMode: Image.PreserveAspectFit -// } - -// onClicked: { -// main_content.replace("scenes/Scene_settings.qml") -// if (inPortrait) { -// sidebar_drawer.close() -// } -// } - - MenuSeparator { - id: header_seperator - parent: header - width: parent.width - anchors.verticalCenter: parent.bottom - } - }*/ - footer: ItemDelegate { id: footer text: " " + qsTr("Settings") @@ -323,10 +245,9 @@ ApplicationWindow { Material.background: "#0d5eaf" Material.foreground: "#ffffff" + anchors.margins: 0 anchors.left: parent.left - anchors.leftMargin: 0 anchors.top: parent.top - anchors.topMargin: 0 Switch { id: theme diff --git a/src/scenes/Scene_placeholder.qml b/src/scenes/Scene_placeholder.qml index 7485518..a5ceac9 100644 --- a/src/scenes/Scene_placeholder.qml +++ b/src/scenes/Scene_placeholder.qml @@ -5,6 +5,10 @@ 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_placeholder objectName: "Scene_placeholder" -- cgit v1.2.3