2024-10-16 12:17:51 +02:00
|
|
|
import { State, SessionStep, CountdownStatus } from "./state.slint";
|
|
|
|
import { VText, VButton, VActionButton, Svg, Palette } from "@selenite";
|
|
|
|
import { CountdownView } from "./countdown-view.slint";
|
|
|
|
import { SettingsView } from "settings-view.slint";
|
|
|
|
|
|
|
|
enum CurrentView {
|
|
|
|
Countdown,
|
|
|
|
Settings
|
|
|
|
}
|
|
|
|
|
|
|
|
export component AppWindow inherits Window {
|
|
|
|
title: "Focus";
|
|
|
|
callback start-stop;
|
|
|
|
property <CurrentView> current-view: CurrentView.Countdown;
|
|
|
|
|
|
|
|
background: Palette.background;
|
|
|
|
default-font-size: 16px;
|
|
|
|
padding: 0px;
|
|
|
|
|
|
|
|
VerticalLayout {
|
|
|
|
width: parent.width;
|
|
|
|
height: parent.height;
|
|
|
|
|
|
|
|
HorizontalLayout {
|
|
|
|
padding: 8px;
|
|
|
|
vertical-stretch: 0;
|
|
|
|
alignment: start;
|
|
|
|
settingsButtons := VActionButton {
|
|
|
|
icon-svg: Svg.burger;
|
|
|
|
background: Palette.background.transparentize(1);
|
|
|
|
clicked => {
|
|
|
|
if (current-view == CurrentView.Countdown) {
|
|
|
|
current-view = CurrentView.Settings;
|
|
|
|
} else if (current-view == CurrentView.Settings) {
|
|
|
|
current-view = CurrentView.Countdown;
|
|
|
|
State.config-changed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if current-view == CurrentView.Countdown : countdown-view := CountdownView {
|
|
|
|
start-stop => { root.start-stop() }
|
|
|
|
vertical-stretch: 1;
|
|
|
|
padding: 32px;
|
|
|
|
padding-top: 0px;
|
|
|
|
}
|
|
|
|
if current-view == CurrentView.Settings : settings-view := SettingsView {
|
|
|
|
vertical-stretch: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-11-25 16:51:35 +01:00
|
|
|
export { State, Palette }
|