107 |
107 |
108 item = new QTableWidgetItem(QString("%1").arg(product->mashs.at(i).step_ph, 3, 'f', 2, '0')); |
108 item = new QTableWidgetItem(QString("%1").arg(product->mashs.at(i).step_ph, 3, 'f', 2, '0')); |
109 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
109 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
110 ui->mashsTable->setItem(i, 11, item); |
110 ui->mashsTable->setItem(i, 11, item); |
111 |
111 |
112 if (i > 0) { |
112 if (i > 0 && product->stage <= PROD_STAGE_BREW) { |
113 pWidget = new QWidget(); |
113 pWidget = new QWidget(); |
114 QPushButton* btn_up = new QPushButton(); |
114 QPushButton* btn_up = new QPushButton(); |
115 btn_up->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
115 btn_up->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
116 btn_up->setIcon(up_icon); |
116 btn_up->setIcon(up_icon); |
117 connect(btn_up, SIGNAL(clicked()), this, SLOT(upMashRow_clicked())); |
117 connect(btn_up, SIGNAL(clicked()), this, SLOT(upMashRow_clicked())); |
122 ui->mashsTable->setCellWidget(i, 12, pWidget); |
122 ui->mashsTable->setCellWidget(i, 12, pWidget); |
123 } else { |
123 } else { |
124 ui->mashsTable->removeCellWidget(i, 12); |
124 ui->mashsTable->removeCellWidget(i, 12); |
125 } |
125 } |
126 |
126 |
127 if (i < (product->mashs.size() - 1)) { |
127 if (i < (product->mashs.size() - 1) && product->stage <= PROD_STAGE_BREW) { |
128 pWidget = new QWidget(); |
128 pWidget = new QWidget(); |
129 QPushButton* btn_down = new QPushButton(); |
129 QPushButton* btn_down = new QPushButton(); |
130 btn_down->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
130 btn_down->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
131 btn_down->setIcon(down_icon); |
131 btn_down->setIcon(down_icon); |
132 connect(btn_down, SIGNAL(clicked()), this, SLOT(downMashRow_clicked())); |
132 connect(btn_down, SIGNAL(clicked()), this, SLOT(downMashRow_clicked())); |
137 ui->mashsTable->setCellWidget(i, 13, pWidget); |
137 ui->mashsTable->setCellWidget(i, 13, pWidget); |
138 } else { |
138 } else { |
139 ui->mashsTable->removeCellWidget(i, 13); |
139 ui->mashsTable->removeCellWidget(i, 13); |
140 } |
140 } |
141 |
141 |
142 pWidget = new QWidget(); |
142 if (product->stage <= PROD_STAGE_BREW) { |
143 QToolButton* btn_dele = new QToolButton(); |
143 pWidget = new QWidget(); |
144 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
144 QToolButton* btn_dele = new QToolButton(); |
145 btn_dele->setIcon(del_icon); |
145 btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
146 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMashRow_clicked())); |
146 btn_dele->setIcon(del_icon); |
147 pLayout = new QHBoxLayout(pWidget); |
147 connect(btn_dele, SIGNAL(clicked()), this, SLOT(deleteMashRow_clicked())); |
148 pLayout->addWidget(btn_dele); |
148 pLayout = new QHBoxLayout(pWidget); |
149 pLayout->setContentsMargins(5, 0, 5, 0); |
149 pLayout->addWidget(btn_dele); |
150 pWidget->setLayout(pLayout); |
150 pLayout->setContentsMargins(5, 0, 5, 0); |
151 ui->mashsTable->setCellWidget(i, 14, pWidget); |
151 pWidget->setLayout(pLayout); |
152 |
152 ui->mashsTable->setCellWidget(i, 14, pWidget); |
153 pWidget = new QWidget(); |
153 |
154 QToolButton* btn_edit = new QToolButton(); |
154 pWidget = new QWidget(); |
155 btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
155 QToolButton* btn_edit = new QToolButton(); |
156 btn_edit->setIcon(ed_icon); |
156 btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
157 connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMashRow_clicked())); |
157 btn_edit->setIcon(ed_icon); |
158 pLayout = new QHBoxLayout(pWidget); |
158 connect(btn_edit, SIGNAL(clicked()), this, SLOT(editMashRow_clicked())); |
159 pLayout->addWidget(btn_edit); |
159 pLayout = new QHBoxLayout(pWidget); |
160 pLayout->setContentsMargins(5, 0, 5, 0); |
160 pLayout->addWidget(btn_edit); |
161 pWidget->setLayout(pLayout); |
161 pLayout->setContentsMargins(5, 0, 5, 0); |
162 ui->mashsTable->setCellWidget(i, 15, pWidget); |
162 pWidget->setLayout(pLayout); |
|
163 ui->mashsTable->setCellWidget(i, 15, pWidget); |
|
164 } else { |
|
165 ui->mashsTable->removeCellWidget(i, 14); |
|
166 ui->mashsTable->removeCellWidget(i, 15); |
|
167 } |
163 } |
168 } |
164 } |
169 } |
165 |
170 |
166 |
171 |
167 double EditProduct::infusionVol(double step_infused, double step_mashkg, double infuse_temp, double step_temp, double last_temp) |
172 double EditProduct::infusionVol(double step_infused, double step_mashkg, double infuse_temp, double step_temp, double last_temp) |