mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 11:39:16 +02:00
Added pixmap cache configuration to options.
This commit is contained in:
@ -3,7 +3,6 @@
|
||||
#include <QLocale>
|
||||
#include <QFileOpenEvent>
|
||||
#include <QNetworkProxyFactory>
|
||||
#include <QPixmapCache>
|
||||
#include "opengl.h"
|
||||
#include "gui.h"
|
||||
#include "onlinemap.h"
|
||||
@ -24,7 +23,6 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
QPixmapCache::setCacheLimit(65536);
|
||||
OnlineMap::setDownloader(new Downloader(this));
|
||||
OPENGL_SET_SAMPLES(4);
|
||||
|
||||
|
13
src/gui.cpp
13
src/gui.cpp
@ -21,6 +21,7 @@
|
||||
#include <QLocale>
|
||||
#include <QMimeData>
|
||||
#include <QUrl>
|
||||
#include <QPixmapCache>
|
||||
#include "config.h"
|
||||
#include "icons.h"
|
||||
#include "keys.h"
|
||||
@ -714,8 +715,8 @@ void GUI::dataSources()
|
||||
"directory:")
|
||||
+ "</p><p><code>" + USER_MAP_DIR + "</code></p><p>"
|
||||
+ tr("The expected structure is one map/atlas in a separate subdirectory."
|
||||
" Supported map formats are OziExplorer image-based maps and tiled"
|
||||
" TrekBuddy maps/atlases (tared and non-tared).") + "</p>"
|
||||
" Supported map formats are OziExplorer maps and TrekBuddy maps/atlases"
|
||||
" (tared and non-tared).") + "</p>"
|
||||
|
||||
+ "<h4>" + tr("POIs") + "</h4><p>"
|
||||
+ tr("To make GPXSee load a POI file automatically on startup, add "
|
||||
@ -910,6 +911,8 @@ void GUI::openOptions()
|
||||
for (int i = 0; i < _tabs.count(); i++)
|
||||
_tabs.at(i)->useOpenGL(options.useOpenGL);
|
||||
}
|
||||
if (options.pixmapCache != _options.pixmapCache)
|
||||
QPixmapCache::setCacheLimit(options.pixmapCache);
|
||||
|
||||
_options = options;
|
||||
}
|
||||
@ -1581,6 +1584,8 @@ void GUI::writeSettings()
|
||||
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
|
||||
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
|
||||
settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL);
|
||||
if (_options.pixmapCache != PIXMAP_CACHE_DEFAULT)
|
||||
settings.setValue(PIXMAP_CACHE_SETTING, _options.pixmapCache);
|
||||
if (_options.printName != PRINT_NAME_DEFAULT)
|
||||
settings.setValue(PRINT_NAME_SETTING, _options.printName);
|
||||
if (_options.printDate != PRINT_DATE_DEFAULT)
|
||||
@ -1758,6 +1763,8 @@ void GUI::readSettings()
|
||||
.toInt();
|
||||
_options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT)
|
||||
.toBool();
|
||||
_options.pixmapCache = settings.value(PIXMAP_CACHE_SETTING,
|
||||
PIXMAP_CACHE_DEFAULT).toInt();
|
||||
_options.printName = settings.value(PRINT_NAME_SETTING, PRINT_NAME_DEFAULT)
|
||||
.toBool();
|
||||
_options.printDate = settings.value(PRINT_DATE_SETTING, PRINT_DATE_DEFAULT)
|
||||
@ -1793,6 +1800,8 @@ void GUI::readSettings()
|
||||
|
||||
_poi->setRadius(_options.poiRadius);
|
||||
|
||||
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
|
||||
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
|
@ -196,11 +196,24 @@ QWidget *OptionsDialog::createSystemPage()
|
||||
#endif // Q_OS_WIN32
|
||||
_useOpenGL->setChecked(_options->useOpenGL);
|
||||
|
||||
QFormLayout *systemLayout = new QFormLayout();
|
||||
systemLayout->addWidget(_useOpenGL);
|
||||
_pixmapCache = new QSpinBox();
|
||||
_pixmapCache->setMinimum(16);
|
||||
_pixmapCache->setMaximum(1024);
|
||||
_pixmapCache->setSuffix(UNIT_SPACE + tr("MB"));
|
||||
_pixmapCache->setValue(_options->pixmapCache);
|
||||
|
||||
QFormLayout *cacheLayout = new QFormLayout();
|
||||
cacheLayout->addRow(tr("Image cache size:"), _pixmapCache);
|
||||
|
||||
QFormLayout *openGLLayout = new QFormLayout();
|
||||
openGLLayout->addWidget(_useOpenGL);
|
||||
|
||||
QWidget *systemTab = new QWidget();
|
||||
systemTab->setLayout(systemLayout);
|
||||
QVBoxLayout *systemTabLayout = new QVBoxLayout();
|
||||
systemTabLayout->addLayout(cacheLayout);
|
||||
systemTabLayout->addLayout(openGLLayout);
|
||||
systemTabLayout->addStretch();
|
||||
systemTab->setLayout(systemTabLayout);
|
||||
|
||||
QTabWidget *systemPage = new QTabWidget();
|
||||
systemPage->addTab(systemTab, tr("System"));
|
||||
@ -275,6 +288,7 @@ void OptionsDialog::accept()
|
||||
_options->poiRadius = _poiRadius->value() * KMINM;
|
||||
|
||||
_options->useOpenGL = _useOpenGL->isChecked();
|
||||
_options->pixmapCache = _pixmapCache->value();
|
||||
|
||||
_options->printName = _name->isChecked();
|
||||
_options->printDate = _date->isChecked();
|
||||
|
@ -26,6 +26,7 @@ struct Options {
|
||||
int poiRadius;
|
||||
// System
|
||||
bool useOpenGL;
|
||||
int pixmapCache;
|
||||
// Print/Export
|
||||
bool printName;
|
||||
bool printDate;
|
||||
@ -66,6 +67,7 @@ private:
|
||||
QSpinBox *_graphWidth;
|
||||
QCheckBox *_graphAA;
|
||||
QDoubleSpinBox *_poiRadius;
|
||||
QSpinBox *_pixmapCache;
|
||||
QCheckBox *_useOpenGL;
|
||||
QCheckBox *_name;
|
||||
QCheckBox *_date;
|
||||
|
@ -94,6 +94,8 @@
|
||||
#define POI_RADIUS_DEFAULT (IMPERIAL_UNITS() ? MIINM : KMINM)
|
||||
#define USE_OPENGL_SETTING "useOpenGL"
|
||||
#define USE_OPENGL_DEFAULT false
|
||||
#define PIXMAP_CACHE_SETTING "pixmapCache"
|
||||
#define PIXMAP_CACHE_DEFAULT 64
|
||||
#define PRINT_NAME_SETTING "printName"
|
||||
#define PRINT_NAME_DEFAULT true
|
||||
#define PRINT_DATE_SETTING "printDate"
|
||||
|
Reference in New Issue
Block a user