mirror of
https://invent.kde.org/graphics/okular
synced 2024-07-16 10:17:04 +00:00
Do not start numberOfPagesWithPixmaps threads because that brings the system down, just start what threadweaver thinks its best
Probably still have to tell the weaver how to optimize for memory consumption but it's an improvement anyways svn path=/trunk/KDE/kdegraphics/okular/; revision=683383
This commit is contained in:
parent
80d7b04b0f
commit
2437917e47
|
@ -85,7 +85,7 @@ IF(APPLE)
|
|||
SET(OKULAR_IOKIT "-framework IOKit" CACHE STRING "Apple IOKit framework")
|
||||
ENDIF(APPLE)
|
||||
|
||||
target_link_libraries(okularcore ${OKULAR_IOKIT} ${KDE4_KIO_LIBS} ${KDE4_KDEPRINT_LIBRARY} ${KDE4_PHONON_LIBRARY} ${MATH_LIB})
|
||||
target_link_libraries(okularcore ${OKULAR_IOKIT} ${KDE4_KIO_LIBS} ${KDE4_KDEPRINT_LIBRARY} ${KDE4_PHONON_LIBRARY} ${MATH_LIB} ${KDE4_THREADWEAVER_LIBRARY} )
|
||||
|
||||
set_target_properties(okularcore PROPERTIES VERSION 1.0.0 SOVERSION 1 )
|
||||
|
||||
|
|
|
@ -290,8 +290,7 @@ void PagePrivate::rotateAt( Rotation orientation )
|
|||
|
||||
RotationJob *job = new RotationJob( object.m_pixmap->toImage(), object.m_rotation, m_rotation, it.key() );
|
||||
job->setPage( this );
|
||||
QObject::connect( job, SIGNAL( finished() ), PageController::self(), SLOT( imageRotationDone() ) );
|
||||
job->start();
|
||||
PageController::self()->addRotationJob(job);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -374,8 +373,7 @@ void Page::setPixmap( int id, QPixmap *pixmap )
|
|||
} else {
|
||||
RotationJob *job = new RotationJob( pixmap->toImage(), Rotation0, d->m_rotation, id );
|
||||
job->setPage( d );
|
||||
QObject::connect( job, SIGNAL( finished() ), PageController::self(), SLOT( imageRotationDone() ) );
|
||||
job->start();
|
||||
PageController::self()->addRotationJob(job);
|
||||
|
||||
delete pixmap;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
// qt/kde includes
|
||||
#include <kglobal.h>
|
||||
#include <threadweaver/ThreadWeaver.h>
|
||||
|
||||
// local includes
|
||||
#include "page_p.h"
|
||||
|
@ -23,6 +24,9 @@ using namespace Okular;
|
|||
PageController::PageController()
|
||||
: QObject()
|
||||
{
|
||||
connect( ThreadWeaver::Weaver::instance(),
|
||||
SIGNAL( jobDone(ThreadWeaver::Job*) ),
|
||||
SLOT( imageRotationDone(ThreadWeaver::Job*) ) );
|
||||
}
|
||||
|
||||
PageController::~PageController()
|
||||
|
@ -34,9 +38,14 @@ PageController * PageController::self()
|
|||
return page_controller_self;
|
||||
}
|
||||
|
||||
void PageController::imageRotationDone()
|
||||
void PageController::addRotationJob(RotationJob *job)
|
||||
{
|
||||
RotationJob *job = sender() ? qobject_cast< RotationJob * >( sender() ) : 0;
|
||||
ThreadWeaver::Weaver::instance()->enqueue(job);
|
||||
}
|
||||
|
||||
void PageController::imageRotationDone(ThreadWeaver::Job *j)
|
||||
{
|
||||
RotationJob *job = qobject_cast< RotationJob * >(j);
|
||||
|
||||
if ( !job )
|
||||
return;
|
||||
|
|
|
@ -12,9 +12,14 @@
|
|||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace ThreadWeaver {
|
||||
class Job;
|
||||
}
|
||||
|
||||
namespace Okular {
|
||||
|
||||
class Page;
|
||||
class RotationJob;
|
||||
|
||||
class PageController : public QObject
|
||||
{
|
||||
|
@ -30,11 +35,13 @@ class PageController : public QObject
|
|||
|
||||
static PageController * self();
|
||||
|
||||
void addRotationJob( RotationJob *job );
|
||||
|
||||
signals:
|
||||
void rotationFinished( int page );
|
||||
|
||||
private slots:
|
||||
void imageRotationDone();
|
||||
void imageRotationDone(ThreadWeaver::Job*);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -10,16 +10,17 @@
|
|||
#ifndef _OKULAR_ROTATIONJOB_H
|
||||
#define _OKULAR_ROTATIONJOB_H
|
||||
|
||||
#include <QtCore/QThread>
|
||||
#include <QtGui/QImage>
|
||||
|
||||
#include <threadweaver/Job.h>
|
||||
|
||||
#include "core/global.h"
|
||||
|
||||
namespace Okular {
|
||||
|
||||
class PagePrivate;
|
||||
|
||||
class RotationJob : public QThread
|
||||
class RotationJob : public ThreadWeaver::Job
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
Loading…
Reference in a new issue