1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 11:39:16 +02:00

Added support for HTTP/2

This commit is contained in:
2018-07-23 23:53:58 +02:00
parent 33739acafe
commit c0e458a437
7 changed files with 48 additions and 0 deletions

View File

@ -920,6 +920,10 @@ void GUI::openOptions()
QPixmapCache::setCacheLimit(options.pixmapCache * 1024);
if (options.connectionTimeout != _options.connectionTimeout)
Downloader::setTimeout(options.connectionTimeout);
#ifdef ENABLE_HTTP2
if (options.enableHTTP2 != _options.enableHTTP2)
Downloader::enableHTTP2(options.enableHTTP2);
#endif // ENABLE_HTTP2
if (reload)
reloadFile();
@ -1755,6 +1759,10 @@ void GUI::writeSettings()
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL);
#ifdef ENABLE_HTTP2
if (_options.enableHTTP2 != ENABLE_HTTP2_DEFAULT)
settings.setValue(ENABLE_HTTP2_SETTING, _options.enableHTTP2);
#endif // ENABLE_HTTP2
if (_options.pixmapCache != PIXMAP_CACHE_DEFAULT)
settings.setValue(PIXMAP_CACHE_SETTING, _options.pixmapCache);
if (_options.connectionTimeout != CONNECTION_TIMEOUT_DEFAULT)
@ -1987,6 +1995,10 @@ void GUI::readSettings()
.toInt();
_options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT)
.toBool();
#ifdef ENABLE_HTTP2
_options.enableHTTP2 = settings.value(ENABLE_HTTP2_SETTING,
ENABLE_HTTP2_DEFAULT).toBool();
#endif // ENABLE_HTTP2
_options.pixmapCache = settings.value(PIXMAP_CACHE_SETTING,
PIXMAP_CACHE_DEFAULT).toInt();
_options.connectionTimeout = settings.value(CONNECTION_TIMEOUT_SETTING,
@ -2052,6 +2064,9 @@ void GUI::readSettings()
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
Downloader::setTimeout(_options.connectionTimeout);
#ifdef ENABLE_HTTP2
Downloader::enableHTTP2(_options.enableHTTP2);
#endif // ENABLE_HTTP2
settings.endGroup();
}

View File

@ -440,6 +440,10 @@ QWidget *OptionsDialog::createSystemPage()
{
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
_useOpenGL->setChecked(_options->useOpenGL);
#ifdef ENABLE_HTTP2
_enableHTTP2 = new QCheckBox(tr("Enable HTTP/2"));
_enableHTTP2->setChecked(_options->enableHTTP2);
#endif // ENABLE_HTTP2
_pixmapCache = new QSpinBox();
_pixmapCache->setMinimum(16);
@ -458,6 +462,9 @@ QWidget *OptionsDialog::createSystemPage()
formLayout->addRow(tr("Connection timeout:"), _connectionTimeout);
QFormLayout *checkboxLayout = new QFormLayout();
#ifdef ENABLE_HTTP2
checkboxLayout->addWidget(_enableHTTP2);
#endif // ENABLE_HTTP2
checkboxLayout->addWidget(_useOpenGL);
QWidget *systemTab = new QWidget();
@ -568,6 +575,9 @@ void OptionsDialog::accept()
_options->poiRadius = poiRadius;
_options->useOpenGL = _useOpenGL->isChecked();
#ifdef ENABLE_HTTP2
_options->enableHTTP2 = _enableHTTP2->isChecked();
#endif // ENABLE_HTTP2
_options->pixmapCache = _pixmapCache->value();
_options->connectionTimeout = _connectionTimeout->value();

View File

@ -5,6 +5,7 @@
#include "palette.h"
#include "units.h"
class ColorBox;
class StyleComboBox;
class OddSpinBox;
@ -48,6 +49,9 @@ struct Options {
int poiRadius;
// System
bool useOpenGL;
#ifdef ENABLE_HTTP2
bool enableHTTP2;
#endif // ENABLE_HTTP2
int pixmapCache;
int connectionTimeout;
// Print/Export
@ -119,6 +123,9 @@ private:
QSpinBox *_pixmapCache;
QSpinBox *_connectionTimeout;
QCheckBox *_useOpenGL;
#ifdef ENABLE_HTTP2
QCheckBox *_enableHTTP2;
#endif // ENABLE_HTTP2
// Print/Export
QRadioButton *_wysiwyg;
QRadioButton *_hires;

View File

@ -130,6 +130,8 @@
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
#define USE_OPENGL_SETTING "useOpenGL"
#define USE_OPENGL_DEFAULT false
#define ENABLE_HTTP2_SETTING "enableHTTP2"
#define ENABLE_HTTP2_DEFAULT true
#define PIXMAP_CACHE_SETTING "pixmapCache"
#define PIXMAP_CACHE_DEFAULT 64 /* MB */
#define CONNECTION_TIMEOUT_SETTING "connectionTimeout"