Skip to content

Commit

Permalink
Increase the distance precision for tracks < 10km/nm/nmi to two decim…
Browse files Browse the repository at this point in the history
…al digits
  • Loading branch information
tumic0 committed Oct 31, 2024
1 parent 3ec3633 commit 244a767
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/GUI/format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,29 @@ QString Format::distance(qreal value, Units units)
if (value < MIINM)
return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
+ qApp->translate("Format", "ft");
else if (value < 10 * MIINM)
return l.toString(value * M2MI, 'f', 2) + UNIT_SPACE
+ qApp->translate("Format", "mi");
else
return l.toString(value * M2MI, 'f', 1) + UNIT_SPACE
+ qApp->translate("Format", "mi");
} else if (units == Nautical) {
if (value < NMIINM)
return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
+ qApp->translate("Format", "ft");
else if (value < 10 * NMIINM)
return l.toString(value * M2NMI, 'f', 2) + UNIT_SPACE
+ qApp->translate("Format", "nmi");
else
return l.toString(value * M2NMI, 'f', 1) + UNIT_SPACE
+ qApp->translate("Format", "nmi");
} else {
if (value < KMINM)
return l.toString(value, 'f', 0) + UNIT_SPACE
+ qApp->translate("Format", "m");
else if (value < 10 * KMINM)
return l.toString(value * M2KM, 'f', 2) + UNIT_SPACE
+ qApp->translate("Format", "km");
else
return l.toString(value * M2KM, 'f', 1) + UNIT_SPACE
+ qApp->translate("Format", "km");
Expand Down

0 comments on commit 244a767

Please sign in to comment.