Skip to content

Commit

Permalink
add progress indication when layers are loaded from projects
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@10673 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 28, 2009
1 parent 5329e67 commit 2ac7ace
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -1555,6 +1555,8 @@ void QgisApp::setupConnections()
connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
this, SLOT( oldProjectVersionWarning( QString ) ) );

connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), this, SLOT( showProgress( int, int ) ) );

}
void QgisApp::createCanvas()
{
Expand Down Expand Up @@ -3182,7 +3184,6 @@ void QgisApp::fileOpen()
} // QgisApp::fileOpen



/**
adds a saved project to qgis, usually called on startup by specifying a
project file on the command line
Expand All @@ -3191,6 +3192,8 @@ bool QgisApp::addProject( QString projectFile )
{
mMapCanvas->freeze( true );

QApplication::setOverrideCursor( Qt::WaitCursor );

// clear the map canvas
removeAllLayers();

Expand Down Expand Up @@ -3254,6 +3257,8 @@ bool QgisApp::addProject( QString projectFile )
return false;
}

QApplication::restoreOverrideCursor();

mMapCanvas->freeze( false );
mMapCanvas->refresh();
return true;
Expand Down
6 changes: 5 additions & 1 deletion src/core/qgsproject.cpp
Expand Up @@ -642,7 +642,7 @@ static QgsProjectVersion _getVersion( QDomDocument const &doc )
</maplayer>
*/
static std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const &doc )
std::pair< bool, std::list<QDomNode> > QgsProject::_getMapLayers( QDomDocument const &doc )
{
// Layer order is implicit in the order they are stored in the project file

Expand Down Expand Up @@ -671,6 +671,8 @@ static std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const

bool returnStatus = true;

emit layerLoaded( 0, nl.count() );

for ( int i = 0; i < nl.count(); i++ )
{
QDomNode node = nl.item( i );
Expand Down Expand Up @@ -715,6 +717,8 @@ static std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const

brokenNodes.push_back( node );
}

emit layerLoaded( i + 1, nl.count() );
}

return make_pair( returnStatus, brokenNodes );
Expand Down
7 changes: 7 additions & 0 deletions src/core/qgsproject.h
Expand Up @@ -266,6 +266,11 @@ class CORE_EXPORT QgsProject : public QObject
//! emitted when an old project file is read.
void oldProjectVersionWarning( QString );

//! emitted when a layer from a projects was read
// @param i current layer
// @param n number of layers
void layerLoaded( int i, int n );

private:

QgsProject(); // private 'cause it's a singleton
Expand All @@ -279,6 +284,8 @@ class CORE_EXPORT QgsProject : public QObject

static QgsProject * theProject_;

std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const &doc );

}; // QgsProject

#endif

0 comments on commit 2ac7ace

Please sign in to comment.