aliveline/ui/review.slint
2ndbeam b5e9a4115a Several bugfixes
- Fixed event invisibility when offset is after event's half width
- Fixed event being shown outside timeline component
- When timer reaches 24:00:00, new day is automatically started
2025-09-12 13:59:12 +03:00

74 lines
2.1 KiB
Text

import { VerticalBox, LineEdit, Button, DatePickerPopup, ComboBox, Slider } from "std-widgets.slint";
import { Timeline } from "timeline.slint";
export component ReviewWidget inherits VerticalBox {
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;
tl := Timeline {
updating: false;
}
GridLayout {
spacing-vertical: 8px;
spacing-horizontal: 16px;
Slider {
minimum: visible-time;
maximum: tl.max-offset;
value: offset;
row: 0;
colspan: 2;
changed(value) => {
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()
}
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);
}
}
}
date-picker := DatePickerPopup {
x: (root.width - self.width) / 2;
y: (root.height - self.height) / 2;
title: "";
accepted(date) => {
current-year = date.year;
current-month = date.month;
current-day = date.day;
root.fetch-log(current-year, current-month, current-day);
}
}
}