1 /***************************************************************************
2 * Copyright (C) 2007 Tobias Koenig <tokoe@kde.org> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #include "generator_p.h"
15 #include "generator.h"
18 using namespace Okular
;
20 PixmapGenerationThread::PixmapGenerationThread( Generator
*generator
)
21 : mGenerator( generator
), mRequest( 0 ), mCalcBoundingBox( false )
25 void PixmapGenerationThread::startGeneration( PixmapRequest
*request
, bool calcBoundingBox
)
28 mCalcBoundingBox
= calcBoundingBox
;
30 start( QThread::InheritPriority
);
33 void PixmapGenerationThread::endGeneration()
38 PixmapRequest
*PixmapGenerationThread::request() const
43 QImage
PixmapGenerationThread::image() const
48 bool PixmapGenerationThread::calcBoundingBox() const
50 return mCalcBoundingBox
;
53 NormalizedRect
PixmapGenerationThread::boundingBox() const
58 void PixmapGenerationThread::run()
64 mImage
= mGenerator
->image( mRequest
);
65 if ( mCalcBoundingBox
)
66 mBoundingBox
= Utils::imageBoundingBox( &mImage
);
71 TextPageGenerationThread::TextPageGenerationThread( Generator
*generator
)
72 : mGenerator( generator
), mPage( 0 )
76 void TextPageGenerationThread::startGeneration( Page
*page
)
80 start( QThread::InheritPriority
);
83 void TextPageGenerationThread::endGeneration()
88 Page
*TextPageGenerationThread::page() const
93 TextPage
* TextPageGenerationThread::textPage() const
98 void TextPageGenerationThread::run()
103 mTextPage
= mGenerator
->textPage( mPage
);
107 FontExtractionThread::FontExtractionThread( Generator
*generator
, int pages
)
108 : mGenerator( generator
), mNumOfPages( pages
), mGoOn( true )
112 void FontExtractionThread::startExtraction( bool async
)
116 connect( this, SIGNAL( finished() ), this, SLOT( deleteLater() ) );
117 start( QThread::InheritPriority
);
126 void FontExtractionThread::stopExtraction()
131 void FontExtractionThread::run()
133 for ( int i
= -1; i
< mNumOfPages
&& mGoOn
; ++i
)
135 FontInfo::List list
= mGenerator
->fontsForPage( i
);
136 foreach ( const FontInfo
& fi
, list
)
144 #include "generator_p.moc"