diff -r f41d02c129e5 -r 7212b980a527 src/EditRecipeTab7.cpp --- a/src/EditRecipeTab7.cpp Thu Aug 11 10:50:18 2022 +0200 +++ b/src/EditRecipeTab7.cpp Wed Aug 17 14:30:33 2022 +0200 @@ -187,6 +187,38 @@ } +void EditRecipe::calcBU() +{ + double BUGU = GetBUGU(); + ui->buguEdit->setValue(BUGU); + ui->est_buguEdit->setValue(BUGU); + ui->est_buguShow->setValue(BUGU); + if (BUGU < 0.32) + ui->buguResult->setText(tr("Very malty and sweet")); + else if (BUGU < 0.43) + ui->buguResult->setText(tr("Malty, sweet")); + else if (BUGU < 0.52) + ui->buguResult->setText(tr("Balanced")); + else if (BUGU < 0.63) + ui->buguResult->setText(tr("Hoppy, bitter")); + else + ui->buguResult->setText(tr("Very hoppy, very bitter")); + + double og = recipe->est_og; + double fg = recipe->est_fg; + double ibu = recipe->est_ibu; + + if (fg < 1.002) /* Can't be too low for this */ + fg = 1.002; + + double bure = ibu / ((0.1808 * Utils::sg_to_plato(og)) + (0.8192 * Utils::sg_to_plato(fg))); + qDebug() << "BU:RE" << bure << recipe->est_fg << recipe->est_ibu; + ui->est_bufguEdit->setValue(bure); + ui->est_bufguShow->setValue(bure); + +} + + void EditRecipe::calcWater() { double liters = 0; @@ -383,18 +415,7 @@ chloride = wg_chloride + RA; } - double BUGU = GetBUGU(); - ui->buguEdit->setValue(BUGU); - if (BUGU < 0.32) - ui->buguResult->setText(tr("Very malty and sweet")); - else if (BUGU < 0.43) - ui->buguResult->setText(tr("Malty, sweet")); - else if (BUGU < 0.52) - ui->buguResult->setText(tr("Balanced")); - else if (BUGU < 0.63) - ui->buguResult->setText(tr("Hoppy, bitter")); - else - ui->buguResult->setText(tr("Very hoppy, very bitter")); + calcBU(); double OptSO4Clratio = GetOptSO4Clratio(); ui->so4clEdit->setValue(OptSO4Clratio);