src/EditProductTab1.cpp

changeset 205
ae6109192fb2
parent 204
decbf82ae9a5
child 206
83ae8ac83f51
--- a/src/EditProductTab1.cpp	Thu May 12 22:41:11 2022 +0200
+++ b/src/EditProductTab1.cpp	Fri May 13 20:51:15 2022 +0200
@@ -197,7 +197,11 @@
      * 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;
+	stage = PROD_STAGE_WAIT;
+    if ((stage == PROD_STAGE_WAIT) && (product->brew_date_start.date().isValid()))
+	stage = PROD_STAGE_BREW;
+    if ((stage == PROD_STAGE_BREW) && (! product->brew_date_start.date().isValid()))
+	stage = PROD_STAGE_WAIT;
 
     if (product->stage != stage) {
 	qDebug() << "setStage() change state:" << prod_stages[product->stage] << "to:" << prod_stages[stage];
@@ -295,6 +299,50 @@
 
     /* Tab 9, brewday */
     ui->tabWidget->setTabEnabled(8, stage > PROD_STAGE_PLAN);
+    if (product->stage < PROD_STAGE_BREW) {
+	ui->brew_startButton1->show();
+        ui->brew_startButton2->show();
+        ui->brew_startDate->setReadOnly(false);
+	ui->brew_endButton1->hide();
+	ui->brew_startLabel2->hide();
+	ui->brew_endLabel->hide();
+	ui->brew_endLabel2->hide();
+	ui->brew_startTime->hide();
+        ui->brew_endDate->hide();
+        ui->brew_endTime->hide();
+    } else if (product->stage == PROD_STAGE_BREW) {
+	ui->brew_startButton1->show();
+        ui->brew_startButton2->show();
+        ui->brew_startDate->setReadOnly(false);
+	ui->brew_startLabel2->show();
+        ui->brew_endLabel->show();
+        ui->brew_endLabel2->show();
+	ui->brew_endButton1->show();
+	ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
+	ui->brew_startTime->show();
+	ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
+        ui->brew_endDate->show();
+	ui->brew_endDate->setReadOnly(false);
+	ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
+        ui->brew_endTime->show();
+    } else {
+	ui->brew_startButton1->hide();
+        ui->brew_startButton2->hide();
+        ui->brew_startDate->setReadOnly(true);
+	ui->brew_startLabel2->show();
+        ui->brew_endLabel->show();
+        ui->brew_endLabel2->show();
+	ui->brew_endButton1->hide();
+	ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
+	ui->brew_startTime->show();
+	ui->brew_startTime->setReadOnly(true);
+	ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::NoButtons);
+        ui->brew_endDate->show();
+	ui->brew_endDate->setReadOnly(true);
+	ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
+        ui->brew_endTime->show();
+	ui->brew_endTime->setReadOnly(true);
+    }
 
     /* Tab 10, fermentation */
     ui->tabWidget->setTabEnabled(9, stage > PROD_STAGE_WAIT);

mercurial