Skip to content

Commit 2ac7ace

Browse files
author
jef
committed
add progress indication when layers are loaded from projects
git-svn-id: http://svn.osgeo.org/qgis/trunk@10673 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5329e67 commit 2ac7ace

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/app/qgisapp.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,8 @@ void QgisApp::setupConnections()
15551555
connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
15561556
this, SLOT( oldProjectVersionWarning( QString ) ) );
15571557

1558+
connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), this, SLOT( showProgress( int, int ) ) );
1559+
15581560
}
15591561
void QgisApp::createCanvas()
15601562
{
@@ -3182,7 +3184,6 @@ void QgisApp::fileOpen()
31823184
} // QgisApp::fileOpen
31833185

31843186

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

3195+
QApplication::setOverrideCursor( Qt::WaitCursor );
3196+
31943197
// clear the map canvas
31953198
removeAllLayers();
31963199

@@ -3254,6 +3257,8 @@ bool QgisApp::addProject( QString projectFile )
32543257
return false;
32553258
}
32563259

3260+
QApplication::restoreOverrideCursor();
3261+
32573262
mMapCanvas->freeze( false );
32583263
mMapCanvas->refresh();
32593264
return true;

src/core/qgsproject.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ static QgsProjectVersion _getVersion( QDomDocument const &doc )
642642
</maplayer>
643643
644644
*/
645-
static std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const &doc )
645+
std::pair< bool, std::list<QDomNode> > QgsProject::_getMapLayers( QDomDocument const &doc )
646646
{
647647
// Layer order is implicit in the order they are stored in the project file
648648

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

672672
bool returnStatus = true;
673673

674+
emit layerLoaded( 0, nl.count() );
675+
674676
for ( int i = 0; i < nl.count(); i++ )
675677
{
676678
QDomNode node = nl.item( i );
@@ -715,6 +717,8 @@ static std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const
715717

716718
brokenNodes.push_back( node );
717719
}
720+
721+
emit layerLoaded( i + 1, nl.count() );
718722
}
719723

720724
return make_pair( returnStatus, brokenNodes );

src/core/qgsproject.h

+7
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ class CORE_EXPORT QgsProject : public QObject
266266
//! emitted when an old project file is read.
267267
void oldProjectVersionWarning( QString );
268268

269+
//! emitted when a layer from a projects was read
270+
// @param i current layer
271+
// @param n number of layers
272+
void layerLoaded( int i, int n );
273+
269274
private:
270275

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

280285
static QgsProject * theProject_;
281286

287+
std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const &doc );
288+
282289
}; // QgsProject
283290

284291
#endif

0 commit comments

Comments
 (0)