From 23be8d308de63543461fd4e69e97fe57ee211e89 Mon Sep 17 00:00:00 2001 From: ZackaryWelch Date: Tue, 30 Jan 2018 17:10:06 -0500 Subject: Added results text for find widget in lumina-pdf --- src-qt5/desktop-utils/lumina-pdf/mainUI.cpp | 15 ++++-- src-qt5/desktop-utils/lumina-pdf/mainUI.ui | 82 +++++++++++++++-------------- 2 files changed, 53 insertions(+), 44 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp index 5f63a9e6..53a126fb 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp @@ -612,6 +612,7 @@ void MainUI::find(QString text, bool forward) { results.clear(); if(research or newText) { + ui->resultsLabel->setText(""); for(int i = 0; i < numPages; i++) { QList textList = DOC->page(i)->textList(); for(int j = 0; j < textList.size(); j++) { @@ -628,7 +629,9 @@ void MainUI::find(QString text, bool forward) { if(!results.empty()) { //Jump to the location of the next or previous textbox and highlight if(forward) { - currentHighlight = (currentHighlight + 1) % results.size(); + currentHighlight++; + if(currentHighlight >= results.size()) + currentHighlight %= results.size(); }else{ currentHighlight--; //Ensure currentHighlight will be between 0 and results.size() - 1 @@ -636,13 +639,17 @@ void MainUI::find(QString text, bool forward) { currentHighlight = results.size() - 1; } - qDebug() << "Jump to location: " << currentHighlight; + + ui->resultsLabel->setText(QString::number(currentHighlight+1) + " of " + QString::number(results.size()) + " results"); Poppler::TextBox *currentText = results.keys()[currentHighlight]; - WIDGET->setCurrentPage(results.value(currentText)); + WIDGET->setCurrentPage(results.value(currentText)+1); + + qDebug() << "Jump to location: " << results.value(currentText); + WIDGET->highlightText(currentHighlight, currentText->boundingBox()); - QTimer::singleShot(10, WIDGET, SLOT(updatePreview())); + //QTimer::singleShot(10, WIDGET, SLOT(updatePreview())); }else{ //Print "No results found" } diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui index 87922995..b8518cf5 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui @@ -30,6 +30,22 @@ 4 + + + + + 0 + 0 + + + + GraphicsArea (replaced) + + + Qt::AlignCenter + + + @@ -74,22 +90,6 @@ - - - - - 0 - 0 - - - - GraphicsArea (replaced) - - - Qt::AlignCenter - - - @@ -104,23 +104,32 @@ QFrame::Raised - - - 4 - - - 4 - - - 4 - - - 4 - - - 4 - - + + + + + + + Find... + + + + + + + Qt::LeftToRight + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + @@ -158,13 +167,6 @@ - - - - Find... - - - -- cgit