begin status bar and progress bar for pdfpreviews
This commit is contained in:
		| @@ -26,6 +26,9 @@ MainWindow::MainWindow(QWidget *parent) : | ||||
|     ui->treeResultsList->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); | ||||
|  | ||||
|     ui->tabWidget->setCurrentIndex(0); | ||||
|     ui->statusBar->addWidget(ui->lblSearchResults); | ||||
|     ui->statusBar->addWidget(ui->pdfProcessBar); | ||||
|     ui->pdfProcessBar->hide(); | ||||
| } | ||||
|  | ||||
| void MainWindow::connectSignals() | ||||
| @@ -51,9 +54,17 @@ bool MainWindow::pdfTabActive() | ||||
|  | ||||
| void MainWindow::tabChanged() | ||||
| { | ||||
|     if(pdfTabActive() && pdfDirty) | ||||
|     if(pdfTabActive()) | ||||
|     { | ||||
|         makePdfPreview(); | ||||
|         if(pdfDirty) | ||||
|         { | ||||
|             makePdfPreview(); | ||||
|         } | ||||
|         ui->pdfProcessBar->show(); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ui->pdfProcessBar->hide(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -62,6 +73,7 @@ void MainWindow::pdfPreviewReceived(PdfPreview preview) | ||||
|     ClickLabel *label = new ClickLabel(); | ||||
|     label->setPixmap(QPixmap::fromImage(preview.previewImage)); | ||||
|     ui->scrollAreaWidgetContents->layout()->addWidget(label); | ||||
|     ui->pdfProcessBar->setValue(++processedPdfPreviews); | ||||
|     connect(label, &ClickLabel::clicked, [=]() { | ||||
|         QSettings settings; | ||||
|         QString command = settings.value("pdfviewer").toString(); | ||||
| @@ -112,7 +124,7 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results) | ||||
| { | ||||
|    this->pdfSearchResults.clear(); | ||||
|    ui->treeResultsList->clear(); | ||||
|  | ||||
|    ui->lblSearchResults->setText("Results: " + QString::number(results.size())); | ||||
|    for(const SearchResult &result : results) | ||||
|    { | ||||
|        QFileInfo pathInfo(result.path); | ||||
| @@ -148,7 +160,9 @@ void MainWindow::makePdfPreview() | ||||
|    qDeleteAll(ui->scrollAreaWidgetContents->children()); | ||||
|  | ||||
|    ui->scrollAreaWidgetContents->setLayout(new QHBoxLayout()); | ||||
|     emit startPdfPreviewGeneration(this->pdfSearchResults, 0.75); | ||||
|    ui->pdfProcessBar->setMaximum(this->pdfSearchResults.size()); | ||||
|    processedPdfPreviews = 0; | ||||
|    emit startPdfPreviewGeneration(this->pdfSearchResults, 0.75); | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -36,6 +36,7 @@ private: | ||||
|     void connectSignals(); | ||||
|     void makePdfPreview(); | ||||
|     bool pdfTabActive(); | ||||
|     unsigned int processedPdfPreviews; | ||||
| private slots: | ||||
|     void lineEditReturnPressed(); | ||||
|     void lineEditTextChanged(); | ||||
|   | ||||
| @@ -82,7 +82,7 @@ | ||||
|              <x>0</x> | ||||
|              <y>0</y> | ||||
|              <width>1179</width> | ||||
|              <height>420</height> | ||||
|              <height>370</height> | ||||
|             </rect> | ||||
|            </property> | ||||
|            <layout class="QHBoxLayout" name="horizontalLayout"/> | ||||
| @@ -154,6 +154,20 @@ | ||||
|       </widget> | ||||
|      </widget> | ||||
|     </item> | ||||
|     <item> | ||||
|      <widget class="QLabel" name="lblSearchResults"> | ||||
|       <property name="text"> | ||||
|        <string>TextLabel</string> | ||||
|       </property> | ||||
|      </widget> | ||||
|     </item> | ||||
|     <item> | ||||
|      <widget class="QProgressBar" name="pdfProcessBar"> | ||||
|       <property name="value"> | ||||
|        <number>24</number> | ||||
|       </property> | ||||
|      </widget> | ||||
|     </item> | ||||
|    </layout> | ||||
|   </widget> | ||||
|   <widget class="QMenuBar" name="menuBar"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user