From 16abd43dae1ed390f10a00fd1c4d76e8f4af668e Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 22 Mar 2022 10:38:23 -0500 Subject: [PATCH] menubar works for both global systems and default built in menubar --- README.org | 2 +- TODO.org | 8 +++++ src/qml/main.qml | 84 ++++++++++++++++++++++++++++-------------------- 3 files changed, 58 insertions(+), 36 deletions(-) create mode 100644 TODO.org diff --git a/README.org b/README.org index d1bf5df..7af305b 100644 --- a/README.org +++ b/README.org @@ -1,7 +1,7 @@ #+TITLE: Church Presenter #+AUTHOR: Chris Cochrun -* Church Presenter +* Introduction This is an attempt at building a church presentation application in Qt/QML. QML provides a very powerful and easy declarative way of creating a UI so it should also be a very simple method of creating on screen slides and presentations. This experiment is to see how difficult it is to rebuild these applications in QML as opposed to other more complicated systems. After digging through the source code of OpenLP, I discovered they are essentially creating a web server and rendering a webpage onto the screen to show slides. This felt like a waste of resources and added complexity when something so simple and useful as QML exists. ** Features (planned are in parentheses) diff --git a/TODO.org b/TODO.org new file mode 100644 index 0000000..7d565fd --- /dev/null +++ b/TODO.org @@ -0,0 +1,8 @@ +#+TITLE: Todo List +* Inbox +** TODO Need to make ListModel capable of bringing in a string list + +[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::/* showPassiveNotification(serviceItemList.currentIndex); */]] +** TODO Parse Lyrics to create a list of strings for slides + +[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::/* showPassiveNotification(serviceItemList.currentIndex); */]] diff --git a/src/qml/main.qml b/src/qml/main.qml index 5dbc468..128d754 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -26,49 +26,62 @@ Kirigami.ApplicationWindow { pageStack.initialPage: mainPage header: Presenter.Header {} - /* menuBar: Qt.platform.os !== "linux" ? Controls.MenuBar { */ - /* Controls.Menu { */ - /* title: qsTr("File") */ - /* Controls.MenuItem { text: qsTr("New...") } */ - /* Controls.MenuItem { text: qsTr("Open...") } */ - /* Controls.MenuItem { text: qsTr("Save") } */ - /* Controls.MenuItem { text: qsTr("Save As...") } */ - /* Controls.MenuSeparator { } */ - /* Controls.MenuItem { text: qsTr("Quit") } */ - /* } */ - /* Controls.Menu { */ - /* title: qsTr("Settings") */ - /* Controls.MenuItem { */ - /* text: qsTr("Configure") */ - /* onTriggered: openSettings() */ - /* } */ - /* } */ - /* Controls.Menu { */ - /* title: qsTr("Help") */ - /* Controls.MenuItem { text: qsTr("About") } */ - /* } */ - /* } : null */ - - Labs.MenuBar { - Labs.Menu { + menuBar: Controls.MenuBar { + visible: !Kirigami.Settings.hasPlatformMenuBar + Controls.Menu { title: qsTr("File") - Labs.MenuItem { text: qsTr("New...") } - Labs.MenuItem { text: qsTr("Open...") } - Labs.MenuItem { text: qsTr("Save") } - Labs.MenuItem { text: qsTr("Save As...") } - Labs.MenuSeparator { } - Labs.MenuItem { text: qsTr("Quit") } + Controls.MenuItem { text: qsTr("New...") } + Controls.MenuItem { text: qsTr("Open...") } + Controls.MenuItem { text: qsTr("Save") } + Controls.MenuItem { text: qsTr("Save As...") } + Controls.MenuSeparator { } + Controls.MenuItem { text: qsTr("Quit") } } - Labs.Menu { + Controls.Menu { title: qsTr("Settings") - Labs.MenuItem { + Controls.MenuItem { text: qsTr("Configure") onTriggered: openSettings() } } - Labs.Menu { + Controls.Menu { title: qsTr("Help") - Labs.MenuItem { text: qsTr("About") } + Controls.MenuItem { text: qsTr("About") } + } + } + + Loader { + id: menuLoader + active: Kirigami.Settings.hasPlatformMenuBar + sourceComponent: globalMenuComponent + onLoaded: print("Loaded global menu") + } + + Component { + id: globalMenuComponent + Labs.MenuBar { + id: globalMenu + Labs.Menu { + title: qsTr("File") + Labs.MenuItem { text: qsTr("New...") } + Labs.MenuItem { text: qsTr("Open...") } + Labs.MenuItem { text: qsTr("Save") } + Labs.MenuItem { text: qsTr("Save As...") } + Labs.MenuSeparator { } + Labs.MenuItem { text: qsTr("Quit") } + } + Labs.Menu { + title: qsTr("Settings") + Labs.MenuItem { + text: qsTr("Configure") + shortcut: "Ctrl+Shift+I" + onTriggered: openSettings() + } + } + Labs.Menu { + title: qsTr("Help") + Labs.MenuItem { text: qsTr("About") } + } } } @@ -102,6 +115,7 @@ Kirigami.ApplicationWindow { /* Kirigami.Settings.style = "Plasma"; */ /* showPassiveNotification(Kirigami.Settings.style); */ print("OS is: " + Qt.platform.os); + print("MENU " + Kirigami.Settings.hasPlatformMenuBar) /* print("checking screens"); */ print("Present Mode is " + presenting); /* print(Qt.application.state); */