|
|
@ -32,7 +32,7 @@ void DriveStats::parseResponse(QString response) { |
|
|
|
|
|
|
|
|
|
|
|
auto update = [](const QJsonObject &obj, StatsLabels& labels, bool metric) { |
|
|
|
auto update = [](const QJsonObject &obj, StatsLabels& labels, bool metric) { |
|
|
|
labels.routes->setText(QString::number((int)obj["routes"].toDouble())); |
|
|
|
labels.routes->setText(QString::number((int)obj["routes"].toDouble())); |
|
|
|
labels.distance->setText(QString::number(obj["distance"].toDouble() * (metric ? MILE_TO_KM : 1))); |
|
|
|
labels.distance->setText(QString::number(int(obj["distance"].toDouble() * (metric ? MILE_TO_KM : 1)))); |
|
|
|
labels.hours->setText(QString::number((int)(obj["minutes"].toDouble() / 60))); |
|
|
|
labels.hours->setText(QString::number((int)(obj["minutes"].toDouble() / 60))); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|