pagecontroller.cpp 1.41 KB
Newer Older
1 2 3 4 5 6 7 8 9
/***************************************************************************
 *   Copyright (C) 2007 by Pino Toscano <pino@kde.org>                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

10 11
#include "pagecontroller_p.h"

12 13
// local includes
#include "page_p.h"
14
#include "rotationjob_p.h"
15

16 17
#include <threadweaver/queueing.h>

18 19 20 21 22 23 24 25 26 27 28
using namespace Okular;

PageController::PageController()
  : QObject()
{
}

PageController::~PageController()
{
}

29
void PageController::addRotationJob(RotationJob *job)
30
{
31 32 33
    connect( job, SIGNAL(done(ThreadWeaver::JobPointer)),
             this, SLOT(imageRotationDone(ThreadWeaver::JobPointer)) );
    ThreadWeaver::enqueue(&m_weaver, job);
34 35
}

36
void PageController::imageRotationDone(const ThreadWeaver::JobPointer &j)
37
{
38
    RotationJob *job = static_cast< RotationJob * >( j.data() );
39 40 41 42 43

    if ( job->page() )
    {
        job->page()->imageRotationDone( job );

44
        emit rotationFinished( job->page()->m_number, job->page()->m_page );
45 46 47
    }
}

48
#include "moc_pagecontroller_p.cpp"