src/EditProductTab1.cpp

changeset 210
b45bd6da5220
parent 206
83ae8ac83f51
child 211
bec0386b1df1
equal deleted inserted replaced
209:19c50b1f58d3 210:b45bd6da5220
313 } else if (product->stage == PROD_STAGE_BREW) { 313 } else if (product->stage == PROD_STAGE_BREW) {
314 ui->brew_startButton1->show(); 314 ui->brew_startButton1->show();
315 ui->brew_startButton2->show(); 315 ui->brew_startButton2->show();
316 ui->brew_startDate->setReadOnly(false); 316 ui->brew_startDate->setReadOnly(false);
317 ui->brew_startLabel2->show(); 317 ui->brew_startLabel2->show();
318 ui->brew_endLabel->show(); 318
319 ui->brew_endLabel2->show(); 319 /*
320 ui->brew_endButton1->show(); 320 * Enable brew_end settings if it is the right date or later.
321 ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows); 321 * If some essential values are filled in.
322 ui->brew_startTime->show(); 322 */
323 ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::UpDownArrows); 323 int brewTime = product->brew_date_start.date().daysTo(QDate::currentDate());
324 ui->brew_endDate->show(); 324
325 ui->brew_endDate->setReadOnly(false); 325 if ((brewTime >= 0) && (product->brew_cooling_method > 0) && (product->brew_cooling_time > 0) &&
326 ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows); 326 (product->brew_aboil_sg > 1.002) && (product->brew_aboil_volume > 0)) {
327 ui->brew_endTime->show(); 327 ui->brew_endLabel->show();
328 ui->brew_startLabel2->show();
329 ui->brew_endLabel2->show();
330 ui->brew_endButton1->show();
331 ui->brew_startTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
332 ui->brew_startTime->show();
333 ui->brew_endDate->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
334 ui->brew_endDate->show();
335 ui->brew_endDate->setReadOnly(false);
336 ui->brew_endTime->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
337 ui->brew_endTime->show();
338 } else {
339 ui->brew_endButton1->hide();
340 ui->brew_startLabel2->hide();
341 ui->brew_endLabel->hide();
342 ui->brew_endLabel2->hide();
343 ui->brew_startTime->hide();
344 ui->brew_endDate->hide();
345 ui->brew_endTime->hide();
346 }
328 } else { 347 } else {
329 ui->brew_startButton1->hide(); 348 ui->brew_startButton1->hide();
330 ui->brew_startButton2->hide(); 349 ui->brew_startButton2->hide();
331 ui->brew_startDate->setReadOnly(true); 350 ui->brew_startDate->setReadOnly(true);
332 ui->brew_startLabel2->show(); 351 ui->brew_startLabel2->show();

mercurial