mirror of
https://github.com/KDE/kasts.git
synced 2024-12-24 15:40:44 +01:00
Only show single page at any time, and pop pages that aren't visible
This commit is contained in:
parent
fdeb4c501a
commit
9860c8b9e5
@ -20,11 +20,16 @@ Kirigami.ApplicationWindow {
|
|||||||
id: root
|
id: root
|
||||||
title: "Kasts"
|
title: "Kasts"
|
||||||
|
|
||||||
pageStack.clip: true
|
|
||||||
|
|
||||||
width: Kirigami.Settings.isMobile ? 360 : 800
|
width: Kirigami.Settings.isMobile ? 360 : 800
|
||||||
height: Kirigami.Settings.isMobile ? 660 : 600
|
height: Kirigami.Settings.isMobile ? 660 : 600
|
||||||
|
|
||||||
|
pageStack.clip: true
|
||||||
|
pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar;
|
||||||
|
pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.ShowBackButton;
|
||||||
|
|
||||||
|
// only have a single page visible at any time
|
||||||
|
pageStack.columnView.columnResizeMode: Kirigami.ColumnView.SingleColumn
|
||||||
|
|
||||||
minimumWidth: Kirigami.Units.gridUnit * 17
|
minimumWidth: Kirigami.Units.gridUnit * 17
|
||||||
minimumHeight: Kirigami.Units.gridUnit * 12
|
minimumHeight: Kirigami.Units.gridUnit * 12
|
||||||
|
|
||||||
@ -91,6 +96,26 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pop pages when not in use
|
||||||
|
Connections {
|
||||||
|
target: applicationWindow().pageStack
|
||||||
|
function onCurrentIndexChanged() {
|
||||||
|
// wait for animation to finish before popping pages
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
interval: 300
|
||||||
|
onTriggered: {
|
||||||
|
let currentIndex = applicationWindow().pageStack.currentIndex;
|
||||||
|
while (applicationWindow().pageStack.depth > (currentIndex + 1) && currentIndex >= 0) {
|
||||||
|
applicationWindow().pageStack.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
saveWindowLayout();
|
saveWindowLayout();
|
||||||
}
|
}
|
||||||
@ -100,11 +125,6 @@ Kirigami.ApplicationWindow {
|
|||||||
currentPage = SettingsManager.lastOpenedPage;
|
currentPage = SettingsManager.lastOpenedPage;
|
||||||
pageStack.initialPage = getPage(SettingsManager.lastOpenedPage);
|
pageStack.initialPage = getPage(SettingsManager.lastOpenedPage);
|
||||||
|
|
||||||
if (Kirigami.Settings.isMobile) {
|
|
||||||
pageStack.globalToolBar.style = Kirigami.ApplicationHeaderStyle.ToolBar;
|
|
||||||
pageStack.globalToolBar.showNavigationButtons = Kirigami.ApplicationHeaderStyle.ShowBackButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete played enclosures if set in settings
|
// Delete played enclosures if set in settings
|
||||||
if (SettingsManager.autoDeleteOnPlayed == 2) {
|
if (SettingsManager.autoDeleteOnPlayed == 2) {
|
||||||
DataManager.deletePlayedEnclosures();
|
DataManager.deletePlayedEnclosures();
|
||||||
|
Loading…
Reference in New Issue
Block a user