Fix issues when there is no feed/entry image

This commit is contained in:
Bart De Vries 2021-04-06 10:12:14 +02:00
parent 83526b0a12
commit 8506068b1f
4 changed files with 20 additions and 20 deletions

View File

@ -16,7 +16,7 @@ Kirigami.SwipeListItem {
contentItem: RowLayout {
Kirigami.Icon {
source: Fetcher.image(entry.image)
source: model.entry.image === "" ? "rss" : Fetcher.image(model.entry.image)
height: parent.height
width: height
}

View File

@ -85,7 +85,7 @@ Kirigami.ScrollablePage {
height: root.height * 0.2
Kirigami.Icon {
source: Fetcher.image(page.feed.image)
source: page.feed.image === "" ? "rss" : Fetcher.image(page.feed.image)
property int size: Kirigami.Units.iconSizes.large
Layout.minimumWidth: size
Layout.minimumHeight: size

View File

@ -21,7 +21,7 @@ Kirigami.ScrollablePage {
ColumnLayout {
Kirigami.Icon {
source: Fetcher.image(feed.image)
source: feed.image === "" ? "rss" : Fetcher.image(feed.image)
property int size: Kirigami.Units.iconSizes.huge
Layout.minimumHeight: size
Layout.minimumWidth: size

View File

@ -23,7 +23,7 @@ Kirigami.SwipeListItem {
onMoveRequested: DataManager.moveQueueItem(oldIndex, newIndex)
}
Kirigami.Icon {
source: Fetcher.image(model.entry.image)
source: entry.image === "" ? "rss" : Fetcher.image(entry.image)
property int size: Kirigami.Units.iconSizes.medium
Layout.minimumHeight: size
Layout.minimumWidth: size
@ -33,10 +33,10 @@ Kirigami.SwipeListItem {
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Controls.Label {
text: model.entry.title
text: entry.title
Layout.fillWidth: true
elide: Text.ElideRight
font.weight: model.entry.read ? Font.Normal : Font.Bold
font.weight: entry.read ? Font.Normal : Font.Bold
opacity: 1
}
Loader {
@ -45,11 +45,11 @@ Kirigami.SwipeListItem {
Component {
id: subtitle
Controls.Label {
text: model.entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (model.entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + model.entry.authors[0].name)
text: entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + entry.authors[0].name)
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: model.entry.read ? 0.7 : 0.9
opacity: entry.read ? 0.7 : 0.9
visible: !downloadProgress.visible
}
}
@ -58,8 +58,8 @@ Kirigami.SwipeListItem {
Controls.ProgressBar {
from: 0
to: 100
value: model.entry.enclosure.downloadProgress
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloading
value: entry.enclosure.downloadProgress
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
Layout.fillWidth: true
}
}
@ -68,8 +68,8 @@ Kirigami.SwipeListItem {
}
onClicked: {
model.entry.read = true
pageStack.push("qrc:/EntryPage.qml", {"entry": model.entry})
entry.read = true
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
}
actions: [
@ -77,32 +77,32 @@ Kirigami.SwipeListItem {
iconName: "media-playback-start"
text: "Play"
onTriggered: {
audio.entry = model.entry
audio.entry = entry
audio.play()
}
},
Kirigami.Action {
text: i18n("Download")
icon.name: "download"
onTriggered: model.entry.enclosure.download()
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloadable
onTriggered: entry.enclosure.download()
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
},
Kirigami.Action {
text: i18n("Cancel download")
icon.name: "edit-delete-remove"
onTriggered: model.entry.enclosure.cancelDownload()
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloading
onTriggered: entry.enclosure.cancelDownload()
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
},
Kirigami.Action {
text: i18n("Delete download")
icon.name: "delete"
onTriggered: model.entry.enclosure.deleteFile()
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloaded
onTriggered: entry.enclosure.deleteFile()
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
},
Kirigami.Action {
text: i18n("Remove from Queue")
icon.name: "delete-table-row"
onTriggered: { DataManager.removeQueueItem(model.entry) }
onTriggered: { DataManager.removeQueueItem(entry) }
}
]
}