aliveline/ui/record.slint

59 lines
1.7 KiB
Text

import { VerticalBox, LineEdit, Button, ComboBox } from "std-widgets.slint";
import { Timeline } from "timeline.slint";
export component RecordWidget inherits VerticalBox {
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;
in-out property events <=> tl.events;
in property<[string]> combo-spans: [];
property<bool> in-progress: false;
property<string> event-name <=> le.text;
tl := Timeline {
updating: true;
}
GridLayout {
spacing-vertical: 8px;
spacing-horizontal: 16px;
le := LineEdit {
placeholder-text: "Event name";
text: "Event name";
font-size: 24px;
horizontal-alignment: center;
colspan: 2;
row: 0;
}
Button {
text: in-progress ? "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:";
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);
}
}
}
}