summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-04-08 22:02:23 (UTC)
committer llornkcor <llornkcor>2004-04-08 22:02:23 (UTC)
commit3ff6546b780c2c74994e21bdd749379be064c979 (patch) (side-by-side diff)
tree864c4ce441cf553de031da4e942247ceeaa130d1
parentc1ffd357ea7e8632f97c6974e86677946d22d816 (diff)
downloadopie-3ff6546b780c2c74994e21bdd749379be064c979.zip
opie-3ff6546b780c2c74994e21bdd749379be064c979.tar.gz
opie-3ff6546b780c2c74994e21bdd749379be064c979.tar.bz2
add kilos/pound combo
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-bartender/bac.cpp33
-rw-r--r--noncore/apps/opie-bartender/bac.h4
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
TextLabel1 = new QLabel(this, "TextLabel1" );
- TextLabel1->setText( tr( "Number of Drinks Consumed" ) );
+ TextLabel1->setText( tr( "# Drinks Consumed" ) );
Layout1->addWidget( TextLabel1 );
@@ -55,2 +55,11 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl
+ weightUnitsCombo =new QComboBox( FALSE, this, "unitComboBox" );
+ weightUnitsCombo->insertItem( tr( "Kilos" ) );
+ weightUnitsCombo->insertItem( tr( "Pounds" ) );
+ Layout2->addWidget( weightUnitsCombo );
+
+ weightUnitsLabel = new QLabel(this, "unitsTextLabel" );
+ weightUnitsLabel->setText( tr( "Units" ) );
+ Layout2->addWidget( weightUnitsLabel );
+
Layout3 = new QHBoxLayout;
@@ -116,13 +125,14 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl
-
Layout7->addWidget( LCDNumber1 );
-
-
+ NumberSpinBox->setFocus();
}
-BacDialog::~BacDialog() {
-}
+BacDialog::~BacDialog()
+{}
+
+void BacDialog::calculate()
+{
-void BacDialog::calculate() {
float weight,genderDiff, bac, typeDrink=0, drinkOz=0, bodyWater, milliliters, oz, gram, gramsMil, alc, metab, bac1;
+ float weightunitDifference, massunitdiff;
QString estBac;
@@ -151,3 +161,8 @@ void BacDialog::calculate() {
};
- weight = WeightSpinBox->value() / 2.2046; // in kilograms
+
+ if( weightUnitsCombo->currentItem() == 0 ) {
+ weight = WeightSpinBox->value(); // kilos
+ } else {
+ weight = WeightSpinBox->value() / 2.2046; // convert to kilograms
+ }
bodyWater = weight * genderDiff;
@@ -162,4 +177,2 @@ void BacDialog::calculate() {
-
-
// 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:
QLCDNumber* LCDNumber1;
-
+ QComboBox *weightUnitsCombo;
+ QLabel *weightUnitsLabel;
protected:
@@ -52,2 +53,3 @@ protected:
QHBoxLayout* Layout6;
+
protected slots: