added the previous item change
This commit is contained in:
parent
420d521494
commit
770e2f4593
3 changed files with 53 additions and 17 deletions
|
@ -177,24 +177,38 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function previousSlideAction() {
|
function previousSlideAction() {
|
||||||
print(textIndex);
|
const prevServiceItemIndex = currentServiceItem - 1;
|
||||||
if (itemType === "song") {
|
const prevItem = serviceItemModel.getItem(prevServiceItemIndex);
|
||||||
if (textIndex === 0) {
|
print("currentServiceItem " + currentServiceItem);
|
||||||
clearText();
|
print("prevServiceItem " + prevServiceItemIndex);
|
||||||
nextSlide();
|
print(prevItem.name);
|
||||||
} else if (textIndex <= root.text.length) {
|
const changed = SlideObject.previous(prevItem);
|
||||||
SlideObject.setText(root.text[textIndex]);
|
print(changed);
|
||||||
print(root.text[textIndex]);
|
if (changed) {
|
||||||
--textIndex;
|
currentServiceItem--;
|
||||||
|
loadVideo();
|
||||||
}
|
}
|
||||||
} else if (itemType === "video") {
|
|
||||||
|
|
||||||
|
|
||||||
|
/* print(textIndex); */
|
||||||
|
/* if (itemType === "song") { */
|
||||||
|
/* if (textIndex === 0) { */
|
||||||
/* clearText(); */
|
/* clearText(); */
|
||||||
previousSlide();
|
/* nextSlide(); */
|
||||||
}
|
/* } else if (textIndex <= root.text.length) { */
|
||||||
else if (itemType === "image") {
|
/* SlideObject.setText(root.text[textIndex]); */
|
||||||
/* clearText(); */
|
/* print(root.text[textIndex]); */
|
||||||
previousSlide();
|
/* --textIndex; */
|
||||||
}
|
/* } */
|
||||||
|
/* } else if (itemType === "video") { */
|
||||||
|
/* /\* clearText(); *\/ */
|
||||||
|
/* previousSlide(); */
|
||||||
|
/* } */
|
||||||
|
/* else if (itemType === "image") { */
|
||||||
|
/* /\* clearText(); *\/ */
|
||||||
|
/* previousSlide(); */
|
||||||
|
/* } */
|
||||||
}
|
}
|
||||||
|
|
||||||
function previousSlide() {
|
function previousSlide() {
|
||||||
|
|
|
@ -210,3 +210,24 @@ bool Slide::next(QVariantMap nextItem)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Slide::previous(QVariantMap prevItem)
|
||||||
|
{
|
||||||
|
qDebug() << "Starting to go to previous item.";
|
||||||
|
qDebug() << "Slide Index: " << m_slideIndex << " Slide Size: " << m_slideSize;
|
||||||
|
QStringList text = m_serviceItem.value("text").toStringList();
|
||||||
|
if (m_slideIndex == 1) {
|
||||||
|
changeSlide(prevItem);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// since the string list is 0 indexed m_slideIndex actually
|
||||||
|
// maps to the next item. So the prev text is minus 2
|
||||||
|
int prevTextIndex = m_slideIndex - 2;
|
||||||
|
qDebug() << prevTextIndex;
|
||||||
|
qDebug() << text[prevTextIndex];
|
||||||
|
setText(text[prevTextIndex]);
|
||||||
|
m_slideIndex--;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void changeSlide(QVariantMap item);
|
Q_INVOKABLE void changeSlide(QVariantMap item);
|
||||||
Q_INVOKABLE bool next(QVariantMap nextItem);
|
Q_INVOKABLE bool next(QVariantMap nextItem);
|
||||||
|
Q_INVOKABLE bool previous(QVariantMap prevItem);
|
||||||
|
|
||||||
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