Change measurement units from metric/arhiac to Metric/English

This commit is contained in:
Seeker4 2019-05-01 09:05:01 -07:00
parent 7f336ea9d4
commit 7e9b59bbf6
6 changed files with 14 additions and 14 deletions

View File

@ -169,7 +169,7 @@ class gYAxisWeight: public gYAxis
gYAxisWeight(UnitSystem us = US_Metric, QColor col = Qt::black) : gYAxis(col), m_unitsystem(us) {} gYAxisWeight(UnitSystem us = US_Metric, QColor col = Qt::black) : gYAxis(col), m_unitsystem(us) {}
virtual ~gYAxisWeight() {} virtual ~gYAxisWeight() {}
//! \brief Returns the current UnitSystem displayed (eg, US_Metric (the rest of the world), US_Archiac (American) ) //! \brief Returns the current UnitSystem displayed (eg, US_Metric (the rest of the world), US_English (American) )
UnitSystem unitSystem() { return m_unitsystem; } UnitSystem unitSystem() { return m_unitsystem; }
//! \brief Set the unit system displayed by this YTicker //! \brief Set the unit system displayed by this YTicker

View File

@ -220,7 +220,7 @@ QString weightString(float kg, UnitSystem us)
if (us == US_Metric) { if (us == US_Metric) {
return QString("%1kg").arg(kg, 0, 'f', 2); return QString("%1kg").arg(kg, 0, 'f', 2);
} else if (us == US_Archiac) { } else if (us == US_English) {
int oz = (kg * 1000.0) / (float)ounce_convert; int oz = (kg * 1000.0) / (float)ounce_convert;
int lb = oz / 16.0; int lb = oz / 16.0;
oz = oz % 16; oz = oz % 16;

View File

@ -53,7 +53,7 @@ const quint16 filetype_summary = 0;
const quint16 filetype_data = 1; const quint16 filetype_data = 1;
const quint16 filetype_sessenabled = 5; const quint16 filetype_sessenabled = 5;
enum UnitSystem { US_Undefined, US_Metric, US_Archiac }; enum UnitSystem { US_Undefined, US_Metric, US_English };
typedef float EventDataType; typedef float EventDataType;

View File

@ -409,7 +409,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
ui->splitter->setVisible(false); ui->splitter->setVisible(false);
if (p_profile->general->unitSystem()==US_Archiac) { if (p_profile->general->unitSystem()==US_English) {
ui->weightSpinBox->setSuffix(STR_UNIT_POUND); ui->weightSpinBox->setSuffix(STR_UNIT_POUND);
ui->weightSpinBox->setDecimals(0); ui->weightSpinBox->setDecimals(0);
ui->ouncesSpinBox->setVisible(true); ui->ouncesSpinBox->setVisible(true);
@ -798,7 +798,7 @@ void Daily::on_ReloadDay()
ui->calButton->setText(ui->calendar->selectedDate().toString(Qt::TextDate)); ui->calButton->setText(ui->calendar->selectedDate().toString(Qt::TextDate));
ui->calendar->setFocus(Qt::ActiveWindowFocusReason); ui->calendar->setFocus(Qt::ActiveWindowFocusReason);
if (p_profile->general->unitSystem()==US_Archiac) { if (p_profile->general->unitSystem()==US_English) {
ui->weightSpinBox->setSuffix(STR_UNIT_POUND); ui->weightSpinBox->setSuffix(STR_UNIT_POUND);
ui->weightSpinBox->setDecimals(0); ui->weightSpinBox->setDecimals(0);
ui->ouncesSpinBox->setVisible(true); ui->ouncesSpinBox->setVisible(true);
@ -1692,7 +1692,7 @@ void Daily::Load(QDate date)
void Daily::UnitsChanged() void Daily::UnitsChanged()
{ {
double kg; double kg;
if (p_profile->general->unitSystem()==US_Archiac) { if (p_profile->general->unitSystem()==US_English) {
kg=ui->weightSpinBox->value(); kg=ui->weightSpinBox->value();
float ounces=(kg*1000.0)/ounce_convert; float ounces=(kg*1000.0)/ounce_convert;
int pounds=ounces/16; int pounds=ounces/16;
@ -2194,7 +2194,7 @@ void Daily::on_weightSpinBox_valueChanged(double arg1)
{ {
// Update the BMI display // Update the BMI display
double kg; double kg;
if (p_profile->general->unitSystem()==US_Archiac) { if (p_profile->general->unitSystem()==US_English) {
kg=((arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert)) / 1000.0; kg=((arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert)) / 1000.0;
} else kg=arg1; } else kg=arg1;
double height=p_profile->user->height()/100.0; double height=p_profile->user->height()/100.0;
@ -2216,7 +2216,7 @@ void Daily::on_weightSpinBox_editingFinished()
} }
double kg; double kg;
if (p_profile->general->unitSystem()==US_Archiac) { if (p_profile->general->unitSystem()==US_English) {
kg=((arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert)) / 1000.0; kg=((arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert)) / 1000.0;
} else { } else {
kg=arg1; kg=arg1;

View File

@ -238,7 +238,7 @@ void NewProfile::on_nextButton_clicked()
UnitSystem us; UnitSystem us;
if (ui->heightCombo->currentIndex() == 0) { us = US_Metric; } if (ui->heightCombo->currentIndex() == 0) { us = US_Metric; }
else if (ui->heightCombo->currentIndex() == 1) { us = US_Archiac; } else if (ui->heightCombo->currentIndex() == 1) { us = US_English; }
else { us = US_Metric; } else { us = US_Metric; }
if (profile->general->unitSystem() != us) { if (profile->general->unitSystem() != us) {
@ -249,7 +249,7 @@ void NewProfile::on_nextButton_clicked()
double v = 0; double v = 0;
if (us == US_Archiac) { if (us == US_English) {
// convert to metric // convert to metric
v = (ui->heightEdit->value() * 30.48); v = (ui->heightEdit->value() * 30.48);
v += ui->heightEdit2->value() * 2.54; v += ui->heightEdit2->value() * 2.54;
@ -383,7 +383,7 @@ void NewProfile::edit(const QString name)
double v = profile->user->height(); double v = profile->user->height();
if (us == US_Archiac) { // evil non-metric if (us == US_English) { // evil non-metric
int ti = v / 2.54; int ti = v / 2.54;
int feet = ti / 12; int feet = ti / 12;
int inches = ti % 12; int inches = ti % 12;

View File

@ -40,7 +40,7 @@
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="welcomePage"> <widget class="QWidget" name="welcomePage">
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
@ -456,12 +456,12 @@
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>metric</string> <string>Metric</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>archiac</string> <string>English</string>
</property> </property>
</item> </item>
</widget> </widget>