mirror of
https://invent.kde.org/graphics/okular
synced 2024-11-05 18:34:53 +00:00
isolate the tiff loading in an own function
svn path=/trunk/KDE/kdegraphics/okular/; revision=890978
This commit is contained in:
parent
a2b63a66dc
commit
855a32c601
2 changed files with 8 additions and 16 deletions
|
@ -204,21 +204,7 @@ bool TIFFGenerator::loadDocument( const QString & fileName, QVector<Okular::Page
|
|||
qfile->open( QIODevice::ReadOnly );
|
||||
d->dev = qfile;
|
||||
d->data = QFile::encodeName( QFileInfo( *qfile ).fileName() );
|
||||
d->tiff = TIFFClientOpen( d->data.constData(), "r", d->dev,
|
||||
okular_tiffReadProc, okular_tiffWriteProc, okular_tiffSeekProc,
|
||||
okular_tiffCloseProc, okular_tiffSizeProc,
|
||||
okular_tiffMapProc, okular_tiffUnmapProc );
|
||||
if ( !d->tiff )
|
||||
{
|
||||
delete d->dev;
|
||||
d->dev = 0;
|
||||
d->data.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
loadPages( pagesVector );
|
||||
|
||||
return true;
|
||||
return loadTiff( pagesVector, d->data.constData() );
|
||||
}
|
||||
|
||||
bool TIFFGenerator::loadDocumentFromData( const QByteArray & fileData, QVector< Okular::Page * > & pagesVector )
|
||||
|
@ -227,7 +213,12 @@ bool TIFFGenerator::loadDocumentFromData( const QByteArray & fileData, QVector<
|
|||
QBuffer* qbuffer = new QBuffer( &d->data );
|
||||
qbuffer->open( QIODevice::ReadOnly );
|
||||
d->dev = qbuffer;
|
||||
d->tiff = TIFFClientOpen( "<stdin>", "r", d->dev,
|
||||
return loadTiff( pagesVector, "<stdin>" );
|
||||
}
|
||||
|
||||
bool TIFFGenerator::loadTiff( QVector< Okular::Page * > & pagesVector, const char *name )
|
||||
{
|
||||
d->tiff = TIFFClientOpen( name, "r", d->dev,
|
||||
okular_tiffReadProc, okular_tiffWriteProc, okular_tiffSeekProc,
|
||||
okular_tiffCloseProc, okular_tiffSizeProc,
|
||||
okular_tiffMapProc, okular_tiffUnmapProc );
|
||||
|
|
|
@ -36,6 +36,7 @@ class TIFFGenerator : public Okular::Generator
|
|||
class Private;
|
||||
Private * const d;
|
||||
|
||||
bool loadTiff( QVector< Okular::Page * > & pagesVector, const char *name );
|
||||
void loadPages( QVector<Okular::Page*> & pagesVector );
|
||||
int mapPage( int page ) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue