gui: mainwindow: remove dead code and unused members

This commit is contained in:
Albert S. 2019-04-29 23:09:23 +02:00
parent f6fc2ae881
commit 897b6d03a5
2 changed files with 2 additions and 19 deletions

View File

@ -30,9 +30,7 @@ MainWindow::MainWindow(QWidget *parent) :
throw std::runtime_error("Failed to open database"); throw std::runtime_error("Failed to open database");
} }
connectSignals(); connectSignals();
searchThread.start();
ui->treeResultsList->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); ui->treeResultsList->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
ui->statusBar->addWidget(ui->lblSearchResults); ui->statusBar->addWidget(ui->lblSearchResults);
ui->statusBar->addWidget(ui->pdfProcessBar); ui->statusBar->addWidget(ui->pdfProcessBar);
@ -44,7 +42,6 @@ MainWindow::MainWindow(QWidget *parent) :
void MainWindow::connectSignals() void MainWindow::connectSignals()
{ {
connect(ui->txtSearch, &QLineEdit::returnPressed, this, &MainWindow::lineEditReturnPressed); connect(ui->txtSearch, &QLineEdit::returnPressed, this, &MainWindow::lineEditReturnPressed);
// connect(this, &MainWindow::beginSearch, searchWorker, &SearchWorker::search);
connect(&searchWatcher, &QFutureWatcher<SearchResult>::finished, this, [&]{ connect(&searchWatcher, &QFutureWatcher<SearchResult>::finished, this, [&]{
try try
{ {
@ -61,12 +58,7 @@ void MainWindow::connectSignals()
connect(&pdfWorkerWatcher, &QFutureWatcher<PdfPreview>::resultReadyAt, this, [&](int index) { connect(&pdfWorkerWatcher, &QFutureWatcher<PdfPreview>::resultReadyAt, this, [&](int index) {
pdfPreviewReceived(pdfWorkerWatcher.resultAt(index)); pdfPreviewReceived(pdfWorkerWatcher.resultAt(index));
}); });
connect(&pdfWorkerWatcher, &QFutureWatcher<PdfPreview>::progressValueChanged, ui->pdfProcessBar, &QProgressBar::setValue); connect(&pdfWorkerWatcher, &QFutureWatcher<PdfPreview>::progressValueChanged, ui->pdfProcessBar, &QProgressBar::setValue);
// connect(searchWorker, &SearchWorker::searchCancelled, this, &MainWindow::handleCancelledSearch);
// connect(searchWorker, &SearchWorker::searchError, this, &MainWindow::handleSearchError);
connect(ui->treeResultsList, &QTreeWidget::itemActivated, this, &MainWindow::treeSearchItemActivated); connect(ui->treeResultsList, &QTreeWidget::itemActivated, this, &MainWindow::treeSearchItemActivated);
connect(ui->treeResultsList, &QTreeWidget::customContextMenuRequested, this, &MainWindow::showSearchResultsContextMenu); connect(ui->treeResultsList, &QTreeWidget::customContextMenuRequested, this, &MainWindow::showSearchResultsContextMenu);
connect(ui->tabWidget, &QTabWidget::currentChanged, this, &MainWindow::tabChanged); connect(ui->tabWidget, &QTabWidget::currentChanged, this, &MainWindow::tabChanged);
@ -223,11 +215,6 @@ void MainWindow::makePdfPreview()
} }
void MainWindow::handleCancelledSearch()
{
}
void MainWindow::handleSearchError(QString error) void MainWindow::handleSearchError(QString error)
{ {
ui->lblSearchResults->setText("Error:" + error); ui->lblSearchResults->setText("Error:" + error);

View File

@ -28,23 +28,19 @@ private:
QFileIconProvider iconProvider; QFileIconProvider iconProvider;
bool pdfDirty; bool pdfDirty;
QSqlDatabase db; QSqlDatabase db;
QFuture<QVector<SearchResult>> searchFuture;
QFutureWatcher<QVector<SearchResult>> searchWatcher; QFutureWatcher<QVector<SearchResult>> searchWatcher;
QFutureWatcher<PdfPreview> pdfWorkerWatcher; QFutureWatcher<PdfPreview> pdfWorkerWatcher;
void add(QString path, unsigned int page); void add(QString path, unsigned int page);
QThread searchThread;
QThread pdfWorkerThread;
QVector<SearchResult> pdfSearchResults; QVector<SearchResult> pdfSearchResults;
void connectSignals(); void connectSignals();
void makePdfPreview(); void makePdfPreview();
bool pdfTabActive(); bool pdfTabActive();
void keyPressEvent(QKeyEvent *event) override; void keyPressEvent(QKeyEvent *event) override;
unsigned int processedPdfPreviews; unsigned int processedPdfPreviews;
void handleSearchResults(const QVector<SearchResult> &results);
void handleSearchError(QString error);
private slots: private slots:
void lineEditReturnPressed(); void lineEditReturnPressed();
void handleSearchResults(const QVector<SearchResult> &results);
void handleCancelledSearch();
void handleSearchError(QString error);
void treeSearchItemActivated(QTreeWidgetItem *item, int i); void treeSearchItemActivated(QTreeWidgetItem *item, int i);
void showSearchResultsContextMenu(const QPoint &point); void showSearchResultsContextMenu(const QPoint &point);
void tabChanged(); void tabChanged();