better working changing slides and serviceItems

This commit is contained in:
Chris Cochrun 2023-01-20 15:38:11 -06:00
parent e30ee1a53e
commit 1ed76ff3e3
3 changed files with 23 additions and 62 deletions

View file

@ -181,6 +181,25 @@ Controls.Page {
console.log("Slide changed to: " + item.name); console.log("Slide changed to: " + item.name);
} }
function changeSlide(index) {
console.log("index grabbed: " + index);
const item = SlideModel.getItem(index);
currentSlide = index;
currentServiceItem = item.serviceItemId;
console.log("index grabbed: " + index);
console.log(item);
presentation.stopVideo();
pWindow.stopVideo();
/* presentation.itemType = item.type; */
console.log("Time to start changing");
ServiceItemModel.activate(currentServiceItem);
SlideObject.changeSlide(item);
presentation.textIndex = 0;
console.log("Slide changed to: " + index);
}
function loopVideo() { function loopVideo() {
presentation.loopVideo(); presentation.loopVideo();
pWindow.loopVideo(); pWindow.loopVideo();

View file

@ -286,25 +286,10 @@ FocusScope {
const nextSlideIdx = currentSlide + 1; const nextSlideIdx = currentSlide + 1;
if (nextSlideIdx > totalSlides || nextSlideIdx < 0) if (nextSlideIdx > totalSlides || nextSlideIdx < 0)
return; return;
const nextItem = SlideModel.getItem(nextSlideIdx);
console.log("currentServiceItem " + currentServiceItem); console.log("currentServiceItem " + currentServiceItem);
console.log("currentSlide " + currentSlide); console.log("currentSlide " + currentSlide);
console.log("nextSlideIdx " + nextSlideIdx); console.log("nextSlideIdx " + nextSlideIdx);
console.log(nextItem.index); changeSlide(nextSlideIdx);
SlideObject.changeSlide(nextItem);
currentSlide = nextSlideIdx;
currentServiceItem = nextItem.serviceItemId;
changeServiceItem(currentServiceItem);
/* const change = SlideObject.next(nextItem); */
/* console.log(change); */
/* if (currentServiceItem === totalServiceItems - 1 & change) */
/* return; */
/* if (change) { */
/* SlideObject.changeSlide(nextItem); */
/* currentServiceItem++; */
/* changeServiceItem(currentServiceItem); */
/* leftDock.changeItem(); */
/* } */
} }
function nextSlide() { function nextSlide() {
@ -317,26 +302,10 @@ FocusScope {
const prevSlideIdx = currentSlide - 1; const prevSlideIdx = currentSlide - 1;
if (prevSlideIdx > totalSlides || prevSlideIdx < 0) if (prevSlideIdx > totalSlides || prevSlideIdx < 0)
return; return;
const prevItem = SlideModel.getItem(prevSlideIdx);
console.log("currentServiceItem " + currentServiceItem); console.log("currentServiceItem " + currentServiceItem);
console.log("currentSlide " + currentSlide); console.log("currentSlide " + currentSlide);
console.log("prevSlideIdx " + prevSlideIdx); console.log("prevSlideIdx " + prevSlideIdx);
console.log(prevItem.index); changeSlide(prevSlideIdx);
SlideObject.changeSlide(prevItem);
currentSlide = prevSlideIdx;
currentServiceItem = prevItem.serviceItemId;
changeServiceItem(currentServiceItem);
/* const change = SlideObject.previous(prevItem); */
/* console.log(change); */
/* if (currentServiceItem === 0 & change) { */
/* return; */
/* }; */
/* if (change) { */
/* SlideObject.changeSlide(prevItem); */
/* currentServiceItem--; */
/* changeServiceItem(currentServiceItem); */
/* leftDock.changeItem(); */
/* } */
} }
function previousSlide() { function previousSlide() {
@ -344,19 +313,6 @@ FocusScope {
console.log(slideItem); console.log(slideItem);
} }
function changeSlide() {
if (itemType === "song") {
SlideObject.setText(root.text[textIndex]);
console.log(root.text[textIndex]);
textIndex++;
} else if (itemType === "video") {
clearText();
}
else if (itemType === "image") {
clearText();
}
}
function clearText() { function clearText() {
SlideObject.setText(""); SlideObject.setText("");
} }

View file

@ -44,7 +44,7 @@ Item {
Controls.Label { Controls.Label {
id: slidesTitle id: slidesTitle
width: parent.width * 7 width: previewHighlight.width
anchors.top: previewHighlight.bottom anchors.top: previewHighlight.bottom
/* anchors.leftMargin: Kirigami.Units.smallSpacing * 8 */ /* anchors.leftMargin: Kirigami.Units.smallSpacing * 8 */
anchors.topMargin: Kirigami.Units.smallSpacing * 3 anchors.topMargin: Kirigami.Units.smallSpacing * 3
@ -57,7 +57,7 @@ Item {
id: previewerMouse id: previewerMouse
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: SlideObject.changeSlide(SlideModel.getItem(index)) onClicked: changeSlide(index)
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
propagateComposedEvents: true propagateComposedEvents: true
} }
@ -70,18 +70,4 @@ Item {
previewSlidesList.positionViewAtIndex(index, ListView.Contain); previewSlidesList.positionViewAtIndex(index, ListView.Contain);
} }
} }
function changeSlideAndIndex(serviceItem, index) {
// TODO
console.log("Item: " + serviceItem.index + " is " + serviceItem.active);
if (!serviceItem.active) {
changeServiceItem(serviceItem.index)
previewSlidesList.currentIndex = serviceItem.index;
}
console.log("Slide Index is: " + index);
if (outerModelData.slideNumber === 0)
return;
SlideObject.changeSlideIndex(index);
console.log("New slide index is: " + SlideObject.slideIndex);
}
} }