Fri, 08 Apr 2022 20:44:04 +0200
Add fermentable row added.
src/EditRecipe.cpp | file | annotate | diff | comparison | revisions | |
src/EditRecipe.h | file | annotate | diff | comparison | revisions | |
ui/EditRecipe.ui | file | annotate | diff | comparison | revisions |
--- a/src/EditRecipe.cpp Fri Apr 08 20:03:56 2022 +0200 +++ b/src/EditRecipe.cpp Fri Apr 08 20:44:04 2022 +0200 @@ -485,6 +485,7 @@ connect(ui->perc_sugarsShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_sugars_valueChanged); connect(ui->perc_caraShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_cara_valueChanged); connect(ui->lintnerShow, &QProgressBar::valueChanged, this, &EditRecipe::on_lintner_valueChanged); + connect(ui->addFermentable, SIGNAL(clicked()), this, SLOT(on_addFermentRow_clicked())); // All signals from tab "Hops" // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); @@ -1360,6 +1361,45 @@ } +void EditRecipe::on_addFermentRow_clicked() +{ + Fermentables newf; + + qDebug() << "Add fermentable row"; + + for (int i = 0; i < recipe->fermentables.size(); i++) { + if (recipe->fermentables.at(i).f_amount == 0 && recipe->fermentables.at(i).f_color == 0) + return; // Add only one at a time. + } + + newf.f_name = "Select one"; + newf.f_origin = ""; + newf.f_supplier = ""; + newf.f_amount = 0; + newf.f_cost = 0; + newf.f_type = 0; + newf.f_yield = 0; + newf.f_color = 0; + newf.f_coarse_fine_diff = 0; + newf.f_moisture = 0; + newf.f_diastatic_power = 0; + newf.f_protein = 0; + newf.f_dissolved_protein = 0; + newf.f_max_in_batch = 100; + newf.f_graintype = 0; + newf.f_added = 0; + newf.f_recommend_mash = true; + newf.f_add_after_boil = false; + newf.f_adjust_to_total_100 = false; + newf.f_percentage = 0; + newf.f_di_ph = 0; + newf.f_acid_to_ph_57 = 0; + + recipe->fermentables.append(newf); + emit refreshAll(); +} + + void EditRecipe::on_deleteFermentRow_clicked() { QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
--- a/src/EditRecipe.h Fri Apr 08 20:03:56 2022 +0200 +++ b/src/EditRecipe.h Fri Apr 08 20:44:04 2022 +0200 @@ -272,6 +272,7 @@ void ferment_select_changed(int val); void ferment_instock_changed(bool val); void ferment_added_changed(int val); + void on_addFermentRow_clicked(); void on_deleteFermentRow_clicked(); void on_editFermentRow_clicked();
--- a/ui/EditRecipe.ui Fri Apr 08 20:03:56 2022 +0200 +++ b/ui/EditRecipe.ui Fri Apr 08 20:44:04 2022 +0200 @@ -1353,6 +1353,23 @@ <string>%v%</string> </property> </widget> + <widget class="QPushButton" name="addFermentable"> + <property name="geometry"> + <rect> + <x>140</x> + <y>100</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Add</string> + </property> + <property name="icon"> + <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc"> + <normaloff>:/icons/bms/graan.png</normaloff>:/icons/bms/graan.png</iconset> + </property> + </widget> </widget> <widget class="QWidget" name="hops"> <attribute name="icon">