diff options
| author | JosJuice <josjuice@gmail.com> | 2019-08-09 14:33:24 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2019-08-09 14:47:15 +0200 |
| commit | cd02ca17ce2927a9b004d418353073c50ca1ba77 (patch) | |
| tree | cc8dbe5248e872dda2f85dc2af82dc90d1b257b8 /Source/Core | |
| parent | e87a3f91a919fa0a470b5f785b354661dcb1f4d4 (diff) | |
VolumeVerifier: Allocate QProgressDialog on stack
No reason to have it on the heap.
This also lets us skip calling reset, since the dialog closes
when the QProgressDialog object goes out of scope.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt/Config/VerifyWidget.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/Core/DolphinQt/Config/VerifyWidget.cpp b/Source/Core/DolphinQt/Config/VerifyWidget.cpp index 8fc16d5a66..488343fc76 100644 --- a/Source/Core/DolphinQt/Config/VerifyWidget.cpp +++ b/Source/Core/DolphinQt/Config/VerifyWidget.cpp @@ -98,18 +98,18 @@ void VerifyWidget::Verify() // We have to divide the number of processed bytes with something so it won't make ints overflow constexpr int DIVISOR = 0x100; - QProgressDialog* progress = new QProgressDialog(tr("Verifying"), tr("Cancel"), 0, - verifier.GetTotalBytes() / DIVISOR, this); - progress->setWindowTitle(tr("Verifying")); - progress->setWindowFlags(progress->windowFlags() & ~Qt::WindowContextHelpButtonHint); - progress->setMinimumDuration(500); - progress->setWindowModality(Qt::WindowModal); + QProgressDialog progress(tr("Verifying"), tr("Cancel"), 0, verifier.GetTotalBytes() / DIVISOR, + this); + progress.setWindowTitle(tr("Verifying")); + progress.setWindowFlags(progress.windowFlags() & ~Qt::WindowContextHelpButtonHint); + progress.setMinimumDuration(500); + progress.setWindowModality(Qt::WindowModal); verifier.Start(); while (verifier.GetBytesProcessed() != verifier.GetTotalBytes()) { - progress->setValue(verifier.GetBytesProcessed() / DIVISOR); - if (progress->wasCanceled()) + progress.setValue(verifier.GetBytesProcessed() / DIVISOR); + if (progress.wasCanceled()) return; verifier.Process(); @@ -117,7 +117,7 @@ void VerifyWidget::Verify() verifier.Finish(); DiscIO::VolumeVerifier::Result result = verifier.GetResult(); - progress->reset(); + progress.setValue(verifier.GetBytesProcessed() / DIVISOR); m_summary_text->setText(QString::fromStdString(result.summary_text)); |
