Skip to content

Commit 6e11084

Browse files
committedJul 11, 2016
Fix network cache configuration
Fix #14990
1 parent 1225431 commit 6e11084

File tree

5 files changed

+10
-17
lines changed

5 files changed

+10
-17
lines changed
 

‎python/core/qgsnetworkaccessmanager.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class QgsNetworkAccessManager : QNetworkAccessManager
6161
void setupDefaultProxyAndCache();
6262

6363
//! return whether the system proxy should be used
64-
bool useSystemProxy();
64+
bool useSystemProxy() const;
6565

6666
public slots:
6767
/** Send GET request, calls get().

‎src/app/qgisapp.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10880,8 +10880,6 @@ void QgisApp::namSetup()
1088010880
{
1088110881
QgsNetworkAccessManager *nam = QgsNetworkAccessManager::instance();
1088210882

10883-
namUpdate();
10884-
1088510883
connect( nam, SIGNAL( authenticationRequired( QNetworkReply *, QAuthenticator * ) ),
1088610884
this, SLOT( namAuthenticationRequired( QNetworkReply *, QAuthenticator * ) ) );
1088710885

‎src/app/qgsoptions.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
311311
}
312312

313313
// cache settings
314-
QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>( QgsNetworkAccessManager::instance()->cache() );
315-
if ( cache )
316-
{
317-
mCacheDirectory->setText( cache->cacheDirectory() );
318-
mCacheSize->setMinimum( 0 );
319-
mCacheSize->setMaximum( std::numeric_limits<int>::max() );
320-
mCacheSize->setSingleStep( 1024 );
321-
QgsDebugMsg( QString( "set cacheSize: %1" ).arg( cache->maximumCacheSize() ) );
322-
mCacheSize->setValue( cache->maximumCacheSize() / 1024 );
323-
}
314+
mCacheDirectory->setText( mSettings->value( "cache/directory" ).toString() );
315+
mCacheSize->setMinimum( 0 );
316+
mCacheSize->setMaximum( std::numeric_limits<int>::max() );
317+
mCacheSize->setSingleStep( 1024 );
318+
mCacheSize->setValue( mSettings->value( "cache/size" ).toInt() / 1024 );
324319

325320
//wms search server
326321
leWmsSearch->setText( mSettings->value( "/qgis/WMSSearchUrl", "http://geopole.org/wms/search?search=%1&type=rss" ).toString() );

‎src/core/qgsnetworkaccessmanager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache()
372372
if ( !newcache )
373373
newcache = new QgsNetworkDiskCache( this );
374374

375-
QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
375+
QString cacheDirectory = settings.value( "cache/directory" ).toString();
376+
if ( cacheDirectory.isEmpty() )
377+
cacheDirectory = QgsApplication::qgisSettingsDirPath() + "cache";
376378
qint64 cacheSize = settings.value( "cache/size", 50 * 1024 * 1024 ).toULongLong();
377-
QgsDebugMsg( QString( "setCacheDirectory: %1" ).arg( cacheDirectory ) );
378-
QgsDebugMsg( QString( "setMaximumCacheSize: %1" ).arg( cacheSize ) );
379379
newcache->setCacheDirectory( cacheDirectory );
380380
newcache->setMaximumCacheSize( cacheSize );
381381
QgsDebugMsg( QString( "cacheDirectory: %1" ).arg( newcache->cacheDirectory() ) );

‎src/core/qgsnetworkaccessmanager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
8383
void setupDefaultProxyAndCache();
8484

8585
//! return whether the system proxy should be used
86-
bool useSystemProxy() { return mUseSystemProxy; }
86+
bool useSystemProxy() const { return mUseSystemProxy; }
8787

8888
public slots:
8989
/** Send GET request, calls get().

0 commit comments

Comments
 (0)
Please sign in to comment.