using better naming for the item's index rather than ID

This commit is contained in:
Chris Cochrun 2023-10-28 06:15:23 -05:00
parent eff14e8a8b
commit 0c7305e3d4

View file

@ -551,10 +551,10 @@ Item {
serviceItemList.forceLayout() serviceItemList.forceLayout()
} }
function addItem(index, type, itemID) { function addItem(index, type, itemIndex) {
switch (type) { switch (type) {
case 'image': { case 'image': {
const image = imageProxyModel.getImage(itemID); const image = imageProxyModel.getImage(itemIndex);
console.log("adding: " + image.title + " of type " + type); console.log("adding: " + image.title + " of type " + type);
ServiceItemModel.insertItem(index, image.title, ServiceItemModel.insertItem(index, image.title,
"", type, image.filePath, "", type, image.filePath,
@ -564,7 +564,7 @@ Item {
return; return;
} }
case 'video': { case 'video': {
const video = videoProxyModel.getVideo(itemID); const video = videoProxyModel.getVideo(itemIndex);
console.log("adding: " + video.title + " of type " + type); console.log("adding: " + video.title + " of type " + type);
ServiceItemModel.insertItem(index, video.title, ServiceItemModel.insertItem(index, video.title,
"", type, video.filePath, "", type, video.filePath,
@ -574,8 +574,8 @@ Item {
return; return;
} }
case 'song': { case 'song': {
const lyrics = songProxyModel.getLyricList(itemID); const lyrics = songProxyModel.getLyricList(itemIndex);
const song = songProxyModel.getSong(itemID); const song = songProxyModel.getSong(itemIndex);
/* showPassiveNotification(song.title); */ /* showPassiveNotification(song.title); */
console.log("adding: " + song.title + console.log("adding: " + song.title +
" of type " + type + " of type " + type +
@ -589,7 +589,7 @@ Item {
return; return;
} }
case 'presentation': { case 'presentation': {
const pres = presProxyModel.getPresentation(itemID); const pres = presProxyModel.getPresentation(itemIndex);
console.log("adding: " + pres.title + console.log("adding: " + pres.title +
" of type " + type + " of type " + type +
" with " + pres.pageCount + " slides"); " with " + pres.pageCount + " slides");
@ -606,10 +606,10 @@ Item {
/* totalServiceItems++; */ /* totalServiceItems++; */
} }
function appendItem(type, itemID) { function appendItem(type, itemIndex) {
switch (type) { switch (type) {
case 'image': { case 'image': {
const image = imageProxyModel.getImage(itemID); const image = imageProxyModel.getImage(itemIndex);
console.log("adding: " + image.title + " of type " + type); console.log("adding: " + image.title + " of type " + type);
ServiceItemModel.addItem(image.title, ServiceItemModel.addItem(image.title,
type, image.filePath, type, image.filePath,
@ -619,7 +619,7 @@ Item {
return; return;
} }
case 'video': { case 'video': {
const video = videoProxyModel.getVideo(itemID); const video = videoProxyModel.getVideo(itemIndex);
console.log("adding: " + video.title + " of type " + type); console.log("adding: " + video.title + " of type " + type);
ServiceItemModel.addItem(video.title, ServiceItemModel.addItem(video.title,
type, video.filePath, type, video.filePath,
@ -629,8 +629,8 @@ Item {
return; return;
} }
case 'song': { case 'song': {
const lyrics = songProxyModel.getLyricList(itemID); const lyrics = songProxyModel.getLyricList(itemIndex);
const song = songProxyModel.getSong(itemID); const song = songProxyModel.getSong(itemIndex);
console.log("adding: " + song.title + console.log("adding: " + song.title +
" of type " + type + " of type " + type +
" with " + lyrics.length + " slides"); " with " + lyrics.length + " slides");
@ -643,7 +643,7 @@ Item {
return; return;
} }
case 'presentation': { case 'presentation': {
const pres = presProxyModel.getPresentation(itemID); const pres = presProxyModel.getPresentation(itemIndex);
console.log("adding: " + pres.title + console.log("adding: " + pres.title +
" of type " + type + " of type " + type +
" with " + pres.pageCount + " slides"); " with " + pres.pageCount + " slides");