added diff view
Dependencies
- [2]
F6YAQWVDadded UI for `pijul change` - [3]
NBBTJI4Ifixed bug s.t. choosing a new channel clears the log selection & delta view - [4]
337EO2TUadd selection callback to changelog UI (& fix deselection) - [5]
4RPYR65Cconnect GUI to pijul to display simple channel list - [6]
IQY5LHENadd GUI element to display simple `pijul log` results - [7]
SOTD66FOset Changelog UI to display log from selected channel in ChannelsList UI - [8]
NSE6BLWAinit slint project from https://github.com/slint-ui/slint-rust-template - [9]
I4NM4O3Zmake changelog elements interactable - [10]
XERTHGSYconsolidated `pijul log` UI elements into their own component - [*]
HZV5P57Ychanged channel and log views to use `ListView` (looks much cleaner) - [*]
NCRTU7M4cargo init
Change contents
- edit in ui/app-window.slint at line 29
}}}component DiffEntry inherits Rectangle {VerticalBox {label := Text {text: "active diff"; - edit in ui/app-window.slint at line 39
in-out property <bool> is-selected: false;in property <bool> has-hover;states [selected when root.is-selected: {root.background: Palette.selection-background;label.color: Palette.selection-foreground;}lowlighted when root.has-hover: {root.background: Palette.alternate-background;label.color: Palette.alternate-foreground;}] - replacement in ui/app-window.slint at line 104
in-out property <int> selected: -1;in-out property <int> selected: -2;public function deselect() {root.selected = -2;} - edit in ui/app-window.slint at line 115
diff-entry := DiffEntry {is-selected: root.selected == -1;has-hover: touch0.has-hover; - edit in ui/app-window.slint at line 120
touch0 := TouchArea {clicked => {root.selected = -1;root.selection-changed(-1);}}} - edit in ui/app-window.slint at line 239
callback request-diff-delta(string);function fill-diff-view() {if log.selected >= 0 && log.selected < log.changes_log.length {root.request-change-delta(changes_log[log.selected].hash)} else {root.request-diff-delta(chs.channels[chs.selected])}} - replacement in ui/app-window.slint at line 256
if log.selected >= 0 {root.request-change-delta(changes_log[log.selected].hash)} else {delta = "";}fill-diff-view(); - replacement in ui/app-window.slint at line 266
log.selected = -1;delta = "";log.deselect();root.request-diff-delta(chs.channels[chs.selected]) - replacement in ui/app-window.slint at line 274
if log.selected >= 0 {root.request-change-delta(changes_log[log.selected].hash)} else {delta = "";}fill-diff-view(); - edit in src/main.rs at line 108
Ok(delta) => delta,Err(e) => {println!("{:?}", e);return;}};ui.set_delta((&String::from(delta)[..]).into());}});ui.on_request_diff_delta({let ui_handle = ui.as_weak();move |ch_name: SharedString| {let ch_name = ch_name.as_str();let ui = ui_handle.unwrap();let exe_path_string = ui.get_exe_path();let exe_path = Path::new(exe_path_string.as_str());let repo_path_string = ui.get_repo_path();let repo_path = Path::new(repo_path_string.as_str());let diff_output = cmds::diff(exe_path,repo_path,Some(ch_name).filter(|cn| !cn.is_empty()),);let delta = match diff_output { - edit in src/cmds.rs at line 61
let output = cmd.output()?;check_exit_status(cmd, output.status)?;// TODO this will fail when diffing binary dataOk(String::from_utf8(output.stdout)?)}pub fn diff(exe: &std::path::Path,repo: &std::path::Path,ch_name_maybe: Option<&str>,) -> Result<String, Error> {let mut cmd = Command::new(exe);let cmd = cmd.arg("diff").arg("--no-prompt").arg("--repository").arg(repo);if let Some(ch_name) = ch_name_maybe {cmd.arg("--channel").arg(ch_name);}