From f890dd8c22cae9e90d55b763f1d896b25975aeab Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Mon, 27 Nov 2023 20:34:50 -0500 Subject: 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 --- src/mainwindow.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/mainwindow.cpp') 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>::finished, this, &MainWindow::archive_thread_watcher_done); + connect(&archive_thread_watcher, &QFutureWatcher::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 result = archive_thread_watcher.result(); - - // For MainWindow::on_listWidget_itemActivated - if (std::get_if(&result)) { - // For MainWindow::open_file - if (const Archive::InitError* parse_error = std::get_if(&result)) - finish_open_file(*parse_error); - } else if (not std::get_if(&result)) - qDebug() << "What, the variant is weird"; + Archive::InitError result = archive_thread_watcher.result(); + + if (result) + finish_open_file(result); } -- cgit v1.2.3-54-g00ecf