From caa2e31d9958113162119b3fef240c2e343eaa0b Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 6 Mar 2023 15:06:18 -0600 Subject: [PATCH] add looping for slides This add looping primarily for videos but I've added in the groundwork for looping through any kind of slide. This obviously will be implemented differently for each type of slide, but this way the groundwork is done already. --- src/cpp/serviceitem.cpp | 17 +++++++++-- src/cpp/serviceitem.h | 7 ++++- src/cpp/serviceitemmodel.cpp | 32 +++++++++++++------- src/cpp/serviceitemmodel.h | 8 +++-- src/cpp/slide.cpp | 17 +++++++++-- src/cpp/slide.h | 7 ++++- src/cpp/slidemodel.cpp | 38 +++++++++++++++--------- src/cpp/slidemodel.h | 7 +++-- src/cpp/slideobject.cpp | 16 ++++++++-- src/cpp/slideobject.h | 2 +- src/main.cpp | 2 +- src/qml/presenter/Presentation.qml | 5 ++-- src/qml/presenter/PresentationWindow.qml | 1 + src/qml/presenter/ServiceList.qml | 18 ++++++----- src/qml/presenter/Slide.qml | 2 ++ 15 files changed, 130 insertions(+), 49 deletions(-) diff --git a/src/cpp/serviceitem.cpp b/src/cpp/serviceitem.cpp index 7169cb9..36b1653 100644 --- a/src/cpp/serviceitem.cpp +++ b/src/cpp/serviceitem.cpp @@ -52,9 +52,9 @@ ServiceItem::ServiceItem(const QString &name, const QString &type, const QString ServiceItem::ServiceItem(const QString &name, const QString &type, const QString &background, const QString &backgroundType, const QStringList &text, const QString &audio, const QString &font, const int &fontSize, - const int &slideNumber, QObject *parent) + const int &slideNumber, const bool &loop, QObject *parent) : QObject(parent),m_name(name),m_type(type),m_background(background), - m_backgroundType(backgroundType),m_text(text),m_audio(audio),m_font(font),m_fontSize(fontSize),m_slideNumber(slideNumber) + m_backgroundType(backgroundType),m_text(text),m_audio(audio),m_font(font),m_fontSize(fontSize),m_slideNumber(slideNumber),m_loop(loop) { } @@ -106,6 +106,10 @@ bool ServiceItem::selected() const { return m_selected; } +bool ServiceItem::loop() const { + return m_loop; +} + void ServiceItem::setName(QString name) { if (m_name == name) @@ -207,3 +211,12 @@ void ServiceItem::setSelected(bool selected) m_selected = selected; emit selectedChanged(m_selected); } + +void ServiceItem::setLoop(bool loop) +{ + if (m_loop == loop) + return; + + m_loop = loop; + emit loopChanged(m_loop); +} diff --git a/src/cpp/serviceitem.h b/src/cpp/serviceitem.h index c37ff82..7849d88 100644 --- a/src/cpp/serviceitem.h +++ b/src/cpp/serviceitem.h @@ -18,6 +18,7 @@ class ServiceItem : public QObject Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged) + Q_PROPERTY(bool loop READ loop WRITE setLoop NOTIFY loopChanged) Q_PROPERTY(int slideNumber READ slideNumber WRITE setSlideNumber NOTIFY slideNumberChanged) // Q_PROPERTY(Thumbnail thumbnail READ thumbnail WRITE setThumbnail NOTIFY thumbnailChanged) @@ -38,7 +39,7 @@ public: ServiceItem(const QString &name, const QString &type, const QString &background, const QString &backgroundType, const QStringList &text, const QString &audio, const QString &font, const int &fontSize, const int &slideNumber, - QObject * parent = nullptr); + const bool &loop, QObject * parent = nullptr); QString name() const; QString type() const; @@ -50,6 +51,7 @@ public: int fontSize() const; bool active() const; bool selected() const; + bool loop() const; int slideNumber() const; // Thumbnail thumbnail() const; @@ -64,6 +66,7 @@ public: void setSlideNumber(int slideNumber); void setActive(bool active); void setSelected(bool selected); + void setLoop(bool loop); signals: void nameChanged(QString name); @@ -77,6 +80,7 @@ signals: void slideNumberChanged(int slideNumber); void activeChanged(bool active); void selectedChanged(bool selected); + void loopChanged(bool loop); private: QString m_name; @@ -90,6 +94,7 @@ private: int m_slideNumber; bool m_active; bool m_selected; + bool m_loop; }; #endif // SERVICEITEM_H diff --git a/src/cpp/serviceitemmodel.cpp b/src/cpp/serviceitemmodel.cpp index e773d8d..b1bc219 100644 --- a/src/cpp/serviceitemmodel.cpp +++ b/src/cpp/serviceitemmodel.cpp @@ -68,6 +68,8 @@ QVariant ServiceItemModel::data(const QModelIndex &index, int role) const { return item->active(); case SelectedRole: return item->selected(); + case LoopRole: + return item->loop(); default: return QVariant(); } @@ -84,7 +86,8 @@ QHash ServiceItemModel::roleNames() const { {FontSizeRole, "fontSize"}, {SlideNumberRole, "slideNumber"}, {ActiveRole, "active"}, - {SelectedRole, "selected"}}; + {SelectedRole, "selected"}, + {LoopRole, "loop"}}; return mapping; } @@ -162,6 +165,12 @@ bool ServiceItemModel::setData(const QModelIndex &index, const QVariant &value, somethingChanged = true; } break; + case LoopRole: + if (item->loop() != value.toBool()) { + item->setLoop(value.toBool()); + somethingChanged = true; + } + break; if (somethingChanged) { emit dataChanged(index, index, QVector() << role); return true; @@ -267,12 +276,12 @@ void ServiceItemModel::addItem(const QString &name, const QString &type, const QString &background, const QString &backgroundType, const QStringList &text, const QString &audio, const QString &font, const int &fontSize, - const int &slideNumber) { + const int &slideNumber, const bool &loop) { qDebug() << "*************************"; qDebug() << "Plain adding item: " << name; qDebug() << "*************************"; ServiceItem *item = new ServiceItem(name, type, background, backgroundType, - text, audio, font, fontSize, slideNumber); + text, audio, font, fontSize, slideNumber, loop); item->setSelected(false); item->setActive(false); addItem(item); @@ -339,12 +348,13 @@ void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,const QString &background, const QString &backgroundType,const QStringList &text, const QString &audio, const QString &font, - const int &fontSize, const int &slideNumber) { + const int &fontSize, const int &slideNumber, + const bool &loop) { qDebug() << "*************************"; qDebug() << "Inserting serviceItem: " << name << " and index is " << index; qDebug() << "*************************"; ServiceItem *item = new ServiceItem(name, type, background, backgroundType, - text, audio, font, fontSize, slideNumber); + text, audio, font, fontSize, slideNumber, loop); item->setSelected(false); item->setActive(false); insertItem(index, item); @@ -490,6 +500,7 @@ QVariantList ServiceItemModel::getItems() { itm["fontSize"] = item->fontSize(); itm["slideNumber"] = item->slideNumber(); itm["selected"] = item->selected(); + itm["loop"] = item->loop(); itm["active"] = item->active(); data.append(itm); } @@ -614,6 +625,7 @@ bool ServiceItemModel::save(QUrl file) { item.insert("slideNumber", m_items[i]->slideNumber()); item.insert("text", m_items[i]->text()); item.insert("type", m_items[i]->type()); + item.insert("loop", m_items[i]->loop()); qDebug() << "AUDIO IS: " << item.value("audio").toString(); QFileInfo audioFile = item.value("audio").toString(); @@ -807,11 +819,11 @@ bool ServiceItemModel::load(QUrl file) { } addItem(item.value("name").toString(), item.value("type").toString(), - realBackground, - item.value("backgroundType").toString(), - item.value("text").toStringList(), realAudio, - item.value("font").toString(), item.value("fontSize").toInt(), - item.value("slideNumber").toInt()); + realBackground, + item.value("backgroundType").toString(), + item.value("text").toStringList(), realAudio, + item.value("font").toString(), item.value("fontSize").toInt(), + item.value("slideNumber").toInt(), item.value("loop").toBool()); } return true; diff --git a/src/cpp/serviceitemmodel.h b/src/cpp/serviceitemmodel.h index 200bd72..6a3bedd 100644 --- a/src/cpp/serviceitemmodel.h +++ b/src/cpp/serviceitemmodel.h @@ -26,7 +26,8 @@ public: FontSizeRole, SlideNumberRole, ActiveRole, - SelectedRole + SelectedRole, + LoopRole }; // Basic functionality: @@ -72,7 +73,7 @@ public: const QString &backgroundType, const QStringList &text, const QString &audio, const QString &font, const int &fontSize, - const int &slideNumber); + const int &slideNumber, const bool &loop); // Q_INVOKABLE void insertItem(const int &index, const QString &name, // const QString &type); // Q_INVOKABLE void insertItem(const int &index, const QString &name, @@ -93,7 +94,8 @@ public: const QString &type, const QString &background, const QString &backgroundType, const QStringList &text, const QString &audio, const QString &font, - const int &fontSize, const int &slideNumber); + const int &fontSize, const int &slideNumber, + const bool &loop); Q_INVOKABLE void removeItem(int index); Q_INVOKABLE void removeItems(); Q_INVOKABLE bool moveRows(int sourceIndex, int destIndex, int count); diff --git a/src/cpp/slide.cpp b/src/cpp/slide.cpp index 7e492a6..f1cd623 100644 --- a/src/cpp/slide.cpp +++ b/src/cpp/slide.cpp @@ -13,12 +13,12 @@ Slide::Slide(const QString &text, const QString &audio, const QString &imageBack const QString &videoBackground, const QString &horizontalTextAlignment, const QString &verticalTextAlignment, const QString &font, const int &fontSize, const int &imageCount, - const QString &type, const int &slideIndex, QObject *parent) + const QString &type, const int &slideIndex, const bool &loop, QObject *parent) : QObject(parent),m_text(text),m_audio(audio),m_imageBackground(imageBackground), m_videoBackground(videoBackground),m_verticalTextAlignment(verticalTextAlignment), m_horizontalTextAlignment(horizontalTextAlignment),m_font(font), m_fontSize(fontSize),m_imageCount(imageCount),m_type(type), - m_slideIndex(slideIndex),m_active(false),m_selected(false) + m_slideIndex(slideIndex),m_active(false),m_selected(false),m_loop(loop) { qDebug() << "Initializing slide with defaults"; } @@ -92,6 +92,10 @@ bool Slide::selected() const { return m_selected; } +bool Slide::loop() const { + return m_loop; +} + void Slide::setText(QString text) { if (m_text == text) @@ -238,3 +242,12 @@ void Slide::setSelected(bool selected) m_selected = selected; emit selectedChanged(m_selected); } + +void Slide::setLoop(bool loop) +{ + if (m_loop == loop) + return; + + m_loop = loop; + emit loopChanged(m_loop); +} diff --git a/src/cpp/slide.h b/src/cpp/slide.h index 8197a13..c5ad299 100644 --- a/src/cpp/slide.h +++ b/src/cpp/slide.h @@ -28,6 +28,7 @@ class Slide : public QObject Q_PROPERTY(int slideIndex READ slideIndex WRITE setSlideIndex NOTIFY slideIndexChanged) Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged) + Q_PROPERTY(bool loop READ loop WRITE setLoop NOTIFY loopChanged) Q_PROPERTY(QString vidThumbnail READ vidThumbnail WRITE setVidThumbnail NOTIFY vidThumbnailChanged) // QML_ELEMENT @@ -38,7 +39,7 @@ public: const QString &imageBackground, const QString &videoBackground, const QString &horizontalTextAlignment, const QString &verticalTextAlignment, const QString &font, const int &fontSize, const int &imageCount, - const QString &type, const int &slideIndex, + const QString &type, const int &slideIndex, const bool &loop, QObject * parent = nullptr); QString text() const; @@ -55,6 +56,7 @@ public: int serviceItemId() const; bool active() const; bool selected() const; + bool loop() const; QString vidThumbnail() const; Q_INVOKABLE void setText(QString text); @@ -71,6 +73,7 @@ public: Q_INVOKABLE void setSlideIndex(int slideIndex); Q_INVOKABLE void setActive(bool active); Q_INVOKABLE void setSelected(bool selected); + Q_INVOKABLE void setLoop(bool loop); Q_INVOKABLE void setVidThumbnail(QString vidThumbnail); signals: @@ -88,6 +91,7 @@ signals: Q_INVOKABLE void slideIndexChanged(int slideIndex); Q_INVOKABLE void activeChanged(bool active); Q_INVOKABLE void selectedChanged(bool selected); + Q_INVOKABLE void loopChanged(bool loop); Q_INVOKABLE void vidThumbnailChanged(QString vidThumbnail); private: @@ -106,6 +110,7 @@ private: int m_slideIndex; bool m_active; bool m_selected; + bool m_loop; QString m_vidThumbnail; }; diff --git a/src/cpp/slidemodel.cpp b/src/cpp/slidemodel.cpp index a8948ba..f81273c 100644 --- a/src/cpp/slidemodel.cpp +++ b/src/cpp/slidemodel.cpp @@ -85,6 +85,8 @@ QVariant SlideModel::data(const QModelIndex &index, int role) const { return item->active(); case SelectedRole: return item->selected(); + case LoopRole: + return item->loop(); case VidThumbnailRole: return item->vidThumbnail(); default: @@ -107,6 +109,7 @@ QHash SlideModel::roleNames() const { {SlideIndexRole, "slideIndex"}, {ActiveRole, "active"}, {SelectedRole, "selected"}, + {LoopRole, "loop"}, {VidThumbnailRole, "vidThumbnail"} }; @@ -198,6 +201,12 @@ bool SlideModel::setData(const QModelIndex &index, const QVariant &value, somethingChanged = true; } break; + case LoopRole: + if (item->loop() != value.toBool()) { + item->setLoop(value.toBool()); + somethingChanged = true; + } + break; case VidThumbnailRole: if (item->vidThumbnail() != value.toString()) { item->setVidThumbnail(value.toString()); @@ -262,11 +271,11 @@ void SlideModel::addItem(const QString &text, const QString &type, const QString &horizontalTextAlignment, const QString &verticalTextAlignment, const int &serviceItemId, const int &slideIndex, - const int &imageCount) { + const int &imageCount, const bool &loop) { Slide *item = new Slide(text, audio, imageBackground, videoBackground, horizontalTextAlignment, verticalTextAlignment, - font, fontSize, imageCount, type, slideIndex ); + font, fontSize, imageCount, type, slideIndex, loop); item->setSelected(false); item->setActive(false); item->setServiceItemId(serviceItemId); @@ -283,10 +292,10 @@ void SlideModel::insertItem(const int &index, const int &fontSize, const QString &horizontalTextAlignment, const QString &verticalTextAlignment, const int &serviceItemId, const int &slideIndex, - const int &imageCount) { + const int &imageCount, const bool &loop) { Slide *item = new Slide(text, audio, imageBackground, videoBackground, horizontalTextAlignment, verticalTextAlignment, font, fontSize, - imageCount, type, slideIndex); + imageCount, type, slideIndex, loop); item->setSelected(false); item->setActive(false); item->setServiceItemId(serviceItemId); @@ -461,6 +470,7 @@ QVariantList SlideModel::getItems() { itm["serviceItemId"] = item->serviceItemId(); itm["selected"] = item->selected(); itm["active"] = item->active(); + itm["loop"] = item->loop(); data.append(itm); } qDebug() << "$$$$$$$$$$$$$$$$$$$$$$$$$$$"; @@ -552,11 +562,11 @@ void SlideModel::addItemFromService(const int &index, const ServiceItem &item) { if (item.backgroundType() == "image") { addItem(item.text()[i], item.type(), item.background(), "", item.audio(), item.font(), item.fontSize(), "center", "center", - index, i, item.text().size()); + index, i, item.text().size(), item.loop()); } else { addItem(item.text()[i], item.type(), "", item.background(), item.audio(), item.font(), item.fontSize(), "center", "center", - index, i, item.text().size()); + index, i, item.text().size(), item.loop()); } } } else if (item.type() == "presentation") { @@ -564,18 +574,18 @@ void SlideModel::addItemFromService(const int &index, const ServiceItem &item) { addItem("", item.type(), item.background(), "", item.audio(), item.font(), item.fontSize(), "center", "center", - index, i, item.slideNumber()); + index, i, item.slideNumber(), item.loop()); } } else if (item.type() == "video") { addItem("", item.type(), "", item.background(), item.audio(), item.font(), item.fontSize(), "center", "center", - index, 0, 1); + index, 0, 1, item.loop()); } else { addItem("", item.type(), item.background(), "", item.audio(), item.font(), item.fontSize(), "center", "center", - index, 0, 1); + index, 0, 1, item.loop()); } } @@ -595,11 +605,11 @@ void SlideModel::insertItemFromService(const int &index, const ServiceItem &item if (item.backgroundType() == "image") { insertItem(slideId + i, item.type(), item.background(), "", item.text()[i], item.audio(), item.font(), item.fontSize(), "center", "center", - index, i, item.text().size()); + index, i, item.text().size(), item.loop()); } else { insertItem(slideId + i, item.type(), "", item.background(), item.text()[i], item.audio(), item.font(), item.fontSize(), "center", "center", - index, i, item.text().size()); + index, i, item.text().size(), item.loop()); } } } else if (item.type() == "presentation") { @@ -607,18 +617,18 @@ void SlideModel::insertItemFromService(const int &index, const ServiceItem &item insertItem(slideId + i, item.type(), item.background(), "", "", item.audio(), item.font(), item.fontSize(), "center", "center", - index, i, item.slideNumber()); + index, i, item.slideNumber(), item.loop()); } } else if (item.type() == "video") { insertItem(slideId, item.type(), "", item.background(), "", item.audio(), item.font(), item.fontSize(), "center", "center", - index, 0, 1); + index, 0, 1, item.loop()); } else { insertItem(slideId, item.type(), item.background(), "", "", item.audio(), item.font(), item.fontSize(), "center", "center", - index, 0, 1); + index, 0, 1, item.loop()); } } diff --git a/src/cpp/slidemodel.h b/src/cpp/slidemodel.h index 70aec9b..5914a81 100644 --- a/src/cpp/slidemodel.h +++ b/src/cpp/slidemodel.h @@ -30,6 +30,7 @@ public: ImageCountRole, ActiveRole, SelectedRole, + LoopRole, VidThumbnailRole }; @@ -61,7 +62,8 @@ public: const QString &verticalTextAlignment, const int &serviceItemId, const int &slideIndex, - const int &imageCount); + const int &imageCount, + const bool &loop); Q_INVOKABLE void insertItem(const int &index, const QString &text, const QString &type, const QString &imageBackground, const QString &videoBackground, @@ -71,7 +73,8 @@ public: const QString &verticalTextAlignment, const int &serviceItemId, const int &slideIndex, - const int &imageCount); + const int &imageCount, + const bool &loop); Q_INVOKABLE void removeItem(int index); Q_INVOKABLE void removeItems(); Q_INVOKABLE bool moveRows(int sourceIndex, int destIndex, int count); diff --git a/src/cpp/slideobject.cpp b/src/cpp/slideobject.cpp index ff83939..5dcd109 100644 --- a/src/cpp/slideobject.cpp +++ b/src/cpp/slideobject.cpp @@ -84,6 +84,10 @@ void SlideObject::changeSlide(QVariantMap item, int index) if (item.value("fontSize").toInt() != fontSize()) setFontSize(item.value("fontSize").toInt()); + if (loop() != item.value("loop").toBool()) { + setLoop(item.value("loop").toBool()); + emit loopChanged(loop()); + } setImageCount(item.value("imageCount").toInt()); setSlideIndex(item.value("slideIndex").toInt()); qDebug() << "THIS IS THE INDEX OF THE SLIDE!"; @@ -108,6 +112,10 @@ bool SlideObject::next(QVariantMap nextItem, SlideModel *slideModel) setFontSize(nextItem.value("fontSize").toInt()); setImageCount(nextItem.value("imageCount").toInt()); setSlideIndex(nextItem.value("slideIndex").toInt()); + if (loop() != nextItem.value("loop").toBool()) { + setLoop(nextItem.value("loop").toBool()); + emit loopChanged(loop()); + } // m_slideSize = serviceItem.value("slideNumber").toInt(); @@ -129,6 +137,10 @@ bool SlideObject::previous(QVariantMap prevItem, SlideModel *slideModel) setFontSize(prevItem.value("fontSize").toInt()); setImageCount(prevItem.value("imageCount").toInt()); setSlideIndex(prevItem.value("slideIndex").toInt()); + if (loop() != prevItem.value("loop").toBool()) { + setLoop(prevItem.value("loop").toBool()); + emit loopChanged(loop()); + } // m_slideSize = serviceItem.value("slideNumber").toInt(); // emit slideSizeChanged(m_slideSize); @@ -173,9 +185,9 @@ void SlideObject::play() emit isPlayingChanged(m_isPlaying); } -void SlideObject::setLoop() +void SlideObject::setLoop(bool loop) { - m_loop = true; + m_loop = loop; emit loopChanged(m_loop); } diff --git a/src/cpp/slideobject.h b/src/cpp/slideobject.h index bc13305..5f81efa 100644 --- a/src/cpp/slideobject.h +++ b/src/cpp/slideobject.h @@ -39,7 +39,7 @@ public: Q_INVOKABLE bool next(QVariantMap nextItem, SlideModel *slideModel); Q_INVOKABLE bool previous(QVariantMap prevItem, SlideModel *slideModel); Q_INVOKABLE bool changeSlideIndex(int index); - Q_INVOKABLE void setLoop(); + Q_INVOKABLE void setLoop(bool loop); signals: Q_INVOKABLE void isPlayingChanged(bool isPlaying); diff --git a/src/main.cpp b/src/main.cpp index a29bbce..12cfe56 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) serviceItemModel.get()->addItem("Black", "image", "qrc:/assets/black.jpg", "image", QStringList(""), - "", "", 0, 1); + "", "", 0, 1, false); } // apparently mpv needs this class set diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index 5b8b1f4..5b429de 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -127,6 +127,7 @@ FocusScope { chosenFont: SlideObject.font text: SlideObject.text pdfIndex: SlideObject.pdfIndex + vidLoop: SlideObject.loop preview: true } @@ -173,8 +174,8 @@ FocusScope { Controls.Switch { id: loopSwitch text: "Loop" - checked: previewSlide.mpvLoop === "inf" ? true : false - onToggled: mainPage.loopVideo() + checked: SlideObject.loop + onToggled: SlideObject.setLoop(!SlideObject.loop) Keys.onLeftPressed: previousSlideAction() Keys.onRightPressed: nextSlideAction() Keys.onUpPressed: previousSlideAction() diff --git a/src/qml/presenter/PresentationWindow.qml b/src/qml/presenter/PresentationWindow.qml index 590f467..d5b6b41 100644 --- a/src/qml/presenter/PresentationWindow.qml +++ b/src/qml/presenter/PresentationWindow.qml @@ -42,6 +42,7 @@ Window { textSize: SlideObject.fontSize pdfIndex: SlideObject.pdfIndex itemType: SlideObject.type + vidLoop: SlideObject.loop } Connections { diff --git a/src/qml/presenter/ServiceList.qml b/src/qml/presenter/ServiceList.qml index 36157d3..d7034a9 100644 --- a/src/qml/presenter/ServiceList.qml +++ b/src/qml/presenter/ServiceList.qml @@ -534,7 +534,7 @@ Item { ServiceItemModel.insertItem(index, image.title, type, image.filePath, "image", "", "", - "", 0, 0); + "", 0, 0, false); return; } case 'video': { @@ -543,7 +543,7 @@ Item { ServiceItemModel.insertItem(index, video.title, type, video.filePath, "video", "", "", - "", 0, 0); + "", 0, 0, video.loop); return; } case 'song': { @@ -557,7 +557,7 @@ Item { type, song.background, song.backgroundType, lyrics, song.audio, song.font, song.fontSize, - lyrics.length); + lyrics.length, true); return; } case 'presentation': { @@ -568,7 +568,7 @@ Item { ServiceItemModel.insertItem(index, pres.title, type, pres.filePath, "image", "", - "", "", 0, pres.pageCount); + "", "", 0, pres.pageCount, false); return; } default: return; @@ -584,7 +584,7 @@ Item { ServiceItemModel.addItem(image.title, type, image.filePath, "image", "", "", - "", 0, 0); + "", 0, 0, false); return; } case 'video': { @@ -593,7 +593,7 @@ Item { ServiceItemModel.addItem(video.title, type, video.filePath, "video", "", "", - "", 0, 0); + "", 0, 0, video.loop); return; } case 'song': { @@ -605,7 +605,8 @@ Item { ServiceItemModel.addItem(song.title, type, song.background, song.backgroundType, lyrics, - song.audio, song.font, song.fontSize, lyrics.length); + song.audio, song.font, song.fontSize, + lyrics.length, true); return; } case 'presentation': { @@ -616,7 +617,8 @@ Item { ServiceItemModel.addItem(pres.title, type, pres.filePath, "image", "", - "", "", 0, pres.pageCount); + "", "", 0, pres.pageCount, + false); return; } default: return; diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index 3adc6dd..0cfc615 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -58,6 +58,8 @@ Item { /* showPassiveNotification(videoSource + " has been loaded"); */ if (itemType == "song") mpv.setProperty("loop", "inf"); + else if (vidLoop) + mpv.setProperty("loop", "inf"); else mpv.setProperty("loop", "no"); /* showPassiveNotification(mpv.getProperty("loop")); */