native-dialog-rs icon indicating copy to clipboard operation
native-dialog-rs copied to clipboard

Add "progress dialog" API & implementations

Open hedgehog1029 opened this issue 4 years ago • 1 comments

This PR implements progress dialogs which may be updated and queried by the application.

let progress = ProgressDialog::new()
    .set_title("Progress Example")
    .set_text("Doing complicated things...")
    .show()?;

let mut handle = progress.borrow_mut();
handle.set_progress(20.0)?;

Progress so far:

  • [x] Linux compiles
  • [x] Windows compiles
  • [ ] Mac compiles
  • [x] Linux with zenity tested & working well
  • [ ] Linux with kdialog tested

Linux is tested & working, at least for Zenity.
kdialog might need some extra bits (apparently qdbus can be named qdbus-qt5 sometimes?)
The Windows implementation sort of works; the progress bar doesn't seem to want to fit inside the window (I don't think it's supposed to be used like this!) and the text isn't displayed, so it needs a bunch more work.
Mac is not implemented yet. I don't have access to a mac machine that I can develop on, and I have very little idea about the Cocoa API.

I welcome any assistance :)

hedgehog1029 avatar Mar 21 '21 02:03 hedgehog1029

Ok so I've reimplemented the Windows dialog and it actually looks like a progress dialog now.

Example of Windows look

The shortcomings include:

  1. it involves spawning a thread (because TaskDialogIndirect is blocking),
  2. the code is way more complicated now and makes use of various synchronization primitives (probably expensive resources-wise?)
  3. it crashes if the application doesn't have Common Controls 6.0 loaded by the manifest (documented, but...)

I would appreciate your input here - are these acceptable shortcomings? TaskDialogIndirect is perfect apart from the fact it's a blocking call...

hedgehog1029 avatar Mar 22 '21 01:03 hedgehog1029