adding font and fontSize support
This commit is contained in:
parent
2711bde130
commit
ed632e0733
10 changed files with 128 additions and 7 deletions
|
@ -222,6 +222,8 @@ Item {
|
||||||
dragItemBackgroundType = backgroundType;
|
dragItemBackgroundType = backgroundType;
|
||||||
dragItemBackground = background;
|
dragItemBackground = background;
|
||||||
dragItemAudio = audio;
|
dragItemAudio = audio;
|
||||||
|
dragItemFont = font;
|
||||||
|
dragItemFontSize = fontSize;
|
||||||
draggedLibraryItem = self;
|
draggedLibraryItem = self;
|
||||||
} else {
|
} else {
|
||||||
songListItem.Drag.drop()
|
songListItem.Drag.drop()
|
||||||
|
|
|
@ -28,6 +28,8 @@ Controls.Page {
|
||||||
property string dragItemAudio: ""
|
property string dragItemAudio: ""
|
||||||
property string dragItemBackgroundType: ""
|
property string dragItemBackgroundType: ""
|
||||||
property string dragItemBackground: ""
|
property string dragItemBackground: ""
|
||||||
|
property string dragItemFont: ""
|
||||||
|
property string dragItemFontSize
|
||||||
|
|
||||||
property bool editing: true
|
property bool editing: true
|
||||||
|
|
||||||
|
@ -173,6 +175,7 @@ Controls.Page {
|
||||||
|
|
||||||
function editSwitch(item) {
|
function editSwitch(item) {
|
||||||
if (editMode) {
|
if (editMode) {
|
||||||
|
refocusTimer.repeat = false;
|
||||||
switch (editType) {
|
switch (editType) {
|
||||||
case "song" :
|
case "song" :
|
||||||
presentation.visible = false;
|
presentation.visible = false;
|
||||||
|
@ -226,6 +229,7 @@ Controls.Page {
|
||||||
presentationEditor.visible = false;
|
presentationEditor.visible = false;
|
||||||
presentation.visible = true;
|
presentation.visible = true;
|
||||||
editMode = false;
|
editMode = false;
|
||||||
|
refocusTimer.repeat = true;
|
||||||
presenting = true;
|
presenting = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ Item {
|
||||||
imageSource: imagebackground
|
imageSource: imagebackground
|
||||||
videoSource: vidbackground
|
videoSource: vidbackground
|
||||||
audioSource: SlideObject.audio
|
audioSource: SlideObject.audio
|
||||||
|
chosenFont: SlideObject.font
|
||||||
text: SlideObject.text
|
text: SlideObject.text
|
||||||
pdfIndex: SlideObject.pdfIndex
|
pdfIndex: SlideObject.pdfIndex
|
||||||
preview: true
|
preview: true
|
||||||
|
|
|
@ -38,6 +38,7 @@ Window {
|
||||||
videoSource: presentationWindow.visible ? SlideObject.videoBackground : ""
|
videoSource: presentationWindow.visible ? SlideObject.videoBackground : ""
|
||||||
audioSource: SlideObject.audio
|
audioSource: SlideObject.audio
|
||||||
text: SlideObject.text
|
text: SlideObject.text
|
||||||
|
chosenFont: SlideObject.font
|
||||||
pdfIndex: SlideObject.pdfIndex
|
pdfIndex: SlideObject.pdfIndex
|
||||||
itemType: SlideObject.type
|
itemType: SlideObject.type
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,15 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onDropped: (drag) => {
|
onDropped: (drag) => {
|
||||||
print("DROPPED AT END");
|
print("DROPPED AT END");
|
||||||
|
showPassiveNotification(drag.source.title);
|
||||||
appendItem(dragItemTitle,
|
appendItem(dragItemTitle,
|
||||||
dragItemType,
|
dragItemType,
|
||||||
dragItemBackground,
|
dragItemBackground,
|
||||||
dragItemBackgroundType,
|
dragItemBackgroundType,
|
||||||
dragItemText,
|
dragItemText,
|
||||||
dragItemAudio,
|
dragItemAudio,
|
||||||
|
dragItemFont,
|
||||||
|
dragItemFontSize,
|
||||||
dragItemIndex);
|
dragItemIndex);
|
||||||
dropHighlightLine.visible = false;
|
dropHighlightLine.visible = false;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +126,8 @@ ColumnLayout {
|
||||||
dragItemBackgroundType,
|
dragItemBackgroundType,
|
||||||
dragItemText,
|
dragItemText,
|
||||||
dragItemAudio,
|
dragItemAudio,
|
||||||
|
dragItemFont,
|
||||||
|
dragItemFontSize,
|
||||||
dragItemIndex);
|
dragItemIndex);
|
||||||
} else if (drag.keys[0] === "serviceitem") {
|
} else if (drag.keys[0] === "serviceitem") {
|
||||||
serviceItemModel.move(serviceItemList.indexDragged,
|
serviceItemModel.move(serviceItemList.indexDragged,
|
||||||
|
@ -404,13 +409,15 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addItem(index, name, type,
|
function addItem(index, name, type,
|
||||||
background, backgroundType, text, audio, itemID) {
|
background, backgroundType, text, audio,
|
||||||
|
font, fontSize, itemID) {
|
||||||
if (type === "song") {
|
if (type === "song") {
|
||||||
const newtext = songsqlmodel.getLyricList(itemID);
|
const newtext = songsqlmodel.getLyricList(itemID);
|
||||||
print("adding: " + name + " of type " + type);
|
print("adding: " + name + " of type " + type);
|
||||||
serviceItemModel.insertItem(index, name,
|
serviceItemModel.insertItem(index, name,
|
||||||
type, background,
|
type, background,
|
||||||
backgroundType, newtext, audio);
|
backgroundType, newtext,
|
||||||
|
audio, font, fontSize);
|
||||||
totalServiceItems++;
|
totalServiceItems++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -421,7 +428,8 @@ ColumnLayout {
|
||||||
totalServiceItems++;
|
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);
|
print("adding: " + name + " of type " + type);
|
||||||
let lyrics;
|
let lyrics;
|
||||||
if (type === "song") {
|
if (type === "song") {
|
||||||
|
@ -430,7 +438,8 @@ ColumnLayout {
|
||||||
lyrics = songsqlmodel.getLyricList(itemID);
|
lyrics = songsqlmodel.getLyricList(itemID);
|
||||||
print(lyrics);
|
print(lyrics);
|
||||||
serviceItemModel.addItem(name, type, background,
|
serviceItemModel.addItem(name, type, background,
|
||||||
backgroundType, lyrics, audio);
|
backgroundType, lyrics,
|
||||||
|
audio, font, fontSize);
|
||||||
totalServiceItems++;
|
totalServiceItems++;
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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 {
|
QString ServiceItem::name() const {
|
||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +75,14 @@ QString ServiceItem::audio() const {
|
||||||
return m_audio;
|
return m_audio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ServiceItem::font() const {
|
||||||
|
return m_font;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ServiceItem::fontSize() const {
|
||||||
|
return m_fontSize;
|
||||||
|
}
|
||||||
|
|
||||||
void ServiceItem::setName(QString name)
|
void ServiceItem::setName(QString name)
|
||||||
{
|
{
|
||||||
if (m_name == name)
|
if (m_name == name)
|
||||||
|
@ -119,3 +137,21 @@ void ServiceItem::setAudio(QString audio)
|
||||||
m_audio = audio;
|
m_audio = audio;
|
||||||
emit audioChanged(m_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);
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ class ServiceItem : public QObject
|
||||||
Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged)
|
Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged)
|
||||||
Q_PROPERTY(QStringList text READ text WRITE setText NOTIFY textChanged)
|
Q_PROPERTY(QStringList text READ text WRITE setText NOTIFY textChanged)
|
||||||
Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged)
|
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:
|
public:
|
||||||
explicit ServiceItem(QObject *parent = nullptr);
|
explicit ServiceItem(QObject *parent = nullptr);
|
||||||
|
@ -25,6 +27,9 @@ public:
|
||||||
ServiceItem(const QString &name, const QString &type, const QString &background,
|
ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||||
const QString &backgroundType, const QStringList &text, const QString &audio,
|
const QString &backgroundType, const QStringList &text, const QString &audio,
|
||||||
QObject * parent = nullptr);
|
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 name() const;
|
||||||
QString type() const;
|
QString type() const;
|
||||||
|
@ -32,6 +37,8 @@ public:
|
||||||
QString backgroundType() const;
|
QString backgroundType() const;
|
||||||
QStringList text() const;
|
QStringList text() const;
|
||||||
QString audio() const;
|
QString audio() const;
|
||||||
|
QString font() const;
|
||||||
|
int fontSize() const;
|
||||||
|
|
||||||
void setName(QString name);
|
void setName(QString name);
|
||||||
void setType(QString type);
|
void setType(QString type);
|
||||||
|
@ -39,6 +46,8 @@ public:
|
||||||
void setBackgroundType(QString backgroundType);
|
void setBackgroundType(QString backgroundType);
|
||||||
void setText(QStringList text);
|
void setText(QStringList text);
|
||||||
void setAudio(QString audio);
|
void setAudio(QString audio);
|
||||||
|
void setFont(QString font);
|
||||||
|
void setFontSize(int fontSize);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void nameChanged(QString name);
|
void nameChanged(QString name);
|
||||||
|
@ -47,6 +56,8 @@ signals:
|
||||||
void backgroundTypeChanged(QString backgroundType);
|
void backgroundTypeChanged(QString backgroundType);
|
||||||
void textChanged(QStringList text);
|
void textChanged(QStringList text);
|
||||||
void audioChanged(QString audio);
|
void audioChanged(QString audio);
|
||||||
|
void fontChanged(QString font);
|
||||||
|
void fontSizeChanged(int fontSize);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
@ -55,6 +66,8 @@ private:
|
||||||
QString m_backgroundType;
|
QString m_backgroundType;
|
||||||
QStringList m_text;
|
QStringList m_text;
|
||||||
QString m_audio;
|
QString m_audio;
|
||||||
|
QString m_font;
|
||||||
|
int m_fontSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SERVICEITEM_H
|
#endif // SERVICEITEM_H
|
||||||
|
|
|
@ -49,6 +49,10 @@ QVariant ServiceItemModel::data(const QModelIndex &index, int role) const {
|
||||||
return item->text();
|
return item->text();
|
||||||
case AudioRole:
|
case AudioRole:
|
||||||
return item->audio();
|
return item->audio();
|
||||||
|
case FontRole:
|
||||||
|
return item->font();
|
||||||
|
case FontSizeRole:
|
||||||
|
return item->fontSize();
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +64,9 @@ QHash<int, QByteArray> ServiceItemModel::roleNames() const {
|
||||||
{BackgroundRole, "background"},
|
{BackgroundRole, "background"},
|
||||||
{BackgroundTypeRole, "backgroundType"},
|
{BackgroundTypeRole, "backgroundType"},
|
||||||
{TextRole, "text"},
|
{TextRole, "text"},
|
||||||
{AudioRole, "audio"}};
|
{AudioRole, "audio"},
|
||||||
|
{FontRole, "font"},
|
||||||
|
{FontSizeRole, "fontSize"}};
|
||||||
|
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +114,18 @@ bool ServiceItemModel::setData(const QModelIndex &index, const QVariant &value,
|
||||||
somethingChanged = true;
|
somethingChanged = true;
|
||||||
}
|
}
|
||||||
break;
|
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) {
|
if (somethingChanged) {
|
||||||
emit dataChanged(index, index, QVector<int>() << role);
|
emit dataChanged(index, index, QVector<int>() << role);
|
||||||
return true;
|
return true;
|
||||||
|
@ -187,6 +205,18 @@ void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||||
qDebug() << name << type << background;
|
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) {
|
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type) {
|
||||||
ServiceItem *item = new ServiceItem(name, type);
|
ServiceItem *item = new ServiceItem(name, type);
|
||||||
insertItem(index, item);
|
insertItem(index, item);
|
||||||
|
@ -218,6 +248,18 @@ void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||||
qDebug() << name << type << background << text;
|
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) {
|
void ServiceItemModel::removeItem(int index) {
|
||||||
beginRemoveRows(QModelIndex(), index, index);
|
beginRemoveRows(QModelIndex(), index, index);
|
||||||
m_items.removeAt(index);
|
m_items.removeAt(index);
|
||||||
|
|
|
@ -20,7 +20,9 @@ public:
|
||||||
BackgroundRole,
|
BackgroundRole,
|
||||||
BackgroundTypeRole,
|
BackgroundTypeRole,
|
||||||
TextRole,
|
TextRole,
|
||||||
AudioRole
|
AudioRole,
|
||||||
|
FontRole,
|
||||||
|
FontSizeRole
|
||||||
};
|
};
|
||||||
|
|
||||||
// Basic functionality:
|
// Basic functionality:
|
||||||
|
@ -56,6 +58,11 @@ public:
|
||||||
const QString &background,
|
const QString &background,
|
||||||
const QString &backgroundType,
|
const QString &backgroundType,
|
||||||
const QStringList &text, const QString &audio);
|
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,
|
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
const QString &type);
|
const QString &type);
|
||||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
|
@ -68,6 +75,10 @@ public:
|
||||||
const QString &type, const QString &background,
|
const QString &type, const QString &background,
|
||||||
const QString &backgroundType, const QStringList &text,
|
const QString &backgroundType, const QStringList &text,
|
||||||
const QString &audio);
|
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 void removeItem(int index);
|
||||||
Q_INVOKABLE bool move(int sourceIndex, int destIndex);
|
Q_INVOKABLE bool move(int sourceIndex, int destIndex);
|
||||||
Q_INVOKABLE bool moveDown(int index);
|
Q_INVOKABLE bool moveDown(int index);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "slide.h"
|
#include "slide.h"
|
||||||
#include "serviceitemmodel.h"
|
#include "serviceitemmodel.h"
|
||||||
// #include <QPdfDocument>
|
|
||||||
|
|
||||||
#include <podofo/podofo.h>
|
#include <podofo/podofo.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -225,6 +224,9 @@ void Slide::changeSlide(QVariantMap item)
|
||||||
setImageBackground("");
|
setImageBackground("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setFont(m_serviceItem.value("font").toString());
|
||||||
|
setFontSize(m_serviceItem.value("fontSize").toInt());
|
||||||
|
|
||||||
if (type() == "presentation") {
|
if (type() == "presentation") {
|
||||||
qDebug() << "#$#$#$#$ THIS PDF $#$#$#$#";
|
qDebug() << "#$#$#$#$ THIS PDF $#$#$#$#";
|
||||||
int pageCount;
|
int pageCount;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue