adding serviceItem and index to the slides variables
This commit is contained in:
parent
964eefb7de
commit
f4d034fe7c
3 changed files with 46 additions and 14 deletions
|
@ -175,11 +175,11 @@ Item {
|
|||
nextSlide();
|
||||
}
|
||||
} else if (itemType === "video") {
|
||||
clearText();
|
||||
/* clearText(); */
|
||||
nextSlide();
|
||||
}
|
||||
else if (itemType === "image") {
|
||||
clearText();
|
||||
/* clearText(); */
|
||||
nextSlide();
|
||||
}
|
||||
}
|
||||
|
@ -201,11 +201,11 @@ Item {
|
|||
--textIndex;
|
||||
}
|
||||
} else if (itemType === "video") {
|
||||
clearText();
|
||||
/* clearText(); */
|
||||
previousSlide();
|
||||
}
|
||||
else if (itemType === "image") {
|
||||
clearText();
|
||||
/* clearText(); */
|
||||
previousSlide();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ Slide::Slide(const QString &text, const QString &audio, const QString &imageBack
|
|||
m_horizontalTextAlignment(horizontalTextAlignment),m_font(font),m_fontSize(fontSize),m_type(type)
|
||||
{
|
||||
qDebug() << "Initializing slide with defaults";
|
||||
qDebug() << m_imageBackground;
|
||||
}
|
||||
|
||||
QString Slide::text() const {
|
||||
|
@ -29,6 +28,10 @@ QString Slide::type() const {
|
|||
return m_type;
|
||||
}
|
||||
|
||||
QVariantMap Slide::serviceItem() const {
|
||||
return m_serviceItem;
|
||||
}
|
||||
|
||||
QString Slide::audio() const {
|
||||
return m_audio;
|
||||
}
|
||||
|
@ -83,6 +86,16 @@ void Slide::setType(QString type)
|
|||
emit typeChanged(m_type);
|
||||
}
|
||||
|
||||
void Slide::setServiceItem(QVariantMap serviceItem)
|
||||
{
|
||||
qDebug() << "####changing serviceItem to: " << serviceItem;
|
||||
if (m_serviceItem == serviceItem)
|
||||
return;
|
||||
|
||||
m_serviceItem = serviceItem;
|
||||
emit serviceItemChanged(m_serviceItem);
|
||||
}
|
||||
|
||||
void Slide::setAudio(QString audio)
|
||||
{
|
||||
if (m_audio == audio)
|
||||
|
@ -150,27 +163,38 @@ void Slide::setFontSize(int fontSize)
|
|||
|
||||
void Slide::changeSlide(QVariantMap item)
|
||||
{
|
||||
setType(item.value("type").toString());
|
||||
setServiceItem(item);
|
||||
setType(m_serviceItem.value("type").toString());
|
||||
|
||||
if (item.value("backgroundType") == "image") {
|
||||
setImageBackground(item.value("background").toString());
|
||||
if (serviceItem().value("backgroundType") == "image") {
|
||||
setImageBackground(m_serviceItem.value("background").toString());
|
||||
setVideoBackground("");
|
||||
} else {
|
||||
setVideoBackground(item.value("background").toString());
|
||||
setVideoBackground(m_serviceItem.value("background").toString());
|
||||
setImageBackground("");
|
||||
}
|
||||
|
||||
QStringList text = item.value("text").toStringList();
|
||||
QStringList text = m_serviceItem.value("text").toStringList();
|
||||
if (text.isEmpty())
|
||||
setText("");
|
||||
else {
|
||||
setText(text[0]);
|
||||
}
|
||||
|
||||
qDebug() << "MAP: " << item.value("text");
|
||||
qDebug() << "MAP: " << m_serviceItem.value("text");
|
||||
}
|
||||
|
||||
void Slide::nextSlide()
|
||||
void Slide::next()
|
||||
{
|
||||
if (m_slideIndex == m_slideSize) {
|
||||
changeSlide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_type != "song") {
|
||||
qDebug() << "nextslide current type is song";
|
||||
// setText("");
|
||||
// changeSlide(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
10
src/slide.h
10
src/slide.h
|
@ -11,6 +11,7 @@ class Slide : public QObject
|
|||
Q_OBJECT
|
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
||||
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(QVariantMap serviceItem READ serviceItem WRITE setServiceItem NOTIFY serviceItemChanged)
|
||||
Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged)
|
||||
Q_PROPERTY(QString imageBackground READ imageBackground WRITE setImageBackground NOTIFY imageBackgroundChanged)
|
||||
Q_PROPERTY(QString videoBackground READ videoBackground WRITE setVideoBackground NOTIFY videoBackgroundChanged)
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
|
||||
QString text() const;
|
||||
QString type() const;
|
||||
QVariantMap serviceItem() const;
|
||||
QString audio() const;
|
||||
QString imageBackground() const;
|
||||
QString videoBackground() const;
|
||||
|
@ -40,6 +42,7 @@ public:
|
|||
|
||||
Q_INVOKABLE void setText(QString text);
|
||||
Q_INVOKABLE void setType(QString type);
|
||||
Q_INVOKABLE void setServiceItem(QVariantMap serviceItem);
|
||||
Q_INVOKABLE void setAudio(QString audio);
|
||||
Q_INVOKABLE void setImageBackground(QString imageBackground);
|
||||
Q_INVOKABLE void setVideoBackground(QString videoBackground);
|
||||
|
@ -49,11 +52,12 @@ public:
|
|||
Q_INVOKABLE void setFontSize(int fontSize);
|
||||
|
||||
Q_INVOKABLE void changeSlide(QVariantMap item);
|
||||
Q_INVOKABLE void nextSlide();
|
||||
Q_INVOKABLE void next();
|
||||
|
||||
signals:
|
||||
Q_INVOKABLE void textChanged(QString text);
|
||||
Q_INVOKABLE void typeChanged(QString type);
|
||||
Q_INVOKABLE void serviceItemChanged(QVariantMap serviceItem);
|
||||
Q_INVOKABLE void audioChanged(QString audio);
|
||||
Q_INVOKABLE void imageBackgroundChanged(QString imageBackground);
|
||||
Q_INVOKABLE void videoBackgroundChanged(QString videoBackground);
|
||||
|
@ -66,6 +70,7 @@ private:
|
|||
int m_id;
|
||||
QString m_text;
|
||||
QString m_type;
|
||||
QVariantMap m_serviceItem;
|
||||
QString m_audio;
|
||||
QString m_imageBackground;
|
||||
QString m_videoBackground;
|
||||
|
@ -73,6 +78,9 @@ private:
|
|||
QString m_verticalTextAlignment;
|
||||
QString m_font;
|
||||
int m_fontSize;
|
||||
|
||||
int m_slideIndex;
|
||||
int m_slideSize;
|
||||
};
|
||||
|
||||
#endif //SLIDE_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue