import { VerticalBox, LineEdit, Button, ComboBox } from "std-widgets.slint"; import { Timeline } from "timeline.slint"; export component RecordWidget inherits VerticalBox { callback new-day-started <=> tl.new-day-started; callback update-visible-time(string); callback start-new-event(string); callback chain-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: []; in-out property in-progress: false; property event-name: ""; property minimized: false; property combo-index: 0; tl := Timeline { preferred-height: 100%; updating: true; clicked => { minimized = !minimized; } } if !minimized: 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; edited(text) => { event-name = text; } } Button { text: in-progress ? "Stop" : "Start"; row: 1; clicked => { if in-progress { root.stop-event(); } else { root.start-new-event(event-name); } in-progress = !in-progress; } } Button { text: "Chain"; enabled: in-progress; col: 1; row: 1; clicked => { root.chain-event(event-name); } } Text { text: "Span:"; font-size: 24px; row: 2; horizontal-alignment: right; } ComboBox { model: combo-spans; current-index: combo-index; row: 2; col: 1; selected(current-value) => { root.update-visible-time(current-value); combo-index = self.current-index; } } } }