mirror of
https://github.com/KDE/kasts.git
synced 2025-02-03 18:57:32 +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")
|
placeholderText: i18n("Search podcastindex.org")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
searchButton.clicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Controls.Button {
|
Controls.Button {
|
||||||
id: searchButton
|
id: searchButton
|
||||||
@ -41,6 +44,7 @@ Kirigami.ScrollablePage {
|
|||||||
id: delegateComponent
|
id: delegateComponent
|
||||||
Kirigami.SwipeListItem {
|
Kirigami.SwipeListItem {
|
||||||
id: listItem
|
id: listItem
|
||||||
|
alwaysVisibleActions: true
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
source: model.image
|
source: model.image
|
||||||
@ -67,8 +71,7 @@ Kirigami.ScrollablePage {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
onClicked: {
|
onClicked: {
|
||||||
feedModel = model
|
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": model, isSubscribed: false})
|
||||||
detailDrawer.open();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,36 +87,4 @@ Kirigami.ScrollablePage {
|
|||||||
sourceComponent: delegateComponent
|
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
|
id: page
|
||||||
|
|
||||||
property QtObject feed;
|
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 {
|
header: GenericHeader {
|
||||||
id: headerImage
|
id: headerImage
|
||||||
|
|
||||||
image: feed.cachedImage
|
image: isSubscribed ? feed.cachedImage : feed.image
|
||||||
title: feed.name
|
title: isSubscribed ? feed.name : feed.title
|
||||||
subtitle: page.feed.authors.length === 0 ? "" : i18nc("by <Author(s)>", "by %1", page.feed.authors[0].name)
|
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 {
|
ColumnLayout {
|
||||||
@ -36,8 +50,8 @@ Kirigami.ScrollablePage {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
text: i18nc("by <Author(s)>", "by %1", feed.authors[0].name)
|
text: i18nc("by <Author(s)>", "by %1", isSubscribed ? feed.authors[0].name : feed.author)
|
||||||
visible: feed.authors.length !== 0
|
visible: isSubscribed ? feed.authors.length !== 0 : feed.author !== ""
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
@ -48,17 +62,20 @@ Kirigami.ScrollablePage {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Controls.Label {
|
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
|
wrapMode: Text.WordWrap
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Controls.Label {
|
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
|
wrapMode: Text.WordWrap
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
text: i18np("1 Episode", "%1 Episodes", feed.entryCount) + ", " + i18np("1 Unplayed", "%1 Unplayed", feed.unreadEntryCount)
|
text: i18np("1 Episode", "%1 Episodes", feed.entryCount) + ", " + i18np("1 Unplayed", "%1 Unplayed", feed.unreadEntryCount)
|
||||||
|
visible: isSubscribed
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user