658 calcYeast(); |
658 calcYeast(); |
659 is_changed(); |
659 is_changed(); |
660 } |
660 } |
661 |
661 |
662 |
662 |
|
663 void EditProduct::pitchindex_changed(int val) |
|
664 { |
|
665 #ifdef DEBUG_YEAST |
|
666 qDebug() << "pitchindex_changed" << val; |
|
667 #endif |
|
668 product->pitch_pitchindex = val; |
|
669 } |
|
670 |
|
671 |
|
672 void EditProduct::pitchrate_changed(double val) |
|
673 { |
|
674 #ifdef DEBUG_YEAST |
|
675 qDebug() << "pitchrate_changed" << val; |
|
676 #endif |
|
677 product->yeast_pitchrate = val; |
|
678 calcYeast(); |
|
679 is_changed(); |
|
680 } |
|
681 |
|
682 |
663 void EditProduct::yeast_pitchrate_button_clicked() |
683 void EditProduct::yeast_pitchrate_button_clicked() |
664 { |
684 { |
665 #ifdef DEBUG_YEAST |
685 #ifdef DEBUG_YEAST |
666 qDebug() << "yeast_pitchrate_button_clicked"; |
686 qDebug() << "yeast_pitchrate_button_clicked"; |
667 #endif |
687 #endif |
668 |
688 product->pitch_pitchindex = 1; |
669 |
689 |
|
690 QDialog* dialog = new QDialog(this); |
|
691 dialog->resize(420, 110); |
|
692 dialog->setWindowTitle(tr("BMSapp - Pitchrate")); |
|
693 |
|
694 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
|
695 buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
|
696 buttonBox->setGeometry(QRect(30, 60, 360, 32)); |
|
697 buttonBox->setLayoutDirection(Qt::LeftToRight); |
|
698 buttonBox->setOrientation(Qt::Horizontal); |
|
699 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); |
|
700 buttonBox->setCenterButtons(true); |
|
701 |
|
702 QLabel *typeLabel = new QLabel(dialog); |
|
703 typeLabel->setObjectName(QString::fromUtf8("typeLabel")); |
|
704 typeLabel->setText(tr("Beer pitch type:")); |
|
705 typeLabel->setGeometry(QRect(10, 20, 195, 20)); |
|
706 typeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
|
707 |
|
708 QComboBox *typeEdit = new QComboBox(dialog); |
|
709 typeEdit->setObjectName(QString::fromUtf8("typeEdit")); |
|
710 typeEdit->setGeometry(QRect(215, 20, 185, 23)); |
|
711 typeEdit->setIconSize(QSize(0, 0)); |
|
712 typeEdit->addItem(tr("0.075 Real Kveik")); |
|
713 typeEdit->addItem(tr("0.75 Ale, upto 1.060")); |
|
714 typeEdit->addItem(tr("1.0 Ale, above 1.060")); |
|
715 typeEdit->addItem(tr("1.5 Lager, upto 1.060")); |
|
716 typeEdit->addItem(tr("2.0 Lager, above 1.060")); |
|
717 typeEdit->setCurrentIndex(product->pitch_pitchindex); |
|
718 |
|
719 connect(typeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::pitchindex_changed); |
|
720 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); |
|
721 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); |
|
722 |
|
723 dialog->setModal(true); |
|
724 dialog->exec(); |
|
725 if (dialog->result() != QDialog::Rejected) { |
|
726 switch (product->pitch_pitchindex) { |
|
727 case 0: product->yeast_pitchrate = 0.075; break; |
|
728 case 1: product->yeast_pitchrate = 0.75; break; |
|
729 case 2: product->yeast_pitchrate = 1.0; break; |
|
730 case 3: product->yeast_pitchrate = 1.5; break; |
|
731 case 4: product->yeast_pitchrate = 2.0; break; |
|
732 } |
|
733 ui->pitchrateEdit->setValue(product->yeast_pitchrate); /* Will automatic call calcYeast() and is_changed() */ |
|
734 } |
|
735 |
|
736 disconnect(typeEdit, nullptr, nullptr, nullptr); |
|
737 disconnect(buttonBox, nullptr, nullptr, nullptr); |
670 } |
738 } |
671 |
739 |
672 |
740 |
673 void EditProduct::yeast_retry_button_clicked() |
741 void EditProduct::yeast_retry_button_clicked() |
674 { |
742 { |