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

View File

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