added a working song next action to the slide object
This commit is contained in:
parent
f4d034fe7c
commit
c1410781c9
3 changed files with 59 additions and 28 deletions
|
@ -158,30 +158,41 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextSlideAction() {
|
function nextSlideAction() {
|
||||||
print(textIndex);
|
const nextServiceItemIndex = currentServiceItem + 1;
|
||||||
if (itemType === "song") {
|
const nextItem = serviceItemModel.getItem(nextServiceItemIndex);
|
||||||
if (textIndex === 0) {
|
print("currentServiceItem " + currentServiceItem);
|
||||||
SlideObject.setText(root.text[textIndex]);
|
print("nextServiceItem " + nextServiceItemIndex);
|
||||||
print(root.text[textIndex]);
|
print(nextItem.name);
|
||||||
textIndex++;
|
const changed = SlideObject.next(nextItem);
|
||||||
} else if (textIndex < root.text.length) {
|
print(changed);
|
||||||
SlideObject.setText(root.text[textIndex]);
|
if (changed) {
|
||||||
print(root.text[textIndex]);
|
currentServiceItem++;
|
||||||
textIndex++;
|
loadVideo();
|
||||||
} else {
|
|
||||||
print("Next slide time");
|
|
||||||
textIndex = 0;
|
|
||||||
clearText();
|
|
||||||
nextSlide();
|
|
||||||
}
|
}
|
||||||
} else if (itemType === "video") {
|
/* print(textIndex); */
|
||||||
|
/* if (itemType === "song") { */
|
||||||
|
/* if (textIndex === 0) { */
|
||||||
|
/* SlideObject.setText(root.text[textIndex]); */
|
||||||
|
/* print(root.text[textIndex]); */
|
||||||
|
/* textIndex++; */
|
||||||
|
/* } else if (textIndex < root.text.length) { */
|
||||||
|
/* SlideObject.setText(root.text[textIndex]); */
|
||||||
|
/* print(root.text[textIndex]); */
|
||||||
|
/* textIndex++; */
|
||||||
|
/* } else { */
|
||||||
|
/* print("Next slide time"); */
|
||||||
|
/* textIndex = 0; */
|
||||||
/* clearText(); */
|
/* clearText(); */
|
||||||
nextSlide();
|
/* nextSlide(); */
|
||||||
}
|
/* } */
|
||||||
else if (itemType === "image") {
|
/* } else if (itemType === "video") { */
|
||||||
/* clearText(); */
|
/* /\* clearText(); *\/ */
|
||||||
nextSlide();
|
/* nextSlide(); */
|
||||||
}
|
/* } */
|
||||||
|
/* else if (itemType === "image") { */
|
||||||
|
/* /\* clearText(); *\/ */
|
||||||
|
/* nextSlide(); */
|
||||||
|
/* } */
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextSlide() {
|
function nextSlide() {
|
||||||
|
|
|
@ -175,20 +175,29 @@ void Slide::changeSlide(QVariantMap item)
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList text = m_serviceItem.value("text").toStringList();
|
QStringList text = m_serviceItem.value("text").toStringList();
|
||||||
if (text.isEmpty())
|
if (text.isEmpty()) {
|
||||||
setText("");
|
setText("");
|
||||||
|
m_slideSize = 1;
|
||||||
|
m_slideIndex = 1;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
qDebug() << "TEXT LENGTH: " << text.length();
|
||||||
|
m_slideSize = text.length();
|
||||||
|
m_slideIndex = 1;
|
||||||
setText(text[0]);
|
setText(text[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "MAP: " << m_serviceItem.value("text");
|
qDebug() << "MAP: " << m_serviceItem.value("text");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slide::next()
|
bool Slide::next(QVariantMap nextItem)
|
||||||
{
|
{
|
||||||
|
qDebug() << "Starting to go to next item.";
|
||||||
|
qDebug() << "Slide Index: " << m_slideIndex << " Slide Size: " << m_slideSize;
|
||||||
|
QStringList text = m_serviceItem.value("text").toStringList();
|
||||||
if (m_slideIndex == m_slideSize) {
|
if (m_slideIndex == m_slideSize) {
|
||||||
changeSlide();
|
changeSlide(nextItem);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_type != "song") {
|
if (m_type != "song") {
|
||||||
|
@ -197,4 +206,15 @@ void Slide::next()
|
||||||
// changeSlide(item);
|
// changeSlide(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_type == "song") {
|
||||||
|
// since the string list is 0 indexed m_slideIndex actually
|
||||||
|
// maps to the next item.
|
||||||
|
int nextTextIndex = m_slideIndex;
|
||||||
|
qDebug() << nextTextIndex;
|
||||||
|
qDebug() << text[nextTextIndex];
|
||||||
|
setText(text[nextTextIndex]);
|
||||||
|
m_slideIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
Q_INVOKABLE void setFontSize(int fontSize);
|
Q_INVOKABLE void setFontSize(int fontSize);
|
||||||
|
|
||||||
Q_INVOKABLE void changeSlide(QVariantMap item);
|
Q_INVOKABLE void changeSlide(QVariantMap item);
|
||||||
Q_INVOKABLE void next();
|
Q_INVOKABLE bool next(QVariantMap nextItem);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
Q_INVOKABLE void textChanged(QString text);
|
Q_INVOKABLE void textChanged(QString text);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue