[QGIS Commit] r10673 - in trunk/qgis/src: app core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Apr 28 17:32:20 EDT 2009


Author: jef
Date: 2009-04-28 17:32:19 -0400 (Tue, 28 Apr 2009)
New Revision: 10673

Modified:
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/core/qgsproject.cpp
   trunk/qgis/src/core/qgsproject.h
Log:
add progress indication when layers are loaded from projects

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2009-04-28 20:21:06 UTC (rev 10672)
+++ trunk/qgis/src/app/qgisapp.cpp	2009-04-28 21:32:19 UTC (rev 10673)
@@ -1555,6 +1555,8 @@
   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()
 {
@@ -3182,7 +3184,6 @@
 } // QgisApp::fileOpen
 
 
-
 /**
   adds a saved project to qgis, usually called on startup by specifying a
   project file on the command line
@@ -3191,6 +3192,8 @@
 {
   mMapCanvas->freeze( true );
 
+  QApplication::setOverrideCursor( Qt::WaitCursor );
+
   // clear the map canvas
   removeAllLayers();
 
@@ -3254,6 +3257,8 @@
     return false;
   }
 
+  QApplication::restoreOverrideCursor();
+
   mMapCanvas->freeze( false );
   mMapCanvas->refresh();
   return true;

Modified: trunk/qgis/src/core/qgsproject.cpp
===================================================================
--- trunk/qgis/src/core/qgsproject.cpp	2009-04-28 20:21:06 UTC (rev 10672)
+++ trunk/qgis/src/core/qgsproject.cpp	2009-04-28 21:32:19 UTC (rev 10673)
@@ -642,7 +642,7 @@
    </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
 
@@ -671,6 +671,8 @@
 
   bool returnStatus = true;
 
+  emit layerLoaded( 0, nl.count() );
+
   for ( int i = 0; i < nl.count(); i++ )
   {
     QDomNode node = nl.item( i );
@@ -715,6 +717,8 @@
 
       brokenNodes.push_back( node );
     }
+
+    emit layerLoaded( i + 1, nl.count() );
   }
 
   return make_pair( returnStatus, brokenNodes );

Modified: trunk/qgis/src/core/qgsproject.h
===================================================================
--- trunk/qgis/src/core/qgsproject.h	2009-04-28 20:21:06 UTC (rev 10672)
+++ trunk/qgis/src/core/qgsproject.h	2009-04-28 21:32:19 UTC (rev 10673)
@@ -266,6 +266,11 @@
     //! 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
@@ -279,6 +284,8 @@
 
     static QgsProject * theProject_;
 
+    std::pair< bool, std::list<QDomNode> > _getMapLayers( QDomDocument const &doc );
+
 }; // QgsProject
 
 #endif



More information about the QGIS-commit mailing list