Sat, 16 Apr 2022 15:19:04 +0200
Add select target water profile. The mash part of the water tab is ready.
src/EditRecipe.cpp | file | annotate | diff | comparison | revisions | |
src/EditRecipe.h | file | annotate | diff | comparison | revisions | |
src/EditRecipeTab7.cpp | file | annotate | diff | comparison | revisions | |
ui/EditRecipe.ui | file | annotate | diff | comparison | revisions |
--- a/src/EditRecipe.cpp Sat Apr 16 14:44:50 2022 +0200 +++ b/src/EditRecipe.cpp Sat Apr 16 15:19:04 2022 +0200 @@ -70,6 +70,13 @@ query.next(); } + query.prepare("SELECT name FROM profile_water ORDER BY name"); + query.exec(); + ui->wt_sourceEdit->addItem(""); + while (query.next()) { + ui->wt_sourceEdit->addItem(query.value(0).toString()); + } + ui->beerstyleEdit->addItem(""); // First add a dummy query.prepare("SELECT style_guide,style_letter,name FROM profile_styles ORDER BY style_guide,style_letter,name"); query.exec(); @@ -652,6 +659,7 @@ connect(ui->mw_phEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::on_mw_ph_changed); connect(ui->mw_acidvolEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::on_mw_acid_changed); connect(ui->mw_acidPick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::on_mw_type_changed); + connect(ui->wt_sourceEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::on_target_changed); connect(ui->w2_volEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::on_w2_vol_changed); ui->saveButton->setEnabled(false);
--- a/src/EditRecipe.h Sat Apr 16 14:44:50 2022 +0200 +++ b/src/EditRecipe.h Sat Apr 16 15:19:04 2022 +0200 @@ -304,6 +304,7 @@ void on_nahco3_changed(double val); void on_caco3_changed(double val); void on_calc_acid_clicked(); + void on_target_changed(int val); void on_mw_ph_changed(double val); void on_mw_acid_changed(double val); void on_mw_type_changed(int val);
--- a/src/EditRecipeTab7.cpp Sat Apr 16 14:44:50 2022 +0200 +++ b/src/EditRecipeTab7.cpp Sat Apr 16 15:19:04 2022 +0200 @@ -462,7 +462,6 @@ w = my_acids[recipe->wa_acid_name].name_en + ' ' + my_acids[recipe->wa_acid_name].name_nl; recipe->wa_acid_perc = my_acids.at(val).AcidPrc; -// ui->mw_acidPick->setCurrentIndex(val); ui->mw_acidpercEdit->setValue(my_acids.at(val).AcidPrc); brewing_salt_sub(w, ui->mw_acidvolEdit->value()); // For now, set old amount. @@ -477,6 +476,38 @@ } +void EditRecipe::on_target_changed(int val) +{ + QSqlQuery query; + + if (val == 0) { + /* Clear values */ + ui->wt_caEdit->setValue(0); + ui->wt_mgEdit->setValue(0); + ui->wt_hco3Edit->setValue(0); + ui->wt_caco3Edit->setValue(0); + ui->wt_naEdit->setValue(0); + ui->wt_clEdit->setValue(0); + ui->wt_so4Edit->setValue(0); + } else { + query.prepare("SELECT * FROM profile_water ORDER BY name"); + query.exec(); + query.first(); + for (int i = 0; i < (val - 1); i++) { + query.next(); + } + ui->wt_caEdit->setValue(query.value(2).toDouble()); + ui->wt_mgEdit->setValue(query.value(7).toDouble()); + ui->wt_hco3Edit->setValue(query.value(3).toDouble()); + ui->wt_caco3Edit->setValue(query.value(10).toDouble()); + ui->wt_naEdit->setValue(query.value(6).toDouble()); + ui->wt_clEdit->setValue(query.value(5).toDouble()); + ui->wt_so4Edit->setValue(query.value(4).toDouble()); + } + calcWater(); +} + + void EditRecipe::on_cacl2_changed(double val) { set_brewing_salt("CaCl2", val); } void EditRecipe::on_caso4_changed(double val) { set_brewing_salt("CaSO4", val); } void EditRecipe::on_mgso4_changed(double val) { set_brewing_salt("MgSO4", val); }
--- a/ui/EditRecipe.ui Sat Apr 16 14:44:50 2022 +0200 +++ b/ui/EditRecipe.ui Sat Apr 16 15:19:04 2022 +0200 @@ -3229,6 +3229,9 @@ <height>23</height> </rect> </property> + <property name="toolTip"> + <string>If needed, choose a target water profile.</string> + </property> </widget> <widget class="QLabel" name="mixedLabel"> <property name="geometry">