1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Fixed HTTP2 settings handling

This commit is contained in:
Martin Tůma 2018-10-07 14:22:13 +02:00
parent 2f9751672e
commit f9af06267a
4 changed files with 21 additions and 5 deletions

View File

@ -5,6 +5,7 @@
#include <QNetworkProxyFactory> #include <QNetworkProxyFactory>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QSettings>
#include "map/downloader.h" #include "map/downloader.h"
#include "map/ellipsoid.h" #include "map/ellipsoid.h"
#include "map/gcs.h" #include "map/gcs.h"
@ -12,6 +13,7 @@
#include "opengl.h" #include "opengl.h"
#include "gui.h" #include "gui.h"
#include "config.h" #include "config.h"
#include "settings.h"
#include "app.h" #include "app.h"
@ -37,6 +39,16 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
QNetworkProxyFactory::setUseSystemConfiguration(true); QNetworkProxyFactory::setUseSystemConfiguration(true);
Downloader::setNetworkAccessManager(new QNetworkAccessManager(this)); Downloader::setNetworkAccessManager(new QNetworkAccessManager(this));
QSettings settings(APP_NAME, APP_NAME);
settings.beginGroup(OPTIONS_SETTINGS_GROUP);
#ifdef ENABLE_HTTP2
Downloader::enableHTTP2(settings.value(ENABLE_HTTP2_SETTING,
ENABLE_HTTP2_DEFAULT).toBool());
#endif // ENABLE_HTTP2
Downloader::setTimeout(settings.value(CONNECTION_TIMEOUT_SETTING,
CONNECTION_TIMEOUT_DEFAULT).toInt());
settings.endGroup();
OPENGL_SET_SAMPLES(4); OPENGL_SET_SAMPLES(4);
loadDatums(); loadDatums();
loadPCSs(); loadPCSs();

View File

@ -2085,10 +2085,6 @@ void GUI::readSettings()
_poi->setRadius(_options.poiRadius); _poi->setRadius(_options.poiRadius);
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024); QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
Downloader::setTimeout(_options.connectionTimeout);
#ifdef ENABLE_HTTP2
Downloader::enableHTTP2(_options.enableHTTP2);
#endif // ENABLE_HTTP2
settings.endGroup(); settings.endGroup();
} }

View File

@ -227,3 +227,11 @@ bool Downloader::get(const QList<Download> &list,
return finishEmitted; return finishEmitted;
} }
#ifdef ENABLE_HTTP2
void Downloader::enableHTTP2(bool enable)
{
_http2 = enable;
_manager->clearConnectionCache();
}
#endif // ENABLE_HTTP2

View File

@ -48,7 +48,7 @@ public:
static void setTimeout(int timeout) {_timeout = timeout;} static void setTimeout(int timeout) {_timeout = timeout;}
#ifdef ENABLE_HTTP2 #ifdef ENABLE_HTTP2
static void enableHTTP2(bool enable) {_http2 = enable;} static void enableHTTP2(bool enable);
#endif // ENABLE_HTTP2 #endif // ENABLE_HTTP2
static void setNetworkAccessManager(QNetworkAccessManager *manager) static void setNetworkAccessManager(QNetworkAccessManager *manager)
{_manager = manager;} {_manager = manager;}