diff --git a/src/GUI/app.cpp b/src/GUI/app.cpp index d08caef2..e18ce0cd 100644 --- a/src/GUI/app.cpp +++ b/src/GUI/app.cpp @@ -56,7 +56,6 @@ App::App(int &argc, char **argv) : QApplication(argc, argv) "QThreadStorage: Thread X exited after QThreadStorage Y destroyed" */ Downloader::setNetworkManager(new QNetworkAccessManager(this)); DEM::setDir(ProgramPaths::demDir()); - DEM::setCacheSize(536870912/*512MB*/); QSurfaceFormat fmt; fmt.setStencilBufferSize(8); fmt.setSamples(4); diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index b767b81c..11b2c099 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -2416,6 +2416,7 @@ void GUI::writeSettings() WRITE(useOpenGL, _options.useOpenGL); WRITE(enableHTTP2, _options.enableHTTP2); WRITE(pixmapCache, _options.pixmapCache); + WRITE(demCache, _options.demCache); WRITE(connectionTimeout, _options.connectionTimeout); WRITE(hiresPrint, _options.hiresPrint); WRITE(printName, _options.printName); @@ -2697,6 +2698,7 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs) _options.useOpenGL = READ(useOpenGL).toBool(); _options.enableHTTP2 = READ(enableHTTP2).toBool(); _options.pixmapCache = READ(pixmapCache).toInt(); + _options.demCache = READ(demCache).toInt(); _options.connectionTimeout = READ(connectionTimeout).toInt(); _options.hiresPrint = READ(hiresPrint).toBool(); _options.printName = READ(printName).toBool(); @@ -2784,6 +2786,7 @@ void GUI::loadOptions() Downloader::setTimeout(_options.connectionTimeout); QPixmapCache::setCacheLimit(_options.pixmapCache * 1024); + DEM::setCacheSize(_options.demCache * 1024); _poi->setRadius(_options.poiRadius); @@ -2909,6 +2912,8 @@ void GUI::updateOptions(const Options &options) if (options.pixmapCache != _options.pixmapCache) QPixmapCache::setCacheLimit(options.pixmapCache * 1024); + if (options.demCache != _options.demCache) + DEM::setCacheSize(options.demCache * 1024); if (options.connectionTimeout != _options.connectionTimeout) Downloader::setTimeout(options.connectionTimeout); diff --git a/src/GUI/optionsdialog.cpp b/src/GUI/optionsdialog.cpp index 49ac4f07..a38e1c9d 100644 --- a/src/GUI/optionsdialog.cpp +++ b/src/GUI/optionsdialog.cpp @@ -723,6 +723,12 @@ QWidget *OptionsDialog::createSystemPage() _pixmapCache->setSuffix(UNIT_SPACE + tr("MB")); _pixmapCache->setValue(_options.pixmapCache); + _demCache = new QSpinBox(); + _demCache->setMinimum(64); + _demCache->setMaximum(2048); + _demCache->setSuffix(UNIT_SPACE + tr("MB")); + _demCache->setValue(_options.demCache); + _connectionTimeout = new QSpinBox(); _connectionTimeout->setMinimum(30); _connectionTimeout->setMaximum(120); @@ -740,6 +746,7 @@ QWidget *OptionsDialog::createSystemPage() #else // Q_OS_MAC QFormLayout *formLayout = new QFormLayout(); formLayout->addRow(tr("Image cache size:"), _pixmapCache); + formLayout->addRow(tr("DEM cache size:"), _demCache); formLayout->addRow(tr("Connection timeout:"), _connectionTimeout); QFormLayout *checkboxLayout = new QFormLayout(); checkboxLayout->addWidget(_enableHTTP2); @@ -932,6 +939,7 @@ void OptionsDialog::accept() _options.useOpenGL = _useOpenGL->isChecked(); _options.enableHTTP2 = _enableHTTP2->isChecked(); _options.pixmapCache = _pixmapCache->value(); + _options.demCache = _demCache->value(); _options.connectionTimeout = _connectionTimeout->value(); _options.dataPath = _dataPath->dir(); _options.mapsPath = _mapsPath->dir(); diff --git a/src/GUI/optionsdialog.h b/src/GUI/optionsdialog.h index b259c71e..847f9252 100644 --- a/src/GUI/optionsdialog.h +++ b/src/GUI/optionsdialog.h @@ -79,6 +79,7 @@ struct Options { bool useOpenGL; bool enableHTTP2; int pixmapCache; + int demCache; int connectionTimeout; QString dataPath; QString mapsPath; @@ -182,6 +183,7 @@ private: #endif // QT 5.14 // System QSpinBox *_pixmapCache; + QSpinBox *_demCache; QSpinBox *_connectionTimeout; QCheckBox *_useOpenGL; QCheckBox *_enableHTTP2; diff --git a/src/GUI/settings.cpp b/src/GUI/settings.cpp index e84311ed..de90892a 100644 --- a/src/GUI/settings.cpp +++ b/src/GUI/settings.cpp @@ -34,8 +34,10 @@ #ifdef Q_OS_ANDROID #define PIXMAP_CACHE 256 +#define DEM_CACHE 128 #else // Q_OS_ANDROID #define PIXMAP_CACHE 512 +#define DEM_CACHE 256 #endif // Q_OS_ANDROID @@ -243,6 +245,7 @@ SETTING(demPassword, "demPassword", "" ); SETTING(useOpenGL, "useOpenGL", false ); SETTING(enableHTTP2, "enableHTTP2", true ); SETTING(pixmapCache, "pixmapCache", PIXMAP_CACHE ); +SETTING(demCache, "demCache", DEM_CACHE ); SETTING(connectionTimeout, "connectionTimeout", 30 ); SETTING(hiresPrint, "hiresPrint", false ); SETTING(printName, "printName", true ); diff --git a/src/GUI/settings.h b/src/GUI/settings.h index 021e06e4..b08a18eb 100644 --- a/src/GUI/settings.h +++ b/src/GUI/settings.h @@ -189,6 +189,7 @@ public: static const Setting useOpenGL; static const Setting enableHTTP2; static const Setting pixmapCache; + static const Setting demCache; static const Setting connectionTimeout; static const Setting hiresPrint; static const Setting printName;