mirror of
https://github.com/KDE/kasts.git
synced 2025-02-03 10:47:30 +01:00
Reusing FeedDetailsPage to show metadata for podcasts discovery
This commit is contained in:
parent
95ee97aefe
commit
5f25a8607b
@ -23,6 +23,9 @@ Kirigami.ScrollablePage {
|
||||
placeholderText: i18n("Search podcastindex.org")
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||
Keys.onReturnPressed: {
|
||||
searchButton.clicked()
|
||||
}
|
||||
}
|
||||
Controls.Button {
|
||||
id: searchButton
|
||||
@ -41,6 +44,7 @@ Kirigami.ScrollablePage {
|
||||
id: delegateComponent
|
||||
Kirigami.SwipeListItem {
|
||||
id: listItem
|
||||
alwaysVisibleActions: true
|
||||
contentItem: RowLayout {
|
||||
Kirigami.Icon {
|
||||
source: model.image
|
||||
@ -67,8 +71,7 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
]
|
||||
onClicked: {
|
||||
feedModel = model
|
||||
detailDrawer.open();
|
||||
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": model, isSubscribed: false})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,36 +87,4 @@ Kirigami.ScrollablePage {
|
||||
sourceComponent: delegateComponent
|
||||
}
|
||||
}
|
||||
Kirigami.OverlaySheet {
|
||||
id: detailDrawer
|
||||
showCloseButton: true
|
||||
contentItem: ColumnLayout {
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 25
|
||||
GenericHeader {
|
||||
image: feedModel.image
|
||||
title: feedModel.title
|
||||
subtitle: feedModel.author
|
||||
Controls.Button {
|
||||
text: enabled ? "Subscribe" : "Subscribed"
|
||||
icon.name: "kt-add-feeds"
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.rightMargin: Kirigami.Units.largeSpacing
|
||||
anchors.topMargin: Kirigami.Units.largeSpacing
|
||||
onClicked: {
|
||||
DataManager.addFeed(feedModel.url)
|
||||
}
|
||||
enabled: !DataManager.isFeedExists(feedModel.url)
|
||||
}
|
||||
}
|
||||
Controls.Label {
|
||||
text: i18n("%1 \n\nAuthor: %2 \nOwner: %3", feedModel.description, feedModel.author, feedModel.ownerName)
|
||||
Layout.margins: Kirigami.Units.gridUnit
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
font.pointSize: SettingsManager && !(SettingsManager.articleFontUseSystem) ? SettingsManager.articleFontSize : Kirigami.Units.fontMetrics.font.pointSize
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,15 +17,29 @@ Kirigami.ScrollablePage {
|
||||
id: page
|
||||
|
||||
property QtObject feed;
|
||||
property bool isSubscribed: true
|
||||
|
||||
title: i18nc("<Podcast Name> - Details", "%1 - Details", feed.name)
|
||||
title: i18nc("<Podcast Name> - Details", "%1 - Details", isSubscribed ? feed.name : feed.title)
|
||||
|
||||
header: GenericHeader {
|
||||
id: headerImage
|
||||
|
||||
image: feed.cachedImage
|
||||
title: feed.name
|
||||
subtitle: page.feed.authors.length === 0 ? "" : i18nc("by <Author(s)>", "by %1", page.feed.authors[0].name)
|
||||
image: isSubscribed ? feed.cachedImage : feed.image
|
||||
title: isSubscribed ? feed.name : feed.title
|
||||
subtitle: isSubscribed ? (page.feed.authors.length === 0 ? "" : i18nc("by <Author(s)>", "by %1", page.feed.authors[0].name)) : feed.author
|
||||
Controls.Button {
|
||||
text: enabled ? i18n("Subscribe") : i18n("Subscribed")
|
||||
icon.name: "kt-add-feeds"
|
||||
visible: !isSubscribed
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.rightMargin: Kirigami.Units.largeSpacing
|
||||
anchors.topMargin: Kirigami.Units.largeSpacing
|
||||
onClicked: {
|
||||
DataManager.addFeed(feed.url)
|
||||
}
|
||||
enabled: !DataManager.isFeedExists(feed.url)
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
@ -36,8 +50,8 @@ Kirigami.ScrollablePage {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Controls.Label {
|
||||
text: i18nc("by <Author(s)>", "by %1", feed.authors[0].name)
|
||||
visible: feed.authors.length !== 0
|
||||
text: i18nc("by <Author(s)>", "by %1", isSubscribed ? feed.authors[0].name : feed.author)
|
||||
visible: isSubscribed ? feed.authors.length !== 0 : feed.author !== ""
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
@ -48,17 +62,20 @@ Kirigami.ScrollablePage {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Controls.Label {
|
||||
text: i18n("Subscribed since: %1", feed.subscribed.toLocaleString(Qt.locale(), Locale.ShortFormat))
|
||||
text: isSubscribed ? i18n("Subscribed since: %1", feed.subscribed.toLocaleString(Qt.locale(), Locale.ShortFormat)) : ""
|
||||
visible: isSubscribed
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Controls.Label {
|
||||
text: i18n("Last Updated: %1", feed.lastUpdated.toLocaleString(Qt.locale(), Locale.ShortFormat))
|
||||
text: isSubscribed ? i18n("Last Updated: %1", feed.lastUpdated.toLocaleString(Qt.locale(), Locale.ShortFormat)) : ""
|
||||
visible: isSubscribed
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Controls.Label {
|
||||
text: i18np("1 Episode", "%1 Episodes", feed.entryCount) + ", " + i18np("1 Unplayed", "%1 Unplayed", feed.unreadEntryCount)
|
||||
visible: isSubscribed
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user