From 42e772591ceb3dce0ad96e6acaf1772eb416f2fc Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 11 Feb 2022 09:58:38 -0600 Subject: [PATCH] Added readme and cleaned up some ui pieces --- README.org | 29 +++++++++++++++++++++++ build/CMakeCache.txt | 4 ++-- build/CMakeFiles/Makefile.cmake | 17 +------------- src/qml/main.qml | 1 + src/qml/presenter/Header.qml | 10 ++------ src/qml/presenter/Library.qml | 8 +++++-- src/qml/presenter/MainWindow.qml | 40 ++++++++++++++++++-------------- src/qml/presenter/SongEditor.qml | 11 ++++++++- src/songlistmodel.cpp | 7 +----- 9 files changed, 74 insertions(+), 53 deletions(-) create mode 100644 README.org diff --git a/README.org b/README.org new file mode 100644 index 0000000..6f8b6d1 --- /dev/null +++ b/README.org @@ -0,0 +1,29 @@ +#+TITLE: Church Presenter +#+AUTHOR: Chris Cochrun + +* Church Presenter +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 created a web server and rendering a page 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 brackets) +- Presents songs lyrics with image and video backgrounds +- Presents slides +- (Custom slide builder) +- (Simple song creation with a powerful text parser) + +* Build and Run +First get the source code + +Then into the root directory. +#+BEGIN_SRC +cd church-presenter +#+END_SRC + +Then build. +#+BEGIN_SRC +cmake -B build/ . && cmake --build build/ +#+END_SRC + +Then run. +#+BEGIN_SRC +./build/bin/presenter +#+END_SRC diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt index 98c6816..9cc341d 100644 --- a/build/CMakeCache.txt +++ b/build/CMakeCache.txt @@ -615,11 +615,11 @@ CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 //Details about finding Gettext FIND_PACKAGE_MESSAGE_DETAILS_Gettext:INTERNAL=[/usr/bin/msgmerge][/usr/bin/msgfmt][v0.21()] //Details about finding KF5 -FIND_PACKAGE_MESSAGE_DETAILS_KF5:INTERNAL=[success][cfound components: Kirigami2 I18n CoreAddons ][v5.90.0(5.68.0)] +FIND_PACKAGE_MESSAGE_DETAILS_KF5:INTERNAL=[success][cfound components: Kirigami2 I18n CoreAddons ][v5.87.0(5.68.0)] //Details about finding KF5CoreAddons FIND_PACKAGE_MESSAGE_DETAILS_KF5CoreAddons:INTERNAL=[/usr/lib64/cmake/KF5CoreAddons/KF5CoreAddonsConfig.cmake][v5.90.0()] //Details about finding KF5I18n -FIND_PACKAGE_MESSAGE_DETAILS_KF5I18n:INTERNAL=[/usr/lib64/cmake/KF5I18n/KF5I18nConfig.cmake][v5.90.0()] +FIND_PACKAGE_MESSAGE_DETAILS_KF5I18n:INTERNAL=[/usr/lib64/cmake/KF5I18n/KF5I18nConfig.cmake][v5.87.0()] //Details about finding KF5Kirigami2 FIND_PACKAGE_MESSAGE_DETAILS_KF5Kirigami2:INTERNAL=[/usr/lib64/cmake/KF5Kirigami2/KF5Kirigami2Config.cmake][v5.90.0()] //Test HAVE_DATE_TIME diff --git a/build/CMakeFiles/Makefile.cmake b/build/CMakeFiles/Makefile.cmake index 2ff999d..cac60cb 100644 --- a/build/CMakeFiles/Makefile.cmake +++ b/build/CMakeFiles/Makefile.cmake @@ -25,7 +25,7 @@ set(CMAKE_MAKEFILE_DEPENDS "/usr/lib64/cmake/KF5I18n/KF5I18nConfigVersion.cmake" "/usr/lib64/cmake/KF5I18n/KF5I18nMacros.cmake" "/usr/lib64/cmake/KF5I18n/KF5I18nQchTargets.cmake" - "/usr/lib64/cmake/KF5I18n/KF5I18nTargets-noconfig.cmake" + "/usr/lib64/cmake/KF5I18n/KF5I18nTargets-debug.cmake" "/usr/lib64/cmake/KF5I18n/KF5I18nTargets.cmake" "/usr/lib64/cmake/KF5Kirigami2/KF5Kirigami2Config.cmake" "/usr/lib64/cmake/KF5Kirigami2/KF5Kirigami2ConfigVersion.cmake" @@ -54,35 +54,25 @@ set(CMAKE_MAKEFILE_DEPENDS "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QEvdevTabletPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QEvdevTouchScreenPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QGifPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QGtk2ThemePlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QGtk3ThemePlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QICNSPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QICOPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QIbusPlatformInputContextPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QJp2Plugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QJpegPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QLibInputPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QLinuxFbIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QMinimalEglIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QMinimalIntegrationPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QMngPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QOffscreenIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QPdfPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QSvgIconPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QSvgPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QTgaPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QTiffPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QTsLibPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QTuioTouchPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QVirtualKeyboardPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QVncIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QWaylandEglPlatformIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QWaylandIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QWaylandXCompositeEglPlatformIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QWaylandXCompositeGlxPlatformIntegrationPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QWbmpPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QWebGLIntegrationPlugin.cmake" - "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QWebpPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QXcbEglIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QXcbGlxIntegrationPlugin.cmake" "/usr/lib64/cmake/Qt5Gui/Qt5Gui_QXcbIntegrationPlugin.cmake" @@ -119,11 +109,6 @@ set(CMAKE_MAKEFILE_DEPENDS "/usr/lib64/cmake/Qt5Widgets/Qt5WidgetsConfigExtras.cmake" "/usr/lib64/cmake/Qt5Widgets/Qt5WidgetsConfigVersion.cmake" "/usr/lib64/cmake/Qt5Widgets/Qt5WidgetsMacros.cmake" - "/usr/lib64/cmake/Qt5Widgets/Qt5Widgets_QBB10StylePlugin.cmake" - "/usr/lib64/cmake/Qt5Widgets/Qt5Widgets_QCleanlooksStylePlugin.cmake" - "/usr/lib64/cmake/Qt5Widgets/Qt5Widgets_QGtk2StylePlugin.cmake" - "/usr/lib64/cmake/Qt5Widgets/Qt5Widgets_QMotifStylePlugin.cmake" - "/usr/lib64/cmake/Qt5Widgets/Qt5Widgets_QPlastiqueStylePlugin.cmake" "/usr/share/ECM/cmake/ECMConfig.cmake" "/usr/share/ECM/cmake/ECMConfigVersion.cmake" "/usr/share/ECM/find-modules/ECMFindModuleHelpersStub.cmake" diff --git a/src/qml/main.qml b/src/qml/main.qml index 6537ca0..8ec2a62 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -25,4 +25,5 @@ Kirigami.ApplicationWindow { function toggleLibrary() { libraryOpen = !libraryOpen } + } diff --git a/src/qml/presenter/Header.qml b/src/qml/presenter/Header.qml index d4b9883..1b1015e 100644 --- a/src/qml/presenter/Header.qml +++ b/src/qml/presenter/Header.qml @@ -22,19 +22,13 @@ Kirigami.ActionToolBar { displayComponent: Component { Kirigami.SearchField { id: searchField + anchors.centerIn: parent + width: parent.width / 3 onAccepted: showPassiveNotification(searchField.text, 3000) } } }, - Kirigami.Action { - icon.name: "fileopen" - text: "VideoBG" - onTriggered: { - print("Action button in buttons page clicked"); - fileDialog.open() - } - }, Kirigami.Action { icon.name: "view-presentation" text: "Go Live" diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index 1a26c1d..04a3e5c 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -25,8 +25,12 @@ Item { label: title subtitle: author hoverEnabled: true - onClicked: ListView.view.currentIndex = index - + onClicked: { + ListView.view.currentIndex = index + songTitle = title + songLyrics = lyrics + showPassiveNotification(songLyrics, 3000) + } } } diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index d2c2b77..e643995 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -11,7 +11,10 @@ import "./" as Presenter Controls.Page { id: mainPage padding: 0 - property var video: null + property url videoBackground: "" + property url imageBackground: "" + property string songTitle: "" + property string songLyrics: "" Item { id: mainItem @@ -57,23 +60,6 @@ Controls.Page { } } - - - FileDialog { - id: fileDialog - title: "Please choose a video" - folder: shortcuts.home - selectMultiple: false - onAccepted: { - print("You chose: " + fileDialog.fileUrls) - video = fileDialog.fileUrl - } - onRejected: { - print("Canceled") - /* Qt.quit() */ - } - } - Loader { id: presentLoader active: presenting @@ -93,4 +79,22 @@ Controls.Page { } } } + + FileDialog { + id: fileDialog + title: "Please choose a video" + folder: shortcuts.home + selectMultiple: false + onAccepted: { + print("You chose: " + fileDialog.fileUrls) + background = fileDialog.fileUrls + + + + } + onRejected: { + print("Canceled") + /* Qt.quit() */ + } + } } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index b2d698d..e1b057c 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -50,6 +50,11 @@ Item { } Controls.ToolButton { text: "Background" + icon.name: "fileopen" + onClicked: { + print("Action button in buttons page clicked"); + fileDialog.open() + } } } } @@ -57,6 +62,8 @@ Item { Controls.TextField { implicitWidth: 300 Layout.leftMargin: 20 + placeholderText: "Song Title..." + text: songTitle } Rectangle { @@ -72,6 +79,9 @@ Item { Layout.bottomMargin: 30 Layout.leftMargin: 20 placeholderText: "Put lyrics here..." + persistentSelection: true + text: songLyrics + textFormat: TextEdit.MarkdownText } Rectangle { @@ -82,5 +92,4 @@ Item { Layout.rightMargin: 20 } } - } diff --git a/src/songlistmodel.cpp b/src/songlistmodel.cpp index 90b156c..d7ab241 100644 --- a/src/songlistmodel.cpp +++ b/src/songlistmodel.cpp @@ -10,14 +10,9 @@ SongListModel::SongListModel(QObject *parent) int SongListModel::rowCount(const QModelIndex &parent) const { - // For list models only the root node (an invalid parent) should return the list's size. For all - // other (valid) parents, rowCount() should return 0 so that it does not become a tree model. if (parent.isValid()) return 0; - - // FIXME: Implement me! return m_data.count(); - } QVariant SongListModel::data(const QModelIndex &index, int role) const @@ -25,7 +20,7 @@ QVariant SongListModel::data(const QModelIndex &index, int role) const if (!index.isValid()) return QVariant(); - // FIXME: Implement me! + // this is the returning of song data const Data &data = m_data.at(index.row()); if ( role == TitleRole ) return data.title;