ok I added some proxy models to all sql models, but they aint done..

This commit is contained in:
Chris Cochrun 2023-02-17 16:14:50 -06:00
parent cc501873c1
commit c9f6fc4d1b
8 changed files with 117 additions and 71 deletions

View file

@ -48,7 +48,7 @@ Item {
anchors {left: songLabel.right
verticalCenter: songLabel.verticalCenter
leftMargin: 15}
text: songSqlModel.rowCount()
text: songProxyModel.songModel.rowCount()
color: Kirigami.Theme.disabledTextColor
}
@ -288,7 +288,7 @@ Item {
y: songClickHandler.mouseY + 10
Kirigami.Action {
text: "delete"
onTriggered: songSqlModel.deleteSong(index)
onTriggered: songProxyModel.deleteSong(index)
}
}
}
@ -312,8 +312,8 @@ Item {
}
function newSong() {
songSqlModel.newSong();
songLibraryList.currentIndex = songSqlModel.rowCount() - 1;
songProxyModel.songModel.newSong();
songLibraryList.currentIndex = songProxyModel.songModel.rowCount() - 1;
if (!editMode)
editMode = true;
editType = "song";
@ -343,7 +343,7 @@ Item {
anchors {left: videoLabel.right
verticalCenter: videoLabel.verticalCenter
leftMargin: 15}
text: videoSqlModel.rowCount()
text: videoProxyModel.videoModel.rowCount()
font.pixelSize: 15
color: Kirigami.Theme.disabledTextColor
}
@ -586,7 +586,7 @@ Item {
rightClickVideoMenu.popup()
else{
videoLibraryList.currentIndex = index
const video = videoSqlModel.getVideo(videoLibraryList.currentIndex);
const video = videoProxyModel.videoModel.getVideo(videoLibraryList.currentIndex);
if (!editMode)
editMode = true;
editType = "video";
@ -602,7 +602,7 @@ Item {
y: videoClickHandler.mouseY + 10
Kirigami.Action {
text: "delete"
onTriggered: videoSqlModel.deleteVideo(index)
onTriggered: videoProxyModel.deleteVideo(index)
}
}
}
@ -614,7 +614,6 @@ Item {
/* anchors.left: videoLibraryList.right */
active: hovered || pressed
}
}
Rectangle {
@ -639,7 +638,7 @@ Item {
anchors {left: imageLabel.right
verticalCenter: imageLabel.verticalCenter
leftMargin: 15}
text: imageSqlModel.rowCount()
text: imageProxyModel.imageModel.rowCount()
font.pixelSize: 15
color: Kirigami.Theme.disabledTextColor
}
@ -881,7 +880,7 @@ Item {
rightClickImageMenu.popup()
else{
imageLibraryList.currentIndex = index
const image = imageSqlModel.getImage(imageLibraryList.currentIndex);
const image = imageProxyModel.imageModel.getImage(imageLibraryList.currentIndex);
if (!editMode)
editMode = true;
editType = "image";
@ -897,7 +896,7 @@ Item {
y: imageClickHandler.mouseY + 10
Kirigami.Action {
text: "delete"
onTriggered: imageSqlModel.deleteImage(index)
onTriggered: imageProxyModel.deleteImage(index)
}
}
}
@ -933,7 +932,7 @@ Item {
anchors {left: presentationLabel.right
verticalCenter: presentationLabel.verticalCenter
leftMargin: 10}
text: presSqlModel.rowCount()
text: presProxyModel.presentationModel.rowCount()
font.pixelSize: 15
color: Kirigami.Theme.disabledTextColor
}
@ -1166,7 +1165,7 @@ Item {
rightClickPresMenu.popup()
else{
presentationLibraryList.currentIndex = index
const pres = presSqlModel.getPresentation(presentationLibraryList.currentIndex);
const pres = presProxyModel.presentationModel.getPresentation(presentationLibraryList.currentIndex);
if (!editMode)
editMode = true;
editType = "presentation";
@ -1182,7 +1181,7 @@ Item {
y: presClickHandler.mouseY + 10
Kirigami.Action {
text: "delete"
onTriggered: presSqlModel.deletePresentation(index)
onTriggered: presProxyModel.deletePresentation(index)
}
}
}
@ -1355,11 +1354,11 @@ Item {
onExited: overlay = false
function addVideo(url) {
videoSqlModel.newVideo(url);
videoProxyModel.videoModel.newVideo(url);
selectedLibrary = "videos";
videoLibraryList.currentIndex = videoSqlModel.rowCount();
console.log(videoSqlModel.getVideo(videoLibraryList.currentIndex));
const video = videoSqlModel.getVideo(videoLibraryList.currentIndex);
videoLibraryList.currentIndex = videoProxyModel.videoModel.rowCount();
console.log(videoProxyModel.videoModel.getVideo(videoLibraryList.currentIndex));
const video = videoProxyModel.videoModel.getVideo(videoLibraryList.currentIndex);
showPassiveNotification("newest video: " + video.title);
if (!editMode)
editMode = true;
@ -1367,11 +1366,11 @@ Item {
}
function addImg(url) {
imageSqlModel.newImage(url);
imageProxyModel.imageModel.newImage(url);
selectedLibrary = "images";
imageLibraryList.currentIndex = imageSqlModel.rowCount();
console.log(imageSqlModel.getImage(imageLibraryList.currentIndex));
const image = imageSqlModel.getImage(imageLibraryList.currentIndex);
imageLibraryList.currentIndex = imageProxyModel.imageModel.rowCount();
console.log(imageProxyModel.imageModel.getImage(imageLibraryList.currentIndex));
const image = imageProxyModel.imageModel.getImage(imageLibraryList.currentIndex);
showPassiveNotification("newest image: " + image.title);
if (!editMode)
editMode = true;
@ -1385,11 +1384,11 @@ Item {
console.log(pdf.status);
console.log("PAGECOUNT: " + pdf.pageCount);
}
presSqlModel.newPresentation(url, pdf.pageCount);
presProxyModel.presentationModel.newPresentation(url, pdf.pageCount);
selectedLibrary = "presentations";
presentationLibraryList.currentIndex = presSqlModel.rowCount();
console.log(presSqlModel.getPresentation(presentationLibraryList.currentIndex));
const presentation = presSqlModel.getImage(presentationLibraryList.currentIndex);
presentationLibraryList.currentIndex = presProxyModel.presentationModel.rowCount();
console.log(presProxyModel.presentationModel.getPresentation(presentationLibraryList.currentIndex));
const presentation = presProxyModel.presentationModel.getImage(presentationLibraryList.currentIndex);
showPassiveNotification("newest image: " + presentation.title);
if (!editMode)
editMode = true;
@ -1459,29 +1458,9 @@ Item {
border.color: overlay ? Kirigami.Theme.hoverColor : "#00000000"
}
// used for detecting number of pages without the need for PoDoFo
PdfDocument {
id: pdf
}
MpvObject {
id: thumbnailer
useHwdec: true
enableAudio: false
width: 0
height: 0
Component.onCompleted: console.log("ready")
onFileLoaded: {
thumbnailer.pause();
console.log("FILE: " + thumbnailer.mediaTitle);
thumbnailer.screenshotToFile(thumbnailFile(thumbnailer.mediaTitle));
showPassiveNotification("Screenshot Taken to: " + thumbnailFile(thumbnailer.mediaTitle));
thumbnailer.stop();
}
function thumbnailFile(title) {
const thumbnailFolder = Labs.StandardPaths.writableLocation(Labs.StandardPaths.AppDataLocation) + "/thumbnails/";
return Qt.resolvedUrl(thumbnailFolder + title);
}
}
}
}

View file

@ -321,7 +321,7 @@ Item {
function changeSong(index) {
clearSlides();
console.log(index);
const s = songsqlmodel.getSong(index);
const s = songProxyModel.songModel.getSong(index);
song = s;
songLyrics = s.lyrics;
songIndex = index;
@ -344,41 +344,41 @@ Item {
}
function updateLyrics(lyrics) {
songsqlmodel.updateLyrics(songIndex, lyrics);
songProxyModel.songModel.updateLyrics(songIndex, lyrics);
songLyrics = lyrics;
clearSlides();
changeSlideText(songIndex);
}
function updateTitle(title) {
songsqlmodel.updateTitle(songIndex, title)
songProxyModel.songModel.updateTitle(songIndex, title)
}
function updateAuthor(author) {
songsqlmodel.updateAuthor(songIndex, author)
songProxyModel.songModel.updateAuthor(songIndex, author)
}
function updateAudio(audio) {
songsqlmodel.updateAudio(songIndex, audio)
songProxyModel.songModel.updateAudio(songIndex, audio)
}
function updateCcli(ccli) {
songsqlmodel.updateCcli(songIndex, ccli)
songProxyModel.songModel.updateCcli(songIndex, ccli)
}
function updateVerseOrder(vorder) {
songsqlmodel.updateVerseOrder(songIndex, vorder)
songProxyModel.songModel.updateVerseOrder(songIndex, vorder)
}
function updateAudioFile(file) {
songsqlmodel.updateAudio(songIndex, file);
songProxyModel.songModel.updateAudio(songIndex, file);
}
function updateBackground(background, backgroundType) {
song.backgroundType = backgroundType;
song.background = background;
songsqlmodel.updateBackground(songIndex, background);
songsqlmodel.updateBackgroundType(songIndex, backgroundType);
songProxyModel.songModel.updateBackground(songIndex, background);
songProxyModel.songModel.updateBackgroundType(songIndex, backgroundType);
console.log("changed background");
if (backgroundType === "image") {
//todo
@ -395,23 +395,23 @@ Item {
function updateHorizontalTextAlignment(textAlignment) {
changeSlideHAlignment(textAlignment);
songsqlmodel.updateHorizontalTextAlignment(songIndex, textAlignment);
songProxyModel.songModel.updateHorizontalTextAlignment(songIndex, textAlignment);
}
function updateVerticalTextAlignment(textAlignment) {
changeSlideVAlignment(textAlignment);
songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment)
songProxyModel.songModel.updateVerticalTextAlignment(songIndex, textAlignment)
}
function updateFont(font) {
changeSlideFont(font, false);
songsqlmodel.updateFont(songIndex, font);
songProxyModel.songModel.updateFont(songIndex, font);
song.font = font;
}
function updateFontSize(fontSize) {
changeSlideFontSize(fontSize, false);
songsqlmodel.updateFontSize(songIndex, fontSize);
songProxyModel.songModel.updateFontSize(songIndex, fontSize);
song.fontSize = fontSize;
}
@ -468,7 +468,7 @@ Item {
function changeSlideText(id) {
/* console.log("Here are the verses: " + verses); */
const verses = songsqlmodel.getLyricList(id);
const verses = songProxyModel.songModel.getLyricList(id);
verses.forEach(slideEditor.appendVerse);
/* slideEditor.loadVideo(); */
}