483 connect(ui->est_og2Edit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
483 connect(ui->est_og2Edit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
484 connect(ui->perc_mashShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_mash_valueChanged); |
484 connect(ui->perc_mashShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_mash_valueChanged); |
485 connect(ui->perc_sugarsShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_sugars_valueChanged); |
485 connect(ui->perc_sugarsShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_sugars_valueChanged); |
486 connect(ui->perc_caraShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_cara_valueChanged); |
486 connect(ui->perc_caraShow, &QProgressBar::valueChanged, this, &EditRecipe::on_perc_cara_valueChanged); |
487 connect(ui->lintnerShow, &QProgressBar::valueChanged, this, &EditRecipe::on_lintner_valueChanged); |
487 connect(ui->lintnerShow, &QProgressBar::valueChanged, this, &EditRecipe::on_lintner_valueChanged); |
|
488 connect(ui->addFermentable, SIGNAL(clicked()), this, SLOT(on_addFermentRow_clicked())); |
488 |
489 |
489 // All signals from tab "Hops" |
490 // All signals from tab "Hops" |
490 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
491 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
491 |
492 |
492 // All signals from tab "Miscs" |
493 // All signals from tab "Miscs" |
1358 calcFermentables(); |
1359 calcFermentables(); |
1359 is_changed(); |
1360 is_changed(); |
1360 } |
1361 } |
1361 |
1362 |
1362 |
1363 |
|
1364 void EditRecipe::on_addFermentRow_clicked() |
|
1365 { |
|
1366 Fermentables newf; |
|
1367 |
|
1368 qDebug() << "Add fermentable row"; |
|
1369 |
|
1370 for (int i = 0; i < recipe->fermentables.size(); i++) { |
|
1371 if (recipe->fermentables.at(i).f_amount == 0 && recipe->fermentables.at(i).f_color == 0) |
|
1372 return; // Add only one at a time. |
|
1373 } |
|
1374 |
|
1375 newf.f_name = "Select one"; |
|
1376 newf.f_origin = ""; |
|
1377 newf.f_supplier = ""; |
|
1378 newf.f_amount = 0; |
|
1379 newf.f_cost = 0; |
|
1380 newf.f_type = 0; |
|
1381 newf.f_yield = 0; |
|
1382 newf.f_color = 0; |
|
1383 newf.f_coarse_fine_diff = 0; |
|
1384 newf.f_moisture = 0; |
|
1385 newf.f_diastatic_power = 0; |
|
1386 newf.f_protein = 0; |
|
1387 newf.f_dissolved_protein = 0; |
|
1388 newf.f_max_in_batch = 100; |
|
1389 newf.f_graintype = 0; |
|
1390 newf.f_added = 0; |
|
1391 newf.f_recommend_mash = true; |
|
1392 newf.f_add_after_boil = false; |
|
1393 newf.f_adjust_to_total_100 = false; |
|
1394 newf.f_percentage = 0; |
|
1395 newf.f_di_ph = 0; |
|
1396 newf.f_acid_to_ph_57 = 0; |
|
1397 |
|
1398 recipe->fermentables.append(newf); |
|
1399 emit refreshAll(); |
|
1400 } |
|
1401 |
|
1402 |
1363 void EditRecipe::on_deleteFermentRow_clicked() |
1403 void EditRecipe::on_deleteFermentRow_clicked() |
1364 { |
1404 { |
1365 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
1405 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
1366 int row = pb->objectName().toInt(); |
1406 int row = pb->objectName().toInt(); |
1367 qDebug() << "Delete fermentable row" << row << recipe->fermentables.size(); |
1407 qDebug() << "Delete fermentable row" << row << recipe->fermentables.size(); |