Commit 453f45e7 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid

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
parent d679b3c9
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment