mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Added time zone settings
This commit is contained in:
parent
035883aab2
commit
5bd744a8ed
@ -14,8 +14,7 @@ greaterThan(QT_MAJOR_VERSION, 4) {
|
|||||||
QT += widgets
|
QT += widgets
|
||||||
QT += printsupport
|
QT += printsupport
|
||||||
}
|
}
|
||||||
lessThan(QT_MAJOR_VERSION, 5) {QT += opengl}
|
lessThan(QT_VERSION, 5.4.0) {QT += opengl}
|
||||||
equals(QT_MAJOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 4) {QT += opengl}
|
|
||||||
|
|
||||||
INCLUDEPATH += ./src
|
INCLUDEPATH += ./src
|
||||||
HEADERS += src/common/config.h \
|
HEADERS += src/common/config.h \
|
||||||
@ -348,6 +347,9 @@ greaterThan(QT_MAJOR_VERSION, 4) {
|
|||||||
HEADERS += src/data/geojsonparser.h
|
HEADERS += src/data/geojsonparser.h
|
||||||
SOURCES += src/data/geojsonparser.cpp
|
SOURCES += src/data/geojsonparser.cpp
|
||||||
}
|
}
|
||||||
|
greaterThan(QT_VERSION, 5.1.0) {
|
||||||
|
HEADERS += src/GUI/timezoneinfo.h
|
||||||
|
}
|
||||||
|
|
||||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\" \
|
DEFINES += APP_VERSION=\\\"$$VERSION\\\" \
|
||||||
QT_NO_DEPRECATED_WARNINGS
|
QT_NO_DEPRECATED_WARNINGS
|
||||||
|
@ -248,7 +248,7 @@ void GUI::createActions()
|
|||||||
_reloadFileAction->setMenuRole(QAction::NoRole);
|
_reloadFileAction->setMenuRole(QAction::NoRole);
|
||||||
_reloadFileAction->setShortcut(RELOAD_SHORTCUT);
|
_reloadFileAction->setShortcut(RELOAD_SHORTCUT);
|
||||||
_reloadFileAction->setActionGroup(_fileActionGroup);
|
_reloadFileAction->setActionGroup(_fileActionGroup);
|
||||||
connect(_reloadFileAction, SIGNAL(triggered()), this, SLOT(reloadFile()));
|
connect(_reloadFileAction, SIGNAL(triggered()), this, SLOT(reloadFiles()));
|
||||||
addAction(_reloadFileAction);
|
addAction(_reloadFileAction);
|
||||||
_statisticsAction = new QAction(tr("Statistics..."), this);
|
_statisticsAction = new QAction(tr("Statistics..."), this);
|
||||||
_statisticsAction->setMenuRole(QAction::NoRole);
|
_statisticsAction->setMenuRole(QAction::NoRole);
|
||||||
@ -791,7 +791,12 @@ bool GUI::loadFile(const QString &fileName)
|
|||||||
_trackDistance += track.distance();
|
_trackDistance += track.distance();
|
||||||
_time += track.time();
|
_time += track.time();
|
||||||
_movingTime += track.movingTime();
|
_movingTime += track.movingTime();
|
||||||
const QDate &date = track.date().date();
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
const QDateTime date = track.date().toTimeZone(
|
||||||
|
_options.timeZone.zone());
|
||||||
|
#else // ENABLE_TIMEZONES
|
||||||
|
const QDateTime &date = track.date();
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
if (_dateRange.first.isNull() || _dateRange.first > date)
|
if (_dateRange.first.isNull() || _dateRange.first > date)
|
||||||
_dateRange.first = date;
|
_dateRange.first = date;
|
||||||
if (_dateRange.second.isNull() || _dateRange.second < date)
|
if (_dateRange.second.isNull() || _dateRange.second < date)
|
||||||
@ -990,9 +995,16 @@ void GUI::openOptions()
|
|||||||
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||||
options.hidpiMap ? devicePixelRatioF() : 1.0);
|
options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
if (options.timeZone != _options.timeZone) {
|
||||||
|
_mapView->setTimeZone(options.timeZone.zone());
|
||||||
|
_dateRange.first = _dateRange.first.toTimeZone(options.timeZone.zone());
|
||||||
|
_dateRange.second = _dateRange.second.toTimeZone(options.timeZone.zone());
|
||||||
|
}
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
if (reload)
|
if (reload)
|
||||||
reloadFile();
|
reloadFiles();
|
||||||
|
|
||||||
_options = options;
|
_options = options;
|
||||||
}
|
}
|
||||||
@ -1185,7 +1197,7 @@ void GUI::plot(QPrinter *printer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::reloadFile()
|
void GUI::reloadFiles()
|
||||||
{
|
{
|
||||||
_trackCount = 0;
|
_trackCount = 0;
|
||||||
_routeCount = 0;
|
_routeCount = 0;
|
||||||
@ -1195,7 +1207,7 @@ void GUI::reloadFile()
|
|||||||
_routeDistance = 0;
|
_routeDistance = 0;
|
||||||
_time = 0;
|
_time = 0;
|
||||||
_movingTime = 0;
|
_movingTime = 0;
|
||||||
_dateRange = DateRange(QDate(), QDate());
|
_dateRange = DateTimeRange(QDateTime(), QDateTime());
|
||||||
_pathName = QString();
|
_pathName = QString();
|
||||||
|
|
||||||
for (int i = 0; i < _tabs.count(); i++)
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
@ -1229,7 +1241,7 @@ void GUI::closeFiles()
|
|||||||
_routeDistance = 0;
|
_routeDistance = 0;
|
||||||
_time = 0;
|
_time = 0;
|
||||||
_movingTime = 0;
|
_movingTime = 0;
|
||||||
_dateRange = DateRange(QDate(), QDate());
|
_dateRange = DateTimeRange(QDateTime(), QDateTime());
|
||||||
_pathName = QString();
|
_pathName = QString();
|
||||||
|
|
||||||
_sliderPos = 0;
|
_sliderPos = 0;
|
||||||
@ -1867,6 +1879,9 @@ void GUI::writeSettings()
|
|||||||
if (_options.showSecondarySpeed != SHOW_SECONDARY_SPEED_DEFAULT)
|
if (_options.showSecondarySpeed != SHOW_SECONDARY_SPEED_DEFAULT)
|
||||||
settings.setValue(SHOW_SECONDARY_SPEED_SETTING,
|
settings.setValue(SHOW_SECONDARY_SPEED_SETTING,
|
||||||
_options.showSecondarySpeed);
|
_options.showSecondarySpeed);
|
||||||
|
if (_options.timeZone != TimeZoneInfo())
|
||||||
|
settings.setValue(TIME_ZONE_SETTING, QVariant::fromValue(
|
||||||
|
_options.timeZone));
|
||||||
if (_options.poiRadius != POI_RADIUS_DEFAULT)
|
if (_options.poiRadius != POI_RADIUS_DEFAULT)
|
||||||
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
|
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
|
||||||
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
|
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
|
||||||
@ -2139,6 +2154,9 @@ void GUI::readSettings()
|
|||||||
_options.showSecondarySpeed = settings.value(
|
_options.showSecondarySpeed = settings.value(
|
||||||
SHOW_SECONDARY_SPEED_SETTING,
|
SHOW_SECONDARY_SPEED_SETTING,
|
||||||
SHOW_SECONDARY_SPEED_DEFAULT).toBool();
|
SHOW_SECONDARY_SPEED_DEFAULT).toBool();
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
_options.timeZone = settings.value(TIME_ZONE_SETTING).value<TimeZoneInfo>();
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
_options.automaticPause = settings.value(AUTOMATIC_PAUSE_SETTING,
|
_options.automaticPause = settings.value(AUTOMATIC_PAUSE_SETTING,
|
||||||
AUTOMATIC_PAUSE_DEFAULT).toBool();
|
AUTOMATIC_PAUSE_DEFAULT).toBool();
|
||||||
_options.pauseInterval = settings.value(PAUSE_INTERVAL_SETTING,
|
_options.pauseInterval = settings.value(PAUSE_INTERVAL_SETTING,
|
||||||
@ -2203,6 +2221,9 @@ void GUI::readSettings()
|
|||||||
_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
_mapView->setProjection(_options.projection);
|
_mapView->setProjection(_options.projection);
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
_mapView->setTimeZone(_options.timeZone.zone());
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
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);
|
||||||
|
@ -48,7 +48,7 @@ private slots:
|
|||||||
void exportFile();
|
void exportFile();
|
||||||
void openFile();
|
void openFile();
|
||||||
void closeAll();
|
void closeAll();
|
||||||
void reloadFile();
|
void reloadFiles();
|
||||||
void statistics();
|
void statistics();
|
||||||
void openPOIFile();
|
void openPOIFile();
|
||||||
void closePOIFiles();
|
void closePOIFiles();
|
||||||
@ -92,7 +92,7 @@ private slots:
|
|||||||
void mapInitialized();
|
void mapInitialized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef QPair<QDate, QDate> DateRange;
|
typedef QPair<QDateTime, QDateTime> DateTimeRange;
|
||||||
|
|
||||||
void loadPOIs();
|
void loadPOIs();
|
||||||
void closeFiles();
|
void closeFiles();
|
||||||
@ -220,7 +220,7 @@ private:
|
|||||||
int _trackCount, _routeCount, _areaCount, _waypointCount;
|
int _trackCount, _routeCount, _areaCount, _waypointCount;
|
||||||
qreal _trackDistance, _routeDistance;
|
qreal _trackDistance, _routeDistance;
|
||||||
qreal _time, _movingTime;
|
qreal _time, _movingTime;
|
||||||
DateRange _dateRange;
|
DateTimeRange _dateRange;
|
||||||
QString _pathName;
|
QString _pathName;
|
||||||
|
|
||||||
qreal _sliderPos;
|
qreal _sliderPos;
|
||||||
|
@ -59,8 +59,6 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
_poi = poi;
|
_poi = poi;
|
||||||
connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
||||||
|
|
||||||
_units = Metric;
|
|
||||||
_coordinatesFormat = DecimalDegrees;
|
|
||||||
_mapOpacity = 1.0;
|
_mapOpacity = 1.0;
|
||||||
_backgroundColor = Qt::white;
|
_backgroundColor = Qt::white;
|
||||||
_markerColor = Qt::red;
|
_markerColor = Qt::red;
|
||||||
@ -122,7 +120,6 @@ PathItem *MapView::addTrack(const Track &track)
|
|||||||
ti->setColor(_palette.nextColor());
|
ti->setColor(_palette.nextColor());
|
||||||
ti->setWidth(_trackWidth);
|
ti->setWidth(_trackWidth);
|
||||||
ti->setStyle(_trackStyle);
|
ti->setStyle(_trackStyle);
|
||||||
ti->setUnits(_units);
|
|
||||||
ti->setVisible(_showTracks);
|
ti->setVisible(_showTracks);
|
||||||
ti->setDigitalZoom(_digitalZoom);
|
ti->setDigitalZoom(_digitalZoom);
|
||||||
ti->setMarkerColor(_markerColor);
|
ti->setMarkerColor(_markerColor);
|
||||||
@ -149,8 +146,6 @@ PathItem *MapView::addRoute(const Route &route)
|
|||||||
ri->setColor(_palette.nextColor());
|
ri->setColor(_palette.nextColor());
|
||||||
ri->setWidth(_routeWidth);
|
ri->setWidth(_routeWidth);
|
||||||
ri->setStyle(_routeStyle);
|
ri->setStyle(_routeStyle);
|
||||||
ri->setUnits(_units);
|
|
||||||
ri->setCoordinatesFormat(_coordinatesFormat);
|
|
||||||
ri->setVisible(_showRoutes);
|
ri->setVisible(_showRoutes);
|
||||||
ri->showWaypoints(_showRouteWaypoints);
|
ri->showWaypoints(_showRouteWaypoints);
|
||||||
ri->showWaypointLabels(_showWaypointLabels);
|
ri->showWaypointLabels(_showWaypointLabels);
|
||||||
@ -200,7 +195,6 @@ void MapView::addWaypoints(const QVector<Waypoint> &waypoints)
|
|||||||
wi->setSize(_waypointSize);
|
wi->setSize(_waypointSize);
|
||||||
wi->setColor(_waypointColor);
|
wi->setColor(_waypointColor);
|
||||||
wi->showLabel(_showWaypointLabels);
|
wi->showLabel(_showWaypointLabels);
|
||||||
wi->setToolTipFormat(_units, _coordinatesFormat);
|
|
||||||
wi->setVisible(_showWaypoints);
|
wi->setVisible(_showWaypoints);
|
||||||
wi->setDigitalZoom(_digitalZoom);
|
wi->setDigitalZoom(_digitalZoom);
|
||||||
_scene->addItem(wi);
|
_scene->addItem(wi);
|
||||||
@ -401,7 +395,6 @@ void MapView::addPOI(const QList<Waypoint> &waypoints)
|
|||||||
pi->showLabel(_showPOILabels);
|
pi->showLabel(_showPOILabels);
|
||||||
pi->setVisible(_showPOI);
|
pi->setVisible(_showPOI);
|
||||||
pi->setDigitalZoom(_digitalZoom);
|
pi->setDigitalZoom(_digitalZoom);
|
||||||
pi->setToolTipFormat(_units, _coordinatesFormat);
|
|
||||||
_scene->addItem(pi);
|
_scene->addItem(pi);
|
||||||
|
|
||||||
_pois.insert(SearchPointer<Waypoint>(&(pi->waypoint())), pi);
|
_pois.insert(SearchPointer<Waypoint>(&(pi->waypoint())), pi);
|
||||||
@ -410,42 +403,32 @@ void MapView::addPOI(const QList<Waypoint> &waypoints)
|
|||||||
|
|
||||||
void MapView::setUnits(Units units)
|
void MapView::setUnits(Units units)
|
||||||
{
|
{
|
||||||
if (_units == units)
|
WaypointItem::setUnits(units);
|
||||||
return;
|
PathItem::setUnits(units);
|
||||||
|
|
||||||
_units = units;
|
|
||||||
|
|
||||||
_mapScale->setUnits(_units);
|
|
||||||
|
|
||||||
for (int i = 0; i < _tracks.count(); i++)
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
_tracks[i]->setUnits(_units);
|
_tracks[i]->updateTicks();
|
||||||
for (int i = 0; i < _routes.count(); i++)
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
_routes[i]->setUnits(_units);
|
_routes[i]->updateTicks();
|
||||||
for (int i = 0; i < _waypoints.size(); i++)
|
|
||||||
_waypoints.at(i)->setToolTipFormat(_units, _coordinatesFormat);
|
|
||||||
|
|
||||||
for (POIHash::const_iterator it = _pois.constBegin();
|
_mapScale->setUnits(units);
|
||||||
it != _pois.constEnd(); it++)
|
|
||||||
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
||||||
{
|
{
|
||||||
if (_coordinatesFormat == format)
|
WaypointItem::setCoordinatesFormat(format);
|
||||||
return;
|
|
||||||
|
|
||||||
_coordinatesFormat = format;
|
_coordinates->setFormat(format);
|
||||||
|
}
|
||||||
|
|
||||||
_coordinates->setFormat(_coordinatesFormat);
|
void MapView::setTimeZone(const QTimeZone &zone)
|
||||||
|
{
|
||||||
for (int i = 0; i < _waypoints.count(); i++)
|
#ifdef ENABLE_TIMEZONES
|
||||||
_waypoints.at(i)->setToolTipFormat(_units, _coordinatesFormat);
|
WaypointItem::setTimeZone(zone);
|
||||||
for (int i = 0; i < _routes.count(); i++)
|
PathItem::setTimeZone(zone);
|
||||||
_routes[i]->setCoordinatesFormat(_coordinatesFormat);
|
#else // ENABLE_TIMEZONES
|
||||||
|
Q_UNUSED(zone);
|
||||||
for (POIHash::const_iterator it = _pois.constBegin();
|
#endif // ENABLE_TIMEZONES
|
||||||
it != _pois.constEnd(); it++)
|
|
||||||
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::clearMapCache()
|
void MapView::clearMapCache()
|
||||||
|
@ -31,6 +31,7 @@ class GraphItem;
|
|||||||
class AreaItem;
|
class AreaItem;
|
||||||
class Area;
|
class Area;
|
||||||
class GraphicsScene;
|
class GraphicsScene;
|
||||||
|
class QTimeZone;
|
||||||
|
|
||||||
class MapView : public QGraphicsView
|
class MapView : public QGraphicsView
|
||||||
{
|
{
|
||||||
@ -83,6 +84,7 @@ public slots:
|
|||||||
void showTicks(bool show);
|
void showTicks(bool show);
|
||||||
void clearMapCache();
|
void clearMapCache();
|
||||||
void setCoordinatesFormat(CoordinatesFormat format);
|
void setCoordinatesFormat(CoordinatesFormat format);
|
||||||
|
void setTimeZone(const QTimeZone &zone);
|
||||||
void setDevicePixelRatio(qreal deviceRatio, qreal mapRatio);
|
void setDevicePixelRatio(qreal deviceRatio, qreal mapRatio);
|
||||||
void setProjection(int id);
|
void setProjection(int id);
|
||||||
|
|
||||||
@ -137,8 +139,6 @@ private:
|
|||||||
POI *_poi;
|
POI *_poi;
|
||||||
|
|
||||||
Palette _palette;
|
Palette _palette;
|
||||||
Units _units;
|
|
||||||
CoordinatesFormat _coordinatesFormat;
|
|
||||||
qreal _mapOpacity;
|
qreal _mapOpacity;
|
||||||
Projection _projection;
|
Projection _projection;
|
||||||
|
|
||||||
|
@ -167,11 +167,8 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
// Palette & antialiasing
|
// Palette & antialiasing
|
||||||
_baseColor = new ColorBox();
|
_baseColor = new ColorBox();
|
||||||
_baseColor->setColor(_options->palette.color());
|
_baseColor->setColor(_options->palette.color());
|
||||||
_colorOffset = new QDoubleSpinBox();
|
_colorOffset = new PercentSlider();
|
||||||
_colorOffset->setMinimum(0);
|
_colorOffset->setValue(_options->palette.shift() * 100);
|
||||||
_colorOffset->setMaximum(1.0);
|
|
||||||
_colorOffset->setSingleStep(0.01);
|
|
||||||
_colorOffset->setValue(_options->palette.shift());
|
|
||||||
QFormLayout *paletteLayout = new QFormLayout();
|
QFormLayout *paletteLayout = new QFormLayout();
|
||||||
paletteLayout->addRow(tr("Base color:"), _baseColor);
|
paletteLayout->addRow(tr("Base color:"), _baseColor);
|
||||||
paletteLayout->addRow(tr("Palette shift:"), _colorOffset);
|
paletteLayout->addRow(tr("Palette shift:"), _colorOffset);
|
||||||
@ -419,6 +416,29 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
_showSecondaryElevation = new QCheckBox(tr("Show secondary elevation"));
|
_showSecondaryElevation = new QCheckBox(tr("Show secondary elevation"));
|
||||||
_showSecondaryElevation->setChecked(_options->showSecondaryElevation);
|
_showSecondaryElevation->setChecked(_options->showSecondaryElevation);
|
||||||
|
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
_utcZone = new QRadioButton(tr("UTC"));
|
||||||
|
_systemZone = new QRadioButton(tr("System"));
|
||||||
|
_customZone = new QRadioButton(tr("Custom"));
|
||||||
|
if (_options->timeZone.type() == TimeZoneInfo::UTC)
|
||||||
|
_utcZone->setChecked(true);
|
||||||
|
else if (_options->timeZone.type() == TimeZoneInfo::System)
|
||||||
|
_systemZone->setChecked(true);
|
||||||
|
else
|
||||||
|
_customZone->setChecked(true);
|
||||||
|
_timeZone = new QComboBox();
|
||||||
|
_timeZone->setEnabled(_customZone->isChecked());
|
||||||
|
QList<QByteArray> zones = QTimeZone::availableTimeZoneIds();
|
||||||
|
for (int i = 0; i < zones.size(); i++)
|
||||||
|
_timeZone->addItem(zones.at(i));
|
||||||
|
_timeZone->setCurrentText(_options->timeZone.customZone().id());
|
||||||
|
connect(_customZone, SIGNAL(toggled(bool)), _timeZone,
|
||||||
|
SLOT(setEnabled(bool)));
|
||||||
|
QHBoxLayout *customZoneLayout = new QHBoxLayout();
|
||||||
|
customZoneLayout->addSpacing(20);
|
||||||
|
customZoneLayout->addWidget(_timeZone);
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
QWidget *sourceTab = new QWidget();
|
QWidget *sourceTab = new QWidget();
|
||||||
QVBoxLayout *sourceTabLayout = new QVBoxLayout();
|
QVBoxLayout *sourceTabLayout = new QVBoxLayout();
|
||||||
|
|
||||||
@ -439,14 +459,32 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
elevationOptions->addWidget(_dataDEMElevation);
|
elevationOptions->addWidget(_dataDEMElevation);
|
||||||
elevationOptions->addWidget(_showSecondaryElevation);
|
elevationOptions->addWidget(_showSecondaryElevation);
|
||||||
|
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
QButtonGroup *zoneGroup = new QButtonGroup(this);
|
||||||
|
timeZoneGroup->addButton(_utcZone);
|
||||||
|
timeZoneGroup->addButton(_systemZone);
|
||||||
|
timeZoneGroup->addButton(_customZone);
|
||||||
|
QVBoxLayout *zoneOptions = new QVBoxLayout();
|
||||||
|
zoneOptions->addWidget(_utcZone);
|
||||||
|
zoneOptions->addWidget(_systemZone);
|
||||||
|
zoneOptions->addWidget(_customZone);
|
||||||
|
zoneOptions->addItem(customZoneLayout);
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
QFormLayout *formLayout = new QFormLayout();
|
QFormLayout *formLayout = new QFormLayout();
|
||||||
formLayout->addRow(tr("Speed:"), speedOptions);
|
formLayout->addRow(tr("Speed:"), speedOptions);
|
||||||
formLayout->addRow(tr("Elevation:"), elevationOptions);
|
formLayout->addRow(tr("Elevation:"), elevationOptions);
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
formLayout->addRow(tr("Time zone:"), zoneOptions);
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
sourceTabLayout->addLayout(formLayout);
|
sourceTabLayout->addLayout(formLayout);
|
||||||
#else // Q_OS_MAC
|
#else // Q_OS_MAC
|
||||||
QFormLayout *speedLayout = new QFormLayout();
|
QFormLayout *speedLayout = new QFormLayout();
|
||||||
QFormLayout *elevationLayout = new QFormLayout();
|
QFormLayout *elevationLayout = new QFormLayout();
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
QFormLayout *timeZoneLayout = new QFormLayout();
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
speedLayout->addWidget(_computedSpeed);
|
speedLayout->addWidget(_computedSpeed);
|
||||||
speedLayout->addWidget(_reportedSpeed);
|
speedLayout->addWidget(_reportedSpeed);
|
||||||
@ -462,8 +500,21 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
QGroupBox *elevationBox = new QGroupBox(tr("Elevation"));
|
QGroupBox *elevationBox = new QGroupBox(tr("Elevation"));
|
||||||
elevationBox->setLayout(elevationLayout);
|
elevationBox->setLayout(elevationLayout);
|
||||||
|
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
timeZoneLayout->addWidget(_utcZone);
|
||||||
|
timeZoneLayout->addWidget(_systemZone);
|
||||||
|
timeZoneLayout->addWidget(_customZone);
|
||||||
|
timeZoneLayout->addItem(customZoneLayout);
|
||||||
|
|
||||||
|
QGroupBox *timeZoneBox = new QGroupBox(tr("Time zone"));
|
||||||
|
timeZoneBox->setLayout(timeZoneLayout);
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
sourceTabLayout->addWidget(speedBox);
|
sourceTabLayout->addWidget(speedBox);
|
||||||
sourceTabLayout->addWidget(elevationBox);
|
sourceTabLayout->addWidget(elevationBox);
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
sourceTabLayout->addWidget(timeZoneBox);
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
sourceTabLayout->addStretch();
|
sourceTabLayout->addStretch();
|
||||||
sourceTab->setLayout(sourceTabLayout);
|
sourceTab->setLayout(sourceTabLayout);
|
||||||
@ -677,7 +728,7 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
|||||||
void OptionsDialog::accept()
|
void OptionsDialog::accept()
|
||||||
{
|
{
|
||||||
_options->palette.setColor(_baseColor->color());
|
_options->palette.setColor(_baseColor->color());
|
||||||
_options->palette.setShift(_colorOffset->value());
|
_options->palette.setShift(_colorOffset->value() / 100.0);
|
||||||
_options->mapOpacity = _mapOpacity->value();
|
_options->mapOpacity = _mapOpacity->value();
|
||||||
_options->backgroundColor = _backgroundColor->color();
|
_options->backgroundColor = _backgroundColor->color();
|
||||||
_options->trackWidth = _trackWidth->value();
|
_options->trackWidth = _trackWidth->value();
|
||||||
@ -722,6 +773,13 @@ void OptionsDialog::accept()
|
|||||||
_options->dataUseDEM = _dataDEMElevation->isChecked();
|
_options->dataUseDEM = _dataDEMElevation->isChecked();
|
||||||
_options->showSecondaryElevation = _showSecondaryElevation->isChecked();
|
_options->showSecondaryElevation = _showSecondaryElevation->isChecked();
|
||||||
_options->showSecondarySpeed = _showSecondarySpeed->isChecked();
|
_options->showSecondarySpeed = _showSecondarySpeed->isChecked();
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
_options->timeZone.setType(_utcZone->isChecked()
|
||||||
|
? TimeZoneInfo::UTC : _systemZone->isChecked()
|
||||||
|
? TimeZoneInfo::System : TimeZoneInfo::Custom);
|
||||||
|
_options->timeZone.setCustomZone(QTimeZone(_timeZone->currentText()
|
||||||
|
.toLatin1()));
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
qreal poiRadius = (_options->units == Imperial)
|
qreal poiRadius = (_options->units == Imperial)
|
||||||
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
#include "timezoneinfo.h"
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
class ColorBox;
|
class ColorBox;
|
||||||
class StyleComboBox;
|
class StyleComboBox;
|
||||||
@ -17,6 +20,7 @@ class QRadioButton;
|
|||||||
class PercentSlider;
|
class PercentSlider;
|
||||||
class LimitedComboBox;
|
class LimitedComboBox;
|
||||||
|
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
// Appearance
|
// Appearance
|
||||||
Palette palette;
|
Palette palette;
|
||||||
@ -56,6 +60,9 @@ struct Options {
|
|||||||
bool dataUseDEM;
|
bool dataUseDEM;
|
||||||
bool showSecondaryElevation;
|
bool showSecondaryElevation;
|
||||||
bool showSecondarySpeed;
|
bool showSecondarySpeed;
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
TimeZoneInfo timeZone;
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
// POI
|
// POI
|
||||||
int poiRadius;
|
int poiRadius;
|
||||||
// System
|
// System
|
||||||
@ -103,7 +110,7 @@ private:
|
|||||||
|
|
||||||
// Appearance
|
// Appearance
|
||||||
ColorBox *_baseColor;
|
ColorBox *_baseColor;
|
||||||
QDoubleSpinBox *_colorOffset;
|
PercentSlider *_colorOffset;
|
||||||
PercentSlider *_mapOpacity;
|
PercentSlider *_mapOpacity;
|
||||||
ColorBox *_backgroundColor;
|
ColorBox *_backgroundColor;
|
||||||
QSpinBox *_trackWidth;
|
QSpinBox *_trackWidth;
|
||||||
@ -134,7 +141,6 @@ private:
|
|||||||
OddSpinBox *_cadenceFilter;
|
OddSpinBox *_cadenceFilter;
|
||||||
OddSpinBox *_powerFilter;
|
OddSpinBox *_powerFilter;
|
||||||
QCheckBox *_outlierEliminate;
|
QCheckBox *_outlierEliminate;
|
||||||
|
|
||||||
QRadioButton *_automaticPause;
|
QRadioButton *_automaticPause;
|
||||||
QRadioButton *_manualPause;
|
QRadioButton *_manualPause;
|
||||||
QDoubleSpinBox *_pauseSpeed;
|
QDoubleSpinBox *_pauseSpeed;
|
||||||
@ -145,6 +151,12 @@ private:
|
|||||||
QRadioButton *_dataDEMElevation;
|
QRadioButton *_dataDEMElevation;
|
||||||
QCheckBox *_showSecondaryElevation;
|
QCheckBox *_showSecondaryElevation;
|
||||||
QCheckBox *_showSecondarySpeed;
|
QCheckBox *_showSecondarySpeed;
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
QRadioButton *_utcZone;
|
||||||
|
QRadioButton *_systemZone;
|
||||||
|
QRadioButton *_customZone;
|
||||||
|
QComboBox *_timeZone;
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
// POI
|
// POI
|
||||||
QDoubleSpinBox *_poiRadius;
|
QDoubleSpinBox *_poiRadius;
|
||||||
// System
|
// System
|
||||||
|
@ -21,12 +21,16 @@ static inline unsigned segments(qreal distance)
|
|||||||
return ceil(distance / GEOGRAPHICAL_MILE);
|
return ceil(distance / GEOGRAPHICAL_MILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Units PathItem::_units = Metric;
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
QTimeZone PathItem::_timeZone = QTimeZone::utc();
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
||||||
: GraphicsItem(parent), _path(path), _map(map)
|
: GraphicsItem(parent), _path(path), _map(map)
|
||||||
{
|
{
|
||||||
Q_ASSERT(_path.isValid());
|
Q_ASSERT(_path.isValid());
|
||||||
|
|
||||||
_units = Metric;
|
|
||||||
_digitalZoom = 0;
|
_digitalZoom = 0;
|
||||||
_width = 3;
|
_width = 3;
|
||||||
QBrush brush(Qt::SolidPattern);
|
QBrush brush(Qt::SolidPattern);
|
||||||
@ -352,16 +356,6 @@ void PathItem::showTicks(bool show)
|
|||||||
updateTicks();
|
updateTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathItem::setUnits(Units units)
|
|
||||||
{
|
|
||||||
if (_units == units)
|
|
||||||
return;
|
|
||||||
|
|
||||||
prepareGeometryChange();
|
|
||||||
_units = units;
|
|
||||||
updateTicks();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
#ifndef PATHITEM_H
|
#ifndef PATHITEM_H
|
||||||
#define PATHITEM_H
|
#define PATHITEM_H
|
||||||
|
|
||||||
|
#include "common/config.h"
|
||||||
#include <QGraphicsObject>
|
#include <QGraphicsObject>
|
||||||
#include <QPen>
|
#include <QPen>
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
#include <QTimeZone>
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
#include "data/path.h"
|
#include "data/path.h"
|
||||||
#include "markeritem.h"
|
#include "markeritem.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
@ -28,7 +32,6 @@ public:
|
|||||||
|
|
||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
|
|
||||||
void setUnits(Units units);
|
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void setWidth(qreal width);
|
void setWidth(qreal width);
|
||||||
void setStyle(Qt::PenStyle style);
|
void setStyle(Qt::PenStyle style);
|
||||||
@ -37,6 +40,13 @@ public:
|
|||||||
void showMarker(bool show);
|
void showMarker(bool show);
|
||||||
void showTicks(bool show);
|
void showTicks(bool show);
|
||||||
|
|
||||||
|
void updateTicks();
|
||||||
|
|
||||||
|
static void setUnits(Units units) {_units = units;}
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
static void setTimeZone(const QTimeZone &zone) {_timeZone = zone;}
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void moveMarker(qreal distance);
|
void moveMarker(qreal distance);
|
||||||
void hover(bool hover);
|
void hover(bool hover);
|
||||||
@ -49,7 +59,10 @@ protected:
|
|||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
Units _units;
|
static Units _units;
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
static QTimeZone _timeZone;
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PathSegment *segment(qreal x) const;
|
const PathSegment *segment(qreal x) const;
|
||||||
@ -60,7 +73,6 @@ private:
|
|||||||
|
|
||||||
qreal xInM() const;
|
qreal xInM() const;
|
||||||
unsigned tickSize() const;
|
unsigned tickSize() const;
|
||||||
void updateTicks();
|
|
||||||
|
|
||||||
Path _path;
|
Path _path;
|
||||||
Map *_map;
|
Map *_map;
|
||||||
|
@ -47,7 +47,6 @@ RouteItem::RouteItem(const Route &route, Map *map, QGraphicsItem *parent)
|
|||||||
_desc = route.description();
|
_desc = route.description();
|
||||||
_comment = route.comment();
|
_comment = route.comment();
|
||||||
_links = route.links();
|
_links = route.links();
|
||||||
_coordinatesFormat = DecimalDegrees;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouteItem::setMap(Map *map)
|
void RouteItem::setMap(Map *map)
|
||||||
@ -58,28 +57,6 @@ void RouteItem::setMap(Map *map)
|
|||||||
PathItem::setMap(map);
|
PathItem::setMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouteItem::setUnits(Units u)
|
|
||||||
{
|
|
||||||
if (_units == u)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < _waypoints.count(); i++)
|
|
||||||
_waypoints[i]->setToolTipFormat(u, _coordinatesFormat);
|
|
||||||
|
|
||||||
PathItem::setUnits(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RouteItem::setCoordinatesFormat(CoordinatesFormat format)
|
|
||||||
{
|
|
||||||
if (_coordinatesFormat == format)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_coordinatesFormat = format;
|
|
||||||
|
|
||||||
for (int i = 0; i < _waypoints.count(); i++)
|
|
||||||
_waypoints[i]->setToolTipFormat(_units, _coordinatesFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RouteItem::showWaypoints(bool show)
|
void RouteItem::showWaypoints(bool show)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _waypoints.count(); i++)
|
for (int i = 0; i < _waypoints.count(); i++)
|
||||||
|
@ -19,8 +19,6 @@ public:
|
|||||||
|
|
||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
|
|
||||||
void setUnits(Units u);
|
|
||||||
void setCoordinatesFormat(CoordinatesFormat format);
|
|
||||||
void showWaypoints(bool show);
|
void showWaypoints(bool show);
|
||||||
void showWaypointLabels(bool show);
|
void showWaypointLabels(bool show);
|
||||||
|
|
||||||
@ -31,7 +29,6 @@ private:
|
|||||||
QString _desc;
|
QString _desc;
|
||||||
QString _comment;
|
QString _comment;
|
||||||
QVector<Link> _links;
|
QVector<Link> _links;
|
||||||
CoordinatesFormat _coordinatesFormat;
|
|
||||||
|
|
||||||
QVector<WaypointItem*> _waypoints;
|
QVector<WaypointItem*> _waypoints;
|
||||||
};
|
};
|
||||||
|
@ -149,6 +149,7 @@
|
|||||||
#define SHOW_SECONDARY_ELEVATION_DEFAULT false
|
#define SHOW_SECONDARY_ELEVATION_DEFAULT false
|
||||||
#define SHOW_SECONDARY_SPEED_SETTING "showSecondarySpeed"
|
#define SHOW_SECONDARY_SPEED_SETTING "showSecondarySpeed"
|
||||||
#define SHOW_SECONDARY_SPEED_DEFAULT false
|
#define SHOW_SECONDARY_SPEED_DEFAULT false
|
||||||
|
#define TIME_ZONE_SETTING "timeZone"
|
||||||
#define POI_RADIUS_SETTING "poiRadius"
|
#define POI_RADIUS_SETTING "poiRadius"
|
||||||
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
|
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
|
||||||
#define USE_OPENGL_SETTING "useOpenGL"
|
#define USE_OPENGL_SETTING "useOpenGL"
|
||||||
|
69
src/GUI/timezoneinfo.h
Normal file
69
src/GUI/timezoneinfo.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#ifndef TIMEZONEINFO_H
|
||||||
|
#define TIMEZONEINFO_H
|
||||||
|
|
||||||
|
#include <QTimeZone>
|
||||||
|
#include <QDataStream>
|
||||||
|
|
||||||
|
class TimeZoneInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Type {
|
||||||
|
UTC,
|
||||||
|
System,
|
||||||
|
Custom
|
||||||
|
};
|
||||||
|
|
||||||
|
TimeZoneInfo() : _type(UTC), _customZone(QTimeZone::systemTimeZone()) {}
|
||||||
|
|
||||||
|
Type type() const {return _type;}
|
||||||
|
const QTimeZone &customZone() const {return _customZone;}
|
||||||
|
QTimeZone zone() const
|
||||||
|
{
|
||||||
|
if (_type == UTC)
|
||||||
|
return QTimeZone::utc();
|
||||||
|
else if (_type == System)
|
||||||
|
return QTimeZone::systemTimeZone();
|
||||||
|
else
|
||||||
|
return _customZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setType(Type type) {_type = type;}
|
||||||
|
void setCustomZone(const QTimeZone &zone) {_customZone = zone;}
|
||||||
|
|
||||||
|
bool operator==(const TimeZoneInfo &other) const
|
||||||
|
{
|
||||||
|
if (_type == UTC || _type == System)
|
||||||
|
return _type == other._type;
|
||||||
|
else
|
||||||
|
return (other._type == Custom && _customZone == other._customZone);
|
||||||
|
}
|
||||||
|
bool operator!=(const TimeZoneInfo &other) {return !(*this == other);}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend QDataStream& operator<<(QDataStream &out, const TimeZoneInfo &info);
|
||||||
|
friend QDataStream& operator>>(QDataStream &in, TimeZoneInfo &info);
|
||||||
|
|
||||||
|
Type _type;
|
||||||
|
QTimeZone _customZone;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(TimeZoneInfo)
|
||||||
|
|
||||||
|
inline QDataStream &operator<<(QDataStream &out, const TimeZoneInfo &info)
|
||||||
|
{
|
||||||
|
out << static_cast<int>(info._type) << info._customZone;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDataStream &operator>>(QDataStream &in, TimeZoneInfo &info)
|
||||||
|
{
|
||||||
|
int t;
|
||||||
|
|
||||||
|
in >> t;
|
||||||
|
info._type = static_cast<TimeZoneInfo::Type>(t);
|
||||||
|
in >> info._customZone;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TIMEZONEINFO_H
|
@ -22,7 +22,13 @@ QString TrackItem::info() const
|
|||||||
if (_movingTime > 0)
|
if (_movingTime > 0)
|
||||||
tt.insert(tr("Moving time"), Format::timeSpan(_movingTime));
|
tt.insert(tr("Moving time"), Format::timeSpan(_movingTime));
|
||||||
if (!_date.isNull())
|
if (!_date.isNull())
|
||||||
tt.insert(tr("Date"), _date.toString(Qt::SystemLocaleShortDate));
|
tt.insert(tr("Date"),
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
_date.toTimeZone(_timeZone)
|
||||||
|
#else // ENABLE_TIMEZONES
|
||||||
|
_date
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
.toString(Qt::SystemLocaleShortDate));
|
||||||
if (!_links.isEmpty()) {
|
if (!_links.isEmpty()) {
|
||||||
QString links;
|
QString links;
|
||||||
for (int i = 0; i < _links.size(); i++) {
|
for (int i = 0; i < _links.size(); i++) {
|
||||||
|
@ -13,6 +13,13 @@
|
|||||||
#define FS(size) \
|
#define FS(size) \
|
||||||
((int)((qreal)size * 1.41))
|
((int)((qreal)size * 1.41))
|
||||||
|
|
||||||
|
|
||||||
|
Units WaypointItem::_units = Metric;
|
||||||
|
CoordinatesFormat WaypointItem::_format = DecimalDegrees;
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
QTimeZone WaypointItem::_timeZone = QTimeZone::utc();
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
QString WaypointItem::info() const
|
QString WaypointItem::info() const
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
@ -30,7 +37,12 @@ QString WaypointItem::info() const
|
|||||||
}
|
}
|
||||||
if (_waypoint.timestamp().isValid())
|
if (_waypoint.timestamp().isValid())
|
||||||
tt.insert(qApp->translate("WaypointItem", "Date"),
|
tt.insert(qApp->translate("WaypointItem", "Date"),
|
||||||
_waypoint.timestamp().toString(Qt::SystemLocaleShortDate));
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
_waypoint.timestamp().toTimeZone(_timeZone)
|
||||||
|
#else // ENABLE_TIMEZONES
|
||||||
|
_waypoint.timestamp()
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
.toString(Qt::SystemLocaleShortDate));
|
||||||
if (!_waypoint.description().isEmpty())
|
if (!_waypoint.description().isEmpty())
|
||||||
tt.insert(qApp->translate("WaypointItem", "Description"),
|
tt.insert(qApp->translate("WaypointItem", "Description"),
|
||||||
_waypoint.description());
|
_waypoint.description());
|
||||||
@ -78,9 +90,6 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
|||||||
_font.setPixelSize(FS(_size));
|
_font.setPixelSize(FS(_size));
|
||||||
_font.setFamily(FONT_FAMILY);
|
_font.setFamily(FONT_FAMILY);
|
||||||
|
|
||||||
_units = Metric;
|
|
||||||
_format = DecimalDegrees;
|
|
||||||
|
|
||||||
updateCache();
|
updateCache();
|
||||||
|
|
||||||
setPos(map->ll2xy(waypoint.coordinates()));
|
setPos(map->ll2xy(waypoint.coordinates()));
|
||||||
@ -151,12 +160,6 @@ void WaypointItem::setColor(const QColor &color)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointItem::setToolTipFormat(Units units, CoordinatesFormat format)
|
|
||||||
{
|
|
||||||
_units = units;
|
|
||||||
_format = format;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaypointItem::showLabel(bool show)
|
void WaypointItem::showLabel(bool show)
|
||||||
{
|
{
|
||||||
if (_showLabel == show)
|
if (_showLabel == show)
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
#ifndef WAYPOINTITEM_H
|
#ifndef WAYPOINTITEM_H
|
||||||
#define WAYPOINTITEM_H
|
#define WAYPOINTITEM_H
|
||||||
|
|
||||||
|
#include "common/config.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
#include <QTimeZone>
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
#include "data/waypoint.h"
|
#include "data/waypoint.h"
|
||||||
#include "map/map.h"
|
#include "map/map.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
@ -23,7 +27,6 @@ public:
|
|||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void showLabel(bool show);
|
void showLabel(bool show);
|
||||||
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
|
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
|
||||||
void setToolTipFormat(Units units, CoordinatesFormat format);
|
|
||||||
|
|
||||||
QPainterPath shape() const {return _shape;}
|
QPainterPath shape() const {return _shape;}
|
||||||
QRectF boundingRect() const {return _shape.boundingRect();}
|
QRectF boundingRect() const {return _shape.boundingRect();}
|
||||||
@ -32,6 +35,13 @@ public:
|
|||||||
|
|
||||||
QString info() const;
|
QString info() const;
|
||||||
|
|
||||||
|
static void setUnits(Units units) {_units = units;}
|
||||||
|
static void setCoordinatesFormat(CoordinatesFormat format)
|
||||||
|
{_format = format;}
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
static void setTimeZone(const QTimeZone &zone) {_timeZone = zone;}
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
@ -48,8 +58,11 @@ private:
|
|||||||
QFont _font;
|
QFont _font;
|
||||||
QRect _labelBB;
|
QRect _labelBB;
|
||||||
|
|
||||||
Units _units;
|
static Units _units;
|
||||||
CoordinatesFormat _format;
|
static CoordinatesFormat _format;
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
static QTimeZone _timeZone;
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WAYPOINTITEM_H
|
#endif // WAYPOINTITEM_H
|
||||||
|
@ -18,4 +18,8 @@
|
|||||||
#define ENABLE_GEOJSON
|
#define ENABLE_GEOJSON
|
||||||
#endif // QT >= 5.0
|
#endif // QT >= 5.0
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
||||||
|
#define ENABLE_TIMEZONES
|
||||||
|
#endif // QT >= 5.2
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
#endif /* CONFIG_H */
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
#include "GUI/timezoneinfo.h"
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
#include "GUI/app.h"
|
#include "GUI/app.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -7,6 +10,9 @@ int main(int argc, char *argv[])
|
|||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
|
#ifdef ENABLE_TIMEZONES
|
||||||
|
qRegisterMetaTypeStreamOperators<TimeZoneInfo>("TimeZoneInfo");
|
||||||
|
#endif // ENABLE_TIMEZONES
|
||||||
|
|
||||||
App app(argc, argv);
|
App app(argc, argv);
|
||||||
return app.run();
|
return app.run();
|
||||||
|
Loading…
Reference in New Issue
Block a user