First attempt at Swipeable episode list (all, new, unread)

This commit is contained in:
Bart De Vries 2021-04-18 09:40:19 +02:00
parent e92b02795e
commit 29d625e810
5 changed files with 72 additions and 19 deletions

View File

@ -19,6 +19,7 @@ public:
enum Type {
All,
New,
Unread,
Downloading,
Downloaded,
};

View File

@ -10,14 +10,16 @@ import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import QtGraphicalEffects 1.15
import QtMultimedia 5.15
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kirigami 2.15 as Kirigami
import org.kde.alligator 1.0
Kirigami.ScrollablePage {
id: page
title: i18n("Episode List")
Kirigami.ScrollablePage {
//anchors.fill: parent
title: i18n("New Episodes")
property var episodeType: EpisodeModel.All
supportsRefreshing: true
onRefreshingChanged: {
@ -27,13 +29,6 @@ Kirigami.ScrollablePage {
}
}
actions.main: Kirigami.Action {
text: i18n("Refresh all feeds")
iconName: "view-refresh"
onTriggered: refreshing = true
visible: !Kirigami.Settings.isMobile
}
Kirigami.PlaceholderMessage {
visible: episodeList.count === 0
@ -42,22 +37,21 @@ Kirigami.ScrollablePage {
text: i18n("No Entries available")
}
Component {
id: entryListDelegate
id: episodeListDelegate
GenericEntryDelegate {
listView: episodeList
}
}
ListView {
anchors.fill: parent
id: episodeList
visible: count !== 0
model: EpisodeModel { type: EpisodeModel.All }
model: EpisodeModel { type: episodeType }
delegate: Kirigami.DelegateRecycler {
width: episodeList.width
sourceComponent: entryListDelegate
sourceComponent: episodeListDelegate
}
}
}

View File

@ -0,0 +1,57 @@
/**
* SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
* SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.14
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import QtGraphicalEffects 1.15
import QtMultimedia 5.15
import org.kde.kirigami 2.15 as Kirigami
import org.kde.alligator 1.0
Kirigami.Page {
id: page
title: i18n("Episode List")
padding: 0
header: Controls.TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
Controls.TabButton {
text: "New Episodes"
}
Controls.TabButton {
text: "All Episodes"
}
}
Controls.SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: tabBar.currentIndex
EpisodeListPage {
title: i18n("New Episodes")
episodeType: EpisodeModel.New
}
EpisodeListPage {
title: i18n("All Episodes")
episodeType: EpisodeModel.All
}
}
/*actions.main: Kirigami.Action {
text: i18n("Refresh all feeds")
iconName: "view-refresh"
onTriggered: refreshing = true
visible: !Kirigami.Settings.isMobile
}*/
}

View File

@ -27,7 +27,7 @@ Kirigami.ApplicationWindow {
pageStack.initialPage: mainPagePool.loadPage(SettingsManager.lastOpenedPage === "FeedListPage" ? "qrc:/FeedListPage.qml"
: SettingsManager.lastOpenedPage === "QueuePage" ? "qrc:/QueuePage.qml"
: SettingsManager.lastOpenedPage === "EpisodeListPage" ? "qrc:/EpisodeListPage.qml"
: SettingsManager.lastOpenedPage === "EpisodeSwipePage" ? "qrc:/EpisodeSwipePage.qml"
: "qrc:/FeedListPage.qml")
globalDrawer: Kirigami.GlobalDrawer {
@ -49,9 +49,9 @@ Kirigami.ApplicationWindow {
text: i18n("Episodes")
iconName: "rss"
pagePool: mainPagePool
page: "qrc:/EpisodeListPage.qml"
page: "qrc:/EpisodeSwipePage.qml"
onTriggered: {
SettingsManager.lastOpenedPage = "EpisodeListPage" // for persistency
SettingsManager.lastOpenedPage = "EpisodeSwipePage" // for persistency
}
},
Kirigami.PagePoolAction {

View File

@ -14,6 +14,7 @@
<file alias="FooterBar.qml">qml/FooterBar.qml</file>
<file alias="QueuePage.qml">qml/QueuePage.qml</file>
<file alias="EpisodeListPage.qml">qml/EpisodeListPage.qml</file>
<file alias="EpisodeSwipePage.qml">qml/EpisodeSwipePage.qml</file>
<file alias="GenericListHeader.qml">qml/GenericListHeader.qml</file>
<file alias="GenericEntryDelegate.qml">qml/GenericEntryDelegate.qml</file>
<file alias="logo.png">../logo.png</file>