Start the text generation request via a queued connection

Summary:
so that pixmap generation gets a chance to start before the text generation

This makes that on files where both the text generation and the pixmap generation
are slow at least we see something "as fast as possible" since only either text generation
or pixmap generation threads run at the same time

Reviewers: #okular, mlaurent

Reviewed By: mlaurent

Subscribers: michaelweghorn, dvratil, mlaurent, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8378
remotes/origin/Applications/17.12
Albert Astals Cid 9 years ago committed by Albert Astals Cid
parent d679b3c9f2
commit 453f45e7f7
  1. 3
      core/generator.cpp
  2. 9
      core/generator_p.h

@ -252,7 +252,8 @@ void Generator::generatePixmap( PixmapRequest *request )
*/
if ( hasFeature( TextExtraction ) && !request->page()->hasTextPage() && canGenerateTextPage() && !d->m_closing ) {
d->mTextPageReady = false;
d->textPageGenerationThread()->startGeneration( request->page() );
// Queue the text generation request so that pixmap generation gets a chance to start before the text generation
QMetaObject::invokeMethod(d->textPageGenerationThread(), "startGeneration", Qt::QueuedConnection, Q_ARG(Okular::Page*, request->page()));
}
return;

@ -19,6 +19,8 @@
class QEventLoop;
class QMutex;
#include "page.h"
namespace Okular {
class DocumentObserver;
@ -124,14 +126,15 @@ class TextPageGenerationThread : public QThread
public:
TextPageGenerationThread( Generator *generator );
void startGeneration( Page *page );
void endGeneration();
Page *page() const;
TextPage* textPage() const;
public slots:
void startGeneration( Okular::Page *page );
protected:
void run() override;
@ -166,4 +169,6 @@ class FontExtractionThread : public QThread
}
Q_DECLARE_METATYPE(Okular::Page*)
#endif

Loading…
Cancel
Save