ui: Mass layout refactor

- Replaced TabWidget mode selection with ComboBox
- Moved Timeline out of record/review widgets
- Added TimelineState struct
- Set slint style to cosmic
This commit is contained in:
Alexey 2026-04-08 11:12:49 +03:00
commit 1a1f6dde83
7 changed files with 190 additions and 160 deletions

View file

@ -1,62 +1,58 @@
import { VerticalBox, LineEdit, Button, DatePickerPopup, ComboBox, Slider } from "std-widgets.slint";
import { Timeline } from "timeline.slint";
import { Timeline, TimelineState } from "timeline.slint";
import { Const } from "global.slint";
export component ReviewWidget inherits VerticalBox {
export component ReviewWidget inherits VerticalLayout {
callback update-visible-time(string);
callback fetch-log(int, int, int);
property<int> max-offset: 24 * 3600;
property<int> current-year;
property<int> current-month;
property<int> current-day;
in property<[string]> combo-spans: [];
in-out property visible-time <=> tl.visible-time;
in-out property offset <=> tl.offset;
in-out property events <=> tl.events;
in-out property<TimelineState> state;
in-out property<bool> minimized;
in-out property<bool> is-active;
tl := Timeline {
updating: false;
}
GridLayout {
spacing-vertical: 8px;
spacing-horizontal: 16px;
if is-active: VerticalLayout {
spacing: 8px;
Slider {
minimum: visible-time;
maximum: tl.max-offset;
value: offset;
row: 0;
colspan: 2;
minimum: state.visible-time;
maximum: Const.max-offset;
value: state.offset;
changed(value) => {
offset = value;
state.offset = value;
}
}
Text {
text: "Day: \{current-day}/\{current-month}/\{current-year}";
font-size: 32px;
horizontal-alignment: right;
row: 1;
}
Button {
text: "Select";
clicked => {
date-picker.show()
if !minimized: GridLayout {
spacing-horizontal: 16px;
padding: 8px;
Text {
text: "Day: \{current-day}/\{current-month}/\{current-year}";
font-size: 24px;
horizontal-alignment: right;
}
row: 1;
col: 1;
}
Text {
text: "Span: ";
font-size: 24px;
row: 2;
horizontal-alignment: right;
}
ComboBox {
model: combo-spans;
current-index: 0;
row: 2;
col: 1;
selected(current-value) => {
root.update-visible-time(current-value);
Button {
text: "Select";
clicked => {
date-picker.show()
}
col: 1;
}
Text {
text: "Span: ";
font-size: 24px;
row: 1;
horizontal-alignment: right;
}
ComboBox {
model: combo-spans;
current-index: 0;
row: 1;
col: 1;
selected(current-value) => {
root.update-visible-time(current-value);
}
}
}
}