From 9109636f0728307c4219b97bd94346007e0c5c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= Date: Tue, 10 Oct 2023 23:28:23 +0200 Subject: [PATCH] Show an error messages in image preview popup on error Closes #150 --- modules/Lith/UI/PreviewPopup.qml | 41 ++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/modules/Lith/UI/PreviewPopup.qml b/modules/Lith/UI/PreviewPopup.qml index 7a87b7a..70d266c 100644 --- a/modules/Lith/UI/PreviewPopup.qml +++ b/modules/Lith/UI/PreviewPopup.qml @@ -15,12 +15,12 @@ // along with this program; If not, see . import QtQuick -import QtQuick.Controls import QtQuick.Layouts import QtMultimedia as Multimedia //import QtWebView import Lith.Core +import Lith.Style Dialog { id: root @@ -35,7 +35,10 @@ Dialog { topMargin: 0 bottomInset: 0 padding: 0 - background: Item {} + background: Rectangle { + color: palette.base + opacity: 0.5 + } property string currentUrl @@ -265,7 +268,6 @@ Dialog { duration: 60 } } - } BusyIndicator { @@ -344,6 +346,35 @@ Dialog { delegateImage.scale = 1.0 } } + + ColumnLayout { + visible: delegateImage.status === Image.Error + anchors.centerIn: delegateImage + width: parent.width / 3.0 * 2.0 + spacing: 12 + Image { + Layout.alignment: Qt.AlignHCenter + width: 32 + height: 32 + source: "qrc:/navigation/"+WindowHelper.currentThemeName+"/dizzy.png" + } + Label { + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + wrapMode: Label.Wrap + color: "red" + horizontalAlignment: Label.AlignHCenter + text: delegateImage.status === Image.Error ? qsTr("The picture could not be displayed") : "" + } + Label { + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + wrapMode: Label.Wrap + horizontalAlignment: Label.AlignHCenter + text: qsTr("URL: %1").arg(delegateImage.source) + textFormat: Label.RichText + } + } } Item { @@ -424,10 +455,10 @@ Dialog { spacing: 12 Label { id: errorMsgText - visible: delegateImage.status === Image.Error || delegateVideo.errorString.length > 0 + visible: delegateVideo.errorString.length > 0 Layout.alignment: Qt.AlignHCenter color: "red" - text: delegateImage.status === Image.Error ? qsTr("The picture could not be displayed") : delegateVideo.errorString + text: delegateVideo.errorString } RowLayout { spacing: 24