summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <[email protected]>2017-12-14 14:33:18 +0100
committerAlbert Astals Cid <[email protected]>2017-12-14 14:33:18 +0100
commit4fc203076b20f2aa54df7e3bb0548461540d841d (patch)
tree289d5663920d374e5f26d40677158d0c8de7bce7
parent22662af2291a4fecb2df8e477cd5b2c4f0bbae88 (diff)
Code simplification
No need to use d->m_loadedGenerators to find the generator since we already have m_generator
-rw-r--r--core/document.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/core/document.cpp b/core/document.cpp
index 21fa9e1..4c59c65 100644
--- a/core/document.cpp
+++ b/core/document.cpp
@@ -4331,24 +4331,16 @@ bool Document::canSwapBackingFile() const
{
if ( !d->m_generator )
return false;
- Q_ASSERT( !d->m_generatorName.isEmpty() );
-
- QHash< QString, GeneratorInfo >::iterator genIt = d->m_loadedGenerators.find( d->m_generatorName );
- Q_ASSERT( genIt != d->m_loadedGenerators.end() );
- return genIt->generator->hasFeature( Generator::SwapBackingFile );
+ return d->m_generator->hasFeature( Generator::SwapBackingFile );
}
bool Document::swapBackingFile( const QString &newFileName, const QUrl &url )
{
if ( !d->m_generator )
return false;
- Q_ASSERT( !d->m_generatorName.isEmpty() );
-
- QHash< QString, GeneratorInfo >::iterator genIt = d->m_loadedGenerators.find( d->m_generatorName );
- Q_ASSERT( genIt != d->m_loadedGenerators.end() );
- if ( !genIt->generator->hasFeature( Generator::SwapBackingFile ) )
+ if ( !d->m_generator->hasFeature( Generator::SwapBackingFile ) )
return false;
// Save metadata about the file we're about to close
@@ -4356,7 +4348,7 @@ bool Document::swapBackingFile( const QString &newFileName, const QUrl &url )
qCDebug(OkularCoreDebug) << "Swapping backing file to" << newFileName;
QVector< Page * > newPagesVector;
- Generator::SwapBackingFileResult result = genIt->generator->swapBackingFile( newFileName, newPagesVector );
+ Generator::SwapBackingFileResult result = d->m_generator->swapBackingFile( newFileName, newPagesVector );
if (result != Generator::SwapBackingFileError)
{
QLinkedList< ObjectRect* > rectsToDelete;