# HG changeset patch # User Michiel Broek # Date 1668438302 -3600 # Node ID e6b5510ca1d9df25a282bce6ad3b48b3dec3b29c # Parent d1a6c269ba6a89be5a6bf7fb3b772775de021a4a Disable manipulating mash steps when brewday is over. diff -r d1a6c269ba6a -r e6b5510ca1d9 src/EditProductTab7.cpp --- 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); + } } }