mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-26 04:00:49 +01:00
Code cleanup
This commit is contained in:
parent
ee5b8fa333
commit
27632bf07e
@ -17,7 +17,7 @@ static QString deg2DMS(double val)
|
|||||||
.arg(sec, 4, 'f', 1, QChar('0'));
|
.arg(sec, 4, 'f', 1, QChar('0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString deg2DM(double val)
|
static QString deg2DMM(double val)
|
||||||
{
|
{
|
||||||
int deg = val;
|
int deg = val;
|
||||||
double r1 = val - deg;
|
double r1 = val - deg;
|
||||||
@ -80,8 +80,8 @@ QString Format::coordinates(const Coordinates &value, CoordinatesFormat type)
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DegreesMinutes:
|
case DegreesMinutes:
|
||||||
return deg2DM(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
return deg2DMM(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
||||||
+ deg2DM(qAbs(value.lon())) + xH;
|
+ deg2DMM(qAbs(value.lon())) + xH;
|
||||||
break;
|
break;
|
||||||
case DMS:
|
case DMS:
|
||||||
return deg2DMS(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
return deg2DMS(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
||||||
|
@ -1467,10 +1467,10 @@ void GUI::writeSettings()
|
|||||||
UNITS_DEFAULT)
|
UNITS_DEFAULT)
|
||||||
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
|
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
|
||||||
? Imperial : Metric);
|
? Imperial : Metric);
|
||||||
CoordinatesFormat ct = _DMSAction->isChecked() ? DMS
|
CoordinatesFormat format = _DMSAction->isChecked() ? DMS
|
||||||
: _degreesMinutesAction->isChecked() ? DegreesMinutes : DecimalDegrees;
|
: _degreesMinutesAction->isChecked() ? DegreesMinutes : DecimalDegrees;
|
||||||
if (ct != COORDINATES_DEFAULT)
|
if (format != COORDINATES_DEFAULT)
|
||||||
settings.setValue(COORDINATES_SETTING, ct);
|
settings.setValue(COORDINATES_SETTING, format);
|
||||||
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
|
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
|
||||||
settings.setValue(SHOW_TOOLBARS_SETTING,
|
settings.setValue(SHOW_TOOLBARS_SETTING,
|
||||||
_showToolbarsAction->isChecked());
|
_showToolbarsAction->isChecked());
|
||||||
|
@ -10,14 +10,14 @@
|
|||||||
#define FS(size) \
|
#define FS(size) \
|
||||||
((int)((qreal)size * 1.41))
|
((int)((qreal)size * 1.41))
|
||||||
|
|
||||||
QString WaypointItem::toolTip(Units units, CoordinatesFormat ct)
|
QString WaypointItem::toolTip(Units units, CoordinatesFormat format)
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
|
||||||
if (!_waypoint.name().isEmpty())
|
if (!_waypoint.name().isEmpty())
|
||||||
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
||||||
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
||||||
Format::coordinates(_waypoint.coordinates(), ct));
|
Format::coordinates(_waypoint.coordinates(), format));
|
||||||
if (!std::isnan(_waypoint.elevation()))
|
if (!std::isnan(_waypoint.elevation()))
|
||||||
tt.insert(qApp->translate("WaypointItem", "Elevation"),
|
tt.insert(qApp->translate("WaypointItem", "Elevation"),
|
||||||
Format::elevation(_waypoint.elevation(), units));
|
Format::elevation(_waypoint.elevation(), units));
|
||||||
@ -124,9 +124,9 @@ void WaypointItem::setColor(const QColor &color)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointItem::setToolTipFormat(Units units, CoordinatesFormat ct)
|
void WaypointItem::setToolTipFormat(Units units, CoordinatesFormat format)
|
||||||
{
|
{
|
||||||
setToolTip(toolTip(units, ct));
|
setToolTip(toolTip(units, format));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointItem::showLabel(bool show)
|
void WaypointItem::showLabel(bool show)
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
const Waypoint &waypoint() const {return _waypoint;}
|
const Waypoint &waypoint() const {return _waypoint;}
|
||||||
|
|
||||||
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
||||||
void setToolTipFormat(Units units, CoordinatesFormat ct);
|
void setToolTipFormat(Units units, CoordinatesFormat format);
|
||||||
void setSize(int size);
|
void setSize(int size);
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void showLabel(bool show);
|
void showLabel(bool show);
|
||||||
@ -32,7 +32,7 @@ private:
|
|||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
|
||||||
void updateShape();
|
void updateShape();
|
||||||
QString toolTip(Units units, CoordinatesFormat ct);
|
QString toolTip(Units units, CoordinatesFormat format);
|
||||||
|
|
||||||
QPainterPath _shape;
|
QPainterPath _shape;
|
||||||
Waypoint _waypoint;
|
Waypoint _waypoint;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user