From 9b6949090e2512a57735ce2f1051931452a1af05 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 30 Mar 2022 11:39:43 -0500 Subject: [PATCH 01/41] Working move, and insert, added some changing of slides functionality --- src/qml/presenter/LeftDock.qml | 14 ++++----- src/qml/presenter/MainWindow.qml | 49 +++++++++--------------------- src/qml/presenter/Presentation.qml | 28 +++++++++++++++-- src/qml/presenter/Slide.qml | 11 ++++--- src/serviceitemmodel.cpp | 21 +++++++++++-- src/serviceitemmodel.h | 1 + 6 files changed, 73 insertions(+), 51 deletions(-) diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index 7b06297..fb8535c 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -111,10 +111,7 @@ ColumnLayout { onMoveRequested: serviceItemModel.move(oldIndex, newIndex) onClicked: { serviceItemList.currentIndex = index; - /* showPassiveNotification(serviceItemList.currentIndex); */ - changeSlideBackground(background, backgroundType); - changeSlideText(text); - changeSlideType(type); + changeServiceItem(index); } } @@ -125,9 +122,9 @@ ColumnLayout { addItem(index, dragItemTitle, dragItemType, - dragItemText, - dragItemBackgroundType, dragItemBackground, + dragItemBackgroundType, + dragItemText, dragItemIndex); } keys: ["library"] @@ -152,9 +149,10 @@ ColumnLayout { function addItem(index, name, type, background, backgroundType, text, itemID) { + const newtext = songsqlmodel.getLyricList(itemID); serviceItemModel.insertItem(index, name, - type, text, background, - backgroundType) + type, background, + backgroundType, newtext); } function appendItem(name, type, background, backgroundType, text, itemID) { diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 938718d..b5cfbc2 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -133,48 +133,29 @@ Controls.Page { id: serviceItemModel } - function changeSlideType(type) { - presentation.itemType = type; - if (slideItem) - slideItem.itemType = type; - } + function changeServiceItem(index) { + const item = serviceItemModel.getItem(index); - function changeSlideText(text) { - presentation.text = text; - if (slideItem) - slideItem.text = text; - } - - function changeSlideBackground(background, type) { - showPassiveNotification("starting background change.."); - showPassiveNotification(background); - showPassiveNotification(type); - if (type == "image") { + presentation.itemType = item.type; + + if (item.backgroundType === "image") { presentation.vidbackground = ""; - presentation.imagebackground = background; - if (slideItem) { - slideItem.videoSource = ""; - slideItem.stopVideo(); - slideItem.imageSource = background; - } + presentation.imagebackground = item.background; } else { presentation.imagebackground = ""; - presentation.vidbackground = background; + presentation.vidbackground = item.background; presentation.loadVideo() - if (slideItem) { - slideItem.imageSource = ""; - slideItem.videoSource = background; - slideItem.loadVideo() - } } - } - function changeSlideNext() { - showPassiveNotification("next slide please") - } + if (item.text.length === 0) { + presentation.text = [""]; + } + else + presentation.text = item.text; + presentation.textIndex = 0; + presentation.nextSlideText(); - function changeSlidePrevious() { - showPassiveNotification("previous slide please") + print("Slide changed to: " + item.name); } function editSwitch(item) { diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index f1647bf..f496730 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -10,11 +10,14 @@ import "./" as Presenter Item { id: root - property string text + property var text + property int textIndex: 0 property string itemType property url imagebackground property url vidbackground + Component.onCompleted: nextSlideText() + GridLayout { anchors.fill: parent columns: 3 @@ -81,7 +84,6 @@ Item { Layout.minimumWidth: 300 Layout.alignment: Qt.AlignCenter textSize: width / 15 - text: root.text itemType: root.itemType imageSource: imagebackground videoSource: vidbackground @@ -95,7 +97,7 @@ Item { Layout.alignment: Qt.AlignLeft MouseArea { anchors.fill: parent - onPressed: changeSlideNext() + onPressed: nextSlideText() cursorShape: Qt.PointingHandCursor } } @@ -112,4 +114,24 @@ Item { function loadVideo() { previewSlide.loadVideo(); } + + function nextSlideText() { + if (textIndex === 0) { + previewSlide.text = root.text[textIndex]; + print(root.text[textIndex]); + textIndex++; + } else if (textIndex < root.text.length) { + previewSlide.text = root.text[textIndex]; + print(root.text[textIndex]); + textIndex++; + } else { + print("Next slide time"); + nextSlide(); + textIndex = 0; + } + } + + function nextSlide() { + print(slideItem); + } } diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index 099ee58..6a15b68 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -15,13 +15,15 @@ Item { property bool editMode: false // These properties are for the slides visuals - property real textSize: 72 + property real textSize: 50 property bool dropShadow: false property url imageSource: imageBackground property url videoSource: videoBackground property string chosenFont: "Quicksand" - property string text: "This is demo text" + property var text: "This is demo text" property color backgroundColor + property var horizontalAlignment + property var verticalAlignment //these properties are for giving video info to parents property int mpvPosition: mpv.position @@ -97,9 +99,10 @@ Item { /* minimumPointSize: 5 */ fontSizeMode: Text.Fit font.family: chosenFont + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter style: Text.Raised - anchors.centerIn: parent - /* width: parent.width */ + anchors.fill: parent clip: true layer.enabled: true diff --git a/src/serviceitemmodel.cpp b/src/serviceitemmodel.cpp index 3d1d196..8fb4a64 100644 --- a/src/serviceitemmodel.cpp +++ b/src/serviceitemmodel.cpp @@ -121,7 +121,7 @@ void ServiceItemModel::addItem(ServiceItem *item) { } void ServiceItemModel::insertItem(const int &index, ServiceItem *item) { - beginInsertRows(this->index(index), index, index); + beginInsertRows(this->index(index).parent(), index, index); m_items.insert(index, item); endInsertRows(); qDebug() << "Success"; @@ -164,7 +164,7 @@ void ServiceItemModel::insertItem(const int &index, const QString &name, const Q const QStringList &text) { ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text); insertItem(index, item); - qDebug() << name << type << background; + qDebug() << name << type << background << text; } void ServiceItemModel::removeItem(int index) { @@ -188,3 +188,20 @@ bool ServiceItemModel::move(int sourceIndex, int destIndex) { // qDebug() << success; return true; } + +QVariantMap ServiceItemModel::getItem(int index) const { + QVariantMap data; + const QModelIndex idx = this->index(index,0); + qDebug() << idx; + if( !idx.isValid() ) + return data; + const QHash rn = roleNames(); + qDebug() << rn; + QHashIterator it(rn); + while (it.hasNext()) { + it.next(); + qDebug() << it.key() << ":" << it.value(); + data[it.value()] = idx.data(it.key()); + } + return data; +} diff --git a/src/serviceitemmodel.h b/src/serviceitemmodel.h index 7ec670d..4536b2c 100644 --- a/src/serviceitemmodel.h +++ b/src/serviceitemmodel.h @@ -56,6 +56,7 @@ public: const QString &backgroundType, const QStringList &text); Q_INVOKABLE void removeItem(int index); Q_INVOKABLE bool move(int sourceIndex, int destIndex); + Q_INVOKABLE QVariantMap getItem(int index) const; private: QList m_items; From 7545f0572459ac102b747eef1f4f8b6bfc7ba78d Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 31 Mar 2022 06:40:39 -0500 Subject: [PATCH 02/41] getting a bit more organized and adding some ui tweaks --- CHANGELOG.org | 4 ++++ TODO.org | 22 ++++++++++++++++++++-- src/qml/presenter/DragHandle.qml | 9 ++++++++- src/qml/presenter/LeftDock.qml | 11 +++++++++++ src/qml/presenter/Presentation.qml | 11 +++++++++-- 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 CHANGELOG.org diff --git a/CHANGELOG.org b/CHANGELOG.org new file mode 100644 index 0000000..7e444ae --- /dev/null +++ b/CHANGELOG.org @@ -0,0 +1,4 @@ +#+TITLE: Changelog +* Changelog +** [2022-03-31 Thu 06:25] Initial Changelog - Nothing worth adding here yet. Once we have a base then the changelog with be appended to +[[file:~/dev/church-presenter/CHANGELOG.org::+TITLE: Changelog]] diff --git a/TODO.org b/TODO.org index 3fcebfe..799a8f9 100644 --- a/TODO.org +++ b/TODO.org @@ -1,8 +1,26 @@ #+TITLE: Todo List * Inbox -** TODO Need to make ListModel capable of bringing in a string list [1/2] [50%] +** TODO Fix file dialog using basic QT theme +[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::FileDialog {]] +** TODO Make toolbar functional for songeditor +[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] +** TODO Finish toolbar +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] +** TODO Find a way to maths the textsize +[[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] + +** TODO Make nextSlideText a nextAction function to incorporate other types of items +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlideText() {]] + +** TODO Create a nextslide function to be used after the end of the list of slides +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] + +** TODO Fix broken append when importing River song +[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]] + +** DONE Need to make ListModel capable of bringing in a string list [2/2] [100%] - [X] Create a Model -- [ ] Create a class that we'll make a list of in the model +- [X] Create a class that we'll make a list of in the model ** DONE Parse Lyrics to create a list of strings for slides SCHEDULED: <2022-03-23 Wed 10:00> diff --git a/src/qml/presenter/DragHandle.qml b/src/qml/presenter/DragHandle.qml index ad3aa0c..e0f081b 100644 --- a/src/qml/presenter/DragHandle.qml +++ b/src/qml/presenter/DragHandle.qml @@ -38,6 +38,7 @@ Item { // Emitted when clicking to activate underneath mousearea signal clicked() + signal rightClicked() MouseArea { id: mouseArea @@ -127,10 +128,16 @@ Item { MouseArea { id: clickArea anchors.fill: parent - onClicked: root.clicked() hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton onEntered: root.containsMouse = true onExited: root.containsMouse = false + onClicked: { + if (mouse.button === Qt.RightButton) + root.rightClicked(); + else + root.clicked(); + } } } } diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index fb8535c..b15b65e 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -113,6 +113,17 @@ ColumnLayout { serviceItemList.currentIndex = index; changeServiceItem(index); } + onRightClicked: rightClickMenu.popup() + } + + Controls.Menu { + id: rightClickMenu + x: mouseHandler.mouseX + y: mouseHandler.mouseY + 10 + Kirigami.Action { + text: "delete" + onTriggered: serviceItemModel.removeItem(index) + } } DropArea { diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index f496730..f4bacd1 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -32,11 +32,18 @@ Item { anchors.fill: parent Controls.ToolButton { - text: "Grid" + text: "Solo" + icon.name: "viewimage" hoverEnabled: true } Controls.ToolButton { - text: "Solo" + text: "Grid" + icon.name: "view-app-grid-symbolic" + hoverEnabled: true + } + Controls.ToolButton { + text: "Details" + icon.name: "view-list-details" hoverEnabled: true } Controls.ToolSeparator {} From 366660dcb2ccb51e39e695623e71d6f7b6d3c486 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 1 Apr 2022 07:32:21 -0500 Subject: [PATCH 03/41] fixed the filepicker dialog and started a window file --- TODO.org | 12 +++++++-- src/main.cpp | 14 +++++++--- src/qml/presenter/LeftDock.qml | 7 ++++- src/qml/presenter/MainWindow.qml | 30 +-------------------- src/qml/presenter/PresentationWindow.qml | 33 ++++++++++++++++++++++++ src/qml/presenter/SongEditor.qml | 1 + src/serviceitemmodel.cpp | 22 +++++++--------- 7 files changed, 71 insertions(+), 48 deletions(-) create mode 100644 src/qml/presenter/PresentationWindow.qml diff --git a/TODO.org b/TODO.org index 799a8f9..cc57e6b 100644 --- a/TODO.org +++ b/TODO.org @@ -1,11 +1,16 @@ #+TITLE: Todo List * Inbox -** TODO Fix file dialog using basic QT theme -[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::FileDialog {]] +** TODO Fix possible bug in arrangingItems in draghandler +[[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] +** TODO [#A] Make Presentation Window follow the presenter component +[[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]] + ** TODO Make toolbar functional for songeditor [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] + ** TODO Finish toolbar [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] + ** TODO Find a way to maths the textsize [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] @@ -25,3 +30,6 @@ ** DONE Parse Lyrics to create a list of strings for slides SCHEDULED: <2022-03-23 Wed 10:00> +** DONE Fix file dialog using basic QT theme +[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::FileDialog {]] + diff --git a/src/main.cpp b/src/main.cpp index 4641cbb..4db08d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,10 +22,13 @@ #include #include +#include +#include #include #include #include #include +#include #include #include #include @@ -67,17 +70,20 @@ static void connectToDatabase() { int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - KLocalizedString::setApplicationDomain("presenter"); - QCoreApplication::setOrganizationName(QStringLiteral("presenter")); + QApplication app(argc, argv); + KLocalizedString::setApplicationDomain("librepresenter"); + QCoreApplication::setOrganizationName(QStringLiteral("librepresenter")); QCoreApplication::setOrganizationDomain(QStringLiteral("tfcconnection.org")); - QCoreApplication::setApplicationName(QStringLiteral("Church Presenter")); + QCoreApplication::setApplicationName(QStringLiteral("Libre Presenter")); #ifdef Q_OS_WINDOWS QIcon::setFallbackThemeName("breeze"); QQuickStyle::setStyle(QStringLiteral("org.kde.breeze")); + QApplication::setStyle(QStringLiteral("breeze")); #else + QIcon::setFallbackThemeName("breeze"); QQuickStyle::setStyle(QStringLiteral("org.kde.desktop")); + QQuickStyle::setFallbackStyle(QStringLiteral("breeze")); #endif QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("system-config-display"))); diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index b15b65e..9dfbdad 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -108,7 +108,12 @@ ColumnLayout { anchors.fill: parent listItem: serviceItem listView: serviceItemList - onMoveRequested: serviceItemModel.move(oldIndex, newIndex) + onMoveRequested: { + print(oldIndex, newIndex); + serviceItemModel.move(oldIndex, newIndex); + } + onDropped: { + } onClicked: { serviceItemList.currentIndex = index; changeServiceItem(index); diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index b5cfbc2..cfd0f1d 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -90,35 +90,7 @@ Controls.Page { Loader { id: presentLoader active: presenting - sourceComponent: presentWindowComp - } - - Component { - id: presentWindowComp - Window { - id: presentationWindow - title: "presentation-window" - height: maximumHeight - width: maximumWidth - screen: presentationScreen - flags: Qt.X11BypassWindowManagerHint - onClosing: presenting = false - - Component.onCompleted: { - presentationWindow.showFullScreen(); - print(screen.name); - } - - Presenter.Slide { - id: presentationSlide - anchors.fill: parent - imageSource: imageBackground - videoSource: videoBackground - text: "" - - Component.onCompleted: slideItem = presentationSlide - } - } + source: "PresentationWindow.qml" } SongSqlModel { diff --git a/src/qml/presenter/PresentationWindow.qml b/src/qml/presenter/PresentationWindow.qml new file mode 100644 index 0000000..3794d51 --- /dev/null +++ b/src/qml/presenter/PresentationWindow.qml @@ -0,0 +1,33 @@ +import QtQuick 2.13 +import QtQuick.Dialogs 1.0 +import QtQuick.Controls 2.15 as Controls +import QtQuick.Window 2.13 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.13 as Kirigami +import "./" as Presenter +import org.presenter 1.0 + +Window { + id: presentationWindow + title: "presentation-window" + height: maximumHeight + width: maximumWidth + screen: presentationScreen + /* flags: Qt.X11BypassWindowManagerHint */ + onClosing: presenting = false + + Component.onCompleted: { + presentationWindow.showFullScreen(); + print(screen.name); + } + + Presenter.Slide { + id: presentationSlide + anchors.fill: parent + imageSource: imageBackground + videoSource: videoBackground + text: "" + + Component.onCompleted: slideItem = presentationSlide + } +} diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 8248574..0f14f45 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -1,5 +1,6 @@ import QtQuick 2.13 import QtQuick.Controls 2.15 as Controls +import Qt.labs.platform 1.1 as Labs import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.2 import org.kde.kirigami 2.13 as Kirigami diff --git a/src/serviceitemmodel.cpp b/src/serviceitemmodel.cpp index 8fb4a64..d431556 100644 --- a/src/serviceitemmodel.cpp +++ b/src/serviceitemmodel.cpp @@ -174,17 +174,15 @@ void ServiceItemModel::removeItem(int index) { } bool ServiceItemModel::move(int sourceIndex, int destIndex) { - qDebug() << "starting move"; + qDebug() << "starting move of: " << "source: " << sourceIndex << "dest: " << destIndex; + qDebug() << index(sourceIndex).row(); + qDebug() << index(destIndex).row(); QModelIndex parent = index(sourceIndex).parent(); - bool begsuc = beginMoveRows(parent, sourceIndex, sourceIndex, parent, destIndex); - qDebug() << begsuc; - if (!begsuc) { - qDebug() << "Failed to start moving rows"; - m_items.move(sourceIndex, destIndex); - return false; - } - // bool success = moveRow(index(sourceIndex).parent(), sourceIndex, index(destIndex).parent(), destIndex); - endMoveRows(); + // bool begsuc = beginMoveRows(parent, sourceIndex, sourceIndex, parent, destIndex); + beginResetModel(); + m_items.move(sourceIndex, destIndex); + // endMoveRows(); + endResetModel(); // qDebug() << success; return true; } @@ -192,11 +190,11 @@ bool ServiceItemModel::move(int sourceIndex, int destIndex) { QVariantMap ServiceItemModel::getItem(int index) const { QVariantMap data; const QModelIndex idx = this->index(index,0); - qDebug() << idx; + // qDebug() << idx; if( !idx.isValid() ) return data; const QHash rn = roleNames(); - qDebug() << rn; + // qDebug() << rn; QHashIterator it(rn); while (it.hasNext()) { it.next(); From 2e72a01c6f5905fca4184ac3fb99031ebcaaa1f2 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sat, 2 Apr 2022 14:50:40 -0500 Subject: [PATCH 04/41] adding a nextSlideAction instead of nextSlideText to allow for other types --- src/main.cpp | 4 +++- src/qml/main.qml | 1 + src/qml/presenter/MainWindow.qml | 2 +- src/qml/presenter/Presentation.qml | 33 +++++++++++++++++------------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4db08d4..06a8365 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) #ifdef Q_OS_WINDOWS QIcon::setFallbackThemeName("breeze"); QQuickStyle::setStyle(QStringLiteral("org.kde.breeze")); - QApplication::setStyle(QStringLiteral("breeze")); + // QApplication::setStyle(QStringLiteral("breeze")); #else QIcon::setFallbackThemeName("breeze"); QQuickStyle::setStyle(QStringLiteral("org.kde.desktop")); @@ -87,6 +87,8 @@ int main(int argc, char *argv[]) #endif QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("system-config-display"))); + qDebug() << QQuickStyle::availableStyles(); + qDebug() << QIcon::themeName(); // apparently mpv needs this class set // let's register mpv as well diff --git a/src/qml/main.qml b/src/qml/main.qml index 128d754..8d369d2 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -121,6 +121,7 @@ Kirigami.ApplicationWindow { /* print(Qt.application.state); */ screens = Qt.application.screens; presentationScreen = screens[1] + print(Kirigami.Settings.Style); for (let i = 0; i < screens.length; i++) { /* print(screens[i]); */ /* print(screens[i].name); */ diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index cfd0f1d..4389edb 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -125,7 +125,7 @@ Controls.Page { else presentation.text = item.text; presentation.textIndex = 0; - presentation.nextSlideText(); + presentation.nextSlideAction(); print("Slide changed to: " + item.name); } diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index f4bacd1..8378f8e 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -104,7 +104,7 @@ Item { Layout.alignment: Qt.AlignLeft MouseArea { anchors.fill: parent - onPressed: nextSlideText() + onPressed: nextSlideAction() cursorShape: Qt.PointingHandCursor } } @@ -122,20 +122,25 @@ Item { previewSlide.loadVideo(); } - function nextSlideText() { - if (textIndex === 0) { - previewSlide.text = root.text[textIndex]; - print(root.text[textIndex]); - textIndex++; - } else if (textIndex < root.text.length) { - previewSlide.text = root.text[textIndex]; - print(root.text[textIndex]); - textIndex++; - } else { - print("Next slide time"); + function nextSlideAction() { + if (itemType === "song") { + if (textIndex === 0) { + previewSlide.text = root.text[textIndex]; + print(root.text[textIndex]); + textIndex++; + } else if (textIndex < root.text.length) { + previewSlide.text = root.text[textIndex]; + print(root.text[textIndex]); + textIndex++; + } else { + print("Next slide time"); + textIndex = 0; + nextSlide(); + } + } else if (itemType === "video") + nextSlide(); + else if (itemType === "image") nextSlide(); - textIndex = 0; - } } function nextSlide() { From 62e1b07ec1708f0b80151b7547d8548f781b60ca Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sat, 2 Apr 2022 14:58:24 -0500 Subject: [PATCH 05/41] nextSlideAction triggers nextslide on last item in list --- TODO.org | 10 +++++++--- src/qml/presenter/LeftDock.qml | 1 + src/qml/presenter/MainWindow.qml | 1 + src/qml/presenter/Presentation.qml | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/TODO.org b/TODO.org index cc57e6b..a88d4f4 100644 --- a/TODO.org +++ b/TODO.org @@ -1,5 +1,7 @@ #+TITLE: Todo List * Inbox +** TODO Make sure the video gets changed in a proper manner to not have left over video showing from previous items +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::currentServiceItem++;]] ** TODO Fix possible bug in arrangingItems in draghandler [[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] ** TODO [#A] Make Presentation Window follow the presenter component @@ -14,12 +16,11 @@ ** TODO Find a way to maths the textsize [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] -** TODO Make nextSlideText a nextAction function to incorporate other types of items -[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlideText() {]] - ** TODO Create a nextslide function to be used after the end of the list of slides [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] +- [ ] Check to make sure this works in all conditions but I believe it works ok. + ** TODO Fix broken append when importing River song [[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]] @@ -30,6 +31,9 @@ ** DONE Parse Lyrics to create a list of strings for slides SCHEDULED: <2022-03-23 Wed 10:00> +** DONE Make nextSlideText a nextAction function to incorporate other types of items +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlideText() {]] + ** DONE Fix file dialog using basic QT theme [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::FileDialog {]] diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index 9dfbdad..047a0b7 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -116,6 +116,7 @@ ColumnLayout { } onClicked: { serviceItemList.currentIndex = index; + currentServiceItem = index; changeServiceItem(index); } onRightClicked: rightClickMenu.popup() diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 4389edb..994423e 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -12,6 +12,7 @@ Controls.Page { padding: 0 // properties passed around for the slides + property int currentServiceItem property url imageBackground: "" property url videoBackground: "" property int blurRadius: 0 diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index 8378f8e..fc25ef4 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -135,6 +135,7 @@ Item { } else { print("Next slide time"); textIndex = 0; + previewSlide.text = ""; nextSlide(); } } else if (itemType === "video") @@ -144,6 +145,8 @@ Item { } function nextSlide() { + currentServiceItem++; + changeServiceItem(currentServiceItem); print(slideItem); } } From e52d44f9376b96dbb184fe6828760adaee7a3685 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 4 Apr 2022 06:43:05 -0500 Subject: [PATCH 06/41] gave the slide a black to put in front of loading videos --- TODO.org | 10 +++++++ src/assets/black.jpg | Bin 0 -> 2097 bytes src/qml/presenter/MainWindow.qml | 2 ++ src/qml/presenter/Presentation.qml | 20 ++++++++++--- src/qml/presenter/Slide.qml | 28 +++++++++++++++--- src/qml/presenter/SlideEditor.qml | 20 +++++++++++++ src/qml/presenter/SongEditor.qml | 17 +++++++++++ src/resources.qrc | 1 + src/songsqlmodel.cpp | 44 ++++++++++++++++++++++++++--- src/songsqlmodel.h | 6 ++++ 10 files changed, 136 insertions(+), 12 deletions(-) create mode 100644 src/assets/black.jpg diff --git a/TODO.org b/TODO.org index a88d4f4..418883d 100644 --- a/TODO.org +++ b/TODO.org @@ -1,7 +1,15 @@ #+TITLE: Todo List * Inbox +** TODO Build out a slide preview system so we can see each slide in the song or image slideshow +[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] ** TODO Make sure the video gets changed in a proper manner to not have left over video showing from previous items [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::currentServiceItem++;]] + +- [X] Build a basic system that changes to black first and then switches to the video +- [ ] Build out a loading system that will load the next video if it needs to and then the switch can be instant. + + The second option is the best, but requires a lot more work. I have the first already working so I'll come back to this once I have more of an idea of how to do it. + ** TODO Fix possible bug in arrangingItems in draghandler [[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] ** TODO [#A] Make Presentation Window follow the presenter component @@ -10,9 +18,11 @@ ** TODO Make toolbar functional for songeditor [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] +- [ ] Will likely need to modify the model to persist the effects stored to the songs ** TODO Finish toolbar [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] + ** TODO Find a way to maths the textsize [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] diff --git a/src/assets/black.jpg b/src/assets/black.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c5796d1d72bb7ff507b978288abd8e02185644ac GIT binary patch literal 2097 zcmex=vmlS~5GZ+{cM3OTSQy3T+*Dx?J=oCdnMlmoj z-T;XwLD+9V>~t`j31qcMQAm(80|S!?0|SFXIubhxiJhELl*_=tWWvC}ppufCm%_ln z6aitUfY>!4c5Y5-GRQy%2Cxr#Qu9KCLE;Py3^EMv44w?W3;_%Z3`q>744Di$3?&S@ z44Djh3C!tn9|Z17(Oj$VBn2pU=Y5* zz`zv^2{#4?29P|%;_D0yAvFvPK4%#iX3k<@P)lcE;E%!KZw|1(q2Y#C4K)1z-)3-T z_zwcVKm?iiHiI)GnOYIr4lxLFFx+AEWM&j(U=n0x7G(T?gh3RXhrpo)BbfdlVGsf3 zESLa<{(p;shnbOqNq|{^fq`)XL~xWGY9SyGid_M4X@}(W1^;g`a4<45FtRcUgH;G( zSHaB4XwQgO1rtIAPFvXQp|;>u!Dz22EDuX@;Cw28qml/presenter/Presentation.qml qml/presenter/Settings.qml assets/parallel.jpg + assets/black.jpg diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index 218fa31..61e7c6c 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -34,6 +34,7 @@ static void createTable() " 'vorder' TEXT," " 'background' TEXT," " 'backgroundType' TEXT," + " 'textAlignment' TEXT," " PRIMARY KEY(id))")) { qFatal("Failed to query database: %s", qPrintable(query.lastError().text())); @@ -41,11 +42,18 @@ static void createTable() qDebug() << query.lastQuery(); qDebug() << "inserting into songs"; - query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, background, backgroundType) VALUES ('10,000 Reasons', '10,000 reasons for my heart to sing', 'Matt Redman', '13470183', '', '', '', '')"); + query.exec( + "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " + "background, backgroundType) VALUES ('10,000 Reasons', '10,000 reasons " + "for my heart to sing', 'Matt Redman', '13470183', '', '', '', '', 'center')"); qDebug() << query.lastQuery(); - query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, background, backgroundType) VALUES ('River', 'Im going down to the river', 'Jordan Feliz', '13470183', '', '', '', '')"); - query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, background, backgroundType) VALUES ('Marvelous Light', 'Into marvelous " - "light Im running', 'Chris Tomlin', '13470183', '', '', '', '')"); + query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " + "background, backgroundType) VALUES ('River', 'Im going down to " + "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center')"); + query.exec( + "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " + "background, backgroundType) VALUES ('Marvelous Light', 'Into marvelous " + "light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center')"); query.exec("select * from songs"); qDebug() << query.lastQuery(); @@ -85,6 +93,7 @@ QHash SongSqlModel::roleNames() const names[Qt::UserRole + 6] = "vorder"; names[Qt::UserRole + 7] = "background"; names[Qt::UserRole + 8] = "backgroundType"; + names[Qt::UserRole + 9] = "textAlignment"; return names; } @@ -130,6 +139,7 @@ QVariantList SongSqlModel::getSong(const int &row) { song.append(recordData.value("vorder")); song.append(recordData.value("background")); song.append(recordData.value("backgroundType")); + song.append(recordData.value("textAlignment")); return song; } @@ -394,3 +404,29 @@ void SongSqlModel::updateBackgroundType(const int &row, const QString &backgroun submitAll(); emit backgroundTypeChanged(); } + +QString SongSqlModel::textAlignment() const { + return m_textAlignment; +} + +void SongSqlModel::setTextAlignment(const QString &textAlignment) { + if (textAlignment == m_textAlignment) + return; + + m_textAlignment = textAlignment; + + select(); + emit textAlignmentChanged(); +} + +// This function is for updating the lyrics from outside the delegate +void SongSqlModel::updateTextAlignment(const int &row, const QString &textAlignment) { + qDebug() << "Row is " << row; + QSqlRecord rowdata = record(row); + qDebug() << rowdata; + rowdata.setValue("textAlignment", textAlignment); + setRecord(row, rowdata); + qDebug() << rowdata; + submitAll(); + emit textAlignmentChanged(); +} diff --git a/src/songsqlmodel.h b/src/songsqlmodel.h index 09045c1..b90dd60 100644 --- a/src/songsqlmodel.h +++ b/src/songsqlmodel.h @@ -18,6 +18,7 @@ class SongSqlModel : public QSqlTableModel Q_PROPERTY(QString vorder READ vorder WRITE setVerseOrder NOTIFY vorderChanged) Q_PROPERTY(QString background READ background WRITE setBackground NOTIFY backgroundChanged) Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) + Q_PROPERTY(QString textAlignment READ textAlignment WRITE setTextAlignment NOTIFY textAlignmentChanged) QML_ELEMENT public: @@ -32,6 +33,7 @@ public: QString vorder() const; QString background() const; QString backgroundType() const; + QString textAlignment() const; void setTitle(const QString &title); void setLyrics(const QString &lyrics); @@ -41,6 +43,7 @@ public: void setVerseOrder(const QString &vorder); void setBackground(const QString &background); void setBackgroundType(const QString &backgroundType); + void setTextAlignment(const QString &background); Q_INVOKABLE void updateTitle(const int &row, const QString &title); Q_INVOKABLE void updateLyrics(const int &row, const QString &lyrics); @@ -50,6 +53,7 @@ public: Q_INVOKABLE void updateVerseOrder(const int &row, const QString &vorder); Q_INVOKABLE void updateBackground(const int &row, const QString &background); Q_INVOKABLE void updateBackgroundType(const int &row, const QString &backgroundType); + Q_INVOKABLE void updateTextAlignment(const int &row, const QString &textAlignment); Q_INVOKABLE void newSong(); Q_INVOKABLE void deleteSong(const int &row); @@ -68,6 +72,7 @@ signals: void vorderChanged(); void backgroundChanged(); void backgroundTypeChanged(); + void textAlignmentChanged(); private: int m_id; @@ -79,6 +84,7 @@ private: QString m_vorder; QString m_background; QString m_backgroundType; + QString m_textAlignment; }; #endif //SONGSQLMODEL_H From deb620a2eb7bdeea7e175061ab093d70a62f8047 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 5 Apr 2022 08:21:16 -0500 Subject: [PATCH 07/41] adding some more todos and refactoring getSong so it's more future proof --- TODO.org | 55 +++++++++++++++++-------------- src/qml/presenter/Slide.qml | 10 ++++-- src/qml/presenter/SlideEditor.qml | 5 +++ src/qml/presenter/SongEditor.qml | 19 ++++++----- src/songsqlmodel.cpp | 53 ++++++++++++++++++----------- src/songsqlmodel.h | 2 +- 6 files changed, 89 insertions(+), 55 deletions(-) diff --git a/TODO.org b/TODO.org index 418883d..13e5a4e 100644 --- a/TODO.org +++ b/TODO.org @@ -1,7 +1,38 @@ #+TITLE: Todo List * Inbox +** TODO BUG in dropping and then selecting song will duplicate entries +[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::Layout.fillHeight: true]] + +or at least turns the entry above it into the same as itself while retaining it's title. + ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] + +** TODO Fix possible bug in arrangingItems in draghandler +[[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] + +** TODO [#A] Make Presentation Window follow the presenter component +[[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]] + +** TODO Make toolbar functional for songeditor +[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] + +- [ ] Will likely need to modify the model to persist the effects stored to the songs. Alignment is done, need vertical alignment, font, and effects + +** TODO Finish toolbar +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] + +** TODO Find a way to maths the textsize +[[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] + +** TODO Fix broken append when importing River song +[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]] + +** TODO Create a nextslide function to be used after the end of the list of slides +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] + +- [ ] Check to make sure this works in all conditions but I believe it works ok. + ** TODO Make sure the video gets changed in a proper manner to not have left over video showing from previous items [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::currentServiceItem++;]] @@ -10,30 +41,6 @@ The second option is the best, but requires a lot more work. I have the first already working so I'll come back to this once I have more of an idea of how to do it. -** TODO Fix possible bug in arrangingItems in draghandler -[[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] -** TODO [#A] Make Presentation Window follow the presenter component -[[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]] - -** TODO Make toolbar functional for songeditor -[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] - -- [ ] Will likely need to modify the model to persist the effects stored to the songs -** TODO Finish toolbar -[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] - - -** TODO Find a way to maths the textsize -[[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] - -** TODO Create a nextslide function to be used after the end of the list of slides -[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] - -- [ ] Check to make sure this works in all conditions but I believe it works ok. - -** TODO Fix broken append when importing River song -[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]] - ** DONE Need to make ListModel capable of bringing in a string list [2/2] [100%] - [X] Create a Model - [X] Create a class that we'll make a list of in the model diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index b7aca7b..9208444 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -47,10 +47,12 @@ Item { enableAudio: !preview Component.onCompleted: mpvLoadingTimer.start() onFileLoaded: { - showPassiveNotification(videoSource + " has been loaded"); + /* showPassiveNotification(videoSource + " has been loaded"); */ if (itemType == "song") mpv.setProperty("loop", "inf"); - showPassiveNotification(mpv.getProperty("loop")); + else + mpv.setProperty("loop", "no"); + /* showPassiveNotification(mpv.getProperty("loop")); */ } MouseArea { @@ -148,4 +150,8 @@ Item { black.visible = true; showPassiveNotification("Black is: " + black.visible); } + + function pauseVideo() { + mpv.pause(); + } } diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index fcd3560..71754e7 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -27,6 +27,11 @@ Item { Component.onCompleted: updateHAlignment(textAlignment) + function loadVideo() { + representation.loadVideo(); + representation.pause(); + } + function updateHAlignment(alignment) { switch (alignment) { case "left" : diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 5083fe0..3de1da3 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -277,21 +277,22 @@ Item { function changeSong(index) { const song = songsqlmodel.getSong(index); songIndex = index; - songTitle = song[0]; - songLyrics = song[1]; - songAuthor = song[2]; - songCcli = song[3]; - songAudio = song[4]; - songVorder = song[5]; - songBackground = song[6]; - songBackgroundType = song[7]; - songHAlignment = song[8]; + songTitle = song.title; + songLyrics = song.lyrics; + songAuthor = song.author; + songCcli = song.ccli; + songAudio = song.audio; + songVorder = song.vorder; + songBackground = song.background; + songBackgroundType = song.backgroundType; + songHAlignment = song.textAlignment; if (songBackgroundType == "image") { slideEditor.videoBackground = ""; slideEditor.imageBackground = songBackground; } else { slideEditor.imageBackground = ""; slideEditor.videoBackground = songBackground; + slideEditor.loadVideo(); } print(song); } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index 61e7c6c..fd94159 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -122,26 +122,41 @@ void SongSqlModel::deleteSong(const int &row) { submitAll(); } -QVariantList SongSqlModel::getSong(const int &row) { - QSqlRecord recordData = record(row); - if (recordData.isEmpty()) { - qDebug() << "this is not a song"; - QVariantList empty; - return empty; +QVariantMap SongSqlModel::getSong(const int &row) { + // QSqlRecord recordData = record(row); + // if (recordData.isEmpty()) { + // qDebug() << "this is not a song"; + // QVariantList empty; + // return empty; + // } + + // QVariantList song; + // song.append(recordData.value("title")); + // song.append(recordData.value("lyrics")); + // song.append(recordData.value("author")); + // song.append(recordData.value("ccli")); + // song.append(recordData.value("audio")); + // song.append(recordData.value("vorder")); + // song.append(recordData.value("background")); + // song.append(recordData.value("backgroundType")); + // song.append(recordData.value("textAlignment")); + + // return song; + + QVariantMap data; + const QModelIndex idx = this->index(row,0); + // qDebug() << idx; + if( !idx.isValid() ) + return data; + const QHash rn = roleNames(); + // qDebug() << rn; + QHashIterator it(rn); + while (it.hasNext()) { + it.next(); + qDebug() << it.key() << ":" << it.value(); + data[it.value()] = idx.data(it.key()); } - - QVariantList song; - song.append(recordData.value("title")); - song.append(recordData.value("lyrics")); - song.append(recordData.value("author")); - song.append(recordData.value("ccli")); - song.append(recordData.value("audio")); - song.append(recordData.value("vorder")); - song.append(recordData.value("background")); - song.append(recordData.value("backgroundType")); - song.append(recordData.value("textAlignment")); - - return song; + return data; } QStringList SongSqlModel::getLyricList(const int &row) { diff --git a/src/songsqlmodel.h b/src/songsqlmodel.h index b90dd60..7e7d980 100644 --- a/src/songsqlmodel.h +++ b/src/songsqlmodel.h @@ -57,7 +57,7 @@ public: Q_INVOKABLE void newSong(); Q_INVOKABLE void deleteSong(const int &row); - Q_INVOKABLE QVariantList getSong(const int &row); + Q_INVOKABLE QVariantMap getSong(const int &row); Q_INVOKABLE QStringList getLyricList(const int &row); QVariant data(const QModelIndex &index, int role) const override; From 332c41de1b67bb67bf33501d301153461ab4e6c2 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 7 Apr 2022 12:00:46 -0500 Subject: [PATCH 08/41] debugging the drop duplicating entries --- TODO.org | 2 +- src/qml/presenter/LeftDock.qml | 4 +++- src/serviceitemmodel.cpp | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/TODO.org b/TODO.org index 13e5a4e..db9297a 100644 --- a/TODO.org +++ b/TODO.org @@ -3,7 +3,7 @@ ** TODO BUG in dropping and then selecting song will duplicate entries [[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::Layout.fillHeight: true]] -or at least turns the entry above it into the same as itself while retaining it's title. +or at least turns the entry above it into the same as itself while retaining it's title? ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index 047a0b7..15cc5e3 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -34,6 +34,7 @@ ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true onDropped: { + print("DROPPED AT END"); appendItem(dragItemTitle, dragItemType, dragItemBackground, @@ -136,6 +137,7 @@ ColumnLayout { id: serviceDrop anchors.fill: parent onDropped: { + print("DROPPED IN ITEM AREA"); addItem(index, dragItemTitle, dragItemType, @@ -174,7 +176,7 @@ ColumnLayout { function appendItem(name, type, background, backgroundType, text, itemID) { let lyrics; - if (type == "song") { + if (type === "song") { lyrics = songsqlmodel.getLyricList(itemID); print(lyrics); } diff --git a/src/serviceitemmodel.cpp b/src/serviceitemmodel.cpp index d431556..050e3ca 100644 --- a/src/serviceitemmodel.cpp +++ b/src/serviceitemmodel.cpp @@ -1,6 +1,7 @@ #include "serviceitemmodel.h" #include "serviceitem.h" #include +#include #include #include #include @@ -115,8 +116,15 @@ Qt::ItemFlags ServiceItemModel::flags(const QModelIndex &index) const { void ServiceItemModel::addItem(ServiceItem *item) { const int index = m_items.size(); + qDebug() << index; + // foreach (item, m_items) { + // qDebug() << item; + // } beginInsertRows(QModelIndex(), index, index); m_items.append(item); + foreach (item, m_items) { + qDebug() << item; + } endInsertRows(); } @@ -177,7 +185,7 @@ bool ServiceItemModel::move(int sourceIndex, int destIndex) { qDebug() << "starting move of: " << "source: " << sourceIndex << "dest: " << destIndex; qDebug() << index(sourceIndex).row(); qDebug() << index(destIndex).row(); - QModelIndex parent = index(sourceIndex).parent(); + // QModelIndex parent = index(sourceIndex).parent(); // bool begsuc = beginMoveRows(parent, sourceIndex, sourceIndex, parent, destIndex); beginResetModel(); m_items.move(sourceIndex, destIndex); From 036f83ecfe3ff3f62a4a8b7354c0dbca4dcc61c5 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 7 Apr 2022 15:20:33 -0500 Subject: [PATCH 09/41] fixing bug in initial songs db, items not dragging ontop of screen --- TODO.org | 7 ++++++- src/qml/presenter/Library.qml | 13 ++++++++++++- src/songsqlmodel.cpp | 7 ++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/TODO.org b/TODO.org index db9297a..3ae1053 100644 --- a/TODO.org +++ b/TODO.org @@ -1,6 +1,11 @@ #+TITLE: Todo List +:PROPERTIES: +:CATEGORY: dev +:END: + * Inbox -** TODO BUG in dropping and then selecting song will duplicate entries +** TODO BUG in dropping and then selecting song will duplicate entries :dev: +SCHEDULED: <2022-04-05 Tue> [[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::Layout.fillHeight: true]] or at least turns the entry above it into the same as itself while retaining it's title? diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index cb6b7b2..1607b08 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -195,9 +195,14 @@ Item { target: songListItem x: x y: y + width: width + height: height + } + ParentChange { + target: videoListItem + parent: rootApp.overlay } } - } MouseArea { @@ -411,6 +416,12 @@ Item { target: videoListItem x: x y: y + width: width + height: height + } + ParentChange { + target: videoListItem + parent: rootApp.overlay } } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index fd94159..0d105af 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -44,17 +44,18 @@ static void createTable() query.exec( "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType) VALUES ('10,000 Reasons', '10,000 reasons " + "background, backgroundType, textAlignment) VALUES ('10,000 Reasons', '10,000 reasons " "for my heart to sing', 'Matt Redman', '13470183', '', '', '', '', 'center')"); qDebug() << query.lastQuery(); query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType) VALUES ('River', 'Im going down to " + "background, backgroundType, textAlignment) VALUES ('River', 'Im going down to " "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center')"); query.exec( "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType) VALUES ('Marvelous Light', 'Into marvelous " + "background, backgroundType, textAlignment) VALUES ('Marvelous Light', 'Into marvelous " "light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center')"); + qDebug() << query.lastQuery(); query.exec("select * from songs"); qDebug() << query.lastQuery(); } From 09b6370153eebecb0016e9a89a651bf2d23f329e Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 8 Apr 2022 16:50:32 -0500 Subject: [PATCH 10/41] fixed bug in duplicating last item after video or image item --- src/qml/presenter/MainWindow.qml | 3 ++- src/qml/presenter/Presentation.qml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 80f9e4f..1605785 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -108,6 +108,7 @@ Controls.Page { function changeServiceItem(index) { const item = serviceItemModel.getItem(index); + print("index grabbed: " + index); presentation.stopVideo() presentation.itemType = item.type; @@ -128,7 +129,7 @@ Controls.Page { else presentation.text = item.text; presentation.textIndex = 0; - presentation.nextSlideAction(); + presentation.changeSlide(); print("Slide changed to: " + item.name); } diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index 13c22f6..e028bcf 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -152,6 +152,19 @@ Item { } } + function changeSlide() { + if (itemType === "song") { + previewSlide.text = root.text[textIndex]; + print(root.text[textIndex]); + textIndex++; + } else if (itemType === "video") { + clearText(); + } + else if (itemType === "image") { + clearText(); + } + } + function nextSlide() { currentServiceItem++; changeServiceItem(currentServiceItem); From 0cee5db60d25f470ea5aac22503bc45446516c28 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 8 Apr 2022 17:24:18 -0500 Subject: [PATCH 11/41] basic imagemodel and editor --- TODO.org | 14 +-- src/CMakeLists.txt | 1 + src/imagesqlmodel.cpp | 169 ++++++++++++++++++++++++++++++ src/imagesqlmodel.h | 49 +++++++++ src/main.cpp | 2 + src/qml/presenter/ImageEditor.qml | 115 ++++++-------------- src/qml/presenter/Library.qml | 143 +++++++++++++++++++++++++ src/qml/presenter/MainWindow.qml | 22 +++- src/serviceitemmodel.cpp | 5 +- src/songsqlmodel.cpp | 12 +-- src/videosqlmodel.h | 2 +- 11 files changed, 432 insertions(+), 102 deletions(-) create mode 100644 src/imagesqlmodel.cpp create mode 100644 src/imagesqlmodel.h diff --git a/TODO.org b/TODO.org index 3ae1053..16b7765 100644 --- a/TODO.org +++ b/TODO.org @@ -4,12 +4,8 @@ :END: * Inbox -** TODO BUG in dropping and then selecting song will duplicate entries :dev: -SCHEDULED: <2022-04-05 Tue> -[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::Layout.fillHeight: true]] - -or at least turns the entry above it into the same as itself while retaining it's title? - +** TODO Make an image sql model +[[file:~/dev/church-presenter/src/videosqlmodel.h::ifndef VIDEOSQLMODEL_H]] ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] @@ -53,6 +49,12 @@ or at least turns the entry above it into the same as itself while retaining it' ** DONE Parse Lyrics to create a list of strings for slides SCHEDULED: <2022-03-23 Wed 10:00> +** DONE BUG in dropping and then selecting song will duplicate entries :dev: +SCHEDULED: <2022-04-05 Tue> +[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::Layout.fillHeight: true]] + +or at least turns the entry above it into the same as itself while retaining it's title? + ** DONE Make nextSlideText a nextAction function to incorporate other types of items [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlideText() {]] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fe6f05d..ab4398d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,7 @@ target_sources(presenter serviceitemmodel.cpp serviceitemmodel.h serviceitem.cpp serviceitem.h videosqlmodel.cpp videosqlmodel.h + imagesqlmodel.cpp imagesqlmodel.h mpv/mpvobject.h mpv/mpvobject.cpp mpv/qthelper.hpp mpv/mpvhelpers.h ) diff --git a/src/imagesqlmodel.cpp b/src/imagesqlmodel.cpp new file mode 100644 index 0000000..c4537f0 --- /dev/null +++ b/src/imagesqlmodel.cpp @@ -0,0 +1,169 @@ +#include "imagesqlmodel.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *imagesTableName = "images"; + +static void createImageTable() +{ + if(QSqlDatabase::database().tables().contains(imagesTableName)) { + return; + } + + QSqlQuery query; + if (!query.exec("CREATE TABLE IF NOT EXISTS 'images' (" + " 'id' INTEGER NOT NULL," + " 'title' TEXT NOT NULL," + " 'filePath' TEXT NOT NULL," + " PRIMARY KEY(id))")) { + qFatal("Failed to query database: %s", + qPrintable(query.lastError().text())); + } + qDebug() << query.lastQuery(); + qDebug() << "inserting into images"; + + query.exec("INSERT INTO images (title, filePath) VALUES ('Dec 180', '/home/chris/nextcloud/tfc/openlp/180-dec.png')"); + qDebug() << query.lastQuery(); + query.exec("INSERT INTO images (title, filePath) VALUES ('No TFC', " + "'/home/chris/nextcloud/tfc/openlp/No TFC.png')"); + + query.exec("select * from images"); + qDebug() << query.lastQuery(); +} + +ImageSqlModel::ImageSqlModel(QObject *parent) : QSqlTableModel(parent) { + qDebug() << "creating image table"; + createImageTable(); + setTable(imagesTableName); + setEditStrategy(QSqlTableModel::OnManualSubmit); + // make sure to call select else the model won't fill + select(); +} + +QVariant ImageSqlModel::data(const QModelIndex &index, int role) const { + if (role < Qt::UserRole) { + return QSqlTableModel::data(index, role); + } + + // qDebug() << role; + const QSqlRecord sqlRecord = record(index.row()); + return sqlRecord.value(role - Qt::UserRole); +} + +QHash ImageSqlModel::roleNames() const +{ + QHash names; + names[Qt::UserRole] = "id"; + names[Qt::UserRole + 1] = "title"; + names[Qt::UserRole + 2] = "filePath"; + return names; +} + +void ImageSqlModel::newImage(const QUrl &filePath) { + qDebug() << "adding new image"; + int rows = rowCount(); + + qDebug() << rows; + QSqlRecord recordData = record(); + QFileInfo fileInfo = filePath.toString(); + QString title = fileInfo.baseName(); + recordData.setValue("title", title); + recordData.setValue("filePath", filePath); + + if (insertRecord(rows, recordData)) { + submitAll(); + } else { + qDebug() << lastError(); + }; +} + +void ImageSqlModel::deleteImage(const int &row) { + QSqlRecord recordData = record(row); + if (recordData.isEmpty()) + return; + + removeRow(row); + submitAll(); +} + +int ImageSqlModel::id() const { + return m_id; +} + +QString ImageSqlModel::title() const { + return m_title; +} + +void ImageSqlModel::setTitle(const QString &title) { + if (title == m_title) + return; + + m_title = title; + + select(); + emit titleChanged(); +} + +// This function is for updating the title from outside the delegate +void ImageSqlModel::updateTitle(const int &row, const QString &title) { + qDebug() << "Row is " << row; + QSqlRecord rowdata = record(row); + qDebug() << rowdata; + rowdata.setValue("title", title); + setRecord(row, rowdata); + qDebug() << rowdata; + submitAll(); + emit titleChanged(); +} + +QUrl ImageSqlModel::filePath() const { + return m_filePath; +} + +void ImageSqlModel::setFilePath(const QUrl &filePath) { + if (filePath == m_filePath) + return; + + m_filePath = filePath; + + select(); + emit filePathChanged(); +} + +// This function is for updating the filepath from outside the delegate +void ImageSqlModel::updateFilePath(const int &row, const QUrl &filePath) { + qDebug() << "Row is " << row; + QSqlRecord rowdata = record(row); + qDebug() << rowdata; + rowdata.setValue("filePath", filePath); + setRecord(row, rowdata); + qDebug() << rowdata; + submitAll(); + emit filePathChanged(); +} + +QUrl ImageSqlModel::getImage(const int &row) { + qDebug() << "Row we are getting is " << row; + QUrl image; + QSqlRecord rec = record(row); + qDebug() << rec.value("filePath").toUrl(); + // image.append(rec.value("title")); + // image.append(rec.value("filePath")); + image = rec.value("filePath").toUrl(); + return image; +} diff --git a/src/imagesqlmodel.h b/src/imagesqlmodel.h new file mode 100644 index 0000000..461ba8a --- /dev/null +++ b/src/imagesqlmodel.h @@ -0,0 +1,49 @@ +#ifndef IMAGESQLMODEL_H +#define IMAGESQLMODEL_H + +#include +#include +#include +#include +#include +#include + +class ImageSqlModel : public QSqlTableModel +{ + Q_OBJECT + Q_PROPERTY(int id READ id) + Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) + Q_PROPERTY(QUrl filePath READ filePath WRITE setFilePath NOTIFY filePathChanged) + QML_ELEMENT + +public: + ImageSqlModel(QObject *parent = 0); + + int id() const; + QString title() const; + QUrl filePath() const; + + void setTitle(const QString &title); + void setFilePath(const QUrl &filePath); + + Q_INVOKABLE void updateTitle(const int &row, const QString &title); + Q_INVOKABLE void updateFilePath(const int &row, const QUrl &filePath); + + Q_INVOKABLE void newImage(const QUrl &filePath); + Q_INVOKABLE void deleteImage(const int &row); + Q_INVOKABLE QUrl getImage(const int &row); + + QVariant data(const QModelIndex &index, int role) const override; + QHash roleNames() const override; + +signals: + void titleChanged(); + void filePathChanged(); + +private: + int m_id; + QString m_title; + QUrl m_filePath; +}; + +#endif //IMAGESQLMODEL_H diff --git a/src/main.cpp b/src/main.cpp index 06a8365..845fdc3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,6 +37,7 @@ #include "serviceitemmodel.h" #include "songsqlmodel.h" #include "videosqlmodel.h" +#include "imagesqlmodel.h" static void connectToDatabase() { // let's setup our sql database @@ -98,6 +99,7 @@ int main(int argc, char *argv[]) //register our models qmlRegisterType("org.presenter", 1, 0, "SongSqlModel"); qmlRegisterType("org.presenter", 1, 0, "VideoSqlModel"); + qmlRegisterType("org.presenter", 1, 0, "ImageSqlModel"); qmlRegisterType("org.presenter", 1, 0, "ServiceItemModel"); connectToDatabase(); diff --git a/src/qml/presenter/ImageEditor.qml b/src/qml/presenter/ImageEditor.qml index 4dea612..8da66af 100644 --- a/src/qml/presenter/ImageEditor.qml +++ b/src/qml/presenter/ImageEditor.qml @@ -8,6 +8,9 @@ import "./" as Presenter Item { id: root + property string type: "image" + property var image + GridLayout { id: mainLayout anchors.fill: parent @@ -83,15 +86,15 @@ Item { border.color: Kirigami.Theme.activeBackgroundColor border.width: 2 } - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + closePolicy: Controls.Popup.CloseOnEscape | Controls.Popup.CloseOnPressOutsideParent ColumnLayout { anchors.fill: parent Controls.ToolButton { Layout.fillHeight: true Layout.fillWidth: true - text: "Video" - icon.name: "emblem-videos-symbolic" - onClicked: videoFileDialog.open() & backgroundType.close() + text: "Image" + icon.name: "emblem-images-symbolic" + onClicked: imageFileDialog.open() & backgroundType.close() } Controls.ToolButton { Layout.fillWidth: true @@ -121,11 +124,11 @@ Item { ColumnLayout { Controls.SplitView.fillHeight: true - Controls.SplitView.preferredWidth: 500 - Controls.SplitView.minimumWidth: 500 + Controls.SplitView.preferredWidth: 300 + Controls.SplitView.minimumWidth: 100 Controls.TextField { - id: songTitleField + id: imageTitleField Layout.preferredWidth: 300 Layout.fillWidth: true @@ -133,98 +136,46 @@ Item { Layout.rightMargin: 20 placeholderText: "Song Title..." - text: songTitle + text: "idk" padding: 10 - onEditingFinished: updateTitle(text); - } - Controls.TextField { - id: songVorderField - - Layout.preferredWidth: 300 - Layout.fillWidth: true - Layout.leftMargin: 20 - Layout.rightMargin: 20 - - placeholderText: "verse order..." - text: songVorder - padding: 10 - onEditingFinished: updateVerseOrder(text); + /* onEditingFinished: updateTitle(text); */ } - Controls.ScrollView { - id: songLyricsField - - Layout.preferredHeight: 3000 - Layout.fillWidth: true + Item { + id: empty Layout.fillHeight: true - Layout.leftMargin: 20 - - rightPadding: 20 - - Controls.TextArea { - id: lyricsEditor - width: parent.width - placeholderText: "Put lyrics here..." - persistentSelection: true - text: songLyrics - textFormat: TextEdit.MarkdownText - padding: 10 - onEditingFinished: { - updateLyrics(text); - editorTimer.running = false; - } - onPressed: editorTimer.running = true - } } - Controls.TextField { - id: songAuthorField - - Layout.fillWidth: true - Layout.preferredWidth: 300 - Layout.leftMargin: 20 - Layout.rightMargin: 20 - - placeholderText: "Author..." - text: songAuthor - padding: 10 - onEditingFinished: updateAuthor(text) - } - } ColumnLayout { Controls.SplitView.fillHeight: true Controls.SplitView.preferredWidth: 700 Controls.SplitView.minimumWidth: 300 + spacing: 5 - Rectangle { - id: slideBar - color: Kirigami.Theme.highlightColor - - Layout.preferredWidth: 500 - Layout.preferredHeight: songTitleField.height - Layout.rightMargin: 20 - Layout.leftMargin: 20 + Item { + id: topEmpty + Layout.fillHeight: true } - Presenter.SlideEditor { - id: slideEditor - Layout.preferredWidth: 500 - Layout.fillWidth: true - Layout.preferredHeight: slideEditor.width / 16 * 9 - Layout.bottomMargin: 30 - Layout.rightMargin: 20 - Layout.leftMargin: 20 + Image { + id: imagePreview + Layout.preferredWidth: 600 + Layout.preferredHeight: Layout.preferredWidth / 16 * 9 + Layout.alignment: Qt.AlignCenter + fillMode: Image.PreserveAspectFit + source: "file://" + image.toString() + } + Item { + id: botEmpty + Layout.fillHeight: true } } + } } + function changeImage(image) { + root.image = image; + print(image.toString()); } - Timer { - id: editorTimer - interval: 1000 - repeat: true - running: false - onTriggered: updateLyrics(lyricsEditor.text) - } } diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index 1607b08..4414e26 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -485,12 +485,40 @@ Item { Layout.fillWidth: true Layout.alignment: Qt.AlignTop color: Kirigami.Theme.backgroundColor + opacity: 1.0 Controls.Label { + id: imageLabel anchors.centerIn: parent text: "Images" } + Controls.Label { + id: imageCount + anchors {left: imageLabel.right + verticalCenter: imageLabel.verticalCenter + leftMargin: 15} + text: imagesqlmodel.rowCount() + font.pixelSize: 15 + color: Kirigami.Theme.disabledTextColor + } + + Kirigami.Icon { + id: imageDrawerArrow + anchors {right: parent.right + verticalCenter: imageCount.verticalCenter + rightMargin: 10} + source: "arrow-down" + rotation: selectedLibrary == "images" ? 0 : 180 + + Behavior on rotation { + NumberAnimation { + easing.type: Easing.OutCubic + duration: 300 + } + } + } + MouseArea { anchors.fill: parent onClicked: { @@ -508,6 +536,9 @@ Item { Layout.preferredHeight: parent.height - 200 Layout.fillWidth: true Layout.alignment: Qt.AlignTop + model: imagesqlmodel + delegate: imageDelegate + clip: true state: "deselected" states: [ @@ -534,6 +565,118 @@ Item { duration: 300 } } + + Component { + id: imageDelegate + Item{ + implicitWidth: ListView.view.width + height: selectedLibrary == "images" ? 50 : 0 + Kirigami.BasicListItem { + id: imageListItem + + property bool rightMenu: false + + implicitWidth: imageLibraryList.width + height: selectedLibrary == "images" ? 50 : 0 + clip: true + label: title + /* subtitle: author */ + supportsMouseEvents: false + backgroundColor: { + if (parent.ListView.isCurrentItem) { + Kirigami.Theme.highlightColor; + } else if (imageDragHandler.containsMouse){ + Kirigami.Theme.highlightColor; + } else { + Kirigami.Theme.backgroundColor; + } + } + textColor: { + if (parent.ListView.isCurrentItem || imageDragHandler.containsMouse) + activeTextColor; + else + Kirigami.Theme.textColor; + } + + Behavior on height { + NumberAnimation { + easing.type: Easing.OutCubic + duration: 300 + } + } + Drag.active: imageDragHandler.drag.active + Drag.hotSpot.x: width / 2 + Drag.hotSpot.y: height / 2 + Drag.keys: [ "library" ] + + states: State { + name: "dragged" + when: imageListItem.Drag.active + PropertyChanges { + target: imageListItem + x: x + y: y + width: width + height: height + } + ParentChange { + target: imageListItem + parent: rootApp.overlay + } + } + + } + + MouseArea { + id: imageDragHandler + anchors.fill: parent + hoverEnabled: true + drag { + target: imageListItem + onActiveChanged: { + if (imageDragHandler.drag.active) { + dragItemTitle = title; + dragItemType = "image"; + dragItemText = ""; + dragItemBackgroundType = "image"; + dragItemBackground = filePath; + } else { + imageListItem.Drag.drop() + } + } + filterChildren: true + threshold: 10 + } + MouseArea { + id: imageClickHandler + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if(mouse.button == Qt.RightButton) + rightClickImageMenu.popup() + else{ + imageLibraryList.currentIndex = index + const image = imagesqlmodel.getImage(imageLibraryList.currentIndex); + if (!editMode) + editMode = true; + editType = "image"; + editSwitch(image); + } + } + + } + } + Controls.Menu { + id: rightClickImageMenu + x: imageClickHandler.mouseX + y: imageClickHandler.mouseY + 10 + Kirigami.Action { + text: "delete" + onTriggered: imagesqlmodel.deleteImage(index) + } + } + } + } } Rectangle { diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 1605785..2124e91 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -66,17 +66,24 @@ Controls.Page { id: presentation anchors.fill: parent } + Presenter.SongEditor { id: songEditor visible: false anchors.fill: parent } - + Presenter.VideoEditor { id: videoEditor visible: false anchors.fill: parent } + + Presenter.ImageEditor { + id: imageEditor + visible: false + anchors.fill: parent + } } Presenter.Library { @@ -102,6 +109,10 @@ Controls.Page { id: videosqlmodel } + ImageSqlModel { + id: imagesqlmodel + } + ServiceItemModel { id: serviceItemModel } @@ -141,19 +152,24 @@ Controls.Page { presentation.visible = false; videoEditor.visible = false; videoEditor.stop(); + imageEditor.visible = false; songEditor.visible = true; songEditor.changeSong(item); break; case "video" : presentation.visible = false; songEditor.visible = false; + imageEditor.visible = false; videoEditor.visible = true; videoEditor.changeVideo(item); break; case "image" : - mainPageArea.pop(Controls.StackView.Immediate); - mainPageArea.push(imageEditorComp, Controls.StackView.Immediate); + presentation.visible = false; + videoEditor.visible = false; videoEditor.stop(); + songEditor.visible = false; + imageEditor.visible = true; + imageEditor.changeImage(item); break; default: videoEditor.visible = false; diff --git a/src/serviceitemmodel.cpp b/src/serviceitemmodel.cpp index 050e3ca..1bcebe9 100644 --- a/src/serviceitemmodel.cpp +++ b/src/serviceitemmodel.cpp @@ -116,15 +116,12 @@ Qt::ItemFlags ServiceItemModel::flags(const QModelIndex &index) const { void ServiceItemModel::addItem(ServiceItem *item) { const int index = m_items.size(); - qDebug() << index; + // qDebug() << index; // foreach (item, m_items) { // qDebug() << item; // } beginInsertRows(QModelIndex(), index, index); m_items.append(item); - foreach (item, m_items) { - qDebug() << item; - } endInsertRows(); } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index 0d105af..8087077 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -39,14 +39,14 @@ static void createTable() qFatal("Failed to query database: %s", qPrintable(query.lastError().text())); } - qDebug() << query.lastQuery(); - qDebug() << "inserting into songs"; + // qDebug() << query.lastQuery(); + // qDebug() << "inserting into songs"; query.exec( "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " "background, backgroundType, textAlignment) VALUES ('10,000 Reasons', '10,000 reasons " "for my heart to sing', 'Matt Redman', '13470183', '', '', '', '', 'center')"); - qDebug() << query.lastQuery(); + // qDebug() << query.lastQuery(); query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " "background, backgroundType, textAlignment) VALUES ('River', 'Im going down to " "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center')"); @@ -55,15 +55,15 @@ static void createTable() "background, backgroundType, textAlignment) VALUES ('Marvelous Light', 'Into marvelous " "light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center')"); - qDebug() << query.lastQuery(); + // qDebug() << query.lastQuery(); query.exec("select * from songs"); - qDebug() << query.lastQuery(); + // qDebug() << query.lastQuery(); } SongSqlModel::SongSqlModel(QObject *parent) : QSqlTableModel(parent) { - qDebug() << "creating table"; + // qDebug() << "creating table"; createTable(); setTable(songsTableName); setEditStrategy(QSqlTableModel::OnManualSubmit); diff --git a/src/videosqlmodel.h b/src/videosqlmodel.h index be269a7..f36911f 100644 --- a/src/videosqlmodel.h +++ b/src/videosqlmodel.h @@ -46,4 +46,4 @@ private: QUrl m_filePath; }; -#endif //SONGSQLMODEL_H +#endif //VIDEOSQLMODEL_H From 818b57cef77c8fa677e9ce1111f293ebac629c12 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 8 Apr 2022 17:31:44 -0500 Subject: [PATCH 12/41] imageEditor is working and preview of images works --- TODO.org | 2 ++ src/imagesqlmodel.cpp | 4 ++-- src/qml/presenter/ImageEditor.qml | 2 +- src/qml/presenter/MainWindow.qml | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/TODO.org b/TODO.org index 16b7765..8361ff8 100644 --- a/TODO.org +++ b/TODO.org @@ -4,6 +4,8 @@ :END: * Inbox +** TODO Images stored in sql need to have aspect saved and applied dynamically here +[[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::fillMode: Image.PreserveAspectCrop]] ** TODO Make an image sql model [[file:~/dev/church-presenter/src/videosqlmodel.h::ifndef VIDEOSQLMODEL_H]] ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow diff --git a/src/imagesqlmodel.cpp b/src/imagesqlmodel.cpp index c4537f0..727d761 100644 --- a/src/imagesqlmodel.cpp +++ b/src/imagesqlmodel.cpp @@ -37,10 +37,10 @@ static void createImageTable() qDebug() << query.lastQuery(); qDebug() << "inserting into images"; - query.exec("INSERT INTO images (title, filePath) VALUES ('Dec 180', '/home/chris/nextcloud/tfc/openlp/180-dec.png')"); + query.exec("INSERT INTO images (title, filePath) VALUES ('Dec 180', 'file:///home/chris/nextcloud/tfc/openlp/180-dec.png')"); qDebug() << query.lastQuery(); query.exec("INSERT INTO images (title, filePath) VALUES ('No TFC', " - "'/home/chris/nextcloud/tfc/openlp/No TFC.png')"); + "'file:///home/chris/nextcloud/tfc/openlp/No TFC.png')"); query.exec("select * from images"); qDebug() << query.lastQuery(); diff --git a/src/qml/presenter/ImageEditor.qml b/src/qml/presenter/ImageEditor.qml index 8da66af..d5e80e5 100644 --- a/src/qml/presenter/ImageEditor.qml +++ b/src/qml/presenter/ImageEditor.qml @@ -163,7 +163,7 @@ Item { Layout.preferredHeight: Layout.preferredWidth / 16 * 9 Layout.alignment: Qt.AlignCenter fillMode: Image.PreserveAspectFit - source: "file://" + image.toString() + source: image } Item { id: botEmpty diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 2124e91..9fb41e7 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -175,6 +175,7 @@ Controls.Page { videoEditor.visible = false; videoEditor.stop(); songEditor.visible = false; + imageEditor.visible = false; presentation.visible = true; editMode = false; } From 354d47be8b11b6b4d37685789478e3c84339016d Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 8 Apr 2022 17:32:39 -0500 Subject: [PATCH 13/41] adjusting todos --- TODO.org | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/TODO.org b/TODO.org index 8361ff8..af42ae3 100644 --- a/TODO.org +++ b/TODO.org @@ -6,8 +6,10 @@ * Inbox ** TODO Images stored in sql need to have aspect saved and applied dynamically here [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::fillMode: Image.PreserveAspectCrop]] -** TODO Make an image sql model + +** DONE Make an image sql model [[file:~/dev/church-presenter/src/videosqlmodel.h::ifndef VIDEOSQLMODEL_H]] + ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] @@ -22,7 +24,7 @@ - [ ] Will likely need to modify the model to persist the effects stored to the songs. Alignment is done, need vertical alignment, font, and effects -** TODO Finish toolbar +** TODO Finish toolbar in presentation display [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] ** TODO Find a way to maths the textsize From f14be7157295db15bd7cfa9ddac4732a97deb7ed Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 8 Apr 2022 17:34:44 -0500 Subject: [PATCH 14/41] more todos --- TODO.org | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TODO.org b/TODO.org index af42ae3..9854d71 100644 --- a/TODO.org +++ b/TODO.org @@ -4,12 +4,12 @@ :END: * Inbox +** TODO images and videos need a better get system +[[file:~/dev/church-presenter/src/videosqlmodel.cpp::QVariantList VideoSqlModel::getVideo(const int &row) {]] + ** TODO Images stored in sql need to have aspect saved and applied dynamically here [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::fillMode: Image.PreserveAspectCrop]] -** DONE Make an image sql model -[[file:~/dev/church-presenter/src/videosqlmodel.h::ifndef VIDEOSQLMODEL_H]] - ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] @@ -50,6 +50,9 @@ - [X] Create a Model - [X] Create a class that we'll make a list of in the model +** DONE Make an image sql model +[[file:~/dev/church-presenter/src/videosqlmodel.h::ifndef VIDEOSQLMODEL_H]] + ** DONE Parse Lyrics to create a list of strings for slides SCHEDULED: <2022-03-23 Wed 10:00> From 8d07c7355db6c68e659a2582f0e9e4c1f1208818 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 11 Apr 2022 11:03:20 -0500 Subject: [PATCH 15/41] fixed the leftdock to allow reordering and better dnd --- src/qml/presenter/DragHandle.qml | 9 +- src/qml/presenter/ImageEditor.qml | 2 +- src/qml/presenter/LeftDock.qml | 211 ++++++++++++++++++++++-------- src/qml/presenter/SongEditor.qml | 2 +- src/qml/presenter/VideoEditor.qml | 2 +- src/serviceitemmodel.cpp | 20 +-- src/songsqlmodel.cpp | 11 ++ 7 files changed, 190 insertions(+), 67 deletions(-) diff --git a/src/qml/presenter/DragHandle.qml b/src/qml/presenter/DragHandle.qml index e0f081b..b15c469 100644 --- a/src/qml/presenter/DragHandle.qml +++ b/src/qml/presenter/DragHandle.qml @@ -56,12 +56,15 @@ Item { property int mouseDownY property Item originalParent property int autoScrollThreshold: (listView.contentHeight > listView.height) ? listItem.height * 3 : 0 - opacity: mouseArea.pressed || (!Kirigami.Settings.tabletMode && listItem.hovered) ? 1 : 0.6 function arrangeItem() { - var newIndex = listView.indexAt(1, listView.contentItem.mapFromItem(listItem, 0, 0).y + mouseArea.mouseDownY); + var newIndex = listView.indexAt(1, + listView.contentItem.mapFromItem(listItem, 0, 0).y + + mouseArea.mouseDownY); - if (Math.abs(listItem.y - mouseArea.startY) > height && newIndex > -1 && newIndex !== index) { + if (Math.abs(listItem.y - mouseArea.startY) > height && newIndex > -1 && + newIndex !== index) { + print("old index is: " + index + " and new index is: " + newIndex); root.moveRequested(index, newIndex); } } diff --git a/src/qml/presenter/ImageEditor.qml b/src/qml/presenter/ImageEditor.qml index d5e80e5..75f501b 100644 --- a/src/qml/presenter/ImageEditor.qml +++ b/src/qml/presenter/ImageEditor.qml @@ -30,7 +30,7 @@ Item { implicitWidth: 300 editable: true hoverEnabled: true - onCurrentTextChanged: showPassiveNotification(currentText) + /* onCurrentTextChanged: showPassiveNotification(currentText) */ } Controls.SpinBox { editable: true diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index 15cc5e3..654d38f 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -3,6 +3,7 @@ import QtQuick.Dialogs 1.0 import QtQuick.Controls 2.0 as Controls import QtQuick.Window 2.13 import QtQuick.Layouts 1.2 +import QtQml.Models 2.12 import QtMultimedia 5.15 import QtAudioEngine 1.15 import org.kde.kirigami 2.13 as Kirigami @@ -47,13 +48,14 @@ ColumnLayout { ListView { id: serviceItemList anchors.fill: parent - model: serviceItemModel - delegate: Kirigami.DelegateRecycler { - width: serviceItemList.width - sourceComponent: itemDelegate - } + /* model: serviceItemModel */ + /* delegate: Kirigami.DelegateRecycler { */ + /* width: serviceItemList.width */ + /* sourceComponent: itemDelegate */ + /* } */ clip: true spacing: 3 + property int dragItemIndex addDisplaced: Transition { NumberAnimation {properties: "x, y"; duration: 100} @@ -74,54 +76,160 @@ ColumnLayout { NumberAnimation {properties: "x, y"; duration: 100} } - Component { - id: itemDelegate - Item { - id: serviceItem + model: DelegateModel { + id: visualModel + model: serviceItemModel + delegate: DropArea { + id: serviceDrop implicitWidth: serviceItemList.width height: 50 + onEntered: (drag) => { + /* dropPlacement(drag); */ + const from = (drag.source as visServiceItem) + visualModel.items.move(dragItemIndex, index); + } + onDropped: (drag) => { + print("DROPPED IN ITEM AREA: " + drag.keys); + print(dragItemIndex + " " + index); + const hlIndex = serviceItemList.currentIndex; + if (drag.keys === ["library"]) { + addItem(index, + dragItemTitle, + dragItemType, + dragItemBackground, + dragItemBackgroundType, + dragItemText, + dragItemIndex); + } else if (drag.keys === ["serviceitem"]) { + moveRequested(dragItemIndex, index); + if (hlIndex === dragItemIndex) + serviceItemList.currentIndex = index; + else if (hlIndex === index) + serviceItemList.currentIndex = index + 1; + } + } + keys: ["library","serviceitem"] + Kirigami.BasicListItem { - anchors.fill: parent + id: visServiceItem + width: serviceDrop.width + height: serviceDrop.height + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } label: name subtitle: type - hoverEnabled: true + hoverEnabled: false supportsMouseEvents: false backgroundColor: { - if (parent.ListView.isCurrentItem) { + if (serviceItemList.currentIndex === index || + mouseHandler.containsMouse) Kirigami.Theme.highlightColor; - /* } else if (serviceDrop.constainsDrag){ */ - /* Kirigami.Theme.hoverColor; */ - } else if (mouseHandler.containsMouse){ - Kirigami.Theme.highlightColor; - } else { - Kirigami.Theme.backgroundColor; - } + else + Kirigami.Theme.backgroundColor; } textColor: { - if (parent.ListView.isCurrentItem || mouseHandler.containsMouse) + if (serviceItemList.currentIndex === index || + mouseHandler.containsMouse) activeTextColor; else Kirigami.Theme.textColor; } + + states: [ + State { + when: mouseHandler.drag.active + ParentChange { + target: visServiceItem + parent: serviceItemList + } + + PropertyChanges { + target: visServiceItem + backgroundColor: Kirigami.Theme.backgroundColor + textColor: Kirigami.Theme.textColor + anchors.verticalCenter: undefined + anchors.horizontalCenter: undefined + } + } + ] + + /* Drag.dragType: Drag.Automatic */ + Drag.active: mouseHandler.drag.active + Drag.hotSpot.x: width / 2 + Drag.hotSpot.y: height / 2 + Drag.keys: ["serviceitem"] + + MouseArea { + id: mouseHandler + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + preventStealing: true + + drag { + target: visServiceItem + axis: Drag.YAxis + /* minimumY: root.y */ + /* maximumY: serviceItemList.height - serviceDrop.height */ + smoothed: false + } + + drag.onActiveChanged: { + if (mouseHandler.drag.active) { + dragItemIndex = index; + } + } + + /* onPositionChanged: { */ + /* if (!pressed) { */ + /* return; */ + /* } */ + /* mouseArea.arrangeItem(); */ + /* } */ + + onPressed: { + serviceItemList.interactive = false; + } + + onClicked: { + if (mouse.button === Qt.RightButton) + rightClickMenu.popup(); + else { + serviceItemList.currentIndex = index; + currentServiceItem = index; + changeServiceItem(index); + } + } + + onReleased: { + print("should drop"); + visServiceItem.Drag.drop(); + } + } } - Presenter.DragHandle { - id: mouseHandler - anchors.fill: parent - listItem: serviceItem - listView: serviceItemList - onMoveRequested: { - print(oldIndex, newIndex); - serviceItemModel.move(oldIndex, newIndex); - } - onDropped: { - } - onClicked: { - serviceItemList.currentIndex = index; - currentServiceItem = index; - changeServiceItem(index); - } - onRightClicked: rightClickMenu.popup() - } + + /* Presenter.DragHandle { */ + /* id: mouseHandler */ + /* anchors.fill: parent */ + /* listItem: serviceItem */ + /* listView: serviceItemList */ + /* onMoveRequested: { */ + /* print(oldIndex, newIndex); */ + /* serviceItemModel.move(oldIndex, newIndex); */ + /* } */ + /* onDropped: { */ + /* } */ + /* onClicked: { */ + /* serviceItemList.currentIndex = index; */ + /* currentServiceItem = index; */ + /* changeServiceItem(index); */ + /* } */ + /* onRightClicked: rightClickMenu.popup() */ + /* } */ + + Controls.Menu { id: rightClickMenu @@ -133,23 +241,16 @@ ColumnLayout { } } - DropArea { - id: serviceDrop - anchors.fill: parent - onDropped: { - print("DROPPED IN ITEM AREA"); - addItem(index, - dragItemTitle, - dragItemType, - dragItemBackground, - dragItemBackgroundType, - dragItemText, - dragItemIndex); - } - keys: ["library"] + function moveRequested(oldIndex, newIndex) { + serviceItemModel.move(oldIndex, newIndex); + } + + function dropPlacement(drag) { + print(drag.y); } } } + Kirigami.WheelHandler { id: wheelHandler @@ -164,19 +265,23 @@ ColumnLayout { active: hovered || pressed } } - } + } + function addItem(index, name, type, background, backgroundType, text, itemID) { const newtext = songsqlmodel.getLyricList(itemID); + print("adding: " + name + " of type " + type); serviceItemModel.insertItem(index, name, type, background, backgroundType, newtext); } function appendItem(name, type, background, backgroundType, text, itemID) { + print("adding: " + name + " of type " + type); let lyrics; if (type === "song") { + print(itemID); lyrics = songsqlmodel.getLyricList(itemID); print(lyrics); } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 3de1da3..a087684 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -39,7 +39,7 @@ Item { implicitWidth: 300 editable: true hoverEnabled: true - onCurrentTextChanged: showPassiveNotification(currentText) + /* onCurrentTextChanged: showPassiveNotification(currentText) */ } Controls.SpinBox { editable: true diff --git a/src/qml/presenter/VideoEditor.qml b/src/qml/presenter/VideoEditor.qml index 47b3d63..7c15c12 100644 --- a/src/qml/presenter/VideoEditor.qml +++ b/src/qml/presenter/VideoEditor.qml @@ -32,7 +32,7 @@ Item { implicitWidth: 300 editable: true hoverEnabled: true - onCurrentTextChanged: showPassiveNotification(currentText) + /* onCurrentTextChanged: showPassiveNotification(currentText) */ } Controls.SpinBox { editable: true diff --git a/src/serviceitemmodel.cpp b/src/serviceitemmodel.cpp index 1bcebe9..5118060 100644 --- a/src/serviceitemmodel.cpp +++ b/src/serviceitemmodel.cpp @@ -116,7 +116,7 @@ Qt::ItemFlags ServiceItemModel::flags(const QModelIndex &index) const { void ServiceItemModel::addItem(ServiceItem *item) { const int index = m_items.size(); - // qDebug() << index; + qDebug() << index; // foreach (item, m_items) { // qDebug() << item; // } @@ -179,15 +179,19 @@ void ServiceItemModel::removeItem(int index) { } bool ServiceItemModel::move(int sourceIndex, int destIndex) { - qDebug() << "starting move of: " << "source: " << sourceIndex << "dest: " << destIndex; qDebug() << index(sourceIndex).row(); qDebug() << index(destIndex).row(); - // QModelIndex parent = index(sourceIndex).parent(); - // bool begsuc = beginMoveRows(parent, sourceIndex, sourceIndex, parent, destIndex); - beginResetModel(); - m_items.move(sourceIndex, destIndex); - // endMoveRows(); - endResetModel(); + // beginResetModel(); + QModelIndex parent = index(sourceIndex).parent(); + if (sourceIndex >= 0 && sourceIndex != destIndex && destIndex >= 0 && destIndex < rowCount() && sourceIndex < rowCount()) { + qDebug() << "starting move of: " << "source: " << sourceIndex << "dest: " << destIndex; + bool begsuc = beginMoveRows(QModelIndex(), sourceIndex, sourceIndex, QModelIndex(), destIndex); + if (begsuc) + m_items.move(sourceIndex, destIndex); + endMoveRows(); + } + // endResetModel(); + // emit dataChanged(index(sourceIndex), QModelIndex()); // qDebug() << success; return true; } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index 8087077..cf5167d 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -190,6 +190,7 @@ QStringList SongSqlModel::getLyricList(const int &row) { // This first function pulls out each verse into our verses map foreach (line, rawLyrics) { + qDebug() << line; if (firstItem) { if (keywords.contains(line)) { recordVerse = true; @@ -213,6 +214,16 @@ QStringList SongSqlModel::getLyricList(const int &row) { } qDebug() << verses; + // let's check to see if there is a verse order, if not return the list given + if (vorder.first().isEmpty()) { + qDebug() << "NO VORDER"; + foreach (verse, verses) { + qDebug() << verse; + lyrics.append(verse); + } + qDebug() << lyrics; + return lyrics; + } // this function appends the verse that matches the verse order from the map foreach (const QString &vstr, vorder) { foreach (line, rawLyrics) { From f1378cc1ff2b56086bc3f2c5ccf3ff8f841a6cea Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 11 Apr 2022 14:04:03 -0500 Subject: [PATCH 16/41] making future proof refactor of image and video get system --- TODO.org | 21 ++++++++++++++------ src/imagesqlmodel.cpp | 33 ++++++++++++++++++++++--------- src/imagesqlmodel.h | 2 +- src/qml/presenter/ImageEditor.qml | 18 +++-------------- src/qml/presenter/Library.qml | 2 +- src/qml/presenter/VideoEditor.qml | 6 +++--- src/videosqlmodel.cpp | 32 ++++++++++++++++++++++-------- src/videosqlmodel.h | 2 +- 8 files changed, 72 insertions(+), 44 deletions(-) diff --git a/TODO.org b/TODO.org index 9854d71..262bb65 100644 --- a/TODO.org +++ b/TODO.org @@ -4,8 +4,8 @@ :END: * Inbox -** TODO images and videos need a better get system -[[file:~/dev/church-presenter/src/videosqlmodel.cpp::QVariantList VideoSqlModel::getVideo(const int &row) {]] +** TODO Check for edge cases in inputing wrong vorder and lyrics +[[file:~/dev/church-presenter/TODO.org::*Fix broken append when importing River song][Fix broken append when importing River song]] ** TODO Images stored in sql need to have aspect saved and applied dynamically here [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::fillMode: Image.PreserveAspectCrop]] @@ -13,9 +13,13 @@ ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] -** TODO Fix possible bug in arrangingItems in draghandler +** TODO Fix possible bug in arrangingItems in draghandler [1/3] [33%] [[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] +- [X] Basic fixed dnd +- [ ] Allow for a less buggy interaction +- [ ] Need to check for edge cases + ** TODO [#A] Make Presentation Window follow the presenter component [[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]] @@ -30,9 +34,6 @@ ** TODO Find a way to maths the textsize [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] -** TODO Fix broken append when importing River song -[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]] - ** TODO Create a nextslide function to be used after the end of the list of slides [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] @@ -46,6 +47,14 @@ The second option is the best, but requires a lot more work. I have the first already working so I'll come back to this once I have more of an idea of how to do it. +** DONE images and videos need a better get system +[[file:~/dev/church-presenter/src/videosqlmodel.cpp::QVariantList VideoSqlModel::getVideo(const int &row) {]] + +** DONE Fix broken append when importing River song +[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]] + +This was due to the song not having a vorder. Need to protect from edge cases of the user inputing the formatted text that doesn't fit what's expected in code. + ** DONE Need to make ListModel capable of bringing in a string list [2/2] [100%] - [X] Create a Model - [X] Create a class that we'll make a list of in the model diff --git a/src/imagesqlmodel.cpp b/src/imagesqlmodel.cpp index 727d761..c2f0019 100644 --- a/src/imagesqlmodel.cpp +++ b/src/imagesqlmodel.cpp @@ -157,13 +157,28 @@ void ImageSqlModel::updateFilePath(const int &row, const QUrl &filePath) { emit filePathChanged(); } -QUrl ImageSqlModel::getImage(const int &row) { - qDebug() << "Row we are getting is " << row; - QUrl image; - QSqlRecord rec = record(row); - qDebug() << rec.value("filePath").toUrl(); - // image.append(rec.value("title")); - // image.append(rec.value("filePath")); - image = rec.value("filePath").toUrl(); - return image; +QVariantMap ImageSqlModel::getImage(const int &row) { + // qDebug() << "Row we are getting is " << row; + // QUrl image; + // QSqlRecord rec = record(row); + // qDebug() << rec.value("filePath").toUrl(); + // // image.append(rec.value("title")); + // // image.append(rec.value("filePath")); + // image = rec.value("filePath").toUrl(); + // return image; + + QVariantMap data; + const QModelIndex idx = this->index(row,0); + // qDebug() << idx; + if( !idx.isValid() ) + return data; + const QHash rn = roleNames(); + // qDebug() << rn; + QHashIterator it(rn); + while (it.hasNext()) { + it.next(); + qDebug() << it.key() << ":" << it.value(); + data[it.value()] = idx.data(it.key()); + } + return data; } diff --git a/src/imagesqlmodel.h b/src/imagesqlmodel.h index 461ba8a..8457f86 100644 --- a/src/imagesqlmodel.h +++ b/src/imagesqlmodel.h @@ -31,7 +31,7 @@ public: Q_INVOKABLE void newImage(const QUrl &filePath); Q_INVOKABLE void deleteImage(const int &row); - Q_INVOKABLE QUrl getImage(const int &row); + Q_INVOKABLE QVariantMap getImage(const int &row); QVariant data(const QModelIndex &index, int role) const override; QHash roleNames() const override; diff --git a/src/qml/presenter/ImageEditor.qml b/src/qml/presenter/ImageEditor.qml index 75f501b..81a5e55 100644 --- a/src/qml/presenter/ImageEditor.qml +++ b/src/qml/presenter/ImageEditor.qml @@ -43,18 +43,6 @@ Item { implicitWidth: 100 hoverEnabled: true } - Controls.ToolButton { - text: "B" - hoverEnabled: true - } - Controls.ToolButton { - text: "I" - hoverEnabled: true - } - Controls.ToolButton { - text: "U" - hoverEnabled: true - } Controls.ToolSeparator {} Item { Layout.fillWidth: true } Controls.ToolSeparator {} @@ -66,7 +54,7 @@ Item { } Controls.ToolButton { id: backgroundButton - text: "Background" + text: "Select Image" icon.name: "fileopen" hoverEnabled: true onClicked: backgroundType.open() @@ -175,7 +163,7 @@ Item { } function changeImage(image) { - root.image = image; - print(image.toString()); + root.image = image.filePath; + print(image.filePath.toString()); } } diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index 4414e26..e7914d3 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -820,7 +820,7 @@ Item { videoLibraryList.currentIndex = videosqlmodel.rowCount(); print(videosqlmodel.getVideo(videoLibraryList.currentIndex)); const video = videosqlmodel.getVideo(videoLibraryList.currentIndex); - showPassiveNotification("newest video: " + video); + showPassiveNotification("newest video: " + video.title); if (!editMode) editMode = true; editSwitch("video", video); diff --git a/src/qml/presenter/VideoEditor.qml b/src/qml/presenter/VideoEditor.qml index 7c15c12..a3623ba 100644 --- a/src/qml/presenter/VideoEditor.qml +++ b/src/qml/presenter/VideoEditor.qml @@ -138,7 +138,7 @@ Item { Layout.rightMargin: 20 placeholderText: "Song Title..." - text: video[0] + text: video.title padding: 10 /* onEditingFinished: updateTitle(text); */ } @@ -170,7 +170,7 @@ Item { Component.onCompleted: mpvLoadingTimer.start() onPositionChanged: videoSlider.value = position onFileLoaded: { - showPassiveNotification(video[0] + " has been loaded"); + showPassiveNotification(video.title + " has been loaded"); videoPreview.pause(); } } @@ -220,7 +220,7 @@ Item { id: mpvLoadingTimer interval: 100 onTriggered: { - videoPreview.loadFile(video[1].toString()); + videoPreview.loadFile(video.filePath.toString()); /* showPassiveNotification(video[0]); */ } } diff --git a/src/videosqlmodel.cpp b/src/videosqlmodel.cpp index a503af1..7d4a99f 100644 --- a/src/videosqlmodel.cpp +++ b/src/videosqlmodel.cpp @@ -156,12 +156,28 @@ void VideoSqlModel::updateFilePath(const int &row, const QUrl &filePath) { emit filePathChanged(); } -QVariantList VideoSqlModel::getVideo(const int &row) { - qDebug() << "Row we are getting is " << row; - QVariantList video; - QSqlRecord rec = record(row); - qDebug() << rec.value("title"); - video.append(rec.value("title")); - video.append(rec.value("filePath")); - return video; +QVariantMap VideoSqlModel::getVideo(const int &row) { + // qDebug() << "Row we are getting is " << row; + // QVariantList video; + // QSqlRecord rec = record(row); + // qDebug() << rec.value("title"); + // video.append(rec.value("title")); + // video.append(rec.value("filePath")); + // return video; + + QVariantMap data; + const QModelIndex idx = this->index(row,0); + // qDebug() << idx; + if( !idx.isValid() ) + return data; + const QHash rn = roleNames(); + // qDebug() << rn; + QHashIterator it(rn); + while (it.hasNext()) { + it.next(); + qDebug() << it.key() << ":" << it.value(); + data[it.value()] = idx.data(it.key()); + } + return data; + } diff --git a/src/videosqlmodel.h b/src/videosqlmodel.h index f36911f..07430d4 100644 --- a/src/videosqlmodel.h +++ b/src/videosqlmodel.h @@ -31,7 +31,7 @@ public: Q_INVOKABLE void newVideo(const QUrl &filePath); Q_INVOKABLE void deleteVideo(const int &row); - Q_INVOKABLE QVariantList getVideo(const int &row); + Q_INVOKABLE QVariantMap getVideo(const int &row); QVariant data(const QModelIndex &index, int role) const override; QHash roleNames() const override; From 85e260c874ee6289f7d9af6f0f43b041e8f1478a Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 11 Apr 2022 17:25:10 -0500 Subject: [PATCH 17/41] image title shows after changing imageGet --- src/imagesqlmodel.h | 2 +- src/qml/presenter/ImageEditor.qml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/imagesqlmodel.h b/src/imagesqlmodel.h index 8457f86..2b9893a 100644 --- a/src/imagesqlmodel.h +++ b/src/imagesqlmodel.h @@ -17,7 +17,7 @@ class ImageSqlModel : public QSqlTableModel QML_ELEMENT public: - ImageSqlModel(QObject *parent = 0); + ImageSqlModel(QObject *parent = 0); int id() const; QString title() const; diff --git a/src/qml/presenter/ImageEditor.qml b/src/qml/presenter/ImageEditor.qml index 81a5e55..530f7b4 100644 --- a/src/qml/presenter/ImageEditor.qml +++ b/src/qml/presenter/ImageEditor.qml @@ -124,7 +124,7 @@ Item { Layout.rightMargin: 20 placeholderText: "Song Title..." - text: "idk" + text: image.title padding: 10 /* onEditingFinished: updateTitle(text); */ } @@ -151,7 +151,7 @@ Item { Layout.preferredHeight: Layout.preferredWidth / 16 * 9 Layout.alignment: Qt.AlignCenter fillMode: Image.PreserveAspectFit - source: image + source: image.filePath } Item { id: botEmpty @@ -163,7 +163,7 @@ Item { } function changeImage(image) { - root.image = image.filePath; + root.image = image; print(image.filePath.toString()); } } From 52961bea5423eed07f9cefc16a7a4036f59802f4 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 11 Apr 2022 17:32:42 -0500 Subject: [PATCH 18/41] adding todo and previousSlide and refactor nextSlide --- TODO.org | 2 ++ src/qml/presenter/MainWindow.qml | 1 + src/qml/presenter/Presentation.qml | 22 +++++++++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/TODO.org b/TODO.org index 262bb65..28594ca 100644 --- a/TODO.org +++ b/TODO.org @@ -4,6 +4,8 @@ :END: * Inbox +** TODO implement previousSlide and previousAction +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] ** TODO Check for edge cases in inputing wrong vorder and lyrics [[file:~/dev/church-presenter/TODO.org::*Fix broken append when importing River song][Fix broken append when importing River song]] diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 9fb41e7..9eebae1 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -183,6 +183,7 @@ Controls.Page { videoEditor.visible = false; videoEditor.stop(); songEditor.visible = false; + imageEditor.visible = false; presentation.visible = true; editMode = false; } diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index e028bcf..ee6926b 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -79,7 +79,7 @@ Item { Layout.alignment: Qt.AlignRight MouseArea { anchors.fill: parent - onPressed: changeSlidePrevious() + onPressed: previousSlideAction() cursorShape: Qt.PointingHandCursor } } @@ -152,6 +152,20 @@ Item { } } + function nextSlide() { + changeServiceItem(currentServiceItem++); + print(slideItem); + } + + function previousSlideAction() { + + } + + function previousSlide() { + changeServiceItem(--currentServiceItem); + print(slideItem); + } + function changeSlide() { if (itemType === "song") { previewSlide.text = root.text[textIndex]; @@ -165,12 +179,6 @@ Item { } } - function nextSlide() { - currentServiceItem++; - changeServiceItem(currentServiceItem); - print(slideItem); - } - function clearText() { previewSlide.text = ""; } From 86a5bbf93c69a69e3d7042797d5c03ac56a61360 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 12 Apr 2022 06:39:32 -0500 Subject: [PATCH 19/41] previous slide actions --- TODO.org | 8 ++++++-- src/qml/presenter/MainWindow.qml | 1 + src/qml/presenter/Presentation.qml | 27 +++++++++++++++++++-------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/TODO.org b/TODO.org index 28594ca..2d0b189 100644 --- a/TODO.org +++ b/TODO.org @@ -4,8 +4,9 @@ :END: * Inbox -** TODO implement previousSlide and previousAction -[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] +** TODO bug in changing slides with the arrows +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function changeSlide() {]] + ** TODO Check for edge cases in inputing wrong vorder and lyrics [[file:~/dev/church-presenter/TODO.org::*Fix broken append when importing River song][Fix broken append when importing River song]] @@ -57,6 +58,9 @@ This was due to the song not having a vorder. Need to protect from edge cases of the user inputing the formatted text that doesn't fit what's expected in code. +** DONE implement previousSlide and previousAction +[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] + ** DONE Need to make ListModel capable of bringing in a string list [2/2] [100%] - [X] Create a Model - [X] Create a class that we'll make a list of in the model diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 9eebae1..cfa5f3a 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -134,6 +134,7 @@ Controls.Page { presentation.loadVideo() } + print(item.text.length) if (item.text.length === 0) { presentation.text = [""]; } diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index ee6926b..c77e24c 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -55,13 +55,6 @@ Item { hoverEnabled: true onClicked: {} } - Controls.ToolButton { - id: backgroundButton - text: "Background" - icon.name: "fileopen" - hoverEnabled: true - onClicked: backgroundType.open() - } } } @@ -127,6 +120,7 @@ Item { } function nextSlideAction() { + print(textIndex); if (itemType === "song") { if (textIndex === 0) { previewSlide.text = root.text[textIndex]; @@ -158,7 +152,24 @@ Item { } function previousSlideAction() { - + print(textIndex); + if (itemType === "song") { + if (textIndex === 0) { + clearText(); + nextSlide(); + } else if (textIndex <= root.text.length) { + previewSlide.text = root.text[textIndex]; + print(root.text[textIndex]); + --textIndex + } + } else if (itemType === "video") { + clearText(); + previousSlide(); + } + else if (itemType === "image") { + clearText(); + previousSlide(); + } } function previousSlide() { From e22ac445c5a6ce80d3d5396a817552a4f4af32ae Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 12 Apr 2022 17:21:50 -0500 Subject: [PATCH 20/41] making songeditor align text --- src/qml/presenter/Presentation.qml | 2 +- src/qml/presenter/Slide.qml | 8 ++-- src/qml/presenter/SlideEditor.qml | 24 +++++++++-- src/qml/presenter/SongEditor.qml | 67 +++++++++++++++++++++++++++--- src/songsqlmodel.cpp | 64 ++++++++++++++++++++-------- src/songsqlmodel.h | 18 +++++--- 6 files changed, 145 insertions(+), 38 deletions(-) diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index c77e24c..8e4c5ac 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -160,7 +160,7 @@ Item { } else if (textIndex <= root.text.length) { previewSlide.text = root.text[textIndex]; print(root.text[textIndex]); - --textIndex + --textIndex; } } else if (itemType === "video") { clearText(); diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index 9208444..f4420f4 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -22,8 +22,8 @@ Item { property string chosenFont: "Quicksand" property var text: "This is demo text" property color backgroundColor - property var horizontalAlignment - property var verticalAlignment + property var horizontalAlignment: Text.AlignHCenter + property var verticalAlignment: Text.AlignVCenter //these properties are for giving video info to parents property int mpvPosition: mpv.position @@ -119,8 +119,8 @@ Item { /* minimumPointSize: 5 */ fontSizeMode: Text.Fit font.family: chosenFont - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + horizontalAlignment: horizontalAlignment + verticalAlignment: verticalAlignment style: Text.Raised anchors.fill: parent clip: true diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index 71754e7..f4d171e 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -13,7 +13,8 @@ Item { property string imageBackground property string videoBackground - property string textAlignment + property var hTextAlignment + property var vTextAlignment Presenter.Slide { id: representation @@ -22,14 +23,17 @@ Item { editMode: true imageSource: imageBackground videoSource: videoBackground + horizontalAlignment: hTextAlignment + verticalAlignment: vTextAlignment preview: true } - Component.onCompleted: updateHAlignment(textAlignment) + Component.onCompleted: { + } function loadVideo() { representation.loadVideo(); - representation.pause(); + representation.pauseVideo(); } function updateHAlignment(alignment) { @@ -48,4 +52,18 @@ Item { break; } } + + function updateVAlignment(alignment) { + switch (alignment) { + case "top" : + representation.verticalAlignment = Text.AlignBottom; + break; + case "center" : + representation.verticalAlignment = Text.AlignVCenter; + break; + case "bottom" : + representation.verticalAlignment = Text.AlignBottom; + break; + } + } } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index a087684..a2fe3de 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -19,6 +19,7 @@ Item { property string songBackground property string songBackgroundType property string songHAlignment + property string songVAlignment GridLayout { id: mainLayout @@ -48,16 +49,18 @@ Item { hoverEnabled: true } Controls.ComboBox { + id: hAlignmentBox model: ["Left", "Center", "Right", "Justify"] implicitWidth: 100 hoverEnabled: true - onCurrentTextChanged: updateTextAlignment(currentText.toLowerCase()); + onCurrentTextChanged: updateHorizontalTextAlignment(currentText.toLowerCase()); } Controls.ComboBox { + id: vAlignmentBox model: ["Top", "Center", "Bottom"] implicitWidth: 100 hoverEnabled: true - onCurrentTextChanged: print(currentText.toLowerCase()); + onCurrentTextChanged: updateVerticalTextAlignment(currentText.toLowerCase()); } Controls.ToolButton { text: "B" @@ -226,7 +229,6 @@ Item { Layout.bottomMargin: 30 Layout.rightMargin: 20 Layout.leftMargin: 20 - textAlignment: songHAlignment } } } @@ -285,7 +287,9 @@ Item { songVorder = song.vorder; songBackground = song.background; songBackgroundType = song.backgroundType; - songHAlignment = song.textAlignment; + songHAlignment = song.horizontalTextAlignment; + songVAlignment = song.verticalTextAlignment; + if (songBackgroundType == "image") { slideEditor.videoBackground = ""; slideEditor.imageBackground = songBackground; @@ -294,6 +298,10 @@ Item { slideEditor.videoBackground = songBackground; slideEditor.loadVideo(); } + + changeSlideHAlignment(songHAlignment); + changeSlideVAlignment(songVAlignment); + print(song); } @@ -328,7 +336,54 @@ Item { print("changed background"); } - function updateTextAlignment(textAlignment) { - songsqlmodel.updateTextAlignment(songIndex, textAlignment) + + function updateHorizontalTextAlignment(textAlignment) { + changeSlideHAlignment(textAlignment); + songsqlmodel.updateHorizontalTextAlignment(songIndex, textAlignment); + } + + function updateVerticalTextAlignment(textAlignment) { + changeSlideVAlignment(textAlignment); + songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment) + } + + function changeSlideHAlignment(alignment) { + print("AHHHHHHHHHHH") + switch (alignment) { + case "left" : + hAlignmentBox.currentIndex = 0; + slideEditor.hTextAlignment = Text.AlignLeft; + break; + case "center" : + hAlignmentBox.currentIndex = 1; + slideEditor.hTextAlignment = Text.AlignHCenter; + break; + case "right" : + hAlignmentBox.currentIndex = 2; + slideEditor.hTextAlignment = Text.AlignRight; + break; + case "justify" : + hAlignmentBox.currentIndex = 3; + slideEditor.hTextAlignment = Text.AlignJustify; + break; + } + } + + function changeSlideVAlignment(alignment) { + print("AHHHHHHHHHHH") + switch (alignment) { + case "top" : + vAlignmentBox.currentIndex = 0; + slideEditor.vTextAlignment = Text.AlignBottom; + break; + case "center" : + vAlignmentBox.currentIndex = 1; + slideEditor.vTextAlignment = Text.AlignVCenter; + break; + case "bottom" : + vAlignmentBox.currentIndex = 2; + slideEditor.vTextAlignment = Text.AlignBottom; + break; + } } } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index cf5167d..f56bb3d 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -34,7 +34,8 @@ static void createTable() " 'vorder' TEXT," " 'background' TEXT," " 'backgroundType' TEXT," - " 'textAlignment' TEXT," + " 'horizontalTextAlignment' TEXT," + " 'verticalTextAlignment' TEXT," " PRIMARY KEY(id))")) { qFatal("Failed to query database: %s", qPrintable(query.lastError().text())); @@ -44,16 +45,16 @@ static void createTable() query.exec( "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType, textAlignment) VALUES ('10,000 Reasons', '10,000 reasons " - "for my heart to sing', 'Matt Redman', '13470183', '', '', '', '', 'center')"); + "background, backgroundType, horizontalTextAlignment, verticalTextAlignment) VALUES ('10,000 Reasons', '10,000 reasons " + "for my heart to sing', 'Matt Redman', '13470183', '', '', '', '', 'center', 'center')"); // qDebug() << query.lastQuery(); query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType, textAlignment) VALUES ('River', 'Im going down to " - "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center')"); + "background, backgroundType, horizontalTextAlignment, verticalTextAlignment) VALUES ('River', 'Im going down to " + "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center', 'center')"); query.exec( "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType, textAlignment) VALUES ('Marvelous Light', 'Into marvelous " - "light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center')"); + "background, backgroundType, horizontalTextAlignment, verticalTextAlignment) VALUES ('Marvelous Light', 'Into marvelous " + "light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center', 'center')"); // qDebug() << query.lastQuery(); query.exec("select * from songs"); @@ -94,7 +95,8 @@ QHash SongSqlModel::roleNames() const names[Qt::UserRole + 6] = "vorder"; names[Qt::UserRole + 7] = "background"; names[Qt::UserRole + 8] = "backgroundType"; - names[Qt::UserRole + 9] = "textAlignment"; + names[Qt::UserRole + 9] = "horizontalTextAlignment"; + names[Qt::UserRole + 10] = "verticalTextAlignment"; return names; } @@ -140,7 +142,7 @@ QVariantMap SongSqlModel::getSong(const int &row) { // song.append(recordData.value("vorder")); // song.append(recordData.value("background")); // song.append(recordData.value("backgroundType")); - // song.append(recordData.value("textAlignment")); + // song.append(recordData.value("horizontalTextAlignment")); // return song; @@ -432,28 +434,54 @@ void SongSqlModel::updateBackgroundType(const int &row, const QString &backgroun emit backgroundTypeChanged(); } -QString SongSqlModel::textAlignment() const { - return m_textAlignment; +QString SongSqlModel::horizontalTextAlignment() const { + return m_horizontalTextAlignment; } -void SongSqlModel::setTextAlignment(const QString &textAlignment) { - if (textAlignment == m_textAlignment) +void SongSqlModel::setHorizontalTextAlignment(const QString &horizontalTextAlignment) { + if (horizontalTextAlignment == m_horizontalTextAlignment) return; - m_textAlignment = textAlignment; + m_horizontalTextAlignment = horizontalTextAlignment; select(); - emit textAlignmentChanged(); + emit horizontalTextAlignmentChanged(); } // This function is for updating the lyrics from outside the delegate -void SongSqlModel::updateTextAlignment(const int &row, const QString &textAlignment) { +void SongSqlModel::updateHorizontalTextAlignment(const int &row, const QString &horizontalTextAlignment) { qDebug() << "Row is " << row; QSqlRecord rowdata = record(row); qDebug() << rowdata; - rowdata.setValue("textAlignment", textAlignment); + rowdata.setValue("horizontalTextAlignment", horizontalTextAlignment); setRecord(row, rowdata); qDebug() << rowdata; submitAll(); - emit textAlignmentChanged(); + emit horizontalTextAlignmentChanged(); +} + +QString SongSqlModel::verticalTextAlignment() const { + return m_verticalTextAlignment; +} + +void SongSqlModel::setVerticalTextAlignment(const QString &verticalTextAlignment) { + if (verticalTextAlignment == m_verticalTextAlignment) + return; + + m_verticalTextAlignment = verticalTextAlignment; + + select(); + emit verticalTextAlignmentChanged(); +} + +// This function is for updating the lyrics from outside the delegate +void SongSqlModel::updateVerticalTextAlignment(const int &row, const QString &verticalTextAlignment) { + qDebug() << "Row is " << row; + QSqlRecord rowdata = record(row); + qDebug() << rowdata; + rowdata.setValue("verticalTextAlignment", verticalTextAlignment); + setRecord(row, rowdata); + qDebug() << rowdata; + submitAll(); + emit verticalTextAlignmentChanged(); } diff --git a/src/songsqlmodel.h b/src/songsqlmodel.h index 7e7d980..6e637ad 100644 --- a/src/songsqlmodel.h +++ b/src/songsqlmodel.h @@ -18,7 +18,8 @@ class SongSqlModel : public QSqlTableModel Q_PROPERTY(QString vorder READ vorder WRITE setVerseOrder NOTIFY vorderChanged) Q_PROPERTY(QString background READ background WRITE setBackground NOTIFY backgroundChanged) Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) - Q_PROPERTY(QString textAlignment READ textAlignment WRITE setTextAlignment NOTIFY textAlignmentChanged) + Q_PROPERTY(QString horizontalTextAlignment READ horizontalTextAlignment WRITE setHorizontalTextAlignment NOTIFY horizontalTextAlignmentChanged) + Q_PROPERTY(QString verticalTextAlignment READ verticalTextAlignment WRITE setVerticalTextAlignment NOTIFY verticalTextAlignmentChanged) QML_ELEMENT public: @@ -33,7 +34,8 @@ public: QString vorder() const; QString background() const; QString backgroundType() const; - QString textAlignment() const; + QString horizontalTextAlignment() const; + QString verticalTextAlignment() const; void setTitle(const QString &title); void setLyrics(const QString &lyrics); @@ -43,7 +45,8 @@ public: void setVerseOrder(const QString &vorder); void setBackground(const QString &background); void setBackgroundType(const QString &backgroundType); - void setTextAlignment(const QString &background); + void setHorizontalTextAlignment(const QString &background); + void setVerticalTextAlignment(const QString &background); Q_INVOKABLE void updateTitle(const int &row, const QString &title); Q_INVOKABLE void updateLyrics(const int &row, const QString &lyrics); @@ -53,7 +56,8 @@ public: Q_INVOKABLE void updateVerseOrder(const int &row, const QString &vorder); Q_INVOKABLE void updateBackground(const int &row, const QString &background); Q_INVOKABLE void updateBackgroundType(const int &row, const QString &backgroundType); - Q_INVOKABLE void updateTextAlignment(const int &row, const QString &textAlignment); + Q_INVOKABLE void updateHorizontalTextAlignment(const int &row, const QString &horizontalTextAlignment); + Q_INVOKABLE void updateVerticalTextAlignment(const int &row, const QString &horizontalTextAlignment); Q_INVOKABLE void newSong(); Q_INVOKABLE void deleteSong(const int &row); @@ -72,7 +76,8 @@ signals: void vorderChanged(); void backgroundChanged(); void backgroundTypeChanged(); - void textAlignmentChanged(); + void horizontalTextAlignmentChanged(); + void verticalTextAlignmentChanged(); private: int m_id; @@ -84,7 +89,8 @@ private: QString m_vorder; QString m_background; QString m_backgroundType; - QString m_textAlignment; + QString m_horizontalTextAlignment; + QString m_verticalTextAlignment; }; #endif //SONGSQLMODEL_H From 2e46f403bedc39f57b4f9d27b4fbf28a6b38c091 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 14 Apr 2022 05:37:26 -0500 Subject: [PATCH 21/41] type --- TODO.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index 2d0b189..9cebf8e 100644 --- a/TODO.org +++ b/TODO.org @@ -19,7 +19,7 @@ ** TODO Fix possible bug in arrangingItems in draghandler [1/3] [33%] [[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] -- [X] Basic fixed dnd +- [X] Basic fixed drag n drop - [ ] Allow for a less buggy interaction - [ ] Need to check for edge cases From 672158a31690ebb3b469a4d6d95b1fa3fa168a3f Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 14 Apr 2022 06:30:12 -0500 Subject: [PATCH 22/41] made the alignment of text persistent and editable --- src/qml/presenter/Slide.qml | 8 ++++---- src/qml/presenter/SlideEditor.qml | 6 +++--- src/qml/presenter/SongEditor.qml | 14 +++++++++----- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index f4420f4..ddc1244 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -22,8 +22,8 @@ Item { property string chosenFont: "Quicksand" property var text: "This is demo text" property color backgroundColor - property var horizontalAlignment: Text.AlignHCenter - property var verticalAlignment: Text.AlignVCenter + property var hTextAlignment: Text.AlignHCenter + property var vTextAlignment: Text.AlignVCenter //these properties are for giving video info to parents property int mpvPosition: mpv.position @@ -119,8 +119,8 @@ Item { /* minimumPointSize: 5 */ fontSizeMode: Text.Fit font.family: chosenFont - horizontalAlignment: horizontalAlignment - verticalAlignment: verticalAlignment + horizontalAlignment: hTextAlignment + verticalAlignment: vTextAlignment style: Text.Raised anchors.fill: parent clip: true diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index f4d171e..b628163 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -23,8 +23,8 @@ Item { editMode: true imageSource: imageBackground videoSource: videoBackground - horizontalAlignment: hTextAlignment - verticalAlignment: vTextAlignment + hTextAlignment: root.hTextAlignment + vTextAlignment: root.vTextAlignment preview: true } @@ -56,7 +56,7 @@ Item { function updateVAlignment(alignment) { switch (alignment) { case "top" : - representation.verticalAlignment = Text.AlignBottom; + representation.verticalAlignment = Text.AlignTop; break; case "center" : representation.verticalAlignment = Text.AlignVCenter; diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index a2fe3de..6fb6b1c 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -53,14 +53,14 @@ Item { model: ["Left", "Center", "Right", "Justify"] implicitWidth: 100 hoverEnabled: true - onCurrentTextChanged: updateHorizontalTextAlignment(currentText.toLowerCase()); + onActivated: updateHorizontalTextAlignment(currentText.toLowerCase()); } Controls.ComboBox { id: vAlignmentBox model: ["Top", "Center", "Bottom"] implicitWidth: 100 hoverEnabled: true - onCurrentTextChanged: updateVerticalTextAlignment(currentText.toLowerCase()); + onActivated: updateVerticalTextAlignment(currentText.toLowerCase()); } Controls.ToolButton { text: "B" @@ -290,6 +290,8 @@ Item { songHAlignment = song.horizontalTextAlignment; songVAlignment = song.verticalTextAlignment; + alignmentSetTimer.restart(); + if (songBackgroundType == "image") { slideEditor.videoBackground = ""; slideEditor.imageBackground = songBackground; @@ -338,17 +340,20 @@ Item { function updateHorizontalTextAlignment(textAlignment) { + if (alignmentSetTimer.running) + return; changeSlideHAlignment(textAlignment); songsqlmodel.updateHorizontalTextAlignment(songIndex, textAlignment); } function updateVerticalTextAlignment(textAlignment) { + if (alignmentSetTimer.running) + return; changeSlideVAlignment(textAlignment); songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment) } function changeSlideHAlignment(alignment) { - print("AHHHHHHHHHHH") switch (alignment) { case "left" : hAlignmentBox.currentIndex = 0; @@ -370,11 +375,10 @@ Item { } function changeSlideVAlignment(alignment) { - print("AHHHHHHHHHHH") switch (alignment) { case "top" : vAlignmentBox.currentIndex = 0; - slideEditor.vTextAlignment = Text.AlignBottom; + slideEditor.vTextAlignment = Text.AlignTop; break; case "center" : vAlignmentBox.currentIndex = 1; From 2979b40f5a3ae3607c78f365fe2c4a6b5d0fc1b4 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 18 Apr 2022 13:51:19 -0500 Subject: [PATCH 23/41] update todo --- TODO.org | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TODO.org b/TODO.org index 9cebf8e..9ddd44a 100644 --- a/TODO.org +++ b/TODO.org @@ -4,9 +4,21 @@ :END: * Inbox +** TODO Make toolbar functional for songeditor [1/4] [25%] +[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] + +- [X] alignment +- [ ] font +- [ ] fontsize +- [ ] effects? + ** TODO bug in changing slides with the arrows [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function changeSlide() {]] +slides are inconsistent in changing from one slide to the next or previous. Both functions need looked at. + +Maybe my best solution would be to architect a model or class for both the presentation controller and the presentation window to follow and do all the heavy lifting in there. + ** TODO Check for edge cases in inputing wrong vorder and lyrics [[file:~/dev/church-presenter/TODO.org::*Fix broken append when importing River song][Fix broken append when importing River song]] @@ -26,11 +38,6 @@ ** TODO [#A] Make Presentation Window follow the presenter component [[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]] -** TODO Make toolbar functional for songeditor -[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] - -- [ ] Will likely need to modify the model to persist the effects stored to the songs. Alignment is done, need vertical alignment, font, and effects - ** TODO Finish toolbar in presentation display [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] From 5db946ef53dbddb49ddc846a18a4d2cae753f7cd Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 22 Apr 2022 11:28:50 -0500 Subject: [PATCH 24/41] some changes to songs including attributes --- TODO.org | 6 +-- src/qml/presenter/SongEditor.qml | 43 ++++++--------------- src/songsqlmodel.cpp | 66 +++++++++++++++++++++++++++++--- src/songsqlmodel.h | 16 +++++++- 4 files changed, 88 insertions(+), 43 deletions(-) diff --git a/TODO.org b/TODO.org index 9ddd44a..3240ae0 100644 --- a/TODO.org +++ b/TODO.org @@ -4,12 +4,12 @@ :END: * Inbox -** TODO Make toolbar functional for songeditor [1/4] [25%] +** TODO Make toolbar functional for songeditor [3/4] [75%] [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] - [X] alignment -- [ ] font -- [ ] fontsize +- [X] font +- [X] fontsize - [ ] effects? ** TODO bug in changing slides with the arrows diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 6fb6b1c..9f10c60 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -10,16 +10,7 @@ Item { id: root property int songIndex - property string songTitle - property string songLyrics - property string songAuthor - property string songCcli - property string songAudio - property string songVorder - property string songBackground - property string songBackgroundType - property string songHAlignment - property string songVAlignment + property var song GridLayout { id: mainLayout @@ -40,7 +31,7 @@ Item { implicitWidth: 300 editable: true hoverEnabled: true - /* onCurrentTextChanged: showPassiveNotification(currentText) */ + onCurrentTextChanged: showPassiveNotification(currentText) } Controls.SpinBox { editable: true @@ -158,7 +149,7 @@ Item { Layout.rightMargin: 20 placeholderText: "Song Title..." - text: songTitle + text: song.title padding: 10 onEditingFinished: updateTitle(text); } @@ -171,7 +162,7 @@ Item { Layout.rightMargin: 20 placeholderText: "verse order..." - text: songVorder + text: song.vorder padding: 10 onEditingFinished: updateVerseOrder(text); } @@ -191,7 +182,7 @@ Item { width: parent.width placeholderText: "Put lyrics here..." persistentSelection: true - text: songLyrics + text: song.lyrics textFormat: TextEdit.PlainText padding: 10 onEditingFinished: { @@ -210,7 +201,7 @@ Item { Layout.rightMargin: 20 placeholderText: "Author..." - text: songAuthor + text: song.author padding: 10 onEditingFinished: updateAuthor(text) } @@ -277,32 +268,20 @@ Item { } function changeSong(index) { - const song = songsqlmodel.getSong(index); + song = songsqlmodel.getSong(index); songIndex = index; - songTitle = song.title; - songLyrics = song.lyrics; - songAuthor = song.author; - songCcli = song.ccli; - songAudio = song.audio; - songVorder = song.vorder; - songBackground = song.background; - songBackgroundType = song.backgroundType; - songHAlignment = song.horizontalTextAlignment; - songVAlignment = song.verticalTextAlignment; - - alignmentSetTimer.restart(); if (songBackgroundType == "image") { slideEditor.videoBackground = ""; - slideEditor.imageBackground = songBackground; + slideEditor.imageBackground = song.background; } else { slideEditor.imageBackground = ""; - slideEditor.videoBackground = songBackground; + slideEditor.videoBackground = song.background; slideEditor.loadVideo(); } - changeSlideHAlignment(songHAlignment); - changeSlideVAlignment(songVAlignment); + changeSlideHAlignment(song.horizontalTextAlignment); + changeSlideVAlignment(song.verticalTextAlignment); print(song); } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index f56bb3d..8717965 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -36,6 +36,8 @@ static void createTable() " 'backgroundType' TEXT," " 'horizontalTextAlignment' TEXT," " 'verticalTextAlignment' TEXT," + " 'font' TEXT," + " 'fontSize' INTEGER," " PRIMARY KEY(id))")) { qFatal("Failed to query database: %s", qPrintable(query.lastError().text())); @@ -45,16 +47,16 @@ static void createTable() query.exec( "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType, horizontalTextAlignment, verticalTextAlignment) VALUES ('10,000 Reasons', '10,000 reasons " - "for my heart to sing', 'Matt Redman', '13470183', '', '', '', '', 'center', 'center')"); + "background, backgroundType, horizontalTextAlignment, verticalTextAlignment, font, fontSize) VALUES ('10,000 Reasons', '10,000 reasons " + "for my heart to sing', 'Matt Redman', '13470183', '', '', '', '', 'center', 'center', '', '')"); // qDebug() << query.lastQuery(); query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType, horizontalTextAlignment, verticalTextAlignment) VALUES ('River', 'Im going down to " - "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center', 'center')"); + "background, backgroundType, horizontalTextAlignment, verticalTextAlignment, font, fontSize) VALUES ('River', 'Im going down to " + "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center', 'center', '', '')"); query.exec( "INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, " - "background, backgroundType, horizontalTextAlignment, verticalTextAlignment) VALUES ('Marvelous Light', 'Into marvelous " - "light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center', 'center')"); + "background, backgroundType, horizontalTextAlignment, verticalTextAlignment, font, fontSize) VALUES ('Marvelous Light', 'Into marvelous " + "light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center', 'center', '', '')"); // qDebug() << query.lastQuery(); query.exec("select * from songs"); @@ -485,3 +487,55 @@ void SongSqlModel::updateVerticalTextAlignment(const int &row, const QString &ve submitAll(); emit verticalTextAlignmentChanged(); } + +QString SongSqlModel::font() const { + return m_font; +} + +void SongSqlModel::setFont(const QString &font) { + if (font == m_font) + return; + + m_font = font; + + select(); + emit fontChanged(); +} + +// This function is for updating the lyrics from outside the delegate +void SongSqlModel::updateFont(const int &row, const QString &font) { + qDebug() << "Row is " << row; + QSqlRecord rowdata = record(row); + qDebug() << rowdata; + rowdata.setValue("font", font); + setRecord(row, rowdata); + qDebug() << rowdata; + submitAll(); + emit fontChanged(); +} + +int SongSqlModel::fontSize() const { + return m_fontSize; +} + +void SongSqlModel::setFontSize(const QString &fontSize) { + if (fontSize == m_fontSize) + return; + + m_fontSize = fontSize; + + select(); + emit fontSizeChanged(); +} + +// This function is for updating the lyrics from outside the delegate +void SongSqlModel::updateFontSize(const int &row, const QString &fontSize) { + qDebug() << "Row is " << row; + QSqlRecord rowdata = record(row); + qDebug() << rowdata; + rowdata.setValue("fontSize", fontSize); + setRecord(row, rowdata); + qDebug() << rowdata; + submitAll(); + emit fontSizeChanged(); +} diff --git a/src/songsqlmodel.h b/src/songsqlmodel.h index 6e637ad..1d2b60f 100644 --- a/src/songsqlmodel.h +++ b/src/songsqlmodel.h @@ -20,6 +20,8 @@ class SongSqlModel : public QSqlTableModel Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) Q_PROPERTY(QString horizontalTextAlignment READ horizontalTextAlignment WRITE setHorizontalTextAlignment NOTIFY horizontalTextAlignmentChanged) Q_PROPERTY(QString verticalTextAlignment READ verticalTextAlignment WRITE setVerticalTextAlignment NOTIFY verticalTextAlignmentChanged) + Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged) + Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) QML_ELEMENT public: @@ -36,6 +38,8 @@ public: QString backgroundType() const; QString horizontalTextAlignment() const; QString verticalTextAlignment() const; + QString font() const; + int fontSize() const; void setTitle(const QString &title); void setLyrics(const QString &lyrics); @@ -45,8 +49,10 @@ public: void setVerseOrder(const QString &vorder); void setBackground(const QString &background); void setBackgroundType(const QString &backgroundType); - void setHorizontalTextAlignment(const QString &background); - void setVerticalTextAlignment(const QString &background); + void setHorizontalTextAlignment(const QString &horizontalTextAlignment); + void setVerticalTextAlignment(const QString &verticalTextAlignment); + void setFont(const QString &font); + void setFontSize(const int &fontSize); Q_INVOKABLE void updateTitle(const int &row, const QString &title); Q_INVOKABLE void updateLyrics(const int &row, const QString &lyrics); @@ -58,6 +64,8 @@ public: Q_INVOKABLE void updateBackgroundType(const int &row, const QString &backgroundType); Q_INVOKABLE void updateHorizontalTextAlignment(const int &row, const QString &horizontalTextAlignment); Q_INVOKABLE void updateVerticalTextAlignment(const int &row, const QString &horizontalTextAlignment); + Q_INVOKABLE void updateFont(const int &row, const QString &font); + Q_INVOKABLE void updateFontSize(const int &row, const int &fontSize); Q_INVOKABLE void newSong(); Q_INVOKABLE void deleteSong(const int &row); @@ -78,6 +86,8 @@ signals: void backgroundTypeChanged(); void horizontalTextAlignmentChanged(); void verticalTextAlignmentChanged(); + void fontChanged(); + void fontSizeChanged(); private: int m_id; @@ -91,6 +101,8 @@ private: QString m_backgroundType; QString m_horizontalTextAlignment; QString m_verticalTextAlignment; + QString m_font; + int m_fontSize; }; #endif //SONGSQLMODEL_H From 13a592be51dd3aa09dc7830e8bf4d4d4c6f33994 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 22 Apr 2022 14:29:11 -0500 Subject: [PATCH 25/41] fixing bug in type --- src/songsqlmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index 8717965..9408d8b 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -518,7 +518,7 @@ int SongSqlModel::fontSize() const { return m_fontSize; } -void SongSqlModel::setFontSize(const QString &fontSize) { +void SongSqlModel::setFontSize(const int &fontSize) { if (fontSize == m_fontSize) return; @@ -529,7 +529,7 @@ void SongSqlModel::setFontSize(const QString &fontSize) { } // This function is for updating the lyrics from outside the delegate -void SongSqlModel::updateFontSize(const int &row, const QString &fontSize) { +void SongSqlModel::updateFontSize(const int &row, const int &fontSize) { qDebug() << "Row is " << row; QSqlRecord rowdata = record(row); qDebug() << rowdata; From 8acf57fc2b5a12b1e07f9c8d026f4c5f5adaef99 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 22 Apr 2022 15:31:49 -0500 Subject: [PATCH 26/41] fixing bugs in setting song attributes --- src/qml/presenter/SongEditor.qml | 13 ++++++------- src/songsqlmodel.cpp | 23 +++-------------------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 9f10c60..b917c49 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -10,7 +10,7 @@ Item { id: root property int songIndex - property var song + property var song GridLayout { id: mainLayout @@ -268,10 +268,13 @@ Item { } function changeSong(index) { - song = songsqlmodel.getSong(index); + const s = songsqlmodel.getSong(index); + print(s.font); + print(s.title); + song = s; songIndex = index; - if (songBackgroundType == "image") { + if (song.backgroundType == "image") { slideEditor.videoBackground = ""; slideEditor.imageBackground = song.background; } else { @@ -319,15 +322,11 @@ Item { function updateHorizontalTextAlignment(textAlignment) { - if (alignmentSetTimer.running) - return; changeSlideHAlignment(textAlignment); songsqlmodel.updateHorizontalTextAlignment(songIndex, textAlignment); } function updateVerticalTextAlignment(textAlignment) { - if (alignmentSetTimer.running) - return; changeSlideVAlignment(textAlignment); songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment) } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index 9408d8b..db4651f 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -128,26 +128,9 @@ void SongSqlModel::deleteSong(const int &row) { } QVariantMap SongSqlModel::getSong(const int &row) { - // QSqlRecord recordData = record(row); - // if (recordData.isEmpty()) { - // qDebug() << "this is not a song"; - // QVariantList empty; - // return empty; - // } - - // QVariantList song; - // song.append(recordData.value("title")); - // song.append(recordData.value("lyrics")); - // song.append(recordData.value("author")); - // song.append(recordData.value("ccli")); - // song.append(recordData.value("audio")); - // song.append(recordData.value("vorder")); - // song.append(recordData.value("background")); - // song.append(recordData.value("backgroundType")); - // song.append(recordData.value("horizontalTextAlignment")); - - // return song; - + // this whole function returns all data in the song + // regardless of it's length. When new things are added + // it will still work without refactoring. QVariantMap data; const QModelIndex idx = this->index(row,0); // qDebug() << idx; From bc6f6b060646cf476d4179fa38deffe67c05f63b Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 22 Apr 2022 15:46:11 -0500 Subject: [PATCH 27/41] adding ids and changing email in readme --- README.org | 6 +++--- src/qml/presenter/SongEditor.qml | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 7af305b..ba7a4fc 100644 --- a/README.org +++ b/README.org @@ -7,12 +7,12 @@ This is an attempt at building a church presentation application in Qt/QML. QML ** Features (planned are in parentheses) - Presents songs lyrics with image and video backgrounds - Use MPV as a rendering system for videos +- Simple song creation with a powerful text parser - Almost fully finished - (Present Slides) - (Custom slide builder) -- (Simple song creation with a powerful text parser) ** MPV -You will need MPV installed in order to use this. All videos run through it. This, however, enables us to make videos work very well and with a lot of control and since it uses ffmpeg underneath, nearly any codec regardless of underlying system. This prevents the need for the user to go and install other codecs to work with Windows or MacOS. It also means a much easier control system and the potential to stream web content as well. +You will need MPV installed in order to use this. All videos run through it. This, however, enables us to make videos work very well and with a lot of control and since it uses ffmpeg underneath, nearly any codec regardless of underlying system. This prevents the need for the user to install other codecs to work with Windows or MacOS. It also means a much easier control system and the potential to stream web content as well without downloading first. * Build and Run First get the source code @@ -33,4 +33,4 @@ Then run. #+END_SRC * Contact Me -If, for whatever reason, you need to contact me and get something ironed out, please do so at [[mailto:chris@tfcconnection.org][chris@tfcconnection.org]] +If, for whatever reason, you need to contact me and get something ironed out, please do so at [[mailto:chris@tfcconnection.org][chris@cochrun.xyz]] diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index b917c49..78ab926 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -27,13 +27,16 @@ Item { anchors.fill: parent Controls.ComboBox { + id: fontBox model: Qt.fontFamilies() implicitWidth: 300 editable: true hoverEnabled: true + flat: true onCurrentTextChanged: showPassiveNotification(currentText) } Controls.SpinBox { + id: fontSizeBox editable: true from: 5 to: 72 @@ -44,6 +47,7 @@ Item { model: ["Left", "Center", "Right", "Justify"] implicitWidth: 100 hoverEnabled: true + flat: true onActivated: updateHorizontalTextAlignment(currentText.toLowerCase()); } Controls.ComboBox { @@ -51,6 +55,7 @@ Item { model: ["Top", "Center", "Bottom"] implicitWidth: 100 hoverEnabled: true + flat: true onActivated: updateVerticalTextAlignment(currentText.toLowerCase()); } Controls.ToolButton { From eaa32c8b2beb4254252b3fbefb6f6d1f1d5df8fe Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 22 Apr 2022 16:42:07 -0500 Subject: [PATCH 28/41] implemented font and fontsize in toolbar of songeditor --- TODO.org | 7 +++++-- src/qml/presenter/SlideEditor.qml | 5 ++++- src/qml/presenter/SongEditor.qml | 29 ++++++++++++++++++++++++++++- src/songsqlmodel.cpp | 2 ++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/TODO.org b/TODO.org index 3240ae0..077b434 100644 --- a/TODO.org +++ b/TODO.org @@ -8,9 +8,12 @@ [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] - [X] alignment -- [X] font -- [X] fontsize +- [X] font - Need to finish the UI portion of it +- [X] fontsize - Need to finish the UI portion of it - [ ] effects? + For effects, I'm not 100% sure how to do this in an easy to build out way. Should I just do them the same as the other attributes or have effects be individually stored? Which effects to use? + + I'm thinking shadows for sure for readability on slides. Also, maybe I should have an effect of like glow? But maybe I'll come back to this after more of the core system is finished. ** TODO bug in changing slides with the arrows [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function changeSlide() {]] diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index b628163..ec17628 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -15,16 +15,19 @@ Item { property string videoBackground property var hTextAlignment property var vTextAlignment + property string font + property real fontSize Presenter.Slide { id: representation anchors.fill: parent - textSize: width / 15 editMode: true imageSource: imageBackground videoSource: videoBackground hTextAlignment: root.hTextAlignment vTextAlignment: root.vTextAlignment + chosenFont: font + textSize: fontSize preview: true } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 78ab926..971054b 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -33,7 +33,7 @@ Item { editable: true hoverEnabled: true flat: true - onCurrentTextChanged: showPassiveNotification(currentText) + onActivated: updateFont(currentText) } Controls.SpinBox { id: fontSizeBox @@ -41,6 +41,7 @@ Item { from: 5 to: 72 hoverEnabled: true + onValueModified: updateFontSize(value) } Controls.ComboBox { id: hAlignmentBox @@ -290,6 +291,8 @@ Item { changeSlideHAlignment(song.horizontalTextAlignment); changeSlideVAlignment(song.verticalTextAlignment); + changeSlideFont(song.font, true); + changeSlideFontSize(song.fontSize, true) print(song); } @@ -336,6 +339,16 @@ Item { songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment) } + function updateFont(font) { + changeSlideFont(font, false); + songsqlmodel.updateFont(songIndex, font); + } + + function updateFontSize(fontSize) { + changeSlideFontSize(fontSize, false); + songsqlmodel.updateFontSize(songIndex, fontSize); + } + function changeSlideHAlignment(alignment) { switch (alignment) { case "left" : @@ -373,4 +386,18 @@ Item { break; } } + + function changeSlideFont(font, updateBox) { + const fontIndex = fontBox.find(font); + print(fontIndex); + if (updateBox) + fontBox.currentIndex = fontIndex; + slideEditor.font = font; + } + + function changeSlideFontSize(fontSize, updateBox) { + if (updateBox) + fontSizeBox.value = fontSize; + slideEditor.fontSize = fontSize; + } } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index db4651f..fcf1723 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -99,6 +99,8 @@ QHash SongSqlModel::roleNames() const names[Qt::UserRole + 8] = "backgroundType"; names[Qt::UserRole + 9] = "horizontalTextAlignment"; names[Qt::UserRole + 10] = "verticalTextAlignment"; + names[Qt::UserRole + 11] = "font"; + names[Qt::UserRole + 12] = "fontSize"; return names; } From ceefbebe237bdbe7677529ed34d89b2d176d1351 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sat, 23 Apr 2022 06:18:25 -0500 Subject: [PATCH 29/41] reorganizing --- src/qml/presenter/SongEditor.qml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 971054b..271cd0b 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -275,8 +275,6 @@ Item { function changeSong(index) { const s = songsqlmodel.getSong(index); - print(s.font); - print(s.title); song = s; songIndex = index; @@ -293,8 +291,7 @@ Item { changeSlideVAlignment(song.verticalTextAlignment); changeSlideFont(song.font, true); changeSlideFontSize(song.fontSize, true) - - print(song); + print(s.title); } function updateLyrics(lyrics) { @@ -389,7 +386,6 @@ Item { function changeSlideFont(font, updateBox) { const fontIndex = fontBox.find(font); - print(fontIndex); if (updateBox) fontBox.currentIndex = fontIndex; slideEditor.font = font; From 39fc19dff2ebdad52f443462ac26221257f236b0 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 26 Apr 2022 13:10:26 -0500 Subject: [PATCH 30/41] making songs have a list of slides visible to assist in editing --- src/mpv/mpvobject.cpp | 10 +++-- src/qml/presenter/Slide.qml | 20 ++++++++-- src/qml/presenter/SlideEditor.qml | 61 ++++++++++++++++++++++--------- src/qml/presenter/SongEditor.qml | 13 ++++++- 4 files changed, 78 insertions(+), 26 deletions(-) diff --git a/src/mpv/mpvobject.cpp b/src/mpv/mpvobject.cpp index 17aa838..39fc683 100644 --- a/src/mpv/mpvobject.cpp +++ b/src/mpv/mpvobject.cpp @@ -87,7 +87,7 @@ MpvRenderer::~MpvRenderer() { if (mpv_gl) mpv_render_context_free(mpv_gl); - mpv_terminate_destroy(obj->mpv); + // mpv_destroy(obj->mpv); } void MpvRenderer::render() { @@ -242,7 +242,7 @@ MpvObject::MpvObject(QQuickItem *parent) MpvObject::~MpvObject() { - + // quit(); } QQuickFramebufferObject::Renderer *MpvObject::createRenderer() const @@ -340,6 +340,10 @@ void MpvObject::handle_mpv_event(mpv_event *event) // See: https://github.com/mpv-player/mpv/blob/master/player/lua.c#L471 switch (event->event_id) { + case MPV_EVENT_SHUTDOWN: { + mpv_destroy(mpv); + break; + } case MPV_EVENT_LOG_MESSAGE: { mpv_event_log_message *logData = (mpv_event_log_message *)event->data; Q_EMIT logMessage( @@ -487,7 +491,7 @@ void MpvObject::pause() { // qDebug() << "pause"; if (isPlaying()) { - // qDebug() << "!isPlaying"; + qDebug() << "!isPlaying"; set_paused(true); } } diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index ddc1244..525bc52 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -34,6 +34,9 @@ Item { property string itemType property bool preview: false + implicitWidth: 1920 + implicitHeight: 1080 + Rectangle { id: basePrColor anchors.fill: parent @@ -59,12 +62,12 @@ Item { id: playArea anchors.fill: parent enabled: editMode - onPressed: mpv.loadFile(videoSource.toString()); + onPressed: mpv.playPause(); cursorShape: preview ? Qt.ArrowCursor : Qt.BlankCursor } Controls.ProgressBar { - anchors.centerIn: parent + anchors.top: parent.bottom visible: editMode width: parent.width - 400 value: mpv.position @@ -74,13 +77,24 @@ Item { Timer { id: mpvLoadingTimer - interval: 2 + interval: 100 onTriggered: { + /* showPassiveNotification("YIPPEEE!") */ mpv.loadFile(videoSource.toString()); + if (preview) { + print("WHY AREN'T YOU PASUING!"); + pauseTimer.restart(); + } blackTimer.restart(); } } + Timer { + id: pauseTimer + interval: 200 + onTriggered: mpv.pause() + } + Timer { id: blackTimer interval: 400 diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index ec17628..842e703 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -1,4 +1,4 @@ -import QtQuick 2.13 +import QtQuick 2.15 import QtQuick.Dialogs 1.0 import QtQuick.Controls 2.15 as Controls import QtQuick.Window 2.13 @@ -18,40 +18,65 @@ Item { property string font property real fontSize - Presenter.Slide { - id: representation + property ListModel songs: songModel + + ListView { + id: slideList anchors.fill: parent - editMode: true - imageSource: imageBackground - videoSource: videoBackground - hTextAlignment: root.hTextAlignment - vTextAlignment: root.vTextAlignment - chosenFont: font - textSize: fontSize - preview: true + model: songModel + clip: true + cacheBuffer: 900 + reuseItems: true + spacing: Kirigami.Units.gridUnit + flickDeceleration: 4000 + /* boundsMovement: Flickable.StopAtBounds */ + synchronousDrag: true + delegate: Presenter.Slide { + id: representation + editMode: true + imageSource: root.imageBackground + videoSource: root.videoBackground + hTextAlignment: root.hTextAlignment + vTextAlignment: root.vTextAlignment + chosenFont: root.font + textSize: root.fontSize + preview: true + text: verse + implicitWidth: slideList.width + implicitHeight: width * 9 / 16 + } + } Component.onCompleted: { } - function loadVideo() { - representation.loadVideo(); - representation.pauseVideo(); + ListModel { + id: songModel } + function appendVerse(verse) { + print(verse); + songModel.append({"verse": verse}) + } + + /* function loadVideo() { */ + /* representation.loadVideo(); */ + /* } */ + function updateHAlignment(alignment) { switch (alignment) { case "left" : - representation.horizontalAlignment = Text.AlignLeft; + root.hTextAlignment = Text.AlignLeft; break; case "center" : - representation.horizontalAlignment = Text.AlignHCenter; + root.hTextAlignment = Text.AlignHCenter; break; case "right" : - representation.horizontalAlignment = Text.AlignRight; + root.hTextAlignment = Text.AlignRight; break; case "justify" : - representation.horizontalAlignment = Text.AlignJustify; + root.hTextAlignment = Text.AlignJustify; break; } } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 271cd0b..cbedf47 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -222,8 +222,9 @@ Item { id: slideEditor Layout.preferredWidth: 500 Layout.fillWidth: true - Layout.preferredHeight: slideEditor.width / 16 * 9 + Layout.fillHeight: true Layout.bottomMargin: 30 + Layout.topMargin: 30 Layout.rightMargin: 20 Layout.leftMargin: 20 } @@ -284,13 +285,14 @@ Item { } else { slideEditor.imageBackground = ""; slideEditor.videoBackground = song.background; - slideEditor.loadVideo(); + /* slideEditor.loadVideo(); */ } changeSlideHAlignment(song.horizontalTextAlignment); changeSlideVAlignment(song.verticalTextAlignment); changeSlideFont(song.font, true); changeSlideFontSize(song.fontSize, true) + changeSlideText(songIndex); print(s.title); } @@ -396,4 +398,11 @@ Item { fontSizeBox.value = fontSize; slideEditor.fontSize = fontSize; } + + function changeSlideText(id) { + const verses = songsqlmodel.getLyricList(id); + print("Here are the verses: " + verses); + slideEditor.songs.clear() + verses.forEach(slideEditor.appendVerse); + } } From 418126884333f1af6412905d52631a970f8d6e7b Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 26 Apr 2022 13:10:55 -0500 Subject: [PATCH 31/41] adding todo for splitting verses on empty line --- src/songsqlmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index fcf1723..fdb1080 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -177,6 +177,8 @@ QStringList SongSqlModel::getLyricList(const int &row) { QString line; QMap verses; + //TODO make sure to split empty line in verse into two slides + // This first function pulls out each verse into our verses map foreach (line, rawLyrics) { qDebug() << line; From e0409f87ffd47283f6a833dd2ab7b68b57420681 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 26 Apr 2022 13:11:09 -0500 Subject: [PATCH 32/41] moving variables for better qml inheritance --- src/qml/presenter/SlideEditor.qml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index 842e703..307099e 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -84,14 +84,15 @@ Item { function updateVAlignment(alignment) { switch (alignment) { case "top" : - representation.verticalAlignment = Text.AlignTop; + root.vTextAlignment = Text.AlignTop; break; case "center" : - representation.verticalAlignment = Text.AlignVCenter; + root.vTextAlignment = Text.AlignVCenter; break; case "bottom" : - representation.verticalAlignment = Text.AlignBottom; + root.vTextAlignment = Text.AlignBottom; break; } } + } From 332c8908a22bf62556298e3ec026b3d8f813ca12 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 26 Apr 2022 13:11:57 -0500 Subject: [PATCH 33/41] updating todos --- TODO.org | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/TODO.org b/TODO.org index 077b434..3a80e3e 100644 --- a/TODO.org +++ b/TODO.org @@ -4,7 +4,10 @@ :END: * Inbox -** TODO Make toolbar functional for songeditor [3/4] [75%] +** TODO Need to make =getLyricList= give back the verses with empty lines as separate slides :core: +[[file:~/dev/church-presenter/src/songsqlmodel.cpp:://TODO make sure to split empty line in verse into two slides]] + +** TODO Make toolbar functional for =songeditor= [3/4] [75%] :core: [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] - [X] alignment @@ -15,44 +18,51 @@ I'm thinking shadows for sure for readability on slides. Also, maybe I should have an effect of like glow? But maybe I'll come back to this after more of the core system is finished. -** TODO bug in changing slides with the arrows +** TODO bug in changing slides with the arrows :core: [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function changeSlide() {]] slides are inconsistent in changing from one slide to the next or previous. Both functions need looked at. Maybe my best solution would be to architect a model or class for both the presentation controller and the presentation window to follow and do all the heavy lifting in there. -** TODO Check for edge cases in inputing wrong vorder and lyrics +** TODO Check for edge cases in inputing wrong vorder and lyrics :core: [[file:~/dev/church-presenter/TODO.org::*Fix broken append when importing River song][Fix broken append when importing River song]] -** TODO Images stored in sql need to have aspect saved and applied dynamically here +** TODO Images stored in sql need to have aspect saved and applied dynamically here :core: [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::fillMode: Image.PreserveAspectCrop]] -** TODO Build out a slide preview system so we can see each slide in the song or image slideshow +** TODO Build out a slide preview system so we can see each slide in the song or image slideshow :ui: [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] -** TODO Fix possible bug in arrangingItems in draghandler [1/3] [33%] +- [X] Initial ListView with text coming from =getLyricList= +- [ ] Depending on this [[*Need to make getLyricList give back the verses with empty lines as separate slides][Need to make getLyricList give back the verses with empty lines as separate slides]] +- [ ] Need to perhaps address the MPV crashing problem for a smoother experience. + Essentially, mpv objects cause a seg fault when we remove them from the qml graph scene and are somehow re-referencing them. Using =reuseItems=, I can prevent the seg fault but then we are storing a lot of things in memory and will definitely cause slowdowns on older hardware. + +** TODO Fix possible bug in arrangingItems in draghandler [1/3] [33%] :bug: [[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] - [X] Basic fixed drag n drop - [ ] Allow for a less buggy interaction - [ ] Need to check for edge cases -** TODO [#A] Make Presentation Window follow the presenter component +** PROJ [#A] Make Presentation Window follow the presenter component :core: [[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]] -** TODO Finish toolbar in presentation display +** TODO Finish toolbar in presentation display :ui: [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] -** TODO Find a way to maths the textsize +** TODO Find a way to maths the textsize :slide: [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] -** TODO Create a nextslide function to be used after the end of the list of slides +This may not be as needed. Apparently the text shrinks to fit it's space. + +** TODO Create a nextslide function to be used after the end of the list of slides :slide: [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]] - [ ] Check to make sure this works in all conditions but I believe it works ok. -** TODO Make sure the video gets changed in a proper manner to not have left over video showing from previous items +** TODO Make sure the video gets changed in a proper manner to not have left over video showing from previous items :video:slide: [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::currentServiceItem++;]] - [X] Build a basic system that changes to black first and then switches to the video From 2e8e5654b087671cfd6c7741df3134b1b0f46a06 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 26 Apr 2022 18:24:15 +0000 Subject: [PATCH 34/41] Add LICENSE --- LICENSE | 661 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 661 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3d264fc --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + church-presenter + Copyright (C) 2022 Chris Cochrun + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. From cac676975b3aa6819edb83d8543c75781dcf9f5c Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 29 Apr 2022 10:53:12 -0500 Subject: [PATCH 35/41] previewer autoplays while editors do not --- src/qml/presenter/Slide.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index 525bc52..bb42adb 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -81,7 +81,7 @@ Item { onTriggered: { /* showPassiveNotification("YIPPEEE!") */ mpv.loadFile(videoSource.toString()); - if (preview) { + if (editMode) { print("WHY AREN'T YOU PASUING!"); pauseTimer.restart(); } From c549861c0b0dd6ec5ef00f1d0fbba62f85c37713 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 5 May 2022 17:24:02 -0500 Subject: [PATCH 36/41] test changes --- src/qml/presenter/MainWindow.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index cfa5f3a..e895f5d 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -11,6 +11,7 @@ Controls.Page { id: mainPage padding: 0 + // properties passed around for the slides property int currentServiceItem property url imageBackground: "" From 1f2943cd6edc8074d848afa830484c6f472c0a52 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 5 May 2022 17:24:30 -0500 Subject: [PATCH 37/41] test changes2 --- src/qml/presenter/MainWindow.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index e895f5d..cfa5f3a 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -11,7 +11,6 @@ Controls.Page { id: mainPage padding: 0 - // properties passed around for the slides property int currentServiceItem property url imageBackground: "" From 4d4ceddf9184325c534918d5cbe3fefaf91342cc Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 5 May 2022 17:25:03 -0500 Subject: [PATCH 38/41] Revert "test changes2" This reverts commit 1f2943cd6edc8074d848afa830484c6f472c0a52. --- src/qml/presenter/MainWindow.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index cfa5f3a..e895f5d 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -11,6 +11,7 @@ Controls.Page { id: mainPage padding: 0 + // properties passed around for the slides property int currentServiceItem property url imageBackground: "" From da34f629afe4347fededb7ab8058efa5bcb2da79 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 5 May 2022 17:25:55 -0500 Subject: [PATCH 39/41] fixy fixy --- src/qml/presenter/MainWindow.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index e895f5d..cfa5f3a 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -11,7 +11,6 @@ Controls.Page { id: mainPage padding: 0 - // properties passed around for the slides property int currentServiceItem property url imageBackground: "" From b45763a62ccb504e8bdee0f8544f78c9bf0cc92e Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 23 May 2022 06:25:21 -0500 Subject: [PATCH 40/41] trying to get nix develop to work --- CMakeLists.txt | 6 +++++- flake.nix | 14 +++++++++++++ shell.nix | 33 ++++++++++++++++++++++++++++++ src/qml/main.qml | 2 +- src/qml/presenter/Actions.qml | 2 +- src/qml/presenter/LeftDock.qml | 2 +- src/qml/presenter/Presentation.qml | 2 +- src/qml/presenter/Slide.qml | 2 +- src/qml/presenter/SlideEditor.qml | 2 +- 9 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/CMakeLists.txt b/CMakeLists.txt index e8a2ecf..ec65f22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include(KDEInstallDirs) include(KDECMakeSettings) @@ -27,6 +27,10 @@ kde_enable_exceptions() find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui QuickControls2 Widgets Sql X11Extras) find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n CoreAddons) +find_package(Libmpv) +set_package_properties(Libmpv PROPERTIES TYPE REQUIRED) + + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d9f2d72 --- /dev/null +++ b/flake.nix @@ -0,0 +1,14 @@ +{ + description = "A Church Presentation Application"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + { + devShell = import ./shell.nix { inherit pkgs; }; + } + ); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..7c7f914 --- /dev/null +++ b/shell.nix @@ -0,0 +1,33 @@ +with import { }; +pkgs.mkShell { + name = "presenter-env"; + + nativeBuildInputs = [ + gcc + gnumake + clang + cmake + extra-cmake-modules + pkg-config + # gccStdenv + # stdenv + ]; + + buildInputs = [ + qt5.qtbase + qt5.qttools + qt5.qtquickcontrols2 + qt5.qtx11extras + qt5.qtmultimedia + libsForQt5.kirigami2 + libsForQt5.ki18n + libsForQt5.kcoreaddons + mpv + # libsForQt5.kconfig + # ffmpeg-full + # yt-dlp + ]; + + shellHook = '' + ''; +} diff --git a/src/qml/main.qml b/src/qml/main.qml index 8d369d2..b98f97c 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -5,7 +5,7 @@ import Qt.labs.platform 1.1 as Labs import QtQuick.Window 2.13 import QtQuick.Layouts 1.2 import QtMultimedia 5.15 -import QtAudioEngine 1.15 +/* import QtAudioEngine 1.15 */ import org.kde.kirigami 2.13 as Kirigami import "./presenter" as Presenter diff --git a/src/qml/presenter/Actions.qml b/src/qml/presenter/Actions.qml index 2552ade..2f99693 100644 --- a/src/qml/presenter/Actions.qml +++ b/src/qml/presenter/Actions.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 2.15 as Controls import QtQuick.Window 2.13 import QtQuick.Layouts 1.2 import QtMultimedia 5.15 -import QtAudioEngine 1.15 +/* import QtAudioEngine 1.15 */ import org.kde.kirigami 2.13 as Kirigami import "./" as Presenter diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index 654d38f..00981fe 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -5,7 +5,7 @@ import QtQuick.Window 2.13 import QtQuick.Layouts 1.2 import QtQml.Models 2.12 import QtMultimedia 5.15 -import QtAudioEngine 1.15 +/* import QtAudioEngine 1.15 */ import org.kde.kirigami 2.13 as Kirigami import "./" as Presenter diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index 8e4c5ac..4bcc1c5 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -3,7 +3,7 @@ import QtQuick.Dialogs 1.0 import QtQuick.Controls 2.15 as Controls import QtQuick.Window 2.13 import QtQuick.Layouts 1.2 -import QtAudioEngine 1.15 +/* import QtAudioEngine 1.15 */ import org.kde.kirigami 2.13 as Kirigami import "./" as Presenter diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index bb42adb..d2fe6dd 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -2,7 +2,7 @@ import QtQuick 2.13 import QtQuick.Controls 2.15 as Controls import QtQuick.Layouts 1.2 /* import QtMultimedia 5.15 */ -import QtAudioEngine 1.15 +/* import QtAudioEngine 1.15 */ import QtGraphicalEffects 1.15 import org.kde.kirigami 2.13 as Kirigami import "./" as Presenter diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index 307099e..277f61f 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 2.15 as Controls import QtQuick.Window 2.13 import QtQuick.Layouts 1.2 import QtMultimedia 5.15 -import QtAudioEngine 1.15 +/* import QtAudioEngine 1.15 */ import org.kde.kirigami 2.13 as Kirigami import "./" as Presenter From 24993f99f1f82e0166e48381466987de7114930d Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 24 May 2022 10:03:47 -0500 Subject: [PATCH 41/41] getting closer to a working nix environment --- flake.lock | 41 +++++++++++++++++++++++++++++++++++++++++ shell.nix | 15 ++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ed9d9eb --- /dev/null +++ b/flake.lock @@ -0,0 +1,41 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1652776076, + "narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1653117584, + "narHash": "sha256-5uUrHeHBIaySBTrRExcCoW8fBBYVSDjDYDU5A6iOl+k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f4dfed73ee886b115a99e5b85fdfbeb683290d83", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/shell.nix b/shell.nix index 7c7f914..ad75edd 100644 --- a/shell.nix +++ b/shell.nix @@ -1,5 +1,6 @@ -with import { }; -pkgs.mkShell { +{ pkgs ? { } }: +with pkgs; +mkShell { name = "presenter-env"; nativeBuildInputs = [ @@ -9,6 +10,7 @@ pkgs.mkShell { cmake extra-cmake-modules pkg-config + libsForQt5.wrapQtAppsHook # gccStdenv # stdenv ]; @@ -27,7 +29,14 @@ pkgs.mkShell { # ffmpeg-full # yt-dlp ]; - + + # This creates the proper qt env so that plugins are found right. shellHook = '' + setQtEnvironment=$(mktemp --suffix .setQtEnvironment.sh) + echo "shellHook: setQtEnvironment = $setQtEnvironment" + makeWrapper "/bin/sh" "$setQtEnvironment" "''${qtWrapperArgs[@]}" + sed "/^exec/d" -i "$setQtEnvironment" + source "$setQtEnvironment" + fish ''; }