Switch to using PagePool

This commit is contained in:
Bart De Vries 2021-04-12 13:43:52 +02:00
parent ed58c4eda7
commit 48e0e509f7
3 changed files with 50 additions and 18 deletions

18
src/qml/AboutPage.qml Normal file
View File

@ -0,0 +1,18 @@
/**
* 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 org.kde.kirigami 2.12 as Kirigami
import org.kde.alligator 1.0
Kirigami.AboutPage {
title: i18n("About")
aboutData: _aboutData
}

View File

@ -20,49 +20,62 @@ Kirigami.ApplicationWindow {
title: "Alligator"
pageStack.initialPage: SettingsManager.lastOpenedPage === "FeedListPage" ? feedList
: SettingsManager.lastOpenedPage === "QueuePage" ? queueList
: feedList
//pageStack.initialPage: SettingsManager.lastOpenedPage === "FeedListPage" ? feedList
// : SettingsManager.lastOpenedPage === "QueuePage" ? queueList
// : feedList
Kirigami.PagePool {
id: mainPagePool
cachePages: true
}
pageStack.initialPage: mainPagePool.loadPage(SettingsManager.lastOpenedPage === "FeedListPage" ? "qrc:/FeedListPage.qml"
: SettingsManager.lastOpenedPage === "QueuePage" ? "qrc:/QueuePage.qml"
: "qrc:/FeedListPage.qml")
globalDrawer: Kirigami.GlobalDrawer {
isMenu: true
isMenu: false
actions: [
Kirigami.Action {
Kirigami.PagePoolAction {
text: i18n("Queue")
iconName: "source-playlist"
pagePool: mainPagePool
page: "qrc:/QueuePage.qml"
onTriggered: {
SettingsManager.lastOpenedPage = "QueuePage" // for persistency
pageStack.clear()
pageStack.push(queueList)
}
},
Kirigami.Action {
Kirigami.PagePoolAction {
text: i18n("Subscriptions")
iconName: "rss"
pagePool: mainPagePool
page: "qrc:/FeedListPage.qml"
onTriggered: {
SettingsManager.lastOpenedPage = "FeedListPage" // for persistency
pageStack.clear()
pageStack.push(feedList)
}
},
Kirigami.Action {
Kirigami.PagePoolAction {
text: i18n("Settings")
iconName: "settings-configure"
onTriggered: pageStack.layers.push("qrc:/SettingsPage.qml")
enabled: pageStack.layers.currentItem.title !== i18n("Settings")
pagePool: mainPagePool
page: "qrc:/SettingsPage.qml"
useLayers: true
},
Kirigami.Action {
Kirigami.PagePoolAction {
text: i18n("About")
iconName: "help-about-symbolic"
onTriggered: pageStack.layers.push(aboutPage)
enabled: pageStack.layers.currentItem.title !== i18n("About")
pagePool: mainPagePool
page: "qrc:/AboutPage.qml"
useLayers: true
//enabled: pageStack.layers.currentItem.title !== i18n("About")
}
]
}
Component {
id: aboutPage
Kirigami.AboutPage {
title: i18n("About")
aboutData: _aboutData
}
}
@ -71,13 +84,13 @@ Kirigami.ApplicationWindow {
id: contextDrawer
}
FeedListPage {
/*FeedListPage {
id: feedList
}
QueuePage {
id: queueList
}
}*/
AudioManager {
id: audio

View File

@ -5,6 +5,7 @@
<file alias="FeedListPage.qml">qml/FeedListPage.qml</file>
<file alias="EntryPage.qml">qml/EntryPage.qml</file>
<file alias="SettingsPage.qml">qml/SettingsPage.qml</file>
<file alias="AboutPage.qml">qml/AboutPage.qml</file>
<file alias="FeedDetailsPage.qml">qml/FeedDetailsPage.qml</file>
<file alias="EntryListDelegate.qml">qml/EntryListDelegate.qml</file>
<file alias="AddFeedSheet.qml">qml/AddFeedSheet.qml</file>