adding backbones for audio
This commit is contained in:
parent
9a732e6826
commit
c197277e62
7 changed files with 86 additions and 16 deletions
|
@ -402,13 +402,13 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
function addItem(index, name, type,
|
||||
background, backgroundType, text, itemID) {
|
||||
background, backgroundType, text, audio, itemID) {
|
||||
if (type === "song") {
|
||||
const newtext = songsqlmodel.getLyricList(itemID);
|
||||
print("adding: " + name + " of type " + type);
|
||||
serviceItemModel.insertItem(index, name,
|
||||
type, background,
|
||||
backgroundType, newtext);
|
||||
backgroundType, audio, newtext);
|
||||
totalServiceItems++;
|
||||
return;
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ ColumnLayout {
|
|||
totalServiceItems++;
|
||||
}
|
||||
|
||||
function appendItem(name, type, background, backgroundType, text, itemID) {
|
||||
function appendItem(name, type, background, backgroundType, text, audio, itemID) {
|
||||
print("adding: " + name + " of type " + type);
|
||||
let lyrics;
|
||||
if (type === "song") {
|
||||
|
@ -428,7 +428,7 @@ ColumnLayout {
|
|||
lyrics = songsqlmodel.getLyricList(itemID);
|
||||
print(lyrics);
|
||||
serviceItemModel.addItem(name, type, background,
|
||||
backgroundType, lyrics);
|
||||
backgroundType, lyrics, audio);
|
||||
totalServiceItems++;
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@ Item {
|
|||
property bool dropShadow: false
|
||||
property url imageSource
|
||||
property url videoSource
|
||||
property url audioSource
|
||||
property int pdfIndex
|
||||
property string chosenFont: "Quicksand"
|
||||
property string text: "This is demo text"
|
||||
|
@ -69,13 +70,11 @@ Item {
|
|||
cursorShape: preview ? Qt.ArrowCursor : Qt.BlankCursor
|
||||
}
|
||||
|
||||
/* Controls.ProgressBar { */
|
||||
/* anchors.top: parent.bottom */
|
||||
/* width: mpv.width */
|
||||
/* visible: editMode */
|
||||
/* value: mpv.position */
|
||||
/* to: mpv.duration */
|
||||
/* } */
|
||||
MpvObject {
|
||||
id: audio
|
||||
onFileLoaded: {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
|
@ -88,6 +87,7 @@ Item {
|
|||
print("WHY AREN'T YOU PASUING!");
|
||||
pauseTimer.restart();
|
||||
}
|
||||
audio.loadFile()
|
||||
blackTimer.restart();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,13 +21,23 @@ 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, QObject *parent)
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
QObject *parent)
|
||||
: QObject(parent),m_name(name),m_type(type),m_background(background),
|
||||
m_backgroundType(backgroundType),m_text(text)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ServiceItem::ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
const QString &audio, QObject *parent)
|
||||
: QObject(parent),m_name(name),m_type(type),m_background(background),
|
||||
m_backgroundType(backgroundType),m_text(text),m_audio(audio)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString ServiceItem::name() const {
|
||||
return m_name;
|
||||
}
|
||||
|
@ -51,6 +61,10 @@ QStringList ServiceItem::text() const
|
|||
return m_text;
|
||||
}
|
||||
|
||||
QString ServiceItem::audio() const {
|
||||
return m_audio;
|
||||
}
|
||||
|
||||
void ServiceItem::setName(QString name)
|
||||
{
|
||||
if (m_name == name)
|
||||
|
@ -96,3 +110,12 @@ void ServiceItem::setText(QStringList text)
|
|||
emit textChanged(m_text);
|
||||
|
||||
}
|
||||
|
||||
void ServiceItem::setAudio(QString audio)
|
||||
{
|
||||
if (m_audio == audio)
|
||||
return;
|
||||
|
||||
m_audio = audio;
|
||||
emit audioChanged(m_audio);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ class ServiceItem : public QObject
|
|||
Q_PROPERTY(QString background READ background WRITE setBackground NOTIFY backgroundChanged)
|
||||
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)
|
||||
|
||||
public:
|
||||
explicit ServiceItem(QObject *parent = nullptr);
|
||||
|
@ -19,19 +20,25 @@ public:
|
|||
ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||
const QString &backgroundType, QObject * parent = nullptr);
|
||||
ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text, QObject * parent = nullptr);
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
QObject * parent = nullptr);
|
||||
ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text, const QString &audio,
|
||||
QObject * parent = nullptr);
|
||||
|
||||
QString name() const;
|
||||
QString type() const;
|
||||
QString background() const;
|
||||
QString backgroundType() const;
|
||||
QStringList text() const;
|
||||
QString audio() const;
|
||||
|
||||
void setName(QString name);
|
||||
void setType(QString type);
|
||||
void setBackground(QString background);
|
||||
void setBackgroundType(QString backgroundType);
|
||||
void setText(QStringList text);
|
||||
void setAudio(QString audio);
|
||||
|
||||
signals:
|
||||
void nameChanged(QString name);
|
||||
|
@ -39,6 +46,7 @@ signals:
|
|||
void backgroundChanged(QString background);
|
||||
void backgroundTypeChanged(QString backgroundType);
|
||||
void textChanged(QStringList text);
|
||||
void audioChanged(QString audio);
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
|
@ -46,6 +54,7 @@ private:
|
|||
QString m_background;
|
||||
QString m_backgroundType;
|
||||
QStringList m_text;
|
||||
QString m_audio;
|
||||
};
|
||||
|
||||
#endif // SERVICEITEM_H
|
||||
|
|
|
@ -10,7 +10,7 @@ ServiceItemModel::ServiceItemModel(QObject *parent)
|
|||
: QAbstractListModel(parent) {
|
||||
addItem(new ServiceItem("10,000 Reasons", "song",
|
||||
"file:/home/chris/nextcloud/tfc/openlp/CMG - Nature King 21.jpg",
|
||||
"image", QStringList("Yip Yip")));
|
||||
"image", "file:/home/chris/nextcloud/tfc/openlp/music/Eden-Phil Wickham [lyrics].mp3" QStringList("Yip Yip")));
|
||||
addItem(new ServiceItem("Marvelous Light", "song",
|
||||
"file:/home/chris/nextcloud/tfc/openlp/Fire Embers_Loop.mp4",
|
||||
"video", QStringList("Hallelujah!")));
|
||||
|
@ -46,6 +46,8 @@ QVariant ServiceItemModel::data(const QModelIndex &index, int role) const {
|
|||
return item->backgroundType();
|
||||
case TextRole:
|
||||
return item->text();
|
||||
case AudioRole:
|
||||
return item->audio();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -56,7 +58,8 @@ QHash<int, QByteArray> ServiceItemModel::roleNames() const {
|
|||
{TypeRole, "type"},
|
||||
{BackgroundRole, "background"},
|
||||
{BackgroundTypeRole, "backgroundType"},
|
||||
{TextRole, "text"}};
|
||||
{TextRole, "text"},
|
||||
{AudioRole, "audio"}};
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
@ -98,6 +101,12 @@ bool ServiceItemModel::setData(const QModelIndex &index, const QVariant &value,
|
|||
somethingChanged = true;
|
||||
}
|
||||
break;
|
||||
case AudioRole:
|
||||
if (item->audio() != value.toStringList()) {
|
||||
item->setAudio(value.toStringList());
|
||||
somethingChanged = true;
|
||||
}
|
||||
break;
|
||||
if (somethingChanged) {
|
||||
emit dataChanged(index, index, QVector<int>() << role);
|
||||
return true;
|
||||
|
@ -168,6 +177,15 @@ 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) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio);
|
||||
addItem(item);
|
||||
qDebug() << name << type << background;
|
||||
}
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type) {
|
||||
ServiceItem *item = new ServiceItem(name, type);
|
||||
insertItem(index, item);
|
||||
|
@ -189,6 +207,16 @@ void ServiceItemModel::insertItem(const int &index, const QString &name, const Q
|
|||
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) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio);
|
||||
insertItem(index, item);
|
||||
qDebug() << name << type << background << text;
|
||||
}
|
||||
|
||||
void ServiceItemModel::removeItem(int index) {
|
||||
beginRemoveRows(QModelIndex(), index, index);
|
||||
m_items.removeAt(index);
|
||||
|
|
|
@ -19,7 +19,8 @@ public:
|
|||
TypeRole,
|
||||
BackgroundRole,
|
||||
BackgroundTypeRole,
|
||||
TextRole
|
||||
TextRole,
|
||||
AudioRole
|
||||
};
|
||||
|
||||
// Basic functionality:
|
||||
|
@ -51,6 +52,10 @@ public:
|
|||
const QString &background,
|
||||
const QString &backgroundType,
|
||||
const QStringList &text);
|
||||
Q_INVOKABLE void addItem(const QString &name, 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);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
|
@ -59,6 +64,10 @@ public:
|
|||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text);
|
||||
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);
|
||||
Q_INVOKABLE void removeItem(int index);
|
||||
Q_INVOKABLE bool move(int sourceIndex, int destIndex);
|
||||
Q_INVOKABLE bool moveDown(int index);
|
||||
|
|
|
@ -252,6 +252,7 @@ void Slide::changeSlide(QVariantMap item)
|
|||
m_slideSize = text.length();
|
||||
m_slideIndex = 1;
|
||||
setText(text[0]);
|
||||
setAudio(serviceItem().value("audio").toString());
|
||||
}
|
||||
|
||||
qDebug() << "MAP: " << m_serviceItem.value("text");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue