From 366660dcb2ccb51e39e695623e71d6f7b6d3c486 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 1 Apr 2022 07:32:21 -0500 Subject: [PATCH] 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();