From aeafa9560e281db4bdc7d56b8196965964e333bc Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 29 May 2022 10:51:44 +0200 Subject: [PATCH] mainwindow: Disable page switcher while generation is running This prevents 'spam'. User may have scrolled 10 pages forward, while we are still generating old pages. Then the user wonders why they arrive so late. So disable switching pages while the generation is still running It is unlikely that a user will have to quickly go through search results like that. --- gui/mainwindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 266a81a..a1a45da 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -33,7 +33,11 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath) : QMainWindow(parent connect(&ipcPreviewClient, &IPCPreviewClient::previewReceived, this, &MainWindow::previewReceived, Qt::QueuedConnection); connect(&ipcPreviewClient, &IPCPreviewClient::finished, this, - [&] { this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum()); }); + [&] + { + this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum()); + this->ui->spinPreviewPage->setEnabled(true); + }); connect(&ipcPreviewClient, &IPCPreviewClient::error, this, [this](QString msg) { @@ -459,6 +463,7 @@ void MainWindow::makePreviews(int page) ui->previewProcessBar->setValue(0); ui->previewProcessBar->setVisible(this->previewableSearchResults.size() > 0); ++this->currentPreviewGeneration; + this->ui->spinPreviewPage->setEnabled(false); emit startIpcPreviews(renderConfig, targets); }