mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
respect user's unit pref in import wizard
Based on a patch by Thomas Weichmann.
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#include "MainWindow.h"
|
||||
#include "QuarqRideFile.h"
|
||||
#include <QWaitCondition>
|
||||
#include "Settings.h"
|
||||
#include "Units.h"
|
||||
|
||||
|
||||
// drag and drop passes urls ... convert to a list of files and call main constructor
|
||||
@@ -296,6 +298,10 @@ RideImportWizard::process()
|
||||
tableWidget->item(i,1)->setTextAlignment(Qt::AlignRight); // put in the middle
|
||||
tableWidget->item(i,2)->setTextAlignment(Qt::AlignRight); // put in the middle
|
||||
|
||||
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
|
||||
QVariant unit = settings->value(GC_UNIT);
|
||||
bool metric = unit.toString() == "Metric";
|
||||
|
||||
// show duration by looking at last data point
|
||||
if (ride->dataPoints().last() != NULL) {
|
||||
int secs = ride->dataPoints().last()->secs;
|
||||
@@ -307,8 +313,10 @@ RideImportWizard::process()
|
||||
tableWidget->item(i,3)->setTextAlignment(Qt::AlignHCenter); // put in the middle
|
||||
|
||||
// show distance by looking at last data point
|
||||
int km = ride->dataPoints().last()->km;
|
||||
QString dist = QString ("%1 km").arg(km, 1,10,zero);
|
||||
double km = ride->dataPoints().last()->km;
|
||||
QString dist = metric
|
||||
? QString ("%1 km").arg(km, 0, 'f', 1)
|
||||
: QString ("%1 mi").arg(km * MILES_PER_KM, 0, 'f', 1);
|
||||
tableWidget->item(i,4)->setText(dist);
|
||||
tableWidget->item(i,4)->setTextAlignment(Qt::AlignRight); // put in the middle
|
||||
|
||||
@@ -316,7 +324,7 @@ RideImportWizard::process()
|
||||
|
||||
tableWidget->item(i,3)->setText(tr("00:00:00")); // duration
|
||||
tableWidget->item(i,3)->setTextAlignment(Qt::AlignHCenter); // put in the middle
|
||||
tableWidget->item(i,4)->setText(tr("0 km"));
|
||||
tableWidget->item(i,4)->setText(tr(metric ? "0 km" : "0 mi"));
|
||||
tableWidget->item(i,4)->setTextAlignment(Qt::AlignRight); // put in the middle
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user