Skip to content

Commit 7c72fef

Browse files
committedJun 12, 2016
Fix network cache configuration
Fix #14990
1 parent 7861f89 commit 7c72fef

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
@@ -11325,8 +11325,6 @@ void QgisApp::namSetup()
1132511325
{
1132611326
QgsNetworkAccessManager *nam = QgsNetworkAccessManager::instance();
1132711327

11328-
namUpdate();
11329-
1133011328
connect( nam, SIGNAL( authenticationRequired( QNetworkReply *, QAuthenticator * ) ),
1133111329
this, SLOT( namAuthenticationRequired( QNetworkReply *, QAuthenticator * ) ) );
1133211330

‎src/app/qgsoptions.cpp

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

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

328323
//wms search server
329324
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.