src/EditProductTab1.cpp

changeset 205
ae6109192fb2
parent 204
decbf82ae9a5
child 206
83ae8ac83f51
equal deleted inserted replaced
204:decbf82ae9a5 205:ae6109192fb2
195 195
196 /* 196 /*
197 * See if we need to set a new stage. 197 * See if we need to set a new stage.
198 */ 198 */
199 if ((stage == PROD_STAGE_PLAN) && (product->est_og > 1.005) && (product->est_color > 3) && (product->est_ibu > 3)) 199 if ((stage == PROD_STAGE_PLAN) && (product->est_og > 1.005) && (product->est_color > 3) && (product->est_ibu > 3))
200 stage = 1; 200 stage = PROD_STAGE_WAIT;
201 if ((stage == PROD_STAGE_WAIT) && (product->brew_date_start.date().isValid()))
202 stage = PROD_STAGE_BREW;
203 if ((stage == PROD_STAGE_BREW) && (! product->brew_date_start.date().isValid()))
204 stage = PROD_STAGE_WAIT;
201 205
202 if (product->stage != stage) { 206 if (product->stage != stage) {
203 qDebug() << "setStage() change state:" << prod_stages[product->stage] << "to:" << prod_stages[stage]; 207 qDebug() << "setStage() change state:" << prod_stages[product->stage] << "to:" << prod_stages[stage];
204 product->stage = stage; 208 product->stage = stage;
205 is_changed(); 209 is_changed();
293 } 297 }
294 ui->mw_autoEdit->setDisabled(stage > PROD_STAGE_BREW); 298 ui->mw_autoEdit->setDisabled(stage > PROD_STAGE_BREW);
295 299
296 /* Tab 9, brewday */ 300 /* Tab 9, brewday */
297 ui->tabWidget->setTabEnabled(8, stage > PROD_STAGE_PLAN); 301 ui->tabWidget->setTabEnabled(8, stage > PROD_STAGE_PLAN);
302 if (product->stage < PROD_STAGE_BREW) {
303 ui->brew_startButton1->show();
304 ui->brew_startButton2->show();
305 ui->brew_startDate->setReadOnly(false);
306 ui->brew_endButton1->hide();
307 ui->brew_startLabel2->hide();
308 ui->brew_endLabel->hide();
309 ui->brew_endLabel2->hide();
310 ui->brew_startTime->hide();
311 ui->brew_endDate->hide();
312 ui->brew_endTime->hide();
313 } else if (product->stage == PROD_STAGE_BREW) {
314 ui->brew_startButton1->show();
315 ui->brew_startButton2->show();
316 ui->brew_startDate->setReadOnly(false);
317 ui->brew_startLabel2->show();
318 ui->brew_endLabel->show();
319 ui->brew_endLabel2->show();
320 ui->brew_endButton1->show();
321 ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
322 ui->brew_startTime->show();
323 ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
324 ui->brew_endDate->show();
325 ui->brew_endDate->setReadOnly(false);
326 ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
327 ui->brew_endTime->show();
328 } else {
329 ui->brew_startButton1->hide();
330 ui->brew_startButton2->hide();
331 ui->brew_startDate->setReadOnly(true);
332 ui->brew_startLabel2->show();
333 ui->brew_endLabel->show();
334 ui->brew_endLabel2->show();
335 ui->brew_endButton1->hide();
336 ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
337 ui->brew_startTime->show();
338 ui->brew_startTime->setReadOnly(true);
339 ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::NoButtons);
340 ui->brew_endDate->show();
341 ui->brew_endDate->setReadOnly(true);
342 ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
343 ui->brew_endTime->show();
344 ui->brew_endTime->setReadOnly(true);
345 }
298 346
299 /* Tab 10, fermentation */ 347 /* Tab 10, fermentation */
300 ui->tabWidget->setTabEnabled(9, stage > PROD_STAGE_WAIT); 348 ui->tabWidget->setTabEnabled(9, stage > PROD_STAGE_WAIT);
301 349
302 350

mercurial