Skip to content

Commit

Permalink
Fix network cache configuration
Browse files Browse the repository at this point in the history
Fix #14990
  • Loading branch information
m-kuhn committed Jul 11, 2016
1 parent 1225431 commit 6e11084
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsnetworkaccessmanager.sip
Expand Up @@ -61,7 +61,7 @@ class QgsNetworkAccessManager : QNetworkAccessManager
void setupDefaultProxyAndCache();

//! return whether the system proxy should be used
bool useSystemProxy();
bool useSystemProxy() const;

public slots:
/** Send GET request, calls get().
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -10880,8 +10880,6 @@ void QgisApp::namSetup()
{
QgsNetworkAccessManager *nam = QgsNetworkAccessManager::instance();

namUpdate();

connect( nam, SIGNAL( authenticationRequired( QNetworkReply *, QAuthenticator * ) ),
this, SLOT( namAuthenticationRequired( QNetworkReply *, QAuthenticator * ) ) );

Expand Down
15 changes: 5 additions & 10 deletions src/app/qgsoptions.cpp
Expand Up @@ -311,16 +311,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
}

// cache settings
QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>( QgsNetworkAccessManager::instance()->cache() );
if ( cache )
{
mCacheDirectory->setText( cache->cacheDirectory() );
mCacheSize->setMinimum( 0 );
mCacheSize->setMaximum( std::numeric_limits<int>::max() );
mCacheSize->setSingleStep( 1024 );
QgsDebugMsg( QString( "set cacheSize: %1" ).arg( cache->maximumCacheSize() ) );
mCacheSize->setValue( cache->maximumCacheSize() / 1024 );
}
mCacheDirectory->setText( mSettings->value( "cache/directory" ).toString() );
mCacheSize->setMinimum( 0 );
mCacheSize->setMaximum( std::numeric_limits<int>::max() );
mCacheSize->setSingleStep( 1024 );
mCacheSize->setValue( mSettings->value( "cache/size" ).toInt() / 1024 );

//wms search server
leWmsSearch->setText( mSettings->value( "/qgis/WMSSearchUrl", "http://geopole.org/wms/search?search=%1&type=rss" ).toString() );
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsnetworkaccessmanager.cpp
Expand Up @@ -372,10 +372,10 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache()
if ( !newcache )
newcache = new QgsNetworkDiskCache( this );

QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
QString cacheDirectory = settings.value( "cache/directory" ).toString();
if ( cacheDirectory.isEmpty() )
cacheDirectory = QgsApplication::qgisSettingsDirPath() + "cache";
qint64 cacheSize = settings.value( "cache/size", 50 * 1024 * 1024 ).toULongLong();
QgsDebugMsg( QString( "setCacheDirectory: %1" ).arg( cacheDirectory ) );
QgsDebugMsg( QString( "setMaximumCacheSize: %1" ).arg( cacheSize ) );
newcache->setCacheDirectory( cacheDirectory );
newcache->setMaximumCacheSize( cacheSize );
QgsDebugMsg( QString( "cacheDirectory: %1" ).arg( newcache->cacheDirectory() ) );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsnetworkaccessmanager.h
Expand Up @@ -83,7 +83,7 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
void setupDefaultProxyAndCache();

//! return whether the system proxy should be used
bool useSystemProxy() { return mUseSystemProxy; }
bool useSystemProxy() const { return mUseSystemProxy; }

public slots:
/** Send GET request, calls get().
Expand Down

0 comments on commit 6e11084

Please sign in to comment.