diff options
author | ConfuSomu | 2023-11-27 20:34:50 -0500 |
---|---|---|
committer | ConfuSomu | 2023-11-27 20:47:53 -0500 |
commit | f890dd8c22cae9e90d55b763f1d896b25975aeab (patch) | |
tree | 73db0a45e54e98468d916f42a4f3ab3acc1f5949 /src/mainwindow.cpp | |
parent | d12ac245778c295cf606671021e6aa66bcfc0d80 (diff) | |
download | ActorViewer-f890dd8c22cae9e90d55b763f1d896b25975aeab.tar ActorViewer-f890dd8c22cae9e90d55b763f1d896b25975aeab.tar.gz ActorViewer-f890dd8c22cae9e90d55b763f1d896b25975aeab.zip |
Remove variants from QtConcurrent in main window
The std::variants weren't used and were making the code more complex to
no advantage. All code that would have benefited from variants has
already been moved to QThreads elsewhere
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 82f4b37..12a71b8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -25,7 +25,7 @@ MainWindow::MainWindow(QWidget *parent) connect(ui->buttonCopy, &QPushButton::clicked, ui->actionCopy_status, &QAction::trigger); connect(ui->buttonRandom, &QPushButton::clicked, ui->actionRandom_status, &QAction::trigger); connect(ui->buttonSearch, &QPushButton::clicked, ui->actionFind, &QAction::trigger); - connect(&archive_thread_watcher, &QFutureWatcher<std::variant<QString, Archive::InitError>>::finished, this, &MainWindow::archive_thread_watcher_done); + connect(&archive_thread_watcher, &QFutureWatcher<Archive::InitError>::finished, this, &MainWindow::archive_thread_watcher_done); } MainWindow::~MainWindow() @@ -281,13 +281,8 @@ void MainWindow::finish_open_file(const Archive::InitError& parse_error) { } void MainWindow::archive_thread_watcher_done() { - std::variant<QString, Archive::InitError> result = archive_thread_watcher.result(); - - // For MainWindow::on_listWidget_itemActivated - if (std::get_if<Archive::InitError>(&result)) { - // For MainWindow::open_file - if (const Archive::InitError* parse_error = std::get_if<Archive::InitError>(&result)) - finish_open_file(*parse_error); - } else if (not std::get_if<QString>(&result)) - qDebug() << "What, the variant is weird"; + Archive::InitError result = archive_thread_watcher.result(); + + if (result) + finish_open_file(result); } |