src/EditProductTab4.cpp

changeset 380
8f5c03ed4321
parent 375
c21567bfd703
child 398
49cf387e9070
equal deleted inserted replaced
379:0f2ce4ebd1b8 380:8f5c03ed4321
323 newh.caryophyllene = 0; 323 newh.caryophyllene = 0;
324 newh.cohumulone = 0; 324 newh.cohumulone = 0;
325 newh.myrcene = 0; 325 newh.myrcene = 0;
326 newh.total_oil = 0; 326 newh.total_oil = 0;
327 newh.inventory = 0; 327 newh.inventory = 0;
328 newh.utilisation = 20; 328 newh.utilisation = my_ut_pellet;
329 newh.bu_factor = 1; 329 newh.bu_factor = 1;
330 330
331 product->hops.append(newh); 331 product->hops.append(newh);
332 emit refreshAll(); 332 emit refreshAll();
333 } 333 }
547 ui->hopsTable->setItem(product->hops_row, 5, item); 547 ui->hopsTable->setItem(product->hops_row, 5, item);
548 548
549 if (val == HOP_USEAT_BOIL || val == HOP_USEAT_WHIRLPOOL) { 549 if (val == HOP_USEAT_BOIL || val == HOP_USEAT_WHIRLPOOL) {
550 htimeLabel->setText(tr("Time in minutes:")); 550 htimeLabel->setText(tr("Time in minutes:"));
551 htimeEdit->setValue(product->hops.at(product->hops_row).time); 551 htimeEdit->setValue(product->hops.at(product->hops_row).time);
552 htimeEdit->setReadOnly(false); 552 htimeLabel->show();
553 htimeEdit->show();
553 } else if (val == HOP_USEAT_DRY_HOP) { 554 } else if (val == HOP_USEAT_DRY_HOP) {
554 htimeLabel->setText(tr("Time in days:")); 555 htimeLabel->setText(tr("Time in days:"));
555 htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440); 556 htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440);
556 htimeEdit->setReadOnly(false); 557 htimeLabel->show();
558 htimeEdit->show();
557 } else { 559 } else {
558 htimeLabel->setText("");
559 htimeEdit->setValue(0); 560 htimeEdit->setValue(0);
560 htimeEdit->setReadOnly(true); 561 htimeLabel->hide();
562 htimeEdit->hide();
561 } 563 }
562 564
563 is_changed(); 565 is_changed();
564 emit refreshAll(); 566 emit refreshAll();
565 } 567 }
601 amountLabel->setText(tr("Amount in gr:")); 603 amountLabel->setText(tr("Amount in gr:"));
602 amountLabel->setGeometry(QRect(10, 100, 141, 20)); 604 amountLabel->setGeometry(QRect(10, 100, 141, 20));
603 amountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 605 amountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
604 htimeLabel = new QLabel(dialog); 606 htimeLabel = new QLabel(dialog);
605 htimeLabel->setObjectName(QString::fromUtf8("htimeLabel")); 607 htimeLabel->setObjectName(QString::fromUtf8("htimeLabel"));
606 if (product->hops.at(product->hops_row).useat == 5) // Dry-hop 608 if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP)
607 htimeLabel->setText(tr("Time in days:")); 609 htimeLabel->setText(tr("Time in days:"));
608 else if (product->hops.at(product->hops_row).useat == 2 || product->hops.at(product->hops_row).useat == 4) // Boil or whirlpool 610 else
609 htimeLabel->setText(tr("Time in minutes:")); 611 htimeLabel->setText(tr("Time in minutes:"));
610 else
611 htimeLabel->setText("");
612 612
613 htimeLabel->setGeometry(QRect(10, 130, 141, 20)); 613 htimeLabel->setGeometry(QRect(10, 130, 141, 20));
614 htimeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 614 htimeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
615 QLabel *useatLabel = new QLabel(dialog); 615 QLabel *useatLabel = new QLabel(dialog);
616 useatLabel->setObjectName(QString::fromUtf8("useatLabel")); 616 useatLabel->setObjectName(QString::fromUtf8("useatLabel"));
662 htimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 662 htimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
663 htimeEdit->setAccelerated(true); 663 htimeEdit->setAccelerated(true);
664 htimeEdit->setMaximum(10000.0); 664 htimeEdit->setMaximum(10000.0);
665 if (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL) { 665 if (product->hops.at(product->hops_row).useat == HOP_USEAT_BOIL || product->hops.at(product->hops_row).useat == HOP_USEAT_WHIRLPOOL) {
666 htimeEdit->setValue(product->hops.at(product->hops_row).time); 666 htimeEdit->setValue(product->hops.at(product->hops_row).time);
667 htimeEdit->setReadOnly(false); 667 htimeLabel->show();
668 htimeEdit->show();
668 } else if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) { 669 } else if (product->hops.at(product->hops_row).useat == HOP_USEAT_DRY_HOP) {
669 htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440); 670 htimeEdit->setValue(product->hops.at(product->hops_row).time / 1440);
670 htimeEdit->setReadOnly(false); 671 htimeLabel->show();
672 htimeEdit->show();
671 } else { 673 } else {
672 htimeEdit->setReadOnly(true); 674 htimeLabel->hide();
675 htimeEdit->hide();
673 } 676 }
674 useatEdit = new QComboBox(dialog); 677 useatEdit = new QComboBox(dialog);
675 useatEdit->setObjectName(QString::fromUtf8("useatEdit")); 678 useatEdit->setObjectName(QString::fromUtf8("useatEdit"));
676 useatEdit->setGeometry(QRect(160, 160, 161, 23)); 679 useatEdit->setGeometry(QRect(160, 160, 161, 23));
677 useatEdit->addItem(tr("Mash")); 680 for (int i = 0; i < 7; i++)
678 useatEdit->addItem(tr("First wort")); 681 useatEdit->addItem(QCoreApplication::translate("HopUse", g_hop_useat[i]));
679 useatEdit->addItem(tr("Boil"));
680 useatEdit->addItem(tr("Aroma"));
681 useatEdit->addItem(tr("Whirlpool"));
682 useatEdit->addItem(tr("Dry hop"));
683 useatEdit->addItem(tr("Bottling"));
684 useatEdit->setCurrentIndex(product->hops.at(product->hops_row).useat); 682 useatEdit->setCurrentIndex(product->hops.at(product->hops_row).useat);
685 683
686 hinstockEdit = new QCheckBox(dialog); 684 hinstockEdit = new QCheckBox(dialog);
687 hinstockEdit->setObjectName(QString::fromUtf8("hinstockEdit")); 685 hinstockEdit->setObjectName(QString::fromUtf8("hinstockEdit"));
688 hinstockEdit->setGeometry(QRect(655, 70, 85, 21)); 686 hinstockEdit->setGeometry(QRect(655, 70, 85, 21));

mercurial