Disable manipulating mash steps when brewday is over.

Mon, 14 Nov 2022 16:05:02 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 14 Nov 2022 16:05:02 +0100
changeset 437
e6b5510ca1d9
parent 436
d1a6c269ba6a
child 438
e06b04ef1579

Disable manipulating mash steps when brewday is over.

src/EditProductTab7.cpp file | annotate | diff | comparison | revisions
--- a/src/EditProductTab7.cpp	Mon Nov 14 15:34:11 2022 +0100
+++ b/src/EditProductTab7.cpp	Mon Nov 14 16:05:02 2022 +0100
@@ -109,7 +109,7 @@
         item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
         ui->mashsTable->setItem(i, 11, item);
 
-	if (i > 0) {
+	if (i > 0 && product->stage <= PROD_STAGE_BREW) {
 	    pWidget = new QWidget();
             QPushButton* btn_up = new QPushButton();
             btn_up->setObjectName(QString("%1").arg(i));  /* Send row with the button */
@@ -124,7 +124,7 @@
 	    ui->mashsTable->removeCellWidget(i, 12);
 	}
 
-	if (i < (product->mashs.size() - 1)) {
+	if (i < (product->mashs.size() - 1) && product->stage <= PROD_STAGE_BREW) {
 	    pWidget = new QWidget();
             QPushButton* btn_down = new QPushButton();
             btn_down->setObjectName(QString("%1").arg(i));  /* Send row with the button */
@@ -139,27 +139,32 @@
 	    ui->mashsTable->removeCellWidget(i, 13);
 	}
 
-	pWidget = new QWidget();
-        QToolButton* btn_dele = new QToolButton();
-        btn_dele->setObjectName(QString("%1").arg(i));  /* Send row with the button */
-        btn_dele->setIcon(del_icon);
-        connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMashRow_clicked()));
-        pLayout = new QHBoxLayout(pWidget);
-        pLayout->addWidget(btn_dele);
-        pLayout->setContentsMargins(5, 0, 5, 0);
-        pWidget->setLayout(pLayout);
-        ui->mashsTable->setCellWidget(i, 14, pWidget);
+	if (product->stage <= PROD_STAGE_BREW) {
+	    pWidget = new QWidget();
+            QToolButton* btn_dele = new QToolButton();
+            btn_dele->setObjectName(QString("%1").arg(i));  /* Send row with the button */
+            btn_dele->setIcon(del_icon);
+            connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMashRow_clicked()));
+            pLayout = new QHBoxLayout(pWidget);
+            pLayout->addWidget(btn_dele);
+            pLayout->setContentsMargins(5, 0, 5, 0);
+            pWidget->setLayout(pLayout);
+            ui->mashsTable->setCellWidget(i, 14, pWidget);
 
-        pWidget = new QWidget();
-        QToolButton* btn_edit = new QToolButton();
-        btn_edit->setObjectName(QString("%1").arg(i));  /* Send row with the button */
-        btn_edit->setIcon(ed_icon);
-        connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMashRow_clicked()));
-        pLayout = new QHBoxLayout(pWidget);
-        pLayout->addWidget(btn_edit);
-        pLayout->setContentsMargins(5, 0, 5, 0);
-        pWidget->setLayout(pLayout);
-        ui->mashsTable->setCellWidget(i, 15, pWidget);
+            pWidget = new QWidget();
+            QToolButton* btn_edit = new QToolButton();
+            btn_edit->setObjectName(QString("%1").arg(i));  /* Send row with the button */
+            btn_edit->setIcon(ed_icon);
+            connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMashRow_clicked()));
+            pLayout = new QHBoxLayout(pWidget);
+            pLayout->addWidget(btn_edit);
+            pLayout->setContentsMargins(5, 0, 5, 0);
+            pWidget->setLayout(pLayout);
+            ui->mashsTable->setCellWidget(i, 15, pWidget);
+	} else {
+	    ui->mashsTable->removeCellWidget(i, 14);
+	    ui->mashsTable->removeCellWidget(i, 15);
+	}
     }
 }
 

mercurial