native-dialog-rs
native-dialog-rs copied to clipboard
Add "progress dialog" API & implementations
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 :)
Ok so I've reimplemented the Windows dialog and it actually looks like a progress dialog now.

The shortcomings include:
- it involves spawning a thread (because
TaskDialogIndirectis blocking), - the code is way more complicated now and makes use of various synchronization primitives (probably expensive resources-wise?)
- 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...