mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
parent
3f4b70ee48
commit
2501f834c8
@ -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);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QVector>
|
||||
#include <QLocale>
|
||||
#include "common/range.h"
|
||||
|
||||
class AxisItem : public QGraphicsItem
|
||||
@ -39,6 +40,7 @@ private:
|
||||
QVector<Tick> _ticks;
|
||||
QRectF _boundingRect;
|
||||
QFont _font;
|
||||
QLocale _locale;
|
||||
};
|
||||
|
||||
#endif // AXISITEM_H
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <cmath>
|
||||
#include <QLocale>
|
||||
#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());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <QMap>
|
||||
#include <QLocale>
|
||||
#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();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QPaintDevice>
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
#include <QPalette>
|
||||
#include <QLocale>
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -971,6 +971,8 @@ void GUI::exportFile()
|
||||
|
||||
void GUI::statistics()
|
||||
{
|
||||
QLocale l(QLocale::system());
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString text = "<style>td {white-space: pre; padding-right: 4em;}"
|
||||
"th {text-align: left; padding-top: 0.5em;}</style><table>";
|
||||
@ -981,21 +983,21 @@ void GUI::statistics()
|
||||
|
||||
if (_showTracksAction->isChecked() && _trackCount > 1)
|
||||
text.append("<tr><td>" + tr("Tracks") + ":</td><td>"
|
||||
+ QString::number(_trackCount) + "</td></tr>");
|
||||
+ l.toString(_trackCount) + "</td></tr>");
|
||||
if (_showRoutesAction->isChecked() && _routeCount > 1)
|
||||
text.append("<tr><td>" + tr("Routes") + ":</td><td>"
|
||||
+ QString::number(_routeCount) + "</td></tr>");
|
||||
+ l.toString(_routeCount) + "</td></tr>");
|
||||
if (_showWaypointsAction->isChecked() && _waypointCount > 1)
|
||||
text.append("<tr><td>" + tr("Waypoints") + ":</td><td>"
|
||||
+ QString::number(_waypointCount) + "</td></tr>");
|
||||
+ l.toString(_waypointCount) + "</td></tr>");
|
||||
|
||||
if (_dateRange.first.isValid()) {
|
||||
if (_dateRange.first == _dateRange.second) {
|
||||
QString format = QLocale::system().dateFormat(QLocale::LongFormat);
|
||||
QString format = l.dateFormat(QLocale::LongFormat);
|
||||
text.append("<tr><td>" + tr("Date") + ":</td><td>"
|
||||
+ _dateRange.first.toString(format) + "</td></tr>");
|
||||
} else {
|
||||
QString format = QLocale::system().dateFormat(QLocale::ShortFormat);
|
||||
QString format = l.dateFormat(QLocale::ShortFormat);
|
||||
text.append("<tr><td>" + tr("Date") + ":</td><td>"
|
||||
+ QString("%1 - %2").arg(_dateRange.first.toString(format),
|
||||
_dateRange.second.toString(format)) + "</td></tr>");
|
||||
@ -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)));
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,13 +1,14 @@
|
||||
#include <QSlider>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLocale>
|
||||
#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)
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <QLocale>
|
||||
#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
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <QLocale>
|
||||
#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);
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <QLocale>
|
||||
#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();
|
||||
|
Loading…
Reference in New Issue
Block a user