Shutup LinkPreviewDelegate

Make sure that the console isn't spammed having `linkpreviewer` undefined in `LinkPreviewDelegate`, even though it shouldn't ever be and I couldn't find any case where it was but my console was still intermittently getting spammed.
This commit is contained in:
James Graham
2023-09-11 06:27:13 +00:00
parent 83b3fefbf5
commit cd39d5b129
4 changed files with 19 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ Loader {
* - description - the description of the URL preview.
* - imageSource - a source URL for the preview image.
*/
property var linkPreviewer
required property var linkPreviewer
/**
* @brief Standard height for the link preview.
@@ -39,7 +39,7 @@ Loader {
property bool indicatorEnabled: false
visible: active
sourceComponent: linkPreviewer.loaded ? linkPreviewComponent : loadingComponent
sourceComponent: linkPreviewer && linkPreviewer.loaded ? linkPreviewComponent : loadingComponent
Component {
id: linkPreviewComponent
@@ -61,10 +61,10 @@ Loader {
color: Kirigami.Theme.highlightColor
}
Image {
visible: linkPreviewer.imageSource
visible: root.linkPreviewer.imageSource
Layout.maximumHeight: root.defaultHeight
Layout.maximumWidth: root.defaultHeight
source: linkPreviewer.imageSource
source: root.linkPreviewer.imageSource
fillMode: Image.PreserveAspectFit
}
ColumnLayout {

View File

@@ -68,7 +68,7 @@ TimelineContainer {
}
LinkPreviewDelegate {
Layout.fillWidth: true
active: !currentRoom.usesEncryption && currentRoom.urlPreviewEnabled && Config.showLinkPreview && root.showLinkPreview
active: !currentRoom.usesEncryption && currentRoom.urlPreviewEnabled && Config.showLinkPreview && root.showLinkPreview && !root.linkPreview.empty
linkPreviewer: root.linkPreview
indicatorEnabled: root.isVisibleInTimeline()
}