src/EditProductTab1.cpp

changeset 189
722a4eed545d
parent 184
da148d6b4c95
child 190
bb6c06910f0f
--- a/src/EditProductTab1.cpp	Mon May 02 21:09:48 2022 +0200
+++ b/src/EditProductTab1.cpp	Mon May 02 22:42:19 2022 +0200
@@ -162,7 +162,6 @@
     adjustYeasts(factor);
     calcIBUs();
     calcWater();
-    //calcSparge();
     calcMash();
     is_changed();
     emit refreshAll();
@@ -195,6 +194,20 @@
     int	 stage = product->stage;
     bool locked = product->locked;
 
+    /*
+     * See if we need to set a new stage.
+     */
+    if ((stage == PROD_STAGE_PLAN) && (product->est_og > 1.005) && (product->est_color > 3) && (product->est_ibu > 3))
+	stage = 1;
+
+    if (product->stage != stage) {
+	qDebug() << "setStage() change state:" << prod_stages[product->stage] << "to:" << prod_stages[stage];
+    	product->stage = stage;
+	is_changed();
+    } else {
+	qDebug() << "setStage() stage:" << prod_stages[stage];
+    }
+
     ui->stageEdit->setText(prod_stages[stage]);
 
     /* Tab 1, generic */
@@ -215,27 +228,31 @@
     ui->efficiencyEdit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
     ui->est_ogEdit->setReadOnly(stage > PROD_STAGE_WAIT);
     ui->est_ogEdit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
+    // Block locked if stage <= PROD_STAGE_TASTE
 
-    /* Tab 2, fermentables */
+    /* Tab 2, equipment */
+    ui->tabWidget->setTabEnabled(1, stage < PROD_STAGE_BREW);
+
+    /* Tab 3, fermentables */
     ui->est_og2Edit->setReadOnly(stage > PROD_STAGE_WAIT);
     ui->est_og2Edit->setButtonSymbols((stage > PROD_STAGE_WAIT) ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
     ui->addFermentable->setEnabled(stage <= PROD_STAGE_PACKAGE);
 
-    /* Tab 3, hops */
+    /* Tab 4, hops */
     ui->addHop->setEnabled(stage <= PROD_STAGE_PACKAGE);
 
-    /* Tab 4, miscs */
+    /* Tab 5, miscs */
     ui->addMisc->setEnabled(stage <= PROD_STAGE_PACKAGE);
 
-    /* Tab 5, yeasts */
+    /* Tab 6, yeasts */
     ui->addYeast->setEnabled(stage <= PROD_STAGE_PACKAGE);
 
-    /* Tab 6, mash */
+    /* Tab 7, mash */
     ui->addMash->setEnabled(stage <= PROD_STAGE_BREW);
     ui->mash_nameEdit->setReadOnly(stage > PROD_STAGE_BREW);
     ui->mash_pickEdit->setDisabled(stage > PROD_STAGE_BREW);
 
-    /* Tab 7, water */
+    /* Tab 8, water */
     ui->sp_sourceEdit->setDisabled(stage > PROD_STAGE_BREW);
     ui->wt_sourceEdit->setDisabled(stage > PROD_STAGE_BREW);
     ui->w1_nameEdit->setDisabled(stage > PROD_STAGE_BREW);
@@ -276,6 +293,21 @@
     	ui->mw_acidvolEdit->setButtonSymbols(product->calc_acid ? QAbstractSpinBox::NoButtons : QAbstractSpinBox::UpDownArrows);
     }
     ui->mw_autoEdit->setDisabled(stage > PROD_STAGE_BREW);
+
+    /* Tab 9, brewday */
+    ui->tabWidget->setTabEnabled(8, stage > PROD_STAGE_PLAN);
+
+    /* Tab 10, fermentation */
+    ui->tabWidget->setTabEnabled(9, stage > PROD_STAGE_PLAN);
+
+
+    /* Tab 11, packaging */
+    ui->tabWidget->setTabEnabled(10, stage > PROD_STAGE_PLAN);
+
+
+    /* Tab 12, tasting */
+    ui->tabWidget->setTabEnabled(11, stage > PROD_STAGE_PLAN);
+
 }
 
 

mercurial