From 6fa1178b3277a813949ddabf8a0799e222793f21 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 14 Nov 2024 11:14:22 +0100 Subject: [PATCH] Fix resetting wallpaperPreviewImage Fix popup src path and parent Fix import Fix removing wallpaper in ContentSettingsView --- ScreenPlay/qml/Components/Timeline.qml | 7 +++++-- .../qml/ContentSettings/ContentSettingsView.qml | 11 +++++++---- .../CreateWallpaperFileSelect.qml | 3 +-- ScreenPlayCore/qml/InstantPopup.js | 7 +++++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ScreenPlay/qml/Components/Timeline.qml b/ScreenPlay/qml/Components/Timeline.qml index 6645ba32..2ae809dd 100644 --- a/ScreenPlay/qml/Components/Timeline.qml +++ b/ScreenPlay/qml/Components/Timeline.qml @@ -139,9 +139,12 @@ Control { let timelineSection = timelineSectionList[i]; let lineIndicator = timeline.sectionsList[i].lineIndicator; - // References a single wallpaper - if (timelineSection.wallpaperData.length === 0) + // Reset the preview image + if (timelineSection.wallpaperData.length === 0){ + lineIndicator.wallpaperPreviewImage = "" continue; + } + let firstWallpaper = timelineSection.wallpaperData[0]; lineIndicator.wallpaperPreviewImage = Qt.resolvedUrl("file:///" + firstWallpaper.absolutePath + "/" + firstWallpaper.previewImage); } diff --git a/ScreenPlay/qml/ContentSettings/ContentSettingsView.qml b/ScreenPlay/qml/ContentSettings/ContentSettingsView.qml index fda3d60e..6dea725c 100644 --- a/ScreenPlay/qml/ContentSettings/ContentSettingsView.qml +++ b/ScreenPlay/qml/ContentSettings/ContentSettingsView.qml @@ -156,11 +156,14 @@ Util.Popup { return; } 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; - if (!result.success) { - InstantPopup.openErrorPopup(this, result); - } + if (result.success) { + // Reset to update the wallpaper preview image + timeline.setActiveWallpaperPreviewImage(); + } else { + InstantPopup.openErrorPopup(Window.window.contentItem, result.message); + } }); } diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml index 0345c15a..50a1bb14 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml @@ -5,8 +5,7 @@ import QtQuick.Controls.Material import QtQuick.Layouts import QtQuick.Dialogs import ScreenPlayApp - -import ScreenPlayUtil as Util +import ScreenPlayCore as Util import "../../" Item { diff --git a/ScreenPlayCore/qml/InstantPopup.js b/ScreenPlayCore/qml/InstantPopup.js index 4684bbd6..3a4f46d2 100644 --- a/ScreenPlayCore/qml/InstantPopup.js +++ b/ScreenPlayCore/qml/InstantPopup.js @@ -3,8 +3,11 @@ 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) { console.error(errorMsg) @@ -18,7 +21,7 @@ function openErrorPopup(parent, errorMsg) { if (!errorPopup) { var errorComponent = Qt.createComponent( - "qrc:/qml/ScreenPlayUtil/qml/ErrorPopup.qml") + "qrc:/qml/ScreenPlayCore/qml/ErrorPopup.qml") if (errorComponent.status === QtQ.Component.Ready) { errorPopup = errorComponent.createObject(parent) } else {