author | llornkcor <llornkcor> | 2004-04-08 22:02:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-08 22:02:23 (UTC) |
commit | 3ff6546b780c2c74994e21bdd749379be064c979 (patch) (unidiff) | |
tree | 864c4ce441cf553de031da4e942247ceeaa130d1 /noncore | |
parent | c1ffd357ea7e8632f97c6974e86677946d22d816 (diff) | |
download | opie-3ff6546b780c2c74994e21bdd749379be064c979.zip opie-3ff6546b780c2c74994e21bdd749379be064c979.tar.gz opie-3ff6546b780c2c74994e21bdd749379be064c979.tar.bz2 |
add kilos/pound combo
-rw-r--r-- | noncore/apps/opie-bartender/bac.cpp | 33 | ||||
-rw-r--r-- | noncore/apps/opie-bartender/bac.h | 4 |
2 files changed, 26 insertions, 11 deletions
diff --git a/noncore/apps/opie-bartender/bac.cpp b/noncore/apps/opie-bartender/bac.cpp index c97a253..2e74029 100644 --- a/noncore/apps/opie-bartender/bac.cpp +++ b/noncore/apps/opie-bartender/bac.cpp | |||
@@ -38,3 +38,3 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl | |||
38 | TextLabel1 = new QLabel(this, "TextLabel1" ); | 38 | TextLabel1 = new QLabel(this, "TextLabel1" ); |
39 | TextLabel1->setText( tr( "Number of Drinks Consumed" ) ); | 39 | TextLabel1->setText( tr( "# Drinks Consumed" ) ); |
40 | Layout1->addWidget( TextLabel1 ); | 40 | Layout1->addWidget( TextLabel1 ); |
@@ -55,2 +55,11 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl | |||
55 | 55 | ||
56 | weightUnitsCombo =new QComboBox( FALSE, this, "unitComboBox" ); | ||
57 | weightUnitsCombo->insertItem( tr( "Kilos" ) ); | ||
58 | weightUnitsCombo->insertItem( tr( "Pounds" ) ); | ||
59 | Layout2->addWidget( weightUnitsCombo ); | ||
60 | |||
61 | weightUnitsLabel = new QLabel(this, "unitsTextLabel" ); | ||
62 | weightUnitsLabel->setText( tr( "Units" ) ); | ||
63 | Layout2->addWidget( weightUnitsLabel ); | ||
64 | |||
56 | Layout3 = new QHBoxLayout; | 65 | Layout3 = new QHBoxLayout; |
@@ -116,13 +125,14 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl | |||
116 | 125 | ||
117 | |||
118 | Layout7->addWidget( LCDNumber1 ); | 126 | Layout7->addWidget( LCDNumber1 ); |
119 | 127 | NumberSpinBox->setFocus(); | |
120 | |||
121 | } | 128 | } |
122 | 129 | ||
123 | BacDialog::~BacDialog() { | 130 | BacDialog::~BacDialog() |
124 | } | 131 | {} |
132 | |||
133 | void BacDialog::calculate() | ||
134 | { | ||
125 | 135 | ||
126 | void BacDialog::calculate() { | ||
127 | float weight,genderDiff, bac, typeDrink=0, drinkOz=0, bodyWater, milliliters, oz, gram, gramsMil, alc, metab, bac1; | 136 | float weight,genderDiff, bac, typeDrink=0, drinkOz=0, bodyWater, milliliters, oz, gram, gramsMil, alc, metab, bac1; |
137 | float weightunitDifference, massunitdiff; | ||
128 | QString estBac; | 138 | QString estBac; |
@@ -151,3 +161,8 @@ void BacDialog::calculate() { | |||
151 | }; | 161 | }; |
152 | weight = WeightSpinBox->value() / 2.2046; // in kilograms | 162 | |
163 | if( weightUnitsCombo->currentItem() == 0 ) { | ||
164 | weight = WeightSpinBox->value(); // kilos | ||
165 | } else { | ||
166 | weight = WeightSpinBox->value() / 2.2046; // convert to kilograms | ||
167 | } | ||
153 | bodyWater = weight * genderDiff; | 168 | bodyWater = weight * genderDiff; |
@@ -162,4 +177,2 @@ void BacDialog::calculate() { | |||
162 | 177 | ||
163 | |||
164 | |||
165 | // weightDrink= (nDrinks * .79) / (weight * genderDiff*1000); | 178 | // weightDrink= (nDrinks * .79) / (weight * genderDiff*1000); |
diff --git a/noncore/apps/opie-bartender/bac.h b/noncore/apps/opie-bartender/bac.h index 9245c96..43c7035 100644 --- a/noncore/apps/opie-bartender/bac.h +++ b/noncore/apps/opie-bartender/bac.h | |||
@@ -44,3 +44,4 @@ public: | |||
44 | QLCDNumber* LCDNumber1; | 44 | QLCDNumber* LCDNumber1; |
45 | 45 | QComboBox *weightUnitsCombo; | |
46 | QLabel *weightUnitsLabel; | ||
46 | protected: | 47 | protected: |
@@ -52,2 +53,3 @@ protected: | |||
52 | QHBoxLayout* Layout6; | 53 | QHBoxLayout* Layout6; |
54 | |||
53 | protected slots: | 55 | protected slots: |