diff options
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/MainWindow.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 6080457c5a..1cd6eb4c6f 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -87,6 +87,7 @@ #include "DolphinQt/NetPlay/NetPlaySetupDialog.h" #include "DolphinQt/QtUtils/FileOpenEventFilter.h" #include "DolphinQt/QtUtils/ModalMessageBox.h" +#include "DolphinQt/QtUtils/ParallelProgressDialog.h" #include "DolphinQt/QtUtils/QueueOnObject.h" #include "DolphinQt/QtUtils/RunOnObject.h" #include "DolphinQt/QtUtils/WindowActivationEventFilter.h" @@ -1510,23 +1511,21 @@ void MainWindow::OnImportNANDBackup() if (file.isEmpty()) return; - QProgressDialog* dialog = new QProgressDialog(this); - dialog->setMinimum(0); - dialog->setMaximum(0); - dialog->setLabelText(tr("Importing NAND backup")); - dialog->setCancelButton(nullptr); + ParallelProgressDialog dialog(this); + dialog.GetRaw()->setMinimum(0); + dialog.GetRaw()->setMaximum(0); + dialog.GetRaw()->setLabelText(tr("Importing NAND backup")); + dialog.GetRaw()->setCancelButton(nullptr); auto beginning = QDateTime::currentDateTime().toMSecsSinceEpoch(); - auto result = std::async(std::launch::async, [&] { + std::future<void> result = std::async(std::launch::async, [&] { DiscIO::NANDImporter().ImportNANDBin( file.toStdString(), [&dialog, beginning] { - QueueOnObject(dialog, [&dialog, beginning] { - dialog->setLabelText( - tr("Importing NAND backup\n Time elapsed: %1s") - .arg((QDateTime::currentDateTime().toMSecsSinceEpoch() - beginning) / 1000)); - }); + dialog.SetLabelText( + tr("Importing NAND backup\n Time elapsed: %1s") + .arg((QDateTime::currentDateTime().toMSecsSinceEpoch() - beginning) / 1000)); }, [this] { std::optional<std::string> keys_file = RunOnObject(this, [this] { @@ -1540,10 +1539,10 @@ void MainWindow::OnImportNANDBackup() return *keys_file; return std::string(""); }); - QueueOnObject(dialog, &QProgressDialog::close); + dialog.Reset(); }); - dialog->exec(); + dialog.GetRaw()->exec(); result.wait(); |
