mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-19 04:02:09 +01:00
Added slider/marker color setting
This commit is contained in:
parent
a20a268975
commit
cbdfe4c105
@ -490,3 +490,9 @@ void GraphView::useAntiAliasing(bool use)
|
|||||||
{
|
{
|
||||||
setRenderHint(QPainter::Antialiasing, use);
|
setRenderHint(QPainter::Antialiasing, use);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphView::setSliderColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_slider->setColor(color);
|
||||||
|
_sliderInfo->setColor(color);
|
||||||
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
void useAntiAliasing(bool use);
|
void useAntiAliasing(bool use);
|
||||||
|
|
||||||
void setSliderPosition(qreal pos);
|
void setSliderPosition(qreal pos);
|
||||||
|
void setSliderColor(const QColor &color);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sliderPositionChanged(qreal);
|
void sliderPositionChanged(qreal);
|
||||||
|
@ -850,11 +850,13 @@ void GUI::openOptions()
|
|||||||
SET_VIEW_OPTION(poiColor, setPOIColor);
|
SET_VIEW_OPTION(poiColor, setPOIColor);
|
||||||
SET_VIEW_OPTION(pathAntiAliasing, useAntiAliasing);
|
SET_VIEW_OPTION(pathAntiAliasing, useAntiAliasing);
|
||||||
SET_VIEW_OPTION(useOpenGL, useOpenGL);
|
SET_VIEW_OPTION(useOpenGL, useOpenGL);
|
||||||
|
SET_VIEW_OPTION(sliderColor, setMarkerColor);
|
||||||
|
|
||||||
SET_TAB_OPTION(palette, setPalette);
|
SET_TAB_OPTION(palette, setPalette);
|
||||||
SET_TAB_OPTION(graphWidth, setGraphWidth);
|
SET_TAB_OPTION(graphWidth, setGraphWidth);
|
||||||
SET_TAB_OPTION(graphAntiAliasing, useAntiAliasing);
|
SET_TAB_OPTION(graphAntiAliasing, useAntiAliasing);
|
||||||
SET_TAB_OPTION(useOpenGL, useOpenGL);
|
SET_TAB_OPTION(useOpenGL, useOpenGL);
|
||||||
|
SET_TAB_OPTION(sliderColor, setSliderColor);
|
||||||
|
|
||||||
SET_TRACK_OPTION(elevationFilter, setElevationFilter);
|
SET_TRACK_OPTION(elevationFilter, setElevationFilter);
|
||||||
SET_TRACK_OPTION(speedFilter, setSpeedFilter);
|
SET_TRACK_OPTION(speedFilter, setSpeedFilter);
|
||||||
@ -1627,6 +1629,8 @@ void GUI::writeSettings()
|
|||||||
if (_options.separateGraphPage != SEPARATE_GRAPH_PAGE_DEFAULT)
|
if (_options.separateGraphPage != SEPARATE_GRAPH_PAGE_DEFAULT)
|
||||||
settings.setValue(SEPARATE_GRAPH_PAGE_SETTING,
|
settings.setValue(SEPARATE_GRAPH_PAGE_SETTING,
|
||||||
_options.separateGraphPage);
|
_options.separateGraphPage);
|
||||||
|
if (_options.sliderColor != SLIDER_COLOR_DEFAULT)
|
||||||
|
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1840,6 +1844,8 @@ void GUI::readSettings()
|
|||||||
PRINT_ITEM_COUNT_DEFAULT).toBool();
|
PRINT_ITEM_COUNT_DEFAULT).toBool();
|
||||||
_options.separateGraphPage = settings.value(SEPARATE_GRAPH_PAGE_SETTING,
|
_options.separateGraphPage = settings.value(SEPARATE_GRAPH_PAGE_SETTING,
|
||||||
SEPARATE_GRAPH_PAGE_DEFAULT).toBool();
|
SEPARATE_GRAPH_PAGE_DEFAULT).toBool();
|
||||||
|
_options.sliderColor = settings.value(SLIDER_COLOR_SETTING,
|
||||||
|
SLIDER_COLOR_DEFAULT).value<QColor>();
|
||||||
|
|
||||||
_mapView->setPalette(_options.palette);
|
_mapView->setPalette(_options.palette);
|
||||||
_mapView->setMapOpacity(_options.mapOpacity);
|
_mapView->setMapOpacity(_options.mapOpacity);
|
||||||
@ -1853,6 +1859,7 @@ void GUI::readSettings()
|
|||||||
_mapView->setPOISize(_options.poiSize);
|
_mapView->setPOISize(_options.poiSize);
|
||||||
_mapView->setPOIColor(_options.poiColor);
|
_mapView->setPOIColor(_options.poiColor);
|
||||||
_mapView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
|
_mapView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
|
||||||
|
_mapView->setMarkerColor(_options.sliderColor);
|
||||||
if (_options.useOpenGL)
|
if (_options.useOpenGL)
|
||||||
_mapView->useOpenGL(true);
|
_mapView->useOpenGL(true);
|
||||||
|
|
||||||
@ -1861,6 +1868,7 @@ void GUI::readSettings()
|
|||||||
_tabs.at(i)->setGraphWidth(_options.graphWidth);
|
_tabs.at(i)->setGraphWidth(_options.graphWidth);
|
||||||
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
|
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
|
||||||
_options.graphAntiAliasing);
|
_options.graphAntiAliasing);
|
||||||
|
_tabs.at(i)->setSliderColor(_options.sliderColor);
|
||||||
if (_options.useOpenGL)
|
if (_options.useOpenGL)
|
||||||
_tabs.at(i)->useOpenGL(true);
|
_tabs.at(i)->useOpenGL(true);
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
_units = Metric;
|
_units = Metric;
|
||||||
_opacity = 1.0;
|
_opacity = 1.0;
|
||||||
_backgroundColor = Qt::white;
|
_backgroundColor = Qt::white;
|
||||||
|
_markerColor = Qt::red;
|
||||||
|
|
||||||
_showMap = true;
|
_showMap = true;
|
||||||
_showTracks = true;
|
_showTracks = true;
|
||||||
@ -113,6 +114,7 @@ PathItem *MapView::addTrack(const Track &track)
|
|||||||
ti->setUnits(_units);
|
ti->setUnits(_units);
|
||||||
ti->setVisible(_showTracks);
|
ti->setVisible(_showTracks);
|
||||||
ti->setDigitalZoom(_digitalZoom);
|
ti->setDigitalZoom(_digitalZoom);
|
||||||
|
ti->setMarkerColor(_markerColor);
|
||||||
_scene->addItem(ti);
|
_scene->addItem(ti);
|
||||||
|
|
||||||
if (_showTracks)
|
if (_showTracks)
|
||||||
@ -139,6 +141,7 @@ PathItem *MapView::addRoute(const Route &route)
|
|||||||
ri->showWaypoints(_showRouteWaypoints);
|
ri->showWaypoints(_showRouteWaypoints);
|
||||||
ri->showWaypointLabels(_showWaypointLabels);
|
ri->showWaypointLabels(_showWaypointLabels);
|
||||||
ri->setDigitalZoom(_digitalZoom);
|
ri->setDigitalZoom(_digitalZoom);
|
||||||
|
ri->setMarkerColor(_markerColor);
|
||||||
_scene->addItem(ri);
|
_scene->addItem(ri);
|
||||||
|
|
||||||
if (_showRoutes)
|
if (_showRoutes)
|
||||||
@ -791,6 +794,16 @@ void MapView::useAntiAliasing(bool use)
|
|||||||
setRenderHint(QPainter::Antialiasing, use);
|
setRenderHint(QPainter::Antialiasing, use);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapView::setMarkerColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_markerColor = color;
|
||||||
|
|
||||||
|
for (int i = 0; i < _tracks.size(); i++)
|
||||||
|
_tracks.at(i)->setMarkerColor(color);
|
||||||
|
for (int i = 0; i < _routes.size(); i++)
|
||||||
|
_routes.at(i)->setMarkerColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
void MapView::reloadMap()
|
void MapView::reloadMap()
|
||||||
{
|
{
|
||||||
resetCachedContent();
|
resetCachedContent();
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
void setBackgroundColor(const QColor &color);
|
void setBackgroundColor(const QColor &color);
|
||||||
void useOpenGL(bool use);
|
void useOpenGL(bool use);
|
||||||
void useAntiAliasing(bool use);
|
void useAntiAliasing(bool use);
|
||||||
|
void setMarkerColor(const QColor &color);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showMap(bool show);
|
void showMap(bool show);
|
||||||
@ -127,6 +128,7 @@ private:
|
|||||||
int _poiSize;
|
int _poiSize;
|
||||||
QColor _waypointColor;
|
QColor _waypointColor;
|
||||||
QColor _poiColor;
|
QColor _poiColor;
|
||||||
|
QColor _markerColor;
|
||||||
|
|
||||||
int _digitalZoom;
|
int _digitalZoom;
|
||||||
bool _plot;
|
bool _plot;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
MarkerItem::MarkerItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
MarkerItem::MarkerItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
|
_color = Qt::red;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF MarkerItem::boundingRect() const
|
QRectF MarkerItem::boundingRect() const
|
||||||
@ -22,9 +22,15 @@ void MarkerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
painter->setPen(QPen(Qt::red, WIDTH));
|
painter->setPen(QPen(_color, WIDTH));
|
||||||
painter->drawLine(-SIZE/2, 0, SIZE/2, 0);
|
painter->drawLine(-SIZE/2, 0, SIZE/2, 0);
|
||||||
painter->drawLine(0, -SIZE/2, 0, SIZE/2);
|
painter->drawLine(0, -SIZE/2, 0, SIZE/2);
|
||||||
|
|
||||||
// painter->drawRect(boundingRect());
|
// painter->drawRect(boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MarkerItem::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define MARKERITEM_H
|
#define MARKERITEM_H
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
class MarkerItem : public QGraphicsItem
|
class MarkerItem : public QGraphicsItem
|
||||||
{
|
{
|
||||||
@ -11,6 +12,11 @@ public:
|
|||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget);
|
QWidget *widget);
|
||||||
|
|
||||||
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QColor _color;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MARKERITEM_H
|
#endif // MARKERITEM_H
|
||||||
|
@ -157,11 +157,15 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
|
|
||||||
|
|
||||||
// Graphs
|
// Graphs
|
||||||
|
_sliderColor = new ColorBox();
|
||||||
|
_sliderColor->setColor(_options->sliderColor);
|
||||||
_graphWidth = new QSpinBox();
|
_graphWidth = new QSpinBox();
|
||||||
_graphWidth->setValue(_options->graphWidth);
|
_graphWidth->setValue(_options->graphWidth);
|
||||||
_graphWidth->setMinimum(1);
|
_graphWidth->setMinimum(1);
|
||||||
|
|
||||||
QFormLayout *graphLayout = new QFormLayout();
|
QFormLayout *graphLayout = new QFormLayout();
|
||||||
graphLayout->addRow(tr("Line width:"), _graphWidth);
|
graphLayout->addRow(tr("Line width:"), _graphWidth);
|
||||||
|
graphLayout->addRow(tr("Slider color:"), _sliderColor);
|
||||||
|
|
||||||
_graphAA = new QCheckBox(tr("Use anti-aliasing"));
|
_graphAA = new QCheckBox(tr("Use anti-aliasing"));
|
||||||
_graphAA->setChecked(_options->graphAntiAliasing);
|
_graphAA->setChecked(_options->graphAntiAliasing);
|
||||||
@ -485,6 +489,7 @@ void OptionsDialog::accept()
|
|||||||
_options->poiSize = _poiSize->value();
|
_options->poiSize = _poiSize->value();
|
||||||
_options->poiColor = _poiColor->color();
|
_options->poiColor = _poiColor->color();
|
||||||
_options->graphWidth = _graphWidth->value();
|
_options->graphWidth = _graphWidth->value();
|
||||||
|
_options->sliderColor = _sliderColor->color();
|
||||||
_options->graphAntiAliasing = _graphAA->isChecked();
|
_options->graphAntiAliasing = _graphAA->isChecked();
|
||||||
|
|
||||||
_options->elevationFilter = _elevationFilter->value();
|
_options->elevationFilter = _elevationFilter->value();
|
||||||
|
@ -27,6 +27,7 @@ struct Options {
|
|||||||
int waypointSize;
|
int waypointSize;
|
||||||
int poiSize;
|
int poiSize;
|
||||||
int graphWidth;
|
int graphWidth;
|
||||||
|
QColor sliderColor;
|
||||||
bool pathAntiAliasing;
|
bool pathAntiAliasing;
|
||||||
bool graphAntiAliasing;
|
bool graphAntiAliasing;
|
||||||
int mapOpacity;
|
int mapOpacity;
|
||||||
@ -92,6 +93,7 @@ private:
|
|||||||
QSpinBox *_poiSize;
|
QSpinBox *_poiSize;
|
||||||
ColorBox *_poiColor;
|
ColorBox *_poiColor;
|
||||||
QSpinBox *_graphWidth;
|
QSpinBox *_graphWidth;
|
||||||
|
ColorBox *_sliderColor;
|
||||||
QCheckBox *_graphAA;
|
QCheckBox *_graphAA;
|
||||||
// Data
|
// Data
|
||||||
OddSpinBox *_elevationFilter;
|
OddSpinBox *_elevationFilter;
|
||||||
|
@ -167,6 +167,11 @@ void PathItem::moveMarker(qreal distance)
|
|||||||
_marker->setVisible(false);
|
_marker->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathItem::setMarkerColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_marker->setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
void PathItem::hover(bool hover)
|
void PathItem::hover(bool hover)
|
||||||
{
|
{
|
||||||
if (hover) {
|
if (hover) {
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
void setWidth(qreal width);
|
void setWidth(qreal width);
|
||||||
void setStyle(Qt::PenStyle style);
|
void setStyle(Qt::PenStyle style);
|
||||||
void setDigitalZoom(int zoom);
|
void setDigitalZoom(int zoom);
|
||||||
|
void setMarkerColor(const QColor &color);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void moveMarker(qreal distance);
|
void moveMarker(qreal distance);
|
||||||
|
@ -144,5 +144,7 @@
|
|||||||
#define PRINT_ITEM_COUNT_DEFAULT true
|
#define PRINT_ITEM_COUNT_DEFAULT true
|
||||||
#define SEPARATE_GRAPH_PAGE_SETTING "separateGraphPage"
|
#define SEPARATE_GRAPH_PAGE_SETTING "separateGraphPage"
|
||||||
#define SEPARATE_GRAPH_PAGE_DEFAULT false
|
#define SEPARATE_GRAPH_PAGE_DEFAULT false
|
||||||
|
#define SLIDER_COLOR_SETTING "sliderColor"
|
||||||
|
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
SliderInfoItem::SliderInfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
SliderInfoItem::SliderInfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
_side = Right;
|
_side = Right;
|
||||||
|
_color = Qt::red;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderInfoItem::updateBoundingRect()
|
void SliderInfoItem::updateBoundingRect()
|
||||||
@ -58,7 +59,7 @@ void SliderInfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||||||
|
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
painter->setPen(Qt::red);
|
painter->setPen(_color);
|
||||||
|
|
||||||
if (_side == Right) {
|
if (_side == Right) {
|
||||||
painter->drawText(SIZE, -fm.descent()/2, _y);
|
painter->drawText(SIZE, -fm.descent()/2, _y);
|
||||||
@ -88,3 +89,9 @@ void SliderInfoItem::setSide(Side side)
|
|||||||
_side = side;
|
_side = side;
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SliderInfoItem::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@ public:
|
|||||||
|
|
||||||
void setText(const QString &x, const QString &y);
|
void setText(const QString &x, const QString &y);
|
||||||
void setSide(Side side);
|
void setSide(Side side);
|
||||||
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateBoundingRect();
|
void updateBoundingRect();
|
||||||
@ -23,6 +24,7 @@ private:
|
|||||||
Side _side;
|
Side _side;
|
||||||
QString _x, _y;
|
QString _x, _y;
|
||||||
QRectF _boundingRect;
|
QRectF _boundingRect;
|
||||||
|
QColor _color;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SLIDERINFOITEM_H
|
#endif // SLIDERINFOITEM_H
|
||||||
|
@ -8,6 +8,8 @@ SliderItem::SliderItem(QGraphicsItem *parent) : QGraphicsObject(parent)
|
|||||||
{
|
{
|
||||||
setFlag(ItemIsMovable);
|
setFlag(ItemIsMovable);
|
||||||
setFlag(ItemSendsGeometryChanges);
|
setFlag(ItemSendsGeometryChanges);
|
||||||
|
|
||||||
|
_color = Qt::red;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF SliderItem::boundingRect() const
|
QRectF SliderItem::boundingRect() const
|
||||||
@ -22,7 +24,7 @@ void SliderItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
painter->setPen(Qt::red);
|
painter->setPen(_color);
|
||||||
painter->drawLine(0, 0, 0, -_area.height());
|
painter->drawLine(0, 0, 0, -_area.height());
|
||||||
|
|
||||||
// painter->drawRect(boundingRect());
|
// painter->drawRect(boundingRect());
|
||||||
@ -59,3 +61,9 @@ void SliderItem::setArea(const QRectF &area)
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_area = area;
|
_area = area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SliderItem::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <QGraphicsObject>
|
#include <QGraphicsObject>
|
||||||
|
|
||||||
|
class QColor;
|
||||||
|
|
||||||
class SliderItem : public QGraphicsObject
|
class SliderItem : public QGraphicsObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -17,6 +19,8 @@ public:
|
|||||||
const QRectF &area() const {return _area;}
|
const QRectF &area() const {return _area;}
|
||||||
void setArea(const QRectF &area);
|
void setArea(const QRectF &area);
|
||||||
|
|
||||||
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -27,6 +31,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QRectF _area;
|
QRectF _area;
|
||||||
|
QColor _color;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SLIDERITEM_H
|
#endif // SLIDERITEM_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user