mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Made the HiDPI display mode (of non-HiDPI maps) configurable
This commit is contained in:
parent
d58322b412
commit
89f384feed
@ -40,5 +40,7 @@
|
|||||||
<file>icons/document-print_32@2x.png</file>
|
<file>icons/document-print_32@2x.png</file>
|
||||||
<file>icons/view-filter.png</file>
|
<file>icons/view-filter.png</file>
|
||||||
<file>icons/view-filter@2x.png</file>
|
<file>icons/view-filter@2x.png</file>
|
||||||
|
<file>icons/applications-internet_32.png</file>
|
||||||
|
<file>icons/applications-internet_32@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
icons/applications-internet_32.png
Normal file
BIN
icons/applications-internet_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
icons/applications-internet_32@2x.png
Normal file
BIN
icons/applications-internet_32@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
@ -931,6 +931,11 @@ void GUI::openOptions()
|
|||||||
if (options.enableHTTP2 != _options.enableHTTP2)
|
if (options.enableHTTP2 != _options.enableHTTP2)
|
||||||
Downloader::enableHTTP2(options.enableHTTP2);
|
Downloader::enableHTTP2(options.enableHTTP2);
|
||||||
#endif // ENABLE_HTTP2
|
#endif // ENABLE_HTTP2
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
if (options.hidpiMap != _options.hidpiMap)
|
||||||
|
_mapView->setDevicePixelRatio(options.hidpiMap ? devicePixelRatioF()
|
||||||
|
: 1.0);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
if (reload)
|
if (reload)
|
||||||
reloadFile();
|
reloadFile();
|
||||||
@ -1798,6 +1803,10 @@ void GUI::writeSettings()
|
|||||||
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
|
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
|
||||||
if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT)
|
if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT)
|
||||||
settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap);
|
settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap);
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
if (_options.hidpiMap != HIDPI_MAP_DEFAULT)
|
||||||
|
settings.setValue(HIDPI_MAP_SETTING, _options.hidpiMap);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2033,6 +2042,10 @@ void GUI::readSettings()
|
|||||||
SLIDER_COLOR_DEFAULT).value<QColor>();
|
SLIDER_COLOR_DEFAULT).value<QColor>();
|
||||||
_options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING,
|
_options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING,
|
||||||
ALWAYS_SHOW_MAP_DEFAULT).toBool();
|
ALWAYS_SHOW_MAP_DEFAULT).toBool();
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_options.hidpiMap = settings.value(HIDPI_MAP_SETTING, HIDPI_MAP_SETTING)
|
||||||
|
.toBool();
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
_mapView->setPalette(_options.palette);
|
_mapView->setPalette(_options.palette);
|
||||||
_mapView->setMapOpacity(_options.mapOpacity);
|
_mapView->setMapOpacity(_options.mapOpacity);
|
||||||
@ -2049,6 +2062,9 @@ void GUI::readSettings()
|
|||||||
_mapView->setMarkerColor(_options.sliderColor);
|
_mapView->setMarkerColor(_options.sliderColor);
|
||||||
if (_options.useOpenGL)
|
if (_options.useOpenGL)
|
||||||
_mapView->useOpenGL(true);
|
_mapView->useOpenGL(true);
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_mapView->setDevicePixelRatio(_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
for (int i = 0; i < _tabs.count(); i++) {
|
for (int i = 0; i < _tabs.count(); i++) {
|
||||||
_tabs.at(i)->setPalette(_options.palette);
|
_tabs.at(i)->setPalette(_options.palette);
|
||||||
@ -2134,7 +2150,7 @@ void GUI::show()
|
|||||||
void GUI::screenChanged(QScreen *screen)
|
void GUI::screenChanged(QScreen *screen)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
_mapView->updateDevicePixelRatio();
|
_mapView->setDevicePixelRatio(_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
|
|
||||||
disconnect(SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
disconnect(SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
||||||
SLOT(logicalDotsPerInchChanged(qreal)));
|
SLOT(logicalDotsPerInchChanged(qreal)));
|
||||||
@ -2150,6 +2166,6 @@ void GUI::logicalDotsPerInchChanged(qreal dpi)
|
|||||||
Q_UNUSED(dpi)
|
Q_UNUSED(dpi)
|
||||||
|
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
_mapView->updateDevicePixelRatio();
|
_mapView->setDevicePixelRatio(_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
#endif // ENBLE_HIDPI
|
#endif // ENBLE_HIDPI
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,6 @@
|
|||||||
#define SYSTEM_ICON ":/icons/preferences-system.png"
|
#define SYSTEM_ICON ":/icons/preferences-system.png"
|
||||||
#define PRINT_EXPORT_ICON ":/icons/document-print_32.png"
|
#define PRINT_EXPORT_ICON ":/icons/document-print_32.png"
|
||||||
#define DATA_ICON ":/icons/view-filter.png"
|
#define DATA_ICON ":/icons/view-filter.png"
|
||||||
|
#define MAPS_ICON ":/icons/applications-internet_32.png"
|
||||||
|
|
||||||
#endif /* ICONS_H */
|
#endif /* ICONS_H */
|
||||||
|
@ -42,10 +42,6 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
|
|
||||||
_map = map;
|
_map = map;
|
||||||
_map->load();
|
_map->load();
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
_ratio = devicePixelRatioF();
|
|
||||||
_map->setDevicePixelRatio(_ratio);
|
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||||
|
|
||||||
_poi = poi;
|
_poi = poi;
|
||||||
@ -75,6 +71,9 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
_poiSize = 8;
|
_poiSize = 8;
|
||||||
_poiColor = Qt::black;
|
_poiColor = Qt::black;
|
||||||
|
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_ratio = 1.0;
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
_opengl = false;
|
_opengl = false;
|
||||||
_plot = false;
|
_plot = false;
|
||||||
_digitalZoom = 0;
|
_digitalZoom = 0;
|
||||||
@ -845,23 +844,19 @@ void MapView::reloadMap()
|
|||||||
_scene->invalidate();
|
_scene->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::updateDevicePixelRatio()
|
void MapView::setDevicePixelRatio(qreal ratio)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
if (_ratio == devicePixelRatioF())
|
if (_ratio == ratio)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_ratio = devicePixelRatioF();
|
_ratio = ratio;
|
||||||
|
|
||||||
QRectF vr(mapToScene(viewport()->rect()).boundingRect()
|
QRectF vr(mapToScene(viewport()->rect()).boundingRect()
|
||||||
.intersected(_map->bounds()));
|
.intersected(_map->bounds()));
|
||||||
RectC cr(_map->xy2ll(vr.topLeft()), _map->xy2ll(vr.bottomRight()));
|
RectC cr(_map->xy2ll(vr.topLeft()), _map->xy2ll(vr.bottomRight()));
|
||||||
|
|
||||||
_map->setDevicePixelRatio(_ratio);
|
_map->setDevicePixelRatio(_ratio);
|
||||||
|
|
||||||
digitalZoom(0);
|
|
||||||
|
|
||||||
_map->zoomFit(viewport()->rect().size(), cr);
|
|
||||||
_scene->setSceneRect(_map->bounds());
|
_scene->setSceneRect(_map->bounds());
|
||||||
|
|
||||||
for (int i = 0; i < _tracks.size(); i++)
|
for (int i = 0; i < _tracks.size(); i++)
|
||||||
@ -881,5 +876,7 @@ void MapView::updateDevicePixelRatio()
|
|||||||
centerOn(nc);
|
centerOn(nc);
|
||||||
|
|
||||||
reloadMap();
|
reloadMap();
|
||||||
|
#else // ENABLE_HIDPI
|
||||||
|
Q_UNUSED(ratio);
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public slots:
|
|||||||
void showRouteWaypoints(bool show);
|
void showRouteWaypoints(bool show);
|
||||||
void clearMapCache();
|
void clearMapCache();
|
||||||
void setCoordinatesFormat(CoordinatesFormat format);
|
void setCoordinatesFormat(CoordinatesFormat format);
|
||||||
void updateDevicePixelRatio();
|
void setDevicePixelRatio(qreal ratio);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatePOI();
|
void updatePOI();
|
||||||
|
@ -34,26 +34,61 @@ static QFrame *line()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QWidget *OptionsDialog::createGeneralPage()
|
QWidget *OptionsDialog::createMapPage()
|
||||||
{
|
{
|
||||||
_alwaysShowMap = new QCheckBox(tr("Always show the map"));
|
_alwaysShowMap = new QCheckBox(tr("Always show the map"));
|
||||||
_alwaysShowMap->setChecked(_options->alwaysShowMap);
|
_alwaysShowMap->setChecked(_options->alwaysShowMap);
|
||||||
_alwaysShowMap->setToolTip("<p>" +
|
_alwaysShowMap->setToolTip("<p>" +
|
||||||
tr("Show the map even when no files are loaded.") + "</p>");
|
tr("Show the map even when no files are loaded.") + "</p>");
|
||||||
|
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_hidpi = new QRadioButton(tr("High-resolution"));
|
||||||
|
_lodpi = new QRadioButton(tr("Standard"));
|
||||||
|
if (_options->hidpiMap)
|
||||||
|
_hidpi->setChecked(true);
|
||||||
|
else
|
||||||
|
_lodpi->setChecked(true);
|
||||||
|
QLabel *lhi = new QLabel(tr("Non-HiDPI maps are loaded as HiDPI maps. "
|
||||||
|
"The map is sharp but map objects are small/hard to read."));
|
||||||
|
QLabel *llo = new QLabel(tr("Non-HiDPI maps are loaded such as they are. "
|
||||||
|
"Map objects have the expected size but the map is blurry."));
|
||||||
|
QFont f = lhi->font();
|
||||||
|
f.setPointSize(f.pointSize() - 1);
|
||||||
|
lhi->setWordWrap(true);
|
||||||
|
llo->setWordWrap(true);
|
||||||
|
lhi->setFont(f);
|
||||||
|
llo->setFont(f);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
QFormLayout *showMapLayout = new QFormLayout();
|
QFormLayout *showMapLayout = new QFormLayout();
|
||||||
showMapLayout->addWidget(_alwaysShowMap);
|
showMapLayout->addWidget(_alwaysShowMap);
|
||||||
|
|
||||||
QWidget *generalTab = new QWidget();
|
QWidget *mapTab = new QWidget();
|
||||||
QVBoxLayout *generalTabLayout = new QVBoxLayout();
|
QVBoxLayout *mapTabLayout = new QVBoxLayout();
|
||||||
generalTabLayout->addLayout(showMapLayout);
|
mapTabLayout->addLayout(showMapLayout);
|
||||||
generalTabLayout->addStretch();
|
mapTabLayout->addStretch();
|
||||||
generalTab->setLayout(generalTabLayout);
|
mapTab->setLayout(mapTabLayout);
|
||||||
|
|
||||||
QTabWidget *generalPage = new QTabWidget();
|
#ifdef ENABLE_HIDPI
|
||||||
generalPage->addTab(generalTab, tr("General"));
|
QVBoxLayout *hidpiTabLayout = new QVBoxLayout();
|
||||||
|
hidpiTabLayout->addWidget(_lodpi);
|
||||||
|
hidpiTabLayout->addWidget(llo);
|
||||||
|
hidpiTabLayout->addSpacing(10);
|
||||||
|
hidpiTabLayout->addWidget(_hidpi);
|
||||||
|
hidpiTabLayout->addWidget(lhi);
|
||||||
|
hidpiTabLayout->addStretch();
|
||||||
|
|
||||||
return generalPage;
|
QWidget *hidpiTab = new QWidget();
|
||||||
|
hidpiTab->setLayout(hidpiTabLayout);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
|
QTabWidget *mapPage = new QTabWidget();
|
||||||
|
mapPage->addTab(mapTab, tr("General"));
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
mapPage->addTab(hidpiTab, tr("HiDPI display mode"));
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
|
return mapPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *OptionsDialog::createAppearancePage()
|
QWidget *OptionsDialog::createAppearancePage()
|
||||||
@ -483,8 +518,8 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
|||||||
: QDialog(parent), _options(options)
|
: QDialog(parent), _options(options)
|
||||||
{
|
{
|
||||||
QStackedWidget *pages = new QStackedWidget();
|
QStackedWidget *pages = new QStackedWidget();
|
||||||
pages->addWidget(createGeneralPage());
|
|
||||||
pages->addWidget(createAppearancePage());
|
pages->addWidget(createAppearancePage());
|
||||||
|
pages->addWidget(createMapPage());
|
||||||
pages->addWidget(createDataPage());
|
pages->addWidget(createDataPage());
|
||||||
pages->addWidget(createPOIPage());
|
pages->addWidget(createPOIPage());
|
||||||
pages->addWidget(createExportPage());
|
pages->addWidget(createExportPage());
|
||||||
@ -492,9 +527,9 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
|||||||
|
|
||||||
QListWidget *menu = new QListWidget();
|
QListWidget *menu = new QListWidget();
|
||||||
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
|
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
|
||||||
new QListWidgetItem(QIcon(APP_ICON), tr("General"), menu);
|
|
||||||
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
|
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
|
||||||
menu);
|
menu);
|
||||||
|
new QListWidgetItem(QIcon(MAPS_ICON), tr("Maps"), menu);
|
||||||
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
|
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
|
||||||
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
|
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
|
||||||
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
|
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
|
||||||
@ -532,8 +567,6 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
|||||||
|
|
||||||
void OptionsDialog::accept()
|
void OptionsDialog::accept()
|
||||||
{
|
{
|
||||||
_options->alwaysShowMap = _alwaysShowMap->isChecked();
|
|
||||||
|
|
||||||
_options->palette.setColor(_baseColor->color());
|
_options->palette.setColor(_baseColor->color());
|
||||||
_options->palette.setShift(_colorOffset->value());
|
_options->palette.setShift(_colorOffset->value());
|
||||||
_options->mapOpacity = _mapOpacity->value();
|
_options->mapOpacity = _mapOpacity->value();
|
||||||
@ -553,6 +586,11 @@ void OptionsDialog::accept()
|
|||||||
_options->sliderColor = _sliderColor->color();
|
_options->sliderColor = _sliderColor->color();
|
||||||
_options->graphAntiAliasing = _graphAA->isChecked();
|
_options->graphAntiAliasing = _graphAA->isChecked();
|
||||||
|
|
||||||
|
_options->alwaysShowMap = _alwaysShowMap->isChecked();
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_options->hidpiMap = _hidpi->isChecked();
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
_options->elevationFilter = _elevationFilter->value();
|
_options->elevationFilter = _elevationFilter->value();
|
||||||
_options->speedFilter = _speedFilter->value();
|
_options->speedFilter = _speedFilter->value();
|
||||||
_options->heartRateFilter = _heartRateFilter->value();
|
_options->heartRateFilter = _heartRateFilter->value();
|
||||||
|
@ -18,8 +18,6 @@ class QRadioButton;
|
|||||||
class PercentSlider;
|
class PercentSlider;
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
// General
|
|
||||||
bool alwaysShowMap;
|
|
||||||
// Appearance
|
// Appearance
|
||||||
Palette palette;
|
Palette palette;
|
||||||
int trackWidth;
|
int trackWidth;
|
||||||
@ -36,6 +34,11 @@ struct Options {
|
|||||||
bool graphAntiAliasing;
|
bool graphAntiAliasing;
|
||||||
int mapOpacity;
|
int mapOpacity;
|
||||||
QColor backgroundColor;
|
QColor backgroundColor;
|
||||||
|
// Map
|
||||||
|
bool alwaysShowMap;
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
bool hidpiMap;
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
// Data
|
// Data
|
||||||
int elevationFilter;
|
int elevationFilter;
|
||||||
int speedFilter;
|
int speedFilter;
|
||||||
@ -79,7 +82,7 @@ public slots:
|
|||||||
void accept();
|
void accept();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *createGeneralPage();
|
QWidget *createMapPage();
|
||||||
QWidget *createAppearancePage();
|
QWidget *createAppearancePage();
|
||||||
QWidget *createDataPage();
|
QWidget *createDataPage();
|
||||||
QWidget *createPOIPage();
|
QWidget *createPOIPage();
|
||||||
@ -88,8 +91,6 @@ private:
|
|||||||
|
|
||||||
Options *_options;
|
Options *_options;
|
||||||
|
|
||||||
// General
|
|
||||||
QCheckBox *_alwaysShowMap;
|
|
||||||
// Appearance
|
// Appearance
|
||||||
ColorBox *_baseColor;
|
ColorBox *_baseColor;
|
||||||
QDoubleSpinBox *_colorOffset;
|
QDoubleSpinBox *_colorOffset;
|
||||||
@ -107,6 +108,12 @@ private:
|
|||||||
QSpinBox *_graphWidth;
|
QSpinBox *_graphWidth;
|
||||||
ColorBox *_sliderColor;
|
ColorBox *_sliderColor;
|
||||||
QCheckBox *_graphAA;
|
QCheckBox *_graphAA;
|
||||||
|
// Map
|
||||||
|
QCheckBox *_alwaysShowMap;
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
QRadioButton *_hidpi;
|
||||||
|
QRadioButton *_lodpi;
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
// Data
|
// Data
|
||||||
OddSpinBox *_elevationFilter;
|
OddSpinBox *_elevationFilter;
|
||||||
OddSpinBox *_speedFilter;
|
OddSpinBox *_speedFilter;
|
||||||
|
@ -156,5 +156,7 @@
|
|||||||
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
|
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
|
||||||
#define ALWAYS_SHOW_MAP_SETTING "alwaysShowMap"
|
#define ALWAYS_SHOW_MAP_SETTING "alwaysShowMap"
|
||||||
#define ALWAYS_SHOW_MAP_DEFAULT true
|
#define ALWAYS_SHOW_MAP_DEFAULT true
|
||||||
|
#define HIDPI_MAP_SETTING "HiDPIMap"
|
||||||
|
#define HIDPI_MAP_DEFAULT true
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user