a lot of tweaks to make changing slides work
This commit is contained in:
parent
a024a0b27d
commit
f535bc1500
5 changed files with 75 additions and 52 deletions
|
@ -368,14 +368,22 @@ ColumnLayout {
|
|||
]
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ServiceItemModel
|
||||
onDataChanged: {
|
||||
if (active)
|
||||
serviceItemList.positionViewAtIndex(index, ListView.Contain);
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
totalServiceItems = serviceItemList.count;
|
||||
/* totalServiceItems = serviceItemList.count; */
|
||||
console.log("THE TOTAL SERVICE ITEMS: " + totalServiceItems);
|
||||
}
|
||||
|
||||
function removeItem(index) {
|
||||
ServiceItemModel.removeItem(index);
|
||||
totalServiceItems--;
|
||||
/* totalServiceItems--; */
|
||||
}
|
||||
|
||||
function addItem(index, name, type,
|
||||
|
@ -385,7 +393,7 @@ ColumnLayout {
|
|||
ServiceItemModel.insertItem(index, name,
|
||||
type, background,
|
||||
backgroundType, newtext);
|
||||
totalServiceItems++;
|
||||
/* totalServiceItems++; */
|
||||
}
|
||||
|
||||
function appendItem(name, type, background, backgroundType, text, itemID) {
|
||||
|
@ -402,7 +410,7 @@ ColumnLayout {
|
|||
|
||||
ServiceItemModel.addItem(name, type, background,
|
||||
backgroundType, lyrics);
|
||||
totalServiceItems++;
|
||||
/* totalServiceItems++; */
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,11 +13,13 @@ Controls.Page {
|
|||
|
||||
// properties passed around for the slides
|
||||
property int currentServiceItem
|
||||
property int currentSlide
|
||||
property int totalServiceItems: ServiceItemModel.rowCount()
|
||||
property int totalSlides: SlideModel.rowCount()
|
||||
property url imageBackground: presentation.imageBackground
|
||||
property url videoBackground: presentation.vidBackground
|
||||
property string currentText: presentation.text
|
||||
property int blurRadius: 0
|
||||
property int totalServiceItems
|
||||
|
||||
/* property var video */
|
||||
property int dragItemIndex
|
||||
|
@ -153,6 +155,9 @@ Controls.Page {
|
|||
function changeServiceItem(index) {
|
||||
const item = ServiceItemModel.getItem(index);
|
||||
currentServiceItem = index;
|
||||
const slideId = SlideModel.findSlideIdFromServItm(index);
|
||||
currentSlide = slideId;
|
||||
const slide = SlideModel.getItem(slideId);
|
||||
console.log("index grabbed: " + index);
|
||||
console.log(item);
|
||||
|
||||
|
@ -162,7 +167,7 @@ Controls.Page {
|
|||
console.log("Time to start changing");
|
||||
|
||||
ServiceItemModel.activate(index);
|
||||
SlideObject.changeSlide(item);
|
||||
SlideObject.changeSlide(slide);
|
||||
|
||||
/* if (item.backgroundType === "video") */
|
||||
/* { */
|
||||
|
|
|
@ -183,7 +183,7 @@ FocusScope {
|
|||
anchors.top: mainGrid.bottom
|
||||
anchors.bottom: root.bottom - Kirigami.Units.gridUnit
|
||||
width: parent.width
|
||||
orientation: ListView.Horizontal
|
||||
orientation: Qt.Horizontal
|
||||
spacing: Kirigami.Units.smallSpacing * 2
|
||||
cacheBuffer: 900
|
||||
reuseItems: true
|
||||
|
@ -194,10 +194,6 @@ FocusScope {
|
|||
id: wheelHandler
|
||||
target: previewSlidesList
|
||||
filterMouseEvents: true
|
||||
onWheel: {
|
||||
wheel.accepted = true;
|
||||
showPassiveNotification(wheel.inverted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,21 +275,28 @@ FocusScope {
|
|||
function nextSlideAction() {
|
||||
keyHandler.forceActiveFocus();
|
||||
console.log(currentServiceItem);
|
||||
const nextServiceItemIndex = currentServiceItem + 1;
|
||||
const nextItem = ServiceItemModel.getItem(nextServiceItemIndex);
|
||||
console.log("currentServiceItem " + currentServiceItem);
|
||||
console.log("nextServiceItem " + nextServiceItemIndex);
|
||||
console.log(nextItem.name);
|
||||
const change = SlideObject.next(nextItem);
|
||||
console.log(change);
|
||||
if (currentServiceItem === totalServiceItems - 1 & change)
|
||||
const nextSlideIdx = currentSlide + 1;
|
||||
if (nextSlideIdx > totalSlides || nextSlideIdx < 0)
|
||||
return;
|
||||
if (change) {
|
||||
SlideObject.changeSlide(nextItem);
|
||||
currentServiceItem++;
|
||||
changeServiceItem(currentServiceItem);
|
||||
leftDock.changeItem();
|
||||
}
|
||||
const nextItem = SlideModel.getItem(nextSlideIdx);
|
||||
console.log("currentServiceItem " + currentServiceItem);
|
||||
console.log("currentSlide " + currentSlide);
|
||||
console.log("nextSlideIdx " + nextSlideIdx);
|
||||
console.log(nextItem.index);
|
||||
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() {
|
||||
|
@ -303,22 +306,29 @@ FocusScope {
|
|||
|
||||
function previousSlideAction() {
|
||||
keyHandler.forceActiveFocus();
|
||||
const prevServiceItemIndex = currentServiceItem - 1;
|
||||
const prevItem = ServiceItemModel.getItem(prevServiceItemIndex);
|
||||
console.log("currentServiceItem " + currentServiceItem);
|
||||
console.log("prevServiceItem " + prevServiceItemIndex);
|
||||
console.log(prevItem.name);
|
||||
const change = SlideObject.previous(prevItem);
|
||||
console.log(change);
|
||||
if (currentServiceItem === 0 & change) {
|
||||
const prevSlideIdx = currentSlide - 1;
|
||||
if (prevSlideIdx > totalSlides || prevSlideIdx < 0)
|
||||
return;
|
||||
};
|
||||
if (change) {
|
||||
SlideObject.changeSlide(prevItem);
|
||||
currentServiceItem--;
|
||||
changeServiceItem(currentServiceItem);
|
||||
leftDock.changeItem();
|
||||
}
|
||||
const prevItem = SlideModel.getItem(prevSlideIdx);
|
||||
console.log("currentServiceItem " + currentServiceItem);
|
||||
console.log("currentSlide " + currentSlide);
|
||||
console.log("prevSlideIdx " + prevSlideIdx);
|
||||
console.log(prevItem.index);
|
||||
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() {
|
||||
|
|
|
@ -7,8 +7,6 @@ import org.presenter 1.0
|
|||
|
||||
Item {
|
||||
id: root
|
||||
// Lets set the outerModelData so we can access that data here.
|
||||
|
||||
implicitHeight: Kirigami.Units.gridUnit * 6.5
|
||||
implicitWidth: Kirigami.Units.gridUnit * 10
|
||||
Rectangle {
|
||||
|
@ -59,7 +57,7 @@ Item {
|
|||
id: previewerMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
/* onClicked: changeServiceItem(index) */
|
||||
onClicked: changeServiceItem(index)
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
propagateComposedEvents: true
|
||||
}
|
||||
|
@ -67,8 +65,10 @@ Item {
|
|||
|
||||
Connections {
|
||||
target: SlideModel
|
||||
onDataChanged: if (active)
|
||||
previewSlidesList.positionViewAtIndex(index, ListView.Contain)
|
||||
onDataChanged: {
|
||||
if (active)
|
||||
previewSlidesList.positionViewAtIndex(index, ListView.Contain);
|
||||
}
|
||||
}
|
||||
|
||||
function changeSlideAndIndex(serviceItem, index) {
|
||||
|
|
|
@ -502,13 +502,13 @@ Item {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
totalServiceItems = serviceItemList.count;
|
||||
/* totalServiceItems = serviceItemList.count; */
|
||||
console.log("THE TOTAL SERVICE ITEMS: " + totalServiceItems);
|
||||
}
|
||||
|
||||
function removeItem(index) {
|
||||
ServiceItemModel.removeItem(index);
|
||||
totalServiceItems--;
|
||||
/* totalServiceItems--; */
|
||||
}
|
||||
|
||||
function addItem(index, name, type,
|
||||
|
@ -521,7 +521,7 @@ Item {
|
|||
type, background,
|
||||
backgroundType, newtext,
|
||||
audio, font, fontSize, newtext.length);
|
||||
totalServiceItems++;
|
||||
/* totalServiceItems++; */
|
||||
return;
|
||||
}
|
||||
if (type === "presentation") {
|
||||
|
@ -530,14 +530,14 @@ Item {
|
|||
type, background,
|
||||
backgroundType, "",
|
||||
"", "", 0, dragItemSlideNumber);
|
||||
totalServiceItems++;
|
||||
/* totalServiceItems++; */
|
||||
return;
|
||||
}
|
||||
console.log("adding: " + name + " of type " + type);
|
||||
ServiceItemModel.insertItem(index, name,
|
||||
type, background,
|
||||
backgroundType);
|
||||
totalServiceItems++;
|
||||
/* totalServiceItems++; */
|
||||
}
|
||||
|
||||
function appendItem(name, type, background, backgroundType,
|
||||
|
@ -552,7 +552,7 @@ Item {
|
|||
ServiceItemModel.addItem(name, type, background,
|
||||
backgroundType, lyrics,
|
||||
audio, font, fontSize);
|
||||
totalServiceItems++;
|
||||
/* totalServiceItems++; */
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -561,7 +561,7 @@ Item {
|
|||
|
||||
ServiceItemModel.addItem(name, type, background,
|
||||
backgroundType);
|
||||
totalServiceItems++;
|
||||
/* totalServiceItems++; */
|
||||
}
|
||||
|
||||
function changeItem() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue