add selection callback to changelog UI (& fix deselection)

CrepeGoat
Oct 11, 2024, 8:21 AM
337EO2TURD5ELICUPPC5ZX6ZEOQXT4PVWTE7WKI7VUQPPCUDLFAQC

Dependencies

  • [2] I4NM4O3Z make changelog elements interactable
  • [3] XERTHGSY consolidated `pijul log` UI elements into their own component
  • [4] HZV5P57Y changed channel and log views to use `ListView` (looks much cleaner)
  • [5] G2CHQAOP parsed `pijul log` text blob into individual entries & fields
  • [*] NSE6BLWA init slint project from https://github.com/slint-ui/slint-rust-template

Change contents

  • edit in ui/app-window.slint at line 18
    [3.345][3.345:346](),[3.346][2.166:308]()
    in-out property <bool> is-selected: false;
    touch := TouchArea {
    clicked => {
    is-selected = true;
    }
    }
  • edit in ui/app-window.slint at line 49
    [2.311]
    [2.311]
    in-out property <bool> is-selected: false;
    in property <bool> has-hover;
  • replacement in ui/app-window.slint at line 52
    [2.324][2.324:361]()
    selected when is-selected: {
    [2.324]
    [2.361]
    selected when root.is-selected: {
  • replacement in ui/app-window.slint at line 55
    [2.430][2.430:489]()
    lowlighted when !is-selected && touch.has-hover: {
    [2.430]
    [2.489]
    lowlighted when root.has-hover: {
  • edit in ui/app-window.slint at line 58
    [2.558][2.558:670]()
    off when !is-selected && !touch.has-hover: {
    root.background: Palette.background;
    }
  • edit in ui/app-window.slint at line 63
    [3.109]
    [3.109]
    in-out property <int> selected: -1;
    callback selection-changed(/*new selection*/ int);
  • replacement in ui/app-window.slint at line 75
    [3.317][3.319:377](),[3.319][3.319:377]()
    for change in root.changes_log: ChangeEntry {
    [3.317]
    [3.377]
    for change[index] in root.changes_log: ce := ChangeEntry {
  • edit in ui/app-window.slint at line 80
    [3.537]
    [3.858]
    is-selected: root.selected == index;
    has-hover: touch.has-hover;
    touch := TouchArea {
    clicked => {
    root.selected = index;
    root.selection-changed(index);
    }
    }