Files
zach 7d6f3cc275
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
initial commit for media widget update + anim tokens restructure
2026-08-18 16:14:41 +02:00

126 lines
2.2 KiB
QML

import QtQuick
import QtQuick.Controls
import qs.Components
import qs.Modules.Settings
import ZShell.Config
StackView {
id: root
readonly property int animMovement: Tokens.padding.extraLarge * 2
default property list<Component> pages
required property SettingsState sState
function openSubPage(idx: int, immediate: bool): void {
const page = pages[idx];
if (page) {
push(page, {
sState
}, immediate ? StackView.Immediate : StackView.PushTransition);
} else {
console.warn(logCat, "Attempted to open invalid sub-page index", idx);
sState.closeSubPage();
}
}
clip: busy
popEnter: Transition {
SequentialAnimation {
PropertyAction {
property: "opacity"
value: 0
}
PauseAnimation {
duration: Tokens.anim.durations.expressiveDefaultEffects
}
ParallelAnimation {
Anim {
property: "opacity"
to: 1
type: Anim.SlowEffects
}
Anim {
from: -root.animMovement
property: "x"
to: 0
type: Anim.SlowEffects
}
}
}
}
popExit: Transition {
Anim {
property: "opacity"
to: 0
type: Anim.DefaultEffects
}
}
pushEnter: Transition {
SequentialAnimation {
PropertyAction {
property: "opacity"
value: 0
}
PauseAnimation {
duration: Tokens.anim.durations.expressiveDefaultEffects
}
ParallelAnimation {
Anim {
property: "opacity"
to: 1
type: Anim.SlowEffects
}
Anim {
from: root.animMovement
property: "x"
to: 0
type: Anim.SlowEffects
}
}
}
}
pushExit: Transition {
Anim {
property: "opacity"
to: 0
type: Anim.DefaultEffects
}
}
Component.onCompleted: {
openSubPage(0, true);
for (const page of sState.subPageIdxStack)
openSubPage(page, true);
}
LoggingCategory {
id: logCat
defaultLogLevel: LoggingCategory.Info
name: "ZShell.settings"
}
Connections {
function onSubPageClosed(): void {
if (root.depth < root.sState.subPageIdxStack.length) {
console.log(logCat, "Attempted to close page while depth < stack depth. Ignoring.");
return;
}
root.pop();
}
function onSubPageOpened(idx: int): void {
root.openSubPage(idx, false);
}
target: root.sState
}
}