diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index a3a2746..f68aa81 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -222,6 +222,8 @@ Item { dragItemBackgroundType = backgroundType; dragItemBackground = background; dragItemAudio = audio; + dragItemFont = font; + dragItemFontSize = fontSize; draggedLibraryItem = self; } else { songListItem.Drag.drop() diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index e99a7bf..322bf84 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -28,6 +28,8 @@ Controls.Page { property string dragItemAudio: "" property string dragItemBackgroundType: "" property string dragItemBackground: "" + property string dragItemFont: "" + property string dragItemFontSize property bool editing: true @@ -173,6 +175,7 @@ Controls.Page { function editSwitch(item) { if (editMode) { + refocusTimer.repeat = false; switch (editType) { case "song" : presentation.visible = false; @@ -226,6 +229,7 @@ Controls.Page { presentationEditor.visible = false; presentation.visible = true; editMode = false; + refocusTimer.repeat = true; presenting = true; } } diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index b26d070..cf64070 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -91,6 +91,7 @@ Item { imageSource: imagebackground videoSource: vidbackground audioSource: SlideObject.audio + chosenFont: SlideObject.font text: SlideObject.text pdfIndex: SlideObject.pdfIndex preview: true diff --git a/src/qml/presenter/PresentationWindow.qml b/src/qml/presenter/PresentationWindow.qml index e2e5791..97e64d0 100644 --- a/src/qml/presenter/PresentationWindow.qml +++ b/src/qml/presenter/PresentationWindow.qml @@ -38,6 +38,7 @@ Window { videoSource: presentationWindow.visible ? SlideObject.videoBackground : "" audioSource: SlideObject.audio text: SlideObject.text + chosenFont: SlideObject.font pdfIndex: SlideObject.pdfIndex itemType: SlideObject.type } diff --git a/src/qml/presenter/ServiceList.qml b/src/qml/presenter/ServiceList.qml index de498be..729af83 100644 --- a/src/qml/presenter/ServiceList.qml +++ b/src/qml/presenter/ServiceList.qml @@ -39,12 +39,15 @@ ColumnLayout { Layout.fillWidth: true onDropped: (drag) => { print("DROPPED AT END"); + showPassiveNotification(drag.source.title); appendItem(dragItemTitle, dragItemType, dragItemBackground, dragItemBackgroundType, dragItemText, dragItemAudio, + dragItemFont, + dragItemFontSize, dragItemIndex); dropHighlightLine.visible = false; } @@ -123,6 +126,8 @@ ColumnLayout { dragItemBackgroundType, dragItemText, dragItemAudio, + dragItemFont, + dragItemFontSize, dragItemIndex); } else if (drag.keys[0] === "serviceitem") { serviceItemModel.move(serviceItemList.indexDragged, @@ -404,13 +409,15 @@ ColumnLayout { } function addItem(index, name, type, - background, backgroundType, text, audio, itemID) { + background, backgroundType, text, audio, + font, fontSize, itemID) { if (type === "song") { const newtext = songsqlmodel.getLyricList(itemID); print("adding: " + name + " of type " + type); serviceItemModel.insertItem(index, name, type, background, - backgroundType, newtext, audio); + backgroundType, newtext, + audio, font, fontSize); totalServiceItems++; return; } @@ -421,7 +428,8 @@ ColumnLayout { totalServiceItems++; } - function appendItem(name, type, background, backgroundType, text, audio, itemID) { + function appendItem(name, type, background, backgroundType, + text, audio, font, fontSize, itemID) { print("adding: " + name + " of type " + type); let lyrics; if (type === "song") { @@ -430,7 +438,8 @@ ColumnLayout { lyrics = songsqlmodel.getLyricList(itemID); print(lyrics); serviceItemModel.addItem(name, type, background, - backgroundType, lyrics, audio); + backgroundType, lyrics, + audio, font, fontSize); totalServiceItems++; return; }; diff --git a/src/serviceitem.cpp b/src/serviceitem.cpp index 41826b3..a79a6a1 100644 --- a/src/serviceitem.cpp +++ b/src/serviceitem.cpp @@ -38,6 +38,16 @@ 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, + 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) +{ + +} + QString ServiceItem::name() const { return m_name; } @@ -65,6 +75,14 @@ QString ServiceItem::audio() const { return m_audio; } +QString ServiceItem::font() const { + return m_font; +} + +int ServiceItem::fontSize() const { + return m_fontSize; +} + void ServiceItem::setName(QString name) { if (m_name == name) @@ -119,3 +137,21 @@ void ServiceItem::setAudio(QString audio) m_audio = audio; emit audioChanged(m_audio); } + +void ServiceItem::setFont(QString font) +{ + if (m_font == font) + return; + + m_font = font; + emit fontChanged(m_font); +} + +void ServiceItem::setFontSize(int fontSize) +{ + if (m_fontSize == fontSize) + return; + + m_fontSize = fontSize; + emit fontSizeChanged(m_fontSize); +} diff --git a/src/serviceitem.h b/src/serviceitem.h index 307171c..44a9409 100644 --- a/src/serviceitem.h +++ b/src/serviceitem.h @@ -13,6 +13,8 @@ class ServiceItem : public QObject Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) Q_PROPERTY(QStringList text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged) + Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged) + Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) public: explicit ServiceItem(QObject *parent = nullptr); @@ -25,6 +27,9 @@ public: ServiceItem(const QString &name, const QString &type, const QString &background, const QString &backgroundType, const QStringList &text, const QString &audio, QObject * parent = nullptr); + 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, QObject * parent = nullptr); QString name() const; QString type() const; @@ -32,6 +37,8 @@ public: QString backgroundType() const; QStringList text() const; QString audio() const; + QString font() const; + int fontSize() const; void setName(QString name); void setType(QString type); @@ -39,6 +46,8 @@ public: void setBackgroundType(QString backgroundType); void setText(QStringList text); void setAudio(QString audio); + void setFont(QString font); + void setFontSize(int fontSize); signals: void nameChanged(QString name); @@ -47,6 +56,8 @@ signals: void backgroundTypeChanged(QString backgroundType); void textChanged(QStringList text); void audioChanged(QString audio); + void fontChanged(QString font); + void fontSizeChanged(int fontSize); private: QString m_name; @@ -55,6 +66,8 @@ private: QString m_backgroundType; QStringList m_text; QString m_audio; + QString m_font; + int m_fontSize; }; #endif // SERVICEITEM_H diff --git a/src/serviceitemmodel.cpp b/src/serviceitemmodel.cpp index 9e8216d..b509085 100644 --- a/src/serviceitemmodel.cpp +++ b/src/serviceitemmodel.cpp @@ -49,6 +49,10 @@ QVariant ServiceItemModel::data(const QModelIndex &index, int role) const { return item->text(); case AudioRole: return item->audio(); + case FontRole: + return item->font(); + case FontSizeRole: + return item->fontSize(); default: return QVariant(); } @@ -60,7 +64,9 @@ QHash ServiceItemModel::roleNames() const { {BackgroundRole, "background"}, {BackgroundTypeRole, "backgroundType"}, {TextRole, "text"}, - {AudioRole, "audio"}}; + {AudioRole, "audio"}, + {FontRole, "font"}, + {FontSizeRole, "fontSize"}}; return mapping; } @@ -108,6 +114,18 @@ bool ServiceItemModel::setData(const QModelIndex &index, const QVariant &value, somethingChanged = true; } break; + case FontRole: + if (item->font() != value.toString()) { + item->setFont(value.toString()); + somethingChanged = true; + } + break; + case FontSizeRole: + if (item->fontSize() != value.toInt()) { + item->setFontSize(value.toInt()); + somethingChanged = true; + } + break; if (somethingChanged) { emit dataChanged(index, index, QVector() << role); return true; @@ -187,6 +205,18 @@ void ServiceItemModel::addItem(const QString &name, const QString &type, qDebug() << name << type << background; } +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) { + ServiceItem *item = new ServiceItem(name, type, background, backgroundType, + text, audio, font, fontSize); + addItem(item); + qDebug() << "#################################"; + qDebug() << name << type << font << fontSize; + qDebug() << "#################################"; +} + void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type) { ServiceItem *item = new ServiceItem(name, type); insertItem(index, item); @@ -218,6 +248,18 @@ void ServiceItemModel::insertItem(const int &index, const QString &name, qDebug() << name << type << background << text; } +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) { + ServiceItem *item = new ServiceItem(name, type, background, backgroundType, + text, audio, font, fontSize); + insertItem(index, item); + qDebug() << "#################################"; + qDebug() << name << type << font << fontSize; + qDebug() << "#################################"; +} + void ServiceItemModel::removeItem(int index) { beginRemoveRows(QModelIndex(), index, index); m_items.removeAt(index); diff --git a/src/serviceitemmodel.h b/src/serviceitemmodel.h index 5d910c9..067d840 100644 --- a/src/serviceitemmodel.h +++ b/src/serviceitemmodel.h @@ -20,7 +20,9 @@ public: BackgroundRole, BackgroundTypeRole, TextRole, - AudioRole + AudioRole, + FontRole, + FontSizeRole }; // Basic functionality: @@ -56,6 +58,11 @@ public: const QString &background, const QString &backgroundType, const QStringList &text, const QString &audio); + Q_INVOKABLE void 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); Q_INVOKABLE void insertItem(const int &index, const QString &name, const QString &type); Q_INVOKABLE void insertItem(const int &index, const QString &name, @@ -68,6 +75,10 @@ public: const QString &type, const QString &background, const QString &backgroundType, const QStringList &text, const QString &audio); + Q_INVOKABLE void 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); Q_INVOKABLE void removeItem(int index); Q_INVOKABLE bool move(int sourceIndex, int destIndex); Q_INVOKABLE bool moveDown(int index); diff --git a/src/slide.cpp b/src/slide.cpp index 2705460..d92c477 100644 --- a/src/slide.cpp +++ b/src/slide.cpp @@ -1,6 +1,5 @@ #include "slide.h" #include "serviceitemmodel.h" -// #include #include #include @@ -225,6 +224,9 @@ void Slide::changeSlide(QVariantMap item) setImageBackground(""); } + setFont(m_serviceItem.value("font").toString()); + setFontSize(m_serviceItem.value("fontSize").toInt()); + if (type() == "presentation") { qDebug() << "#$#$#$#$ THIS PDF $#$#$#$#"; int pageCount;