Event chaining
This commit is contained in:
parent
3509263a06
commit
8d5d3584b1
3 changed files with 21 additions and 2 deletions
11
src/main.rs
11
src/main.rs
|
@ -48,7 +48,16 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
let new_event = TimelineEvent { duration: offset - event.start, finished: true, label: event.label, start: event.start };
|
||||
|
||||
events.set_row_data(event_id, new_event);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ui.on_chain_event({
|
||||
let ui_weak = ui.as_weak();
|
||||
move |event_name: SharedString| {
|
||||
let ui = ui_weak.unwrap();
|
||||
ui.invoke_stop_event();
|
||||
ui.invoke_start_new_event(event_name);
|
||||
}
|
||||
});
|
||||
|
||||
ui.run()?;
|
||||
|
|
|
@ -7,6 +7,7 @@ export component AppWindow inherits Window {
|
|||
callback update-record-visible-time <=> record.update-visible-time;
|
||||
callback start-new-event <=> record.start-new-event;
|
||||
callback stop-event <=> record.stop-event;
|
||||
callback chain-event <=> record.chain-event;
|
||||
callback update-record-offset(int);
|
||||
|
||||
update-record-offset(new-offset) => {
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Timeline } from "timeline.slint";
|
|||
export component RecordWidget inherits VerticalBox {
|
||||
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;
|
||||
|
@ -29,7 +30,6 @@ export component RecordWidget inherits VerticalBox {
|
|||
}
|
||||
Button {
|
||||
text: in-progress ? "Stop" : "Start";
|
||||
colspan: 2;
|
||||
row: 1;
|
||||
clicked => {
|
||||
if in-progress {
|
||||
|
@ -40,6 +40,15 @@ export component RecordWidget inherits VerticalBox {
|
|||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue