Wait for shader viewer background debugging, add cancel button

* Until we properly support background debugging we need to wait for it to
  complete, otherwise the user could close the window and we'd crash.
This commit is contained in:
baldurk
2020-05-15 20:31:42 +01:00
parent ec881a600c
commit a81994071f
4 changed files with 52 additions and 4 deletions
+8 -1
View File
@@ -1953,6 +1953,7 @@ public:
setLabel(&m_Label);
}
void enableCancel() { setCancelButtonText(tr("Cancel")); }
void setPercentage(float percent) { setValue(int(maxProgress * percent)); }
void setInfinite(bool infinite)
{
@@ -2299,13 +2300,16 @@ QStringList ParseArgsList(const QString &args)
}
void ShowProgressDialog(QWidget *window, const QString &labelText, ProgressFinishedMethod finished,
ProgressUpdateMethod update)
ProgressUpdateMethod update, ProgressCancelMethod cancel)
{
if(finished())
return;
RDProgressDialog dialog(labelText, window);
if(cancel)
dialog.enableCancel();
// if we don't have an update function, set the progress display to be 'infinite spinner'
dialog.setInfinite(!update);
@@ -2338,6 +2342,9 @@ void ShowProgressDialog(QWidget *window, const QString &labelText, ProgressFinis
// to clean itself up
tickerSemaphore.tryAcquire();
progressTickerThread.wait();
if(cancel && dialog.wasCanceled())
cancel();
}
void UpdateTransferProgress(qint64 xfer, qint64 total, QElapsedTimer *timer,