Skip to content
Permalink
Browse files

Fix network cache configuration

Fix #14990
  • Loading branch information
m-kuhn committed Jun 12, 2016
1 parent 7861f89 commit 7c72fefd7c7a22bf08d26d902dc54c76e2a74df3
@@ -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().
@@ -11325,8 +11325,6 @@ void QgisApp::namSetup()
{
QgsNetworkAccessManager *nam = QgsNetworkAccessManager::instance();

namUpdate();

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

@@ -314,16 +314,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() );
@@ -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() ) );
@@ -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().

0 comments on commit 7c72fef

Please sign in to comment.
You can’t perform that action at this time.