mirror of https://github.com/KDE/kasts.git
Simplify saving the current Page
This commit is contained in:
parent
89e88afa27
commit
04f44bc078
|
@ -31,8 +31,6 @@ FocusScope {
|
||||||
if (AudioManager.entry) {
|
if (AudioManager.entry) {
|
||||||
pushPage("QueuePage");
|
pushPage("QueuePage");
|
||||||
pageStack.push("qrc:/EntryPage.qml", {"entry": AudioManager.entry});
|
pageStack.push("qrc:/EntryPage.qml", {"entry": AudioManager.entry});
|
||||||
SettingsManager.lastOpenedPage = "QueuePage";
|
|
||||||
SettingsManager.save();
|
|
||||||
pageStack.get(0).lastEntry = AudioManager.entry.id;
|
pageStack.get(0).lastEntry = AudioManager.entry.id;
|
||||||
var model = pageStack.get(0).queueList.model;
|
var model = pageStack.get(0).queueList.model;
|
||||||
for (var i = 0; i < model.rowCount(); i++) {
|
for (var i = 0; i < model.rowCount(); i++) {
|
||||||
|
@ -50,8 +48,6 @@ FocusScope {
|
||||||
if (AudioManager.entry) {
|
if (AudioManager.entry) {
|
||||||
pushPage("FeedListPage");
|
pushPage("FeedListPage");
|
||||||
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": AudioManager.entry.feed});
|
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": AudioManager.entry.feed});
|
||||||
SettingsManager.lastOpenedPage = "FeedListPage";
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ Kirigami.ScrollablePage {
|
||||||
|
|
||||||
function openPodcast() {
|
function openPodcast() {
|
||||||
pushPage("FeedListPage");
|
pushPage("FeedListPage");
|
||||||
SettingsManager.lastOpenedPage = "FeedListPage"; // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
lastFeed = entry.feed.url;
|
lastFeed = entry.feed.url;
|
||||||
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": entry.feed});
|
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": entry.feed});
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,6 @@ Kirigami.ScrollablePage {
|
||||||
text: i18n("Downloads")
|
text: i18n("Downloads")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
pushPage("DownloadListPage")
|
pushPage("DownloadListPage")
|
||||||
SettingsManager.lastOpenedPage = "DownloadListPage"; // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ import org.kde.kirigami 2.19 as Kirigami
|
||||||
import org.kde.kasts 1.0
|
import org.kde.kasts 1.0
|
||||||
|
|
||||||
Kirigami.NavigationTabBar {
|
Kirigami.NavigationTabBar {
|
||||||
id: root
|
id: navBar
|
||||||
|
|
||||||
property alias toolbarHeight: root.implicitHeight
|
property alias toolbarHeight: navBar.implicitHeight
|
||||||
property bool transparentBackground: false
|
property bool transparentBackground: false
|
||||||
|
|
||||||
shadow: false
|
shadow: false
|
||||||
|
@ -23,37 +23,31 @@ Kirigami.NavigationTabBar {
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
icon.name: "view-media-playlist"
|
icon.name: "view-media-playlist"
|
||||||
text: i18n("Queue")
|
text: i18n("Queue")
|
||||||
checked: "QueuePage" === SettingsManager.lastOpenedPage
|
checked: "QueuePage" === root.currentPage
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
pushPage("QueuePage");
|
pushPage("QueuePage");
|
||||||
SettingsManager.lastOpenedPage = "QueuePage"; // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
icon.name: "bookmarks"
|
icon.name: "bookmarks"
|
||||||
text: i18n("Subscriptions")
|
text: i18n("Subscriptions")
|
||||||
checked: "FeedListPage" === SettingsManager.lastOpenedPage
|
checked: "FeedListPage" === root.currentPage
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
pushPage("FeedListPage");
|
pushPage("FeedListPage");
|
||||||
SettingsManager.lastOpenedPage = "FeedListPage"; // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
icon.name: "rss"
|
icon.name: "rss"
|
||||||
text: i18n("Episodes")
|
text: i18n("Episodes")
|
||||||
checked: "EpisodeListPage" === SettingsManager.lastOpenedPage
|
checked: "EpisodeListPage" === root.currentPage
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
pushPage("EpisodeListPage")
|
pushPage("EpisodeListPage")
|
||||||
SettingsManager.lastOpenedPage = "EpisodeListPage" // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
icon.name: "settings-configure"
|
icon.name: "settings-configure"
|
||||||
text: i18n("Settings")
|
text: i18n("Settings")
|
||||||
checked: "SettingsPage" === SettingsManager.lastOpenedPage
|
checked: "SettingsPage" === root.currentPage
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
applicationWindow().pageStack.clear()
|
applicationWindow().pageStack.clear()
|
||||||
applicationWindow().pageStack.push("qrc:/SettingsPage.qml", {}, {
|
applicationWindow().pageStack.push("qrc:/SettingsPage.qml", {}, {
|
||||||
|
|
|
@ -75,6 +75,7 @@ Kirigami.ApplicationWindow {
|
||||||
property var desktopWidth
|
property var desktopWidth
|
||||||
property var desktopHeight
|
property var desktopHeight
|
||||||
property int headerSize: Kirigami.Units.gridUnit * 5
|
property int headerSize: Kirigami.Units.gridUnit * 5
|
||||||
|
property alias lastOpenedPage: root.currentPage
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveWindowLayout() {
|
function saveWindowLayout() {
|
||||||
|
@ -103,8 +104,7 @@ Kirigami.ApplicationWindow {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
restoreWindowLayout();
|
restoreWindowLayout();
|
||||||
currentPage = SettingsManager.lastOpenedPage;
|
pageStack.initialPage = getPage(currentPage);
|
||||||
pageStack.initialPage = getPage(SettingsManager.lastOpenedPage);
|
|
||||||
|
|
||||||
// Delete played enclosures if set in settings
|
// Delete played enclosures if set in settings
|
||||||
if (SettingsManager.autoDeleteOnPlayed == 2) {
|
if (SettingsManager.autoDeleteOnPlayed == 2) {
|
||||||
|
@ -178,8 +178,6 @@ Kirigami.ApplicationWindow {
|
||||||
checked: currentPage == "QueuePage"
|
checked: currentPage == "QueuePage"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pushPage("QueuePage")
|
pushPage("QueuePage")
|
||||||
SettingsManager.lastOpenedPage = "QueuePage" // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.NavigationTabButton {
|
Kirigami.NavigationTabButton {
|
||||||
|
@ -190,8 +188,6 @@ Kirigami.ApplicationWindow {
|
||||||
checked: currentPage == "DiscoverPage"
|
checked: currentPage == "DiscoverPage"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pushPage("DiscoverPage")
|
pushPage("DiscoverPage")
|
||||||
SettingsManager.lastOpenedPage = "DiscoverPage" // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.NavigationTabButton {
|
Kirigami.NavigationTabButton {
|
||||||
|
@ -202,8 +198,6 @@ Kirigami.ApplicationWindow {
|
||||||
checked: currentPage == "FeedListPage"
|
checked: currentPage == "FeedListPage"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pushPage("FeedListPage")
|
pushPage("FeedListPage")
|
||||||
SettingsManager.lastOpenedPage = "FeedListPage" // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.NavigationTabButton {
|
Kirigami.NavigationTabButton {
|
||||||
|
@ -214,8 +208,6 @@ Kirigami.ApplicationWindow {
|
||||||
checked: currentPage == "EpisodeListPage"
|
checked: currentPage == "EpisodeListPage"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pushPage("EpisodeListPage")
|
pushPage("EpisodeListPage")
|
||||||
SettingsManager.lastOpenedPage = "EpisodeListPage" // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.NavigationTabButton {
|
Kirigami.NavigationTabButton {
|
||||||
|
@ -226,8 +218,6 @@ Kirigami.ApplicationWindow {
|
||||||
checked: currentPage == "DownloadListPage"
|
checked: currentPage == "DownloadListPage"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pushPage("DownloadListPage")
|
pushPage("DownloadListPage")
|
||||||
SettingsManager.lastOpenedPage = "DownloadListPage" // for persistency
|
|
||||||
SettingsManager.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,6 @@
|
||||||
</entry>
|
</entry>
|
||||||
</group>
|
</group>
|
||||||
<group name="Persistency">
|
<group name="Persistency">
|
||||||
<entry name="lastOpenedPage" type="String">
|
|
||||||
<label>The top-level page that was open at shutdown</label>
|
|
||||||
<default>FeedListPage</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="sleepTimerValue" type="Int">
|
<entry name="sleepTimerValue" type="Int">
|
||||||
<label>The number of seconds/minutes/hours to set the sleep timer to</label>
|
<label>The number of seconds/minutes/hours to set the sleep timer to</label>
|
||||||
<default>30</default>
|
<default>30</default>
|
||||||
|
|
Loading…
Reference in New Issue