Receiving current local time

This commit is contained in:
Alexey 2025-09-08 14:07:18 +03:00
commit 599b027d19
6 changed files with 94 additions and 30 deletions

View file

@ -2,13 +2,22 @@ import { VerticalBox, LineEdit, Button, ComboBox } from "std-widgets.slint";
import { Timeline } from "timeline.slint";
export component RecordWidget inherits VerticalBox {
Timeline {
callback update-visible-time(string);
callback start-new-event(string);
callback stop-event;
in-out property visible-time <=> tl.visible-time;
in-out property updating <=> tl.updating;
in-out property offset <=> tl.offset;
property<bool> in-progress: false;
property<string> event-name <=> le.text;
tl := Timeline {
updating: true;
}
GridLayout {
spacing-vertical: 8px;
spacing-horizontal: 16px;
LineEdit {
le := LineEdit {
placeholder-text: "Event name";
text: "Event name";
font-size: 24px;
@ -17,9 +26,17 @@ export component RecordWidget inherits VerticalBox {
row: 0;
}
Button {
text: "Start";
text: updating ? "Stop" : "Start";
colspan: 2;
row: 1;
clicked => {
if in-progress {
root.stop-event();
} else {
root.start-new-event(event-name);
}
in-progress = !in-progress;
}
}
Text {
text: "Span:";
@ -32,6 +49,9 @@ export component RecordWidget inherits VerticalBox {
current-index: 0;
row: 2;
col: 1;
selected(current-value) => {
root.update-visible-time(current-value);
}
}
}
}