diff --git a/src/GUI/axisitem.cpp b/src/GUI/axisitem.cpp index 9eedfe87..970ce5d9 100644 --- a/src/GUI/axisitem.cpp +++ b/src/GUI/axisitem.cpp @@ -36,7 +36,8 @@ Ticks::Ticks(double minValue, double maxValue, int maxCount) } -AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent) +AxisItem::AxisItem(Type type, QGraphicsItem *parent) + : QGraphicsItem(parent), _locale(QLocale::system()) { _type = type; _size = 0; @@ -56,7 +57,7 @@ void AxisItem::setRange(const RangeF &range) for (int i = 0; i < ticks.count(); i++) { Tick &t = _ticks[i]; t.value = ticks.val(i); - t.boundingBox = fm.tightBoundingRect(QString::number(t.value)); + t.boundingBox = fm.tightBoundingRect(_locale.toString(t.value)); } updateBoundingRect(); @@ -126,7 +127,7 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, TICK/2, (_size/_range.size()) * (val - _range.min()), -TICK/2); painter->drawText(((_size/_range.size()) * (val - _range.min())) - (ts.width()/2), ts.height() + TICK/2 + PADDING, - QString::number(val)); + _locale.toString(val)); } painter->drawText(_size/2 - _labelBB.width()/2, _labelBB.height() @@ -145,7 +146,7 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, * (val - _range.min()))); painter->drawText(-(ts.width() + PADDING + TICK/2), -((_size/_range.size()) * (val - _range.min())) + (ts.height()/2), - QString::number(val)); + _locale.toString(val)); } painter->rotate(-90); diff --git a/src/GUI/axisitem.h b/src/GUI/axisitem.h index f72cbe96..a49674b9 100644 --- a/src/GUI/axisitem.h +++ b/src/GUI/axisitem.h @@ -3,6 +3,7 @@ #include #include +#include #include "common/range.h" class AxisItem : public QGraphicsItem @@ -39,6 +40,7 @@ private: QVector _ticks; QRectF _boundingRect; QFont _font; + QLocale _locale; }; #endif // AXISITEM_H diff --git a/src/GUI/cadencegraph.cpp b/src/GUI/cadencegraph.cpp index 28aaa718..a1da7758 100644 --- a/src/GUI/cadencegraph.cpp +++ b/src/GUI/cadencegraph.cpp @@ -1,3 +1,4 @@ +#include #include "data/data.h" #include "cadencegraphitem.h" #include "cadencegraph.h" @@ -16,9 +17,11 @@ CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent) void CadenceGraph::setInfo() { if (_showTracks) { - GraphView::addInfo(tr("Average"), QString::number(avg() * yScale() + QLocale l(QLocale::system()); + + GraphView::addInfo(tr("Average"), l.toString(avg() * yScale() + yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale() + GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale() + yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); } else clearInfo(); diff --git a/src/GUI/cadencegraphitem.cpp b/src/GUI/cadencegraphitem.cpp index 7efb0cb9..e86bc572 100644 --- a/src/GUI/cadencegraphitem.cpp +++ b/src/GUI/cadencegraphitem.cpp @@ -1,6 +1,8 @@ +#include #include "tooltip.h" #include "cadencegraphitem.h" + CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent) : GraphItem(graph, type, parent) { @@ -16,10 +18,11 @@ CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type, QString CadenceGraphItem::toolTip() const { ToolTip tt; + QLocale l(QLocale::system()); - tt.insert(tr("Maximum"), QString::number(max(), 'f', 1) + tt.insert(tr("Maximum"), l.toString(max(), 'f', 1) + UNIT_SPACE + tr("rpm")); - tt.insert(tr("Average"), QString::number(avg(), 'f', 1) + tt.insert(tr("Average"), l.toString(avg(), 'f', 1) + UNIT_SPACE + tr("rpm")); return tt.toString(); diff --git a/src/GUI/elevationgraph.cpp b/src/GUI/elevationgraph.cpp index ab6bbedd..e377dee4 100644 --- a/src/GUI/elevationgraph.cpp +++ b/src/GUI/elevationgraph.cpp @@ -1,4 +1,5 @@ #include +#include #include "data/data.h" #include "config.h" #include "tooltip.h" @@ -54,13 +55,15 @@ void ElevationGraph::setInfo() if (std::isnan(max()) || std::isnan(min())) clearInfo(); else { - GraphView::addInfo(tr("Ascent"), QString::number(ascent() * yScale(), + QLocale l(QLocale::system()); + + GraphView::addInfo(tr("Ascent"), l.toString(ascent() * yScale(), 'f', 0) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Descent"), QString::number(descent() * yScale(), + GraphView::addInfo(tr("Descent"), l.toString(descent() * yScale(), 'f', 0) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', + GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f', 0) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', + GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f', 0) + UNIT_SPACE + yUnits()); } } diff --git a/src/GUI/elevationgraphitem.cpp b/src/GUI/elevationgraphitem.cpp index eae5d865..f4333c6a 100644 --- a/src/GUI/elevationgraphitem.cpp +++ b/src/GUI/elevationgraphitem.cpp @@ -1,6 +1,8 @@ +#include #include "tooltip.h" #include "elevationgraphitem.h" + ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent) : GraphItem(graph, type, parent) { @@ -24,14 +26,15 @@ QString ElevationGraphItem::toolTip(Units units) const ToolTip tt; qreal scale = (units == Metric) ? 1.0 : M2FT; QString su = (units == Metric) ? tr("m") : tr("ft"); + QLocale l(QLocale::system()); - tt.insert(tr("Ascent"), QString::number(ascent() * scale, 'f', 0) + tt.insert(tr("Ascent"), l.toString(ascent() * scale, 'f', 0) + UNIT_SPACE + su); - tt.insert(tr("Descent"), QString::number(descent() * scale, 'f', 0) + tt.insert(tr("Descent"), l.toString(descent() * scale, 'f', 0) + UNIT_SPACE + su); - tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 0) + tt.insert(tr("Maximum"), l.toString(max() * scale, 'f', 0) + UNIT_SPACE + su); - tt.insert(tr("Minimum"), QString::number(min() * scale, 'f', 0) + tt.insert(tr("Minimum"), l.toString(min() * scale, 'f', 0) + UNIT_SPACE + su); return tt.toString(); diff --git a/src/GUI/format.cpp b/src/GUI/format.cpp index b42a6571..4695c06f 100644 --- a/src/GUI/format.cpp +++ b/src/GUI/format.cpp @@ -46,37 +46,41 @@ QString Format::timeSpan(qreal time, bool full) QString Format::distance(qreal value, Units units) { + QLocale l(QLocale::system()); + if (units == Imperial) { if (value < MIINM) - return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE + return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE + qApp->translate("Format", "ft"); else - return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE + return l.toString(value * M2MI, 'f', 1) + UNIT_SPACE + qApp->translate("Format", "mi"); } else if (units == Nautical) { if (value < NMIINM) - return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE + return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE + qApp->translate("Format", "ft"); else - return QString::number(value * M2NMI, 'f', 1) + UNIT_SPACE + return l.toString(value * M2NMI, 'f', 1) + UNIT_SPACE + qApp->translate("Format", "nmi"); } else { if (value < KMINM) - return QString::number(value, 'f', 0) + UNIT_SPACE + return l.toString(value, 'f', 0) + UNIT_SPACE + qApp->translate("Format", "m"); else - return QString::number(value * M2KM, 'f', 1) + UNIT_SPACE + return l.toString(value * M2KM, 'f', 1) + UNIT_SPACE + qApp->translate("Format", "km"); } } QString Format::elevation(qreal value, Units units) { + QLocale l(QLocale::system()); + if (units == Metric) - return QString::number(qRound(value)) + UNIT_SPACE + return l.toString(qRound(value)) + UNIT_SPACE + qApp->translate("Format", "m"); else - return QString::number(qRound(value * M2FT)) + UNIT_SPACE + return l.toString(qRound(value * M2FT)) + UNIT_SPACE + qApp->translate("Format", "ft"); } @@ -95,7 +99,8 @@ QString Format::coordinates(const Coordinates &value, CoordinatesFormat type) + deg2DMS(qAbs(value.lon())) + xH; break; default: - return QString::number(qAbs(value.lat()), 'f', 5) + yH + "," - + QChar(0x00A0) + QString::number(qAbs(value.lon()), 'f', 5) + xH; + QLocale l(QLocale::system()); + return l.toString(qAbs(value.lat()), 'f', 5) + yH + "," + + QChar(0x00A0) + l.toString(qAbs(value.lon()), 'f', 5) + xH; } } diff --git a/src/GUI/gearratiograph.cpp b/src/GUI/gearratiograph.cpp index b482ce8c..909d726f 100644 --- a/src/GUI/gearratiograph.cpp +++ b/src/GUI/gearratiograph.cpp @@ -1,3 +1,4 @@ +#include #include "data/data.h" #include "gearratiographitem.h" #include "gearratiograph.h" @@ -16,11 +17,13 @@ GearRatioGraph::GearRatioGraph(QWidget *parent) : GraphTab(parent) void GearRatioGraph::setInfo() { if (_showTracks) { - GraphView::addInfo(tr("Most used"), QString::number(top() * yScale(), + QLocale l(QLocale::system()); + + GraphView::addInfo(tr("Most used"), l.toString(top() * yScale(), 'f', 2) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', + GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f', 2) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', + GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f', 2) + UNIT_SPACE + yUnits()); } else clearInfo(); diff --git a/src/GUI/gearratiographitem.cpp b/src/GUI/gearratiographitem.cpp index 70d69216..35e02c2d 100644 --- a/src/GUI/gearratiographitem.cpp +++ b/src/GUI/gearratiographitem.cpp @@ -1,7 +1,9 @@ #include +#include #include "tooltip.h" #include "gearratiographitem.h" + GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN) { @@ -30,10 +32,11 @@ GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type, QString GearRatioGraphItem::toolTip() const { ToolTip tt; + QLocale l(QLocale::system()); - tt.insert(tr("Minimum"), QString::number(min(), 'f', 2)); - tt.insert(tr("Maximum"), QString::number(max(), 'f', 2)); - tt.insert(tr("Most used"), QString::number(top(), 'f', 2)); + tt.insert(tr("Minimum"), l.toString(min(), 'f', 2)); + tt.insert(tr("Maximum"), l.toString(max(), 'f', 2)); + tt.insert(tr("Most used"), l.toString(top(), 'f', 2)); return tt.toString(); } diff --git a/src/GUI/graphview.cpp b/src/GUI/graphview.cpp index 209d3ed7..c2c468c2 100644 --- a/src/GUI/graphview.cpp +++ b/src/GUI/graphview.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "data/graph.h" #include "opengl.h" #include "config.h" @@ -413,8 +414,10 @@ void GraphView::updateSliderPosition() void GraphView::updateSliderInfo() { + QLocale l(QLocale::system()); qreal r, y; + if (_visible.count() > 1) { r = 0; y = 0; @@ -435,9 +438,9 @@ void GraphView::updateSliderInfo() _sliderInfo->setSide(s); _sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r)); _sliderInfo->setText(_graphType == Time ? Format::timeSpan(_sliderPos, - bounds().width() > 3600) : QString::number(_sliderPos * _xScale, 'f', 1) + bounds().width() > 3600) : l.toString(_sliderPos * _xScale, 'f', 1) + UNIT_SPACE + _xUnits, (_visible.count() > 1) ? QString() - : QString::number(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE + : l.toString(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE + _yUnits); } diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index 94476564..bb657362 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -971,6 +971,8 @@ void GUI::exportFile() void GUI::statistics() { + QLocale l(QLocale::system()); + #ifdef Q_OS_WIN32 QString text = ""; @@ -981,21 +983,21 @@ void GUI::statistics() if (_showTracksAction->isChecked() && _trackCount > 1) text.append(""); + + l.toString(_trackCount) + ""); if (_showRoutesAction->isChecked() && _routeCount > 1) text.append(""); + + l.toString(_routeCount) + ""); if (_showWaypointsAction->isChecked() && _waypointCount > 1) text.append(""); + + l.toString(_waypointCount) + ""); if (_dateRange.first.isValid()) { if (_dateRange.first == _dateRange.second) { - QString format = QLocale::system().dateFormat(QLocale::LongFormat); + QString format = l.dateFormat(QLocale::LongFormat); text.append(""); } else { - QString format = QLocale::system().dateFormat(QLocale::ShortFormat); + QString format = l.dateFormat(QLocale::ShortFormat); text.append(""); @@ -1037,6 +1039,7 @@ void GUI::statistics() void GUI::plot(QPrinter *printer) { + QLocale l(QLocale::system()); QPainter p(printer); TrackInfo info; qreal ih, gh, mh, ratio; @@ -1047,19 +1050,19 @@ void GUI::plot(QPrinter *printer) if (_options.printItemCount) { if (_showTracksAction->isChecked() && _trackCount > 1) - info.insert(tr("Tracks"), QString::number(_trackCount)); + info.insert(tr("Tracks"), l.toString(_trackCount)); if (_showRoutesAction->isChecked() && _routeCount > 1) - info.insert(tr("Routes"), QString::number(_routeCount)); + info.insert(tr("Routes"), l.toString(_routeCount)); if (_showWaypointsAction->isChecked() && _waypointCount > 1) - info.insert(tr("Waypoints"), QString::number(_waypointCount)); + info.insert(tr("Waypoints"), l.toString(_waypointCount)); } if (_dateRange.first.isValid() && _options.printDate) { if (_dateRange.first == _dateRange.second) { - QString format = QLocale::system().dateFormat(QLocale::LongFormat); + QString format = l.dateFormat(QLocale::LongFormat); info.insert(tr("Date"), _dateRange.first.toString(format)); } else { - QString format = QLocale::system().dateFormat(QLocale::ShortFormat); + QString format = l.dateFormat(QLocale::ShortFormat); info.insert(tr("Date"), QString("%1 - %2") .arg(_dateRange.first.toString(format), _dateRange.second.toString(format))); diff --git a/src/GUI/heartrategraph.cpp b/src/GUI/heartrategraph.cpp index f68da79d..4777f587 100644 --- a/src/GUI/heartrategraph.cpp +++ b/src/GUI/heartrategraph.cpp @@ -1,3 +1,4 @@ +#include #include "data/data.h" #include "heartrategraphitem.h" #include "heartrategraph.h" @@ -16,9 +17,11 @@ HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent) void HeartRateGraph::setInfo() { if (_showTracks) { - GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', + QLocale l(QLocale::system()); + + GraphView::addInfo(tr("Average"), l.toString(avg() * yScale(), 'f', 0) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', + GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f', 0) + UNIT_SPACE + yUnits()); } else clearInfo(); diff --git a/src/GUI/heartrategraphitem.cpp b/src/GUI/heartrategraphitem.cpp index 45968018..a309274c 100644 --- a/src/GUI/heartrategraphitem.cpp +++ b/src/GUI/heartrategraphitem.cpp @@ -1,6 +1,8 @@ +#include #include "tooltip.h" #include "heartrategraphitem.h" + HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent) : GraphItem(graph, type, parent) { @@ -16,10 +18,11 @@ HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type, QString HeartRateGraphItem::toolTip() const { ToolTip tt; + QLocale l(QLocale::system()); - tt.insert(tr("Maximum"), QString::number(max(), 'f', 0) + tt.insert(tr("Maximum"), l.toString(max(), 'f', 0) + UNIT_SPACE + tr("bpm")); - tt.insert(tr("Average"), QString::number(avg(), 'f', 0) + tt.insert(tr("Average"), l.toString(avg(), 'f', 0) + UNIT_SPACE + tr("bpm")); return tt.toString(); diff --git a/src/GUI/percentslider.cpp b/src/GUI/percentslider.cpp index 16b71515..a1b14dc2 100644 --- a/src/GUI/percentslider.cpp +++ b/src/GUI/percentslider.cpp @@ -1,13 +1,14 @@ #include #include #include +#include #include "units.h" #include "percentslider.h" static QString format(int value) { - return QString::number(value) + UNIT_SPACE + QString("%"); + return QLocale::system().toString(value) + UNIT_SPACE + QString("%"); } PercentSlider::PercentSlider(QWidget *parent) : QWidget(parent) diff --git a/src/GUI/powergraph.cpp b/src/GUI/powergraph.cpp index 58067bf8..950124d1 100644 --- a/src/GUI/powergraph.cpp +++ b/src/GUI/powergraph.cpp @@ -1,3 +1,4 @@ +#include #include "data/data.h" #include "powergraphitem.h" #include "powergraph.h" @@ -16,9 +17,11 @@ PowerGraph::PowerGraph(QWidget *parent) : GraphTab(parent) void PowerGraph::setInfo() { if (_showTracks) { - GraphView::addInfo(tr("Average"), QString::number(avg() * yScale() + QLocale l(QLocale::system()); + + GraphView::addInfo(tr("Average"), l.toString(avg() * yScale() + yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale() + GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale() + yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); } else clearInfo(); diff --git a/src/GUI/powergraphitem.cpp b/src/GUI/powergraphitem.cpp index 3a4f04f0..bb086082 100644 --- a/src/GUI/powergraphitem.cpp +++ b/src/GUI/powergraphitem.cpp @@ -1,6 +1,8 @@ +#include #include "tooltip.h" #include "powergraphitem.h" + PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent) : GraphItem(graph, type, parent) { @@ -16,10 +18,11 @@ PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type, QString PowerGraphItem::toolTip() const { ToolTip tt; + QLocale l(QLocale::system()); - tt.insert(tr("Maximum"), QString::number(max(), 'f', 1) + tt.insert(tr("Maximum"), l.toString(max(), 'f', 1) + UNIT_SPACE + tr("W")); - tt.insert(tr("Average"), QString::number(avg(), 'f', 1) + tt.insert(tr("Average"), l.toString(avg(), 'f', 1) + UNIT_SPACE + tr("W")); return tt.toString(); diff --git a/src/GUI/speedgraph.cpp b/src/GUI/speedgraph.cpp index 2b9938ba..30dc4550 100644 --- a/src/GUI/speedgraph.cpp +++ b/src/GUI/speedgraph.cpp @@ -1,3 +1,4 @@ +#include #include "data/data.h" #include "config.h" #include "tooltip.h" @@ -21,13 +22,14 @@ SpeedGraph::SpeedGraph(QWidget *parent) : GraphTab(parent) void SpeedGraph::setInfo() { if (_showTracks) { + QLocale l(QLocale::system()); QString pace = Format::timeSpan((3600.0 / (avg() * yScale())), false); QString pu = (_units == Metric) ? tr("min/km") : (_units == Imperial) ? tr("min/mi") : tr("min/nmi"); - GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', + GraphView::addInfo(tr("Average"), l.toString(avg() * yScale(), 'f', 1) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', + GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f', 1) + UNIT_SPACE + yUnits()); GraphView::addInfo(tr("Pace"), pace + UNIT_SPACE + pu); } else diff --git a/src/GUI/speedgraphitem.cpp b/src/GUI/speedgraphitem.cpp index f1a4554b..62ebd9de 100644 --- a/src/GUI/speedgraphitem.cpp +++ b/src/GUI/speedgraphitem.cpp @@ -1,7 +1,9 @@ +#include #include "tooltip.h" #include "format.h" #include "speedgraphitem.h" + SpeedGraphItem::SpeedGraphItem(const Graph &graph, GraphType type, qreal movingTime, QGraphicsItem *parent) : GraphItem(graph, type, parent) { @@ -25,10 +27,11 @@ QString SpeedGraphItem::toolTip() const ? avg() * scale : mavg() * scale)), false); QString pu = (_units == Metric) ? tr("min/km") : (_units == Imperial) ? tr("min/mi") : tr("min/nmi"); + QLocale l(QLocale::system()); - tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 1) + tt.insert(tr("Maximum"), l.toString(max() * scale, 'f', 1) + UNIT_SPACE + su); - tt.insert(tr("Average"), QString::number((_timeType == Total) + tt.insert(tr("Average"), l.toString((_timeType == Total) ? avg() * scale : mavg() * scale, 'f', 1) + UNIT_SPACE + su); tt.insert(tr("Pace"), pace + UNIT_SPACE + pu); diff --git a/src/GUI/temperaturegraph.cpp b/src/GUI/temperaturegraph.cpp index 281d8632..98918645 100644 --- a/src/GUI/temperaturegraph.cpp +++ b/src/GUI/temperaturegraph.cpp @@ -1,3 +1,4 @@ +#include #include "data/data.h" #include "temperaturegraphitem.h" #include "temperaturegraph.h" @@ -16,11 +17,13 @@ TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphTab(parent) void TemperatureGraph::setInfo() { if (_showTracks) { - GraphView::addInfo(tr("Average"), QString::number(avg() * yScale() + QLocale l(QLocale::system()); + + GraphView::addInfo(tr("Average"), l.toString(avg() * yScale() + yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale() + GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale() + yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); - GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale() + GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale() + yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); } else clearInfo(); diff --git a/src/GUI/temperaturegraphitem.cpp b/src/GUI/temperaturegraphitem.cpp index 9a9c9c09..9f6412a2 100644 --- a/src/GUI/temperaturegraphitem.cpp +++ b/src/GUI/temperaturegraphitem.cpp @@ -1,6 +1,8 @@ +#include #include "tooltip.h" #include "temperaturegraphitem.h" + TemperatureGraphItem::TemperatureGraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent) : GraphItem(graph, type, parent) { @@ -20,12 +22,13 @@ QString TemperatureGraphItem::toolTip(Units units) const qreal offset = (units == Metric) ? 0 : C2FO; QString su = (units == Metric) ? QChar(0x00B0) + tr("C") : QChar(0x00B0) + tr("F"); + QLocale l(QLocale::system()); - tt.insert(tr("Average"), QString::number(avg() * scale + offset, 'f', 1) + tt.insert(tr("Average"), l.toString(avg() * scale + offset, 'f', 1) + UNIT_SPACE + su); - tt.insert(tr("Maximum"), QString::number(max() * scale + offset, 'f', 1) + tt.insert(tr("Maximum"), l.toString(max() * scale + offset, 'f', 1) + UNIT_SPACE + su); - tt.insert(tr("Minimum"), QString::number(min() * scale + offset, 'f', 1) + tt.insert(tr("Minimum"), l.toString(min() * scale + offset, 'f', 1) + UNIT_SPACE + su); return tt.toString();
" + tr("Tracks") + ":" - + QString::number(_trackCount) + "
" + tr("Routes") + ":" - + QString::number(_routeCount) + "
" + tr("Waypoints") + ":" - + QString::number(_waypointCount) + "
" + tr("Date") + ":" + _dateRange.first.toString(format) + "
" + tr("Date") + ":" + QString("%1 - %2").arg(_dateRange.first.toString(format), _dateRange.second.toString(format)) + "