In the algorithm execution dialog, this adds buttons to allow
users to save the current log (to text or HTML files), copy the
log contents to the clipboard, and clear the log.
Ensure that dialogs are always correctly deleted when appropriate.
Also, if an algorithm is running in a background task and hits
an error, we automatically re-show the algorithm dialog and the
associated log for debugging.
Fixes#16858
which cannot run in background tasks
This is not fantastic UX, but we have lots of constraints here:
- The algorithm dialog itself cannot be made modal. There's child
widgets (such as the point and extent parameter widgets) which
interact with the main QGIS window.
- There is no reliable way in Qt to make a dialog modal after
it's shown (e.g. make it modal only when the algorithm is
running). Trust me - I've tried everything, and all approaches
break with some corner case.
- For non-background algorithms, we must have processEvents calls
in order to show the algorithm feedback and progress to users,
and detect cancel button clicks. Yet these processEvents calls
means that users can interact with other parts of QGIS, e.g.
removing layers from a project, and other operations which
could cause the algorithm to crash. So we MUST have some modal
dialog in order to block interactions outside of allowing
the cancel button clicks/progress repainting.
I've tried many approaches, but this is the only one which
works reliably...