mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 19:49:15 +02:00
Added map background color setting.
Redesigned appearance settings tab.
This commit is contained in:
@ -871,6 +871,8 @@ void GUI::openOptions()
|
||||
}
|
||||
if (options.mapOpacity != _options.mapOpacity)
|
||||
_pathView->setMapOpacity(options.mapOpacity);
|
||||
if (options.blendColor != _options.blendColor)
|
||||
_pathView->setBlendColor(options.blendColor);
|
||||
if (options.trackWidth != _options.trackWidth)
|
||||
_pathView->setTrackWidth(options.trackWidth);
|
||||
if (options.routeWidth != _options.routeWidth)
|
||||
@ -1608,6 +1610,8 @@ void GUI::writeSettings()
|
||||
settings.setValue(PALETTE_SHIFT_SETTING, _options.palette.shift());
|
||||
if (_options.mapOpacity != MAP_OPACITY_DEFAULT)
|
||||
settings.setValue(MAP_OPACITY_SETTING, _options.mapOpacity);
|
||||
if (_options.blendColor != BLEND_COLOR_DEFAULT)
|
||||
settings.setValue(BLEND_COLOR_SETTING, _options.blendColor);
|
||||
if (_options.trackWidth != TRACK_WIDTH_DEFAULT)
|
||||
settings.setValue(TRACK_WIDTH_SETTING, _options.trackWidth);
|
||||
if (_options.routeWidth != ROUTE_WIDTH_DEFAULT)
|
||||
@ -1809,6 +1813,8 @@ void GUI::readSettings()
|
||||
_options.palette = Palette(pc, ps);
|
||||
_options.mapOpacity = settings.value(MAP_OPACITY_SETTING,
|
||||
MAP_OPACITY_DEFAULT).toInt();
|
||||
_options.blendColor = settings.value(BLEND_COLOR_SETTING,
|
||||
BLEND_COLOR_DEFAULT).value<QColor>();
|
||||
_options.trackWidth = settings.value(TRACK_WIDTH_SETTING,
|
||||
TRACK_WIDTH_DEFAULT).toInt();
|
||||
_options.routeWidth = settings.value(ROUTE_WIDTH_SETTING,
|
||||
@ -1864,6 +1870,7 @@ void GUI::readSettings()
|
||||
|
||||
_pathView->setPalette(_options.palette);
|
||||
_pathView->setMapOpacity(_options.mapOpacity);
|
||||
_pathView->setBlendColor(_options.blendColor);
|
||||
_pathView->setTrackWidth(_options.trackWidth);
|
||||
_pathView->setRouteWidth(_options.routeWidth);
|
||||
_pathView->setTrackStyle(_options.trackStyle);
|
||||
|
@ -37,36 +37,10 @@ QWidget *OptionsDialog::createAppearancePage()
|
||||
paletteLayout->addRow(tr("Base color:"), _baseColor);
|
||||
paletteLayout->addRow(tr("Palette shift:"), _colorOffset);
|
||||
#ifndef Q_OS_MAC
|
||||
QGroupBox *pathsBox = new QGroupBox(tr("Paths"));
|
||||
pathsBox->setLayout(paletteLayout);
|
||||
QGroupBox *colorBox = new QGroupBox(tr("Colors"));
|
||||
colorBox->setLayout(paletteLayout);
|
||||
#endif
|
||||
|
||||
_mapOpacity = new PercentSlider();
|
||||
_mapOpacity->setValue(_options->mapOpacity);
|
||||
QFormLayout *mapLayout = new QFormLayout();
|
||||
mapLayout->addRow(tr("Map opacity:"), _mapOpacity);
|
||||
#ifndef Q_OS_MAC
|
||||
QGroupBox *mapBox = new QGroupBox(tr("Map"));
|
||||
mapBox->setLayout(mapLayout);
|
||||
#endif
|
||||
|
||||
QWidget *colorTab = new QWidget();
|
||||
QVBoxLayout *colorTabLayout = new QVBoxLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
QFrame *l0 = new QFrame();
|
||||
l0->setFrameShape(QFrame::HLine);
|
||||
l0->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
colorTabLayout->addLayout(paletteLayout);
|
||||
colorTabLayout->addWidget(l0);
|
||||
colorTabLayout->addLayout(mapLayout);
|
||||
#else // Q_OS_MAC
|
||||
colorTabLayout->addWidget(pathsBox);
|
||||
colorTabLayout->addWidget(mapBox);
|
||||
#endif // O_OS_MAC
|
||||
colorTabLayout->addStretch();
|
||||
colorTab->setLayout(colorTabLayout);
|
||||
|
||||
_trackWidth = new QSpinBox();
|
||||
_trackWidth->setValue(_options->trackWidth);
|
||||
_trackWidth->setMinimum(1);
|
||||
@ -101,6 +75,9 @@ QWidget *OptionsDialog::createAppearancePage()
|
||||
QWidget *pathTab = new QWidget();
|
||||
QVBoxLayout *pathTabLayout = new QVBoxLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
QFrame *l0 = new QFrame();
|
||||
l0->setFrameShape(QFrame::HLine);
|
||||
l0->setFrameShadow(QFrame::Sunken);
|
||||
QFrame *l1 = new QFrame();
|
||||
l1->setFrameShape(QFrame::HLine);
|
||||
l1->setFrameShadow(QFrame::Sunken);
|
||||
@ -108,11 +85,14 @@ QWidget *OptionsDialog::createAppearancePage()
|
||||
l2->setFrameShape(QFrame::HLine);
|
||||
l2->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
pathTabLayout->addLayout(paletteLayout);
|
||||
pathTabLayout->addWidget(l0);
|
||||
pathTabLayout->addLayout(trackLayout);
|
||||
pathTabLayout->addWidget(l1);
|
||||
pathTabLayout->addLayout(routeLayout);
|
||||
pathTabLayout->addWidget(l2);
|
||||
#else // Q_OS_MAC
|
||||
pathTabLayout->addWidget(colorBox);
|
||||
pathTabLayout->addWidget(trackBox);
|
||||
pathTabLayout->addWidget(routeBox);
|
||||
#endif // Q_OS_MAC
|
||||
@ -139,10 +119,28 @@ QWidget *OptionsDialog::createAppearancePage()
|
||||
graphTabLayout->addStretch();
|
||||
graphTab->setLayout(graphTabLayout);
|
||||
|
||||
|
||||
_mapOpacity = new PercentSlider();
|
||||
_mapOpacity->setValue(_options->mapOpacity);
|
||||
_blendColor = new ColorBox();
|
||||
_blendColor->setColor(_options->blendColor);
|
||||
QFormLayout *mapLayout = new QFormLayout();
|
||||
mapLayout->addRow(tr("Background color:"), _blendColor);
|
||||
mapLayout->addRow(tr("Map opacity:"), _mapOpacity);
|
||||
|
||||
|
||||
QWidget *mapTab = new QWidget();
|
||||
QVBoxLayout *mapTabLayout = new QVBoxLayout();
|
||||
mapTabLayout->addLayout(mapLayout);
|
||||
mapTabLayout->addStretch();
|
||||
mapTab->setLayout(mapTabLayout);
|
||||
|
||||
|
||||
|
||||
QTabWidget *appearancePage = new QTabWidget();
|
||||
appearancePage->addTab(colorTab, tr("Colors"));
|
||||
appearancePage->addTab(pathTab, tr("Paths"));
|
||||
appearancePage->addTab(graphTab, tr("Graphs"));
|
||||
appearancePage->addTab(mapTab, tr("Map"));
|
||||
|
||||
return appearancePage;
|
||||
}
|
||||
@ -428,6 +426,7 @@ void OptionsDialog::accept()
|
||||
_options->palette.setColor(_baseColor->color());
|
||||
_options->palette.setShift(_colorOffset->value());
|
||||
_options->mapOpacity = _mapOpacity->value();
|
||||
_options->blendColor = _blendColor->color();
|
||||
_options->trackWidth = _trackWidth->value();
|
||||
_options->trackStyle = (Qt::PenStyle) _trackStyle->itemData(
|
||||
_trackStyle->currentIndex()).toInt();
|
||||
|
@ -19,6 +19,7 @@ struct Options {
|
||||
// Appearance
|
||||
Palette palette;
|
||||
int mapOpacity;
|
||||
QColor blendColor;
|
||||
int trackWidth;
|
||||
int routeWidth;
|
||||
Qt::PenStyle trackStyle;
|
||||
@ -76,6 +77,7 @@ private:
|
||||
ColorBox *_baseColor;
|
||||
QDoubleSpinBox *_colorOffset;
|
||||
PercentSlider *_mapOpacity;
|
||||
ColorBox *_blendColor;
|
||||
QSpinBox *_trackWidth;
|
||||
StyleComboBox *_trackStyle;
|
||||
QSpinBox *_routeWidth;
|
||||
|
@ -47,6 +47,7 @@ PathView::PathView(Map *map, POI *poi, QWidget *parent)
|
||||
|
||||
_units = Metric;
|
||||
_opacity = 1.0;
|
||||
_blendColor = Qt::white;
|
||||
|
||||
_showMap = true;
|
||||
_showTracks = true;
|
||||
@ -685,11 +686,17 @@ void PathView::setMapOpacity(int opacity)
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void PathView::setBlendColor(const QColor &color)
|
||||
{
|
||||
_blendColor = color;
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void PathView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
if (_showMap) {
|
||||
if (_opacity < 1.0) {
|
||||
painter->fillRect(rect, Qt::white);
|
||||
painter->fillRect(rect, _blendColor);
|
||||
painter->setOpacity(_opacity);
|
||||
}
|
||||
_map->draw(painter, rect);
|
||||
|
@ -64,6 +64,7 @@ public slots:
|
||||
void setTrackStyle(Qt::PenStyle style);
|
||||
void setRouteStyle(Qt::PenStyle style);
|
||||
void setMapOpacity(int opacity);
|
||||
void setBlendColor(const QColor &color);
|
||||
|
||||
private slots:
|
||||
void updatePOI();
|
||||
@ -108,6 +109,7 @@ private:
|
||||
Palette _palette;
|
||||
Units _units;
|
||||
qreal _opacity;
|
||||
QColor _blendColor;
|
||||
|
||||
bool _showMap;
|
||||
bool _showTracks;
|
||||
|
@ -80,6 +80,8 @@
|
||||
#define PALETTE_SHIFT_DEFAULT 0.62
|
||||
#define MAP_OPACITY_SETTING "mapOpacity"
|
||||
#define MAP_OPACITY_DEFAULT 100
|
||||
#define BLEND_COLOR_SETTING "blendColor"
|
||||
#define BLEND_COLOR_DEFAULT QColor(Qt::white)
|
||||
#define TRACK_WIDTH_SETTING "trackWidth"
|
||||
#define TRACK_WIDTH_DEFAULT 3
|
||||
#define ROUTE_WIDTH_SETTING "routeWidth"
|
||||
|
Reference in New Issue
Block a user