Skip to content

Commit

Permalink
parse embedded project only once (speedups loading of multiple embedd…
Browse files Browse the repository at this point in the history
…ed layers from the same project)
  • Loading branch information
jef-n committed Nov 12, 2014
1 parent b5f6d2c commit e4cd552
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/core/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,16 +1689,27 @@ QString QgsProject::layerIsEmbedded( const QString& id ) const
bool QgsProject::createEmbeddedLayer( const QString& layerId, const QString& projectFilePath, QList<QDomNode>& brokenNodes,
QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList, bool saveFlag )
{
QFile projectFile( projectFilePath );
if ( !projectFile.open( QIODevice::ReadOnly ) )
{
return false;
}
QgsDebugCall;

QDomDocument projectDocument;
if ( !projectDocument.setContent( &projectFile ) )
static QString prevProjectFilePath;
static QDomDocument projectDocument;

if ( projectFilePath != prevProjectFilePath )
{
return false;
prevProjectFilePath.clear();

QFile projectFile( projectFilePath );
if ( !projectFile.open( QIODevice::ReadOnly ) )
{
return false;
}

if ( !projectDocument.setContent( &projectFile ) )
{
return false;
}

prevProjectFilePath = projectFilePath;
}

//does project store pathes absolute or relative?
Expand Down

0 comments on commit e4cd552

Please sign in to comment.