diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index fcfc9bf..6f44337 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -53,7 +53,7 @@ ColumnLayout { onEntered: (drag) => { if (drag.keys[0] === "library") { dropHighlightLine.visible = true; - var lastItem = serviceItemList.itemAtIndex(serviceItemModel.rowCount() - 1); + var lastItem = serviceItemList.itemAtIndex(ServiceItemModel.rowCount() - 1); dropHighlightLine.y = lastItem.y + lastItem.height; } } @@ -63,7 +63,7 @@ ColumnLayout { ListView { id: serviceItemList anchors.fill: parent - /* model: serviceItemModel */ + /* model: ServiceItemModel */ /* delegate: Kirigami.DelegateRecycler { */ /* width: serviceItemList.width */ /* sourceComponent: itemDelegate */ @@ -95,7 +95,7 @@ ColumnLayout { model: DelegateModel { id: visualModel - model: serviceItemModel + model: ServiceItemModel delegate: DropArea { id: serviceDrop @@ -125,7 +125,7 @@ ColumnLayout { dragItemText, dragItemIndex); } else if (drag.keys[0] === "serviceitem") { - serviceItemModel.move(serviceItemList.indexDragged, + ServiceItemModel.move(serviceItemList.indexDragged, serviceItemList.moveToIndex); serviceItemList.currentIndex = moveToIndex; } @@ -374,7 +374,7 @@ ColumnLayout { } function removeItem(index) { - serviceItemModel.removeItem(index); + ServiceItemModel.removeItem(index); totalServiceItems--; } @@ -382,7 +382,7 @@ ColumnLayout { background, backgroundType, text, itemID) { const newtext = songsqlmodel.getLyricList(itemID); console.log("adding: " + name + " of type " + type); - serviceItemModel.insertItem(index, name, + ServiceItemModel.insertItem(index, name, type, background, backgroundType, newtext); totalServiceItems++; @@ -400,7 +400,7 @@ ColumnLayout { console.log(background); console.log(backgroundType); - serviceItemModel.addItem(name, type, background, + ServiceItemModel.addItem(name, type, background, backgroundType, lyrics); totalServiceItems++; } diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 2ea44eb..025c001 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -37,7 +37,7 @@ Controls.Page { property var song property var draggedLibraryItem - property var serviceItems: serviceItemModel + property var serviceItems: ServiceItemModel property bool songDragged: false @@ -50,7 +50,7 @@ Controls.Page { Component.onCompleted: { changeServiceItem(0); presentation.forceActiveFocus(); - /* const loaded = serviceItemModel.loadLastSaved(); */ + /* const loaded = ServiceItemModel.loadLastSaved(); */ /* if (!loaded) */ /* showPassiveNotification("Failed loading last file"); */ } @@ -146,16 +146,12 @@ Controls.Page { id: pressqlmodel } - ServiceItemModel { - id: serviceItemModel - } - ServiceThing { id: serviceThing } function changeServiceItem(index) { - const item = serviceItemModel.getItem(index); + const item = ServiceItemModel.getItem(index); currentServiceItem = index; console.log("index grabbed: " + index); console.log(item); @@ -165,7 +161,7 @@ Controls.Page { /* presentation.itemType = item.type; */ console.log("Time to start changing"); - serviceItemModel.activate(index); + ServiceItemModel.activate(index); SlideObject.changeSlide(item); /* if (item.backgroundType === "video") */ @@ -174,7 +170,7 @@ Controls.Page { /* } */ presentation.textIndex = 0; - /* serviceItemModel.select(index); */ + /* ServiceItemModel.select(index); */ /* presentation.changeSlide(); */ console.log("Slide changed to: " + item.name); diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index 93cc225..9a5b76a 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -187,7 +187,7 @@ FocusScope { spacing: Kirigami.Units.smallSpacing * 2 cacheBuffer: 900 reuseItems: true - model: serviceItemModel + model: ServiceItemModel delegate: Presenter.PreviewSlideListDelegate {} Kirigami.WheelHandler { @@ -280,7 +280,7 @@ FocusScope { keyHandler.forceActiveFocus(); console.log(currentServiceItem); const nextServiceItemIndex = currentServiceItem + 1; - const nextItem = serviceItemModel.getItem(nextServiceItemIndex); + const nextItem = ServiceItemModel.getItem(nextServiceItemIndex); console.log("currentServiceItem " + currentServiceItem); console.log("nextServiceItem " + nextServiceItemIndex); console.log(nextItem.name); @@ -304,7 +304,7 @@ FocusScope { function previousSlideAction() { keyHandler.forceActiveFocus(); const prevServiceItemIndex = currentServiceItem - 1; - const prevItem = serviceItemModel.getItem(prevServiceItemIndex); + const prevItem = ServiceItemModel.getItem(prevServiceItemIndex); console.log("currentServiceItem " + currentServiceItem); console.log("prevServiceItem " + prevServiceItemIndex); console.log(prevItem.name); diff --git a/src/qml/presenter/PreviewSlideListDelegate.qml b/src/qml/presenter/PreviewSlideListDelegate.qml index 935586f..4d18d7f 100644 --- a/src/qml/presenter/PreviewSlideListDelegate.qml +++ b/src/qml/presenter/PreviewSlideListDelegate.qml @@ -93,7 +93,7 @@ Item { Connections { - target: serviceItemModel + target: ServiceItemModel onDataChanged: if (active) previewSlidesList.positionViewAtIndex(index, ListView.Contain) } diff --git a/src/qml/presenter/ServiceList.qml b/src/qml/presenter/ServiceList.qml index 9ec5873..a62276c 100644 --- a/src/qml/presenter/ServiceList.qml +++ b/src/qml/presenter/ServiceList.qml @@ -78,7 +78,7 @@ Item { onEntered: (drag) => { if (drag.keys[0] === "library") { dropHighlightLine.visible = true; - var lastItem = serviceItemList.itemAtIndex(serviceItemModel.rowCount() - 1); + var lastItem = serviceItemList.itemAtIndex(ServiceItemModel.rowCount() - 1); dropHighlightLine.y = lastItem.y + lastItem.height; } } @@ -120,7 +120,7 @@ Item { dragItemFontSize, dragItemIndex); } else if (drag.keys[0] === "serviceitem") { - /* serviceItemModel.moveRows(serviceItemList.indexDragged, */ + /* ServiceItemModel.moveRows(serviceItemList.indexDragged, */ /* serviceItemList.moveToIndex, 1); */ /* serviceItemList.currentIndex = moveToIndex; */ } @@ -242,7 +242,7 @@ Item { rightClickMenu.popup(mouse); else { serviceItemList.currentIndex = index; - serviceItemModel.select(index); + ServiceItemModel.select(index); } } @@ -264,7 +264,7 @@ Item { /* width: 20 */ listItem: serviceListItem listView: serviceItemList - onMoveRequested: serviceItemModel.moveRows(oldIndex, + onMoveRequested: ServiceItemModel.moveRows(oldIndex, newIndex, 1) } @@ -315,7 +315,7 @@ Item { NumberAnimation {properties: "x, y"; duration: 100} } - model: serviceItemModel + model: ServiceItemModel delegate: Kirigami.DelegateRecycler { width: serviceItemList.width @@ -348,7 +348,7 @@ Item { /* function moveRequested(oldIndex, newIndex) { */ /* console.log("moveRequested: ", oldIndex, newIndex); */ - /* serviceItemModel.moveRows(oldIndex, newIndex, 1); */ + /* ServiceItemModel.moveRows(oldIndex, newIndex, 1); */ /* indexDragged = newIndex; */ /* serviceItemList.currentIndex = newIndex; */ /* } */ @@ -446,7 +446,7 @@ Item { const newid = serviceItemList.currentIndex - 1; showPassiveNotification(oldid + " " + newid); showPassiveNotification("Up"); - const ans = serviceItemModel.moveRows(oldid, newid, 1); + const ans = ServiceItemModel.moveRows(oldid, newid, 1); if (ans) { serviceItemList.currentIndex = newid; @@ -468,7 +468,7 @@ Item { return; }; showPassiveNotification("moving ", id, " down"); - const ans = serviceItemModel.moveDown(id); + const ans = ServiceItemModel.moveDown(id); if (ans) { serviceItemList.currentIndex = id + 1; @@ -487,6 +487,14 @@ Item { showPassiveNotification("remove"); removeItem(serviceItemList.currentIndex); } + }, + Kirigami.Action { + text: "Clear" + icon.name: "recycle" + onTriggered: { + showPassiveNotification("clearing all items"); + ServiceItemModel.clearAll(); + } } ] } @@ -499,7 +507,7 @@ Item { } function removeItem(index) { - serviceItemModel.removeItem(index); + ServiceItemModel.removeItem(index); totalServiceItems--; } @@ -509,7 +517,7 @@ Item { if (type === "song") { const newtext = songsqlmodel.getLyricList(itemID); console.log("adding: " + name + " of type " + type + " with " + newtext.length + " slides"); - serviceItemModel.insertItem(index, name, + ServiceItemModel.insertItem(index, name, type, background, backgroundType, newtext, audio, font, fontSize, newtext.length); @@ -518,7 +526,7 @@ Item { } if (type === "presentation") { console.log("adding: " + name + " of type " + type + " with " + dragItemSlideNumber + " slides"); - serviceItemModel.insertItem(index, name, + ServiceItemModel.insertItem(index, name, type, background, backgroundType, "", "", "", 0, dragItemSlideNumber); @@ -526,7 +534,7 @@ Item { return; } console.log("adding: " + name + " of type " + type); - serviceItemModel.insertItem(index, name, + ServiceItemModel.insertItem(index, name, type, background, backgroundType); totalServiceItems++; @@ -541,7 +549,7 @@ Item { console.log(itemID); lyrics = songsqlmodel.getLyricList(itemID); console.log(lyrics); - serviceItemModel.addItem(name, type, background, + ServiceItemModel.addItem(name, type, background, backgroundType, lyrics, audio, font, fontSize); totalServiceItems++; @@ -551,7 +559,7 @@ Item { console.log(background); console.log(backgroundType); - serviceItemModel.addItem(name, type, background, + ServiceItemModel.addItem(name, type, background, backgroundType); totalServiceItems++; }