gui: handle search exception (again after refactoring)

This commit is contained in:
Albert S. 2019-04-29 23:05:51 +02:00
parent 500fc13070
commit 09804a83cc

View File

@ -15,6 +15,7 @@
#include "ui_mainwindow.h"
#include "clicklabel.h"
#include "../shared/sqlitesearch.h"
#include "../shared/qssgeneralexception.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
@ -44,9 +45,16 @@ void MainWindow::connectSignals()
// connect(this, &MainWindow::beginSearch, searchWorker, &SearchWorker::search);
connect(&searchWatcher, &QFutureWatcher<SearchResult>::finished, this,
[&]
{
try
{
auto results = searchWatcher.future().result();
handleSearchResults(results);
}
catch(QSSGeneralException &e)
{
handleSearchError(e.message);
}
});
connect(&pdfWorkerWatcher, &QFutureWatcher<PdfPreview>::resultReadyAt, this,