1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-25 04:02:50 +01:00

Fix resetting wallpaperPreviewImage

Fix popup src path and parent
Fix import
Fix removing wallpaper in ContentSettingsView
This commit is contained in:
Elias Steurer 2024-11-14 11:14:22 +01:00
parent 9ce8920d0b
commit 6fa1178b32
4 changed files with 18 additions and 10 deletions

View File

@ -139,9 +139,12 @@ Control {
let timelineSection = timelineSectionList[i]; let timelineSection = timelineSectionList[i];
let lineIndicator = timeline.sectionsList[i].lineIndicator; let lineIndicator = timeline.sectionsList[i].lineIndicator;
// References a single wallpaper // Reset the preview image
if (timelineSection.wallpaperData.length === 0) if (timelineSection.wallpaperData.length === 0){
lineIndicator.wallpaperPreviewImage = ""
continue; continue;
}
let firstWallpaper = timelineSection.wallpaperData[0]; let firstWallpaper = timelineSection.wallpaperData[0];
lineIndicator.wallpaperPreviewImage = Qt.resolvedUrl("file:///" + firstWallpaper.absolutePath + "/" + firstWallpaper.previewImage); lineIndicator.wallpaperPreviewImage = Qt.resolvedUrl("file:///" + firstWallpaper.absolutePath + "/" + firstWallpaper.previewImage);
} }

View File

@ -156,11 +156,14 @@ Util.Popup {
return; return;
} }
monitorSelection.enabled = false; monitorSelection.enabled = false;
App.screenPlayManager.removeWallpaperAt(index, selectedTimeline.identifier, selectedTimeline.index).then(result => { App.screenPlayManager.removeWallpaperAt(selectedTimeline.index, selectedTimeline.identifier, index).then(result => {
monitorSelection.enabled = true; monitorSelection.enabled = true;
if (!result.success) { if (result.success) {
InstantPopup.openErrorPopup(this, result); // Reset to update the wallpaper preview image
} timeline.setActiveWallpaperPreviewImage();
} else {
InstantPopup.openErrorPopup(Window.window.contentItem, result.message);
}
}); });
} }

View File

@ -5,8 +5,7 @@ import QtQuick.Controls.Material
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Dialogs import QtQuick.Dialogs
import ScreenPlayApp import ScreenPlayApp
import ScreenPlayCore as Util
import ScreenPlayUtil as Util
import "../../" import "../../"
Item { Item {

View File

@ -3,8 +3,11 @@
var errorPopup var errorPopup
/* /*
Creates error popups in js Creates error popups in js. Make sure you are parenting to an item.
Alternativly use InstantPopup.openErrorPopup(Window.window.contentItem, message);
We cannot access window in here, so the developer must provide it...
*/ */
function openErrorPopup(parent, errorMsg) { function openErrorPopup(parent, errorMsg) {
console.error(errorMsg) console.error(errorMsg)
@ -18,7 +21,7 @@ function openErrorPopup(parent, errorMsg) {
if (!errorPopup) { if (!errorPopup) {
var errorComponent = Qt.createComponent( var errorComponent = Qt.createComponent(
"qrc:/qml/ScreenPlayUtil/qml/ErrorPopup.qml") "qrc:/qml/ScreenPlayCore/qml/ErrorPopup.qml")
if (errorComponent.status === QtQ.Component.Ready) { if (errorComponent.status === QtQ.Component.Ready) {
errorPopup = errorComponent.createObject(parent) errorPopup = errorComponent.createObject(parent)
} else { } else {