MCPcopy Create free account
hub / github.com/baldurk/renderdoc / ShowProgressDialog

Function ShowProgressDialog

qrenderdoc/Code/QRDUtils.cpp:3314–3360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3312}
3313
3314void ShowProgressDialog(QWidget *window, const QString &labelText, ProgressFinishedMethod finished,
3315 ProgressUpdateMethod update, ProgressCancelMethod cancel)
3316{
3317 if(finished())
3318 return;
3319
3320 RDProgressDialog dialog(labelText, window);
3321
3322 if(cancel)
3323 dialog.enableCancel();
3324
3325 // if we don't have an update function, set the progress display to be 'infinite spinner'
3326 dialog.setInfinite(!update);
3327
3328 QSemaphore tickerSemaphore(1);
3329
3330 // start a lambda thread to tick our functions and close the progress dialog when we're done.
3331 LambdaThread progressTickerThread([finished, update, &dialog, &tickerSemaphore]() {
3332 while(tickerSemaphore.available())
3333 {
3334 QThread::msleep(30);
3335
3336 if(update)
3337 GUIInvoke::call(&dialog, [update, &dialog]() { dialog.setPercentage(update()); });
3338
3339 GUIInvoke::call(&dialog, [finished, &tickerSemaphore]() {
3340 if(finished())
3341 tickerSemaphore.tryAcquire();
3342 });
3343 }
3344
3345 GUIInvoke::call(&dialog, [&dialog]() { dialog.closeAndReset(); });
3346 });
3347 progressTickerThread.setName(lit("Progress Dialog"));
3348 progressTickerThread.start();
3349
3350 // show the dialog
3351 RDDialog::show(&dialog);
3352
3353 // signal the thread to exit if somehow we got here without it finishing, then wait for the thread
3354 // to clean itself up
3355 tickerSemaphore.tryAcquire();
3356 progressTickerThread.wait();
3357
3358 if(cancel && dialog.wasCanceled())
3359 cancel();
3360}
3361
3362void UpdateTransferProgress(qint64 xfer, qint64 total, QElapsedTimer *timer,
3363 QProgressBar *progressBar, QLabel *progressLabel, QString progressText)

Callers 15

CopyCaptureToRemoteMethod · 0.85
CopyCaptureFromRemoteMethod · 0.85
LoadCaptureMethod · 0.85
RecompressCaptureMethod · 0.85
ImportCaptureMethod · 0.85
ExportCaptureMethod · 0.85
SetEventIDMethod · 0.85
EmbedDependentFilesMethod · 0.85
RemoveDependentFilesMethod · 0.85
RunToolFunction · 0.85
debugShaderMethod · 0.85

Calls 9

enableCancelMethod · 0.80
setInfiniteMethod · 0.80
availableMethod · 0.80
setPercentageMethod · 0.80
closeAndResetMethod · 0.80
showFunction · 0.50
setNameMethod · 0.45
startMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected