scale combobox: regenerate pdfs preview with choosen scale

This commit is contained in:
Albert S. 2018-09-02 20:30:52 +02:00
parent 7a485c55bb
commit caafb114ca
5 changed files with 18 additions and 5 deletions

View File

@ -5,9 +5,11 @@
#include <QDesktopServices>
#include <QUrl>
#include <QClipboard>
#include <QtGlobal>
#include <QSettings>
#include <QDateTime>
#include <QProcess>
#include <QComboBox>
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "clicklabel.h"
@ -43,8 +45,14 @@ void MainWindow::connectSignals()
connect(this, &MainWindow::startPdfPreviewGeneration, pdfWorker, &PdfWorker::generatePreviews);
connect(pdfWorker, &PdfWorker::previewReady, this, &MainWindow::pdfPreviewReceived);
connect(pdfWorker, &PdfWorker::previewsFinished, [&] { this->pdfDirty = false; });
connect(ui->comboScale, qOverload<const QString &>(&QComboBox::currentIndexChanged), this,
&MainWindow::comboScaleChanged);
}
void MainWindow::comboScaleChanged(QString text)
{
makePdfPreview();
}
bool MainWindow::pdfTabActive()
{
return ui->tabWidget->currentIndex() == 1;
@ -155,7 +163,10 @@ void MainWindow::makePdfPreview()
ui->scrollAreaWidgetContents->setLayout(new QHBoxLayout());
ui->pdfProcessBar->setMaximum(this->pdfSearchResults.size());
processedPdfPreviews = 0;
emit startPdfPreviewGeneration(this->pdfSearchResults, 0.75);
QString scaleText = ui->comboScale->currentText();
scaleText.chop(1);
emit startPdfPreviewGeneration(this->pdfSearchResults, scaleText.toInt() / 100.);
}
void MainWindow::handleCancelledSearch()

View File

@ -47,6 +47,7 @@ class MainWindow : public QMainWindow
void showSearchResultsContextMenu(const QPoint &point);
void tabChanged();
void pdfPreviewReceived(PdfPreview preview);
void comboScaleChanged(QString text);
};
#endif // MAINWINDOW_H

View File

@ -27,7 +27,7 @@
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="resultsTab">
<attribute name="title">
@ -99,9 +99,9 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<widget class="QComboBox" name="comboScale">
<property name="currentText">
<string>25%</string>
<string>75%</string>
</property>
<item>
<property name="text">

View File

@ -7,7 +7,7 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++14
TARGET = qss
TEMPLATE = app

View File

@ -87,6 +87,7 @@ QString SearchWorker::createSql(const SearchWorker::Command &cmd)
{
QString key = cmd.key;
QString value = cmd.value;
value = value.replace("'", "\\'");
if(key == "AND" || key == "OR" || key == "(" || key == ")")
{
return " " + key + " ";