summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-bartender/bac.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-bartender/bac.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-bartender/bac.cpp33
1 files changed, 23 insertions, 10 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
@@ -37,5 +37,5 @@ 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 );
Layout7->addLayout( Layout1 );
@@ -54,4 +54,13 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl
Layout7->addLayout( Layout2 );
+ 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;
Layout3->setSpacing( 6 );
@@ -115,15 +124,16 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl
LCDNumber1->setPalette(palette);
-
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;
@@ -150,5 +160,10 @@ void BacDialog::calculate() {
break;
};
- 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;
milliliters = bodyWater * 1000;
@@ -161,6 +176,4 @@ void BacDialog::calculate() {
bac = bac1 - metab;
-
-
// weightDrink= (nDrinks * .79) / (weight * genderDiff*1000);
// (ounces * percent * 0.075 / weight) - (hours * 0.015);