diff options
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); } |