summaryrefslogtreecommitdiff
path: root/gui/components/MainView.qml
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-12-08 22:23:46 +0100
committerkali kaneko (leap communications) <kali@leap.se>2021-12-09 21:14:52 +0100
commit4fd7c1a92e3c16b300997e2cbd82ae3cdd6279ec (patch)
tree389bbf99489a5391e5b858bee30e05bff0727c61 /gui/components/MainView.qml
parentca3f128194888e30aadc149eb40a1370931eb2eb (diff)
[bug] alternative drawer implementation
this is an attempt to solve the problem we're having with snaps, in which Overlays are not correctly displayed.
Diffstat (limited to 'gui/components/MainView.qml')
-rw-r--r--gui/components/MainView.qml126
1 files changed, 61 insertions, 65 deletions
diff --git a/gui/components/MainView.qml b/gui/components/MainView.qml
index 0f5fb58..886e896 100644
--- a/gui/components/MainView.qml
+++ b/gui/components/MainView.qml
@@ -7,83 +7,80 @@ import QtQuick.Layouts 1.14
import "../themes/themes.js" as Theme
Page {
-
StackView {
id: stackView
anchors.fill: parent
initialItem: Home {}
}
- Drawer {
+ NavigationDrawer {
id: settingsDrawer
-
- width: Math.min(root.width, root.height) / 3 * 2
- height: root.height
-
- ListView {
- focus: true
- currentIndex: -1
+ Rectangle {
anchors.fill: parent
-
- delegate: ItemDelegate {
- width: parent.width
- text: model.text
- visible: {
- if (isDonationService) {return true}
- return model.text != qsTr("Donate")
- }
- highlighted: ListView.isCurrentItem
- icon.color: "transparent"
- icon.source: model.icon
- onClicked: {
- settingsDrawer.close()
- model.triggered()
- }
- }
-
- model: ListModel {
- ListElement {
- text: qsTr("Preferences")
- icon: "../resources/tools.svg"
- triggered: function () {
- stackView.push("Preferences.qml")
- }
- }
- ListElement {
- text: qsTr("Donate")
- icon: "../resources/donate.svg"
- triggered: function () {
- Qt.openUrlExternally(ctx.donateURL)
- }
- }
- ListElement {
- text: qsTr("Help")
- icon: "../resources/help.svg"
- triggered: function () {
- stackView.push("Help.qml")
- settingsDrawer.close()
- }
- } // -> can link to another dialog with report bug / support / contribute / FAQ
- ListElement {
- text: qsTr("About")
- icon: "../resources/about.svg"
- triggered: function () {
- stackView.push("About.qml")
- settingsDrawer.close()
+ color: "white"
+ ListView {
+ focus: true
+ currentIndex: -1
+ anchors.fill: parent
+
+ model: navModel
+ delegate: ItemDelegate {
+ width: parent.width
+ text: model.text
+ visible: {
+ if (isDonationService) {return true}
+ return model.text != qsTr("Donate")
}
- }
- ListElement {
- text: qsTr("Quit")
- icon: "../resources/quit.svg"
- triggered: function () {
- backend.quit()
+ highlighted: ListView.isCurrentItem
+ icon.color: "transparent"
+ icon.source: model.icon
+ onClicked: {
+ settingsDrawer.toggle()
+ model.triggered()
}
}
}
-
- ScrollIndicator.vertical: ScrollIndicator {}
}
- }
+ }
+
+ ListModel {
+ id: navModel
+ ListElement {
+ text: qsTr("Preferences")
+ icon: "../resources/tools.svg"
+ triggered: function () {
+ stackView.push("Preferences.qml")
+ }
+ }
+ ListElement {
+ text: qsTr("Donate")
+ icon: "../resources/donate.svg"
+ triggered: function () {
+ Qt.openUrlExternally(ctx.donateURL)
+ }
+ }
+ ListElement {
+ text: qsTr("Help")
+ icon: "../resources/help.svg"
+ triggered: function () {
+ stackView.push("Help.qml")
+ }
+ } // -> can link to another dialog with report bug / support / contribute / FAQ
+ ListElement {
+ text: qsTr("About")
+ icon: "../resources/about.svg"
+ triggered: function () {
+ stackView.push("About.qml")
+ }
+ }
+ ListElement {
+ text: qsTr("Quit")
+ icon: "../resources/quit.svg"
+ triggered: function () {
+ backend.quit()
+ }
+ }
+ } // end listmodel
header: Header {
id: header
@@ -146,7 +143,6 @@ Page {
horizontalCenter: parent.horizontalCenter
}
}
-
onYes: Qt.openUrlExternally(ctx.donateURL)
}