[QGIS Commit] r13272 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Apr 7 07:29:02 EDT 2010


Author: jef
Date: 2010-04-07 07:29:01 -0400 (Wed, 07 Apr 2010)
New Revision: 13272

Modified:
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
   trunk/qgis/src/app/qgsnetworkproxyfactory.cpp
   trunk/qgis/src/app/qgsnetworkproxyfactory.h
Log:
instantiate proxy factory only once

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2010-04-06 23:45:50 UTC (rev 13271)
+++ trunk/qgis/src/app/qgisapp.cpp	2010-04-07 11:29:01 UTC (rev 13272)
@@ -359,6 +359,7 @@
     , mSplash( splash )
     , mPythonUtils( NULL )
     , mNAM( NULL )
+    , mProxyFactory( NULL )
     , mpTileScaleWidget( NULL )
 #ifdef HAVE_QWT
     , mpGpsWidget( NULL )
@@ -972,26 +973,12 @@
   mActionAddPgLayer = new QAction( getThemeIcon( "mActionAddLayer.png" ), tr( "Add PostGIS Layer..." ), this );
   shortcuts->registerAction( mActionAddPgLayer, tr( "Ctrl+Shift+D", "Add a PostGIS Layer" ) );
   mActionAddPgLayer->setStatusTip( tr( "Add a PostGIS Layer" ) );
-//#ifdef HAVE_POSTGRESQL
-  // QgsDebugMsg("HAVE_POSTGRESQL is defined");
-//  assert(0);
-//#else
-  // QgsDebugMsg("HAVE_POSTGRESQL not defined");
-//  assert(0);
-//#endif
   connect( mActionAddPgLayer, SIGNAL( triggered() ), this, SLOT( addDatabaseLayer() ) );
 
   mActionAddSpatiaLiteLayer = new QAction( getThemeIcon( "mActionAddSpatiaLiteLayer.png" ), tr( "Add SpatiaLite Layer..." ), this );
   shortcuts->registerAction( mActionAddSpatiaLiteLayer, tr( "Ctrl+Shift+L", "Add a SpatiaLite Layer" ) );
   mActionAddSpatiaLiteLayer->setStatusTip( tr( "Add a SpatiaLite Layer" ) );
   connect( mActionAddSpatiaLiteLayer, SIGNAL( triggered() ), this, SLOT( addSpatiaLiteLayer() ) );
-//#ifdef HAVE_SPATIALITE
-  // QgsDebugMsg("HAVE_SPATIALITE is defined");
-//  assert(0);
-//#else
-  // QgsDebugMsg("HAVE_SPATIALITE not defined");
-//  assert(0);
-//#endif
 
   mActionAddWmsLayer = new QAction( getThemeIcon( "mActionAddWmsLayer.png" ), tr( "Add WMS Layer..." ), this );
   shortcuts->registerAction( mActionAddWmsLayer, tr( "Ctrl+Shift+W", "Add a Web Mapping Server Layer" ) );
@@ -6724,8 +6711,14 @@
   }
 
 #if QT_VERSION >= 0x40500
-  mNAM->setProxyFactory( new QgsNetworkProxyFactory( proxy, excludes ) );
+  if( !mProxyFactory )
+  {
+    mProxyFactory = new QgsNetworkProxyFactory();
+    mNAM->setProxyFactory( mProxyFactory );
+  }
 
+  mProxyFactory->setProxyAndExcludes( proxy, excludes );
+
   QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>( nam()->cache() );
   if ( !cache )
     cache = new QNetworkDiskCache( this );

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2010-04-06 23:45:50 UTC (rev 13271)
+++ trunk/qgis/src/app/qgisapp.h	2010-04-07 11:29:01 UTC (rev 13272)
@@ -80,6 +80,10 @@
 #include "qgsfeature.h"
 #include "qgspoint.h"
 
+#if QT_VERSION >= 0x40500
+class QgsNetworkProxyFactory;
+#endif
+
 /*! \class QgisApp
  * \brief Main window for the Qgis application
  */
@@ -1090,6 +1094,9 @@
     QgsUndoWidget* mUndoWidget;
 
     QNetworkAccessManager *mNAM;
+#if QT_VERSION >= 0x40500
+    QgsNetworkProxyFactory *mProxyFactory;
+#endif
 
     int mLastComposerId;
 

Modified: trunk/qgis/src/app/qgsnetworkproxyfactory.cpp
===================================================================
--- trunk/qgis/src/app/qgsnetworkproxyfactory.cpp	2010-04-06 23:45:50 UTC (rev 13271)
+++ trunk/qgis/src/app/qgsnetworkproxyfactory.cpp	2010-04-07 11:29:01 UTC (rev 13272)
@@ -26,8 +26,12 @@
 #include "qgsnetworkproxyfactory.h"
 #include "qgslogger.h"
 
-QgsNetworkProxyFactory::QgsNetworkProxyFactory( const QNetworkProxy &proxy, const QStringList &excludes )
+QgsNetworkProxyFactory::QgsNetworkProxyFactory()
 {
+}
+
+void QgsNetworkProxyFactory::setProxyAndExcludes( const QNetworkProxy &proxy, const QStringList &excludes )
+{
   mProxy = proxy;
   mExcludedURLs = excludes;
 }

Modified: trunk/qgis/src/app/qgsnetworkproxyfactory.h
===================================================================
--- trunk/qgis/src/app/qgsnetworkproxyfactory.h	2010-04-06 23:45:50 UTC (rev 13271)
+++ trunk/qgis/src/app/qgsnetworkproxyfactory.h	2010-04-07 11:29:01 UTC (rev 13272)
@@ -26,10 +26,12 @@
 class QgsNetworkProxyFactory : public QNetworkProxyFactory
 {
   public:
-    QgsNetworkProxyFactory( const QNetworkProxy &proxy, const QStringList &excludes );
+    QgsNetworkProxyFactory();
     virtual ~QgsNetworkProxyFactory();
     virtual QList<QNetworkProxy> queryProxy( const QNetworkProxyQuery & query = QNetworkProxyQuery() );
 
+    void setProxyAndExcludes( const QNetworkProxy &proxy, const QStringList &excludes );
+
   private:
     QStringList mExcludedURLs;
     QNetworkProxy mProxy;



More information about the QGIS-commit mailing list