641 } |
641 } |
642 |
642 |
643 |
643 |
644 void EditProduct::yeast_starter_edit_clicked() |
644 void EditProduct::yeast_starter_edit_clicked() |
645 { |
645 { |
646 int stype; |
|
647 double svol; |
|
648 |
|
649 QToolButton *pb = qobject_cast<QToolButton *>(QObject::sender()); |
646 QToolButton *pb = qobject_cast<QToolButton *>(QObject::sender()); |
650 int row = pb->objectName().toInt(); |
647 int row = pb->objectName().toInt(); |
651 qDebug() << "yeast_starter_edit_clicked" << row; |
648 qDebug() << "yeast_starter_edit_clicked" << row; |
652 |
649 |
653 stype = product->prop_type[row]; |
650 QDialog* dialog = new QDialog(this); |
654 svol = product->prop_volume[row]; |
651 dialog->resize(338, 140); |
|
652 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
|
653 buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
|
654 buttonBox->setGeometry(QRect(30, 90, 271, 32)); |
|
655 buttonBox->setLayoutDirection(Qt::LeftToRight); |
|
656 buttonBox->setOrientation(Qt::Horizontal); |
|
657 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); |
|
658 buttonBox->setCenterButtons(true); |
|
659 |
|
660 QLabel *typeLabel = new QLabel(dialog); |
|
661 typeLabel->setObjectName(QString::fromUtf8("typeLabel")); |
|
662 typeLabel->setText(tr("Start step type:")); |
|
663 typeLabel->setGeometry(QRect(10, 10, 141, 20)); |
|
664 typeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
|
665 QLabel *volLabel = new QLabel(dialog); |
|
666 volLabel->setObjectName(QString::fromUtf8("volLabel")); |
|
667 volLabel->setText(tr("Starter step volume:")); |
|
668 volLabel->setGeometry(QRect(10, 40, 141, 20)); |
|
669 volLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
|
670 |
|
671 QComboBox *typeEdit = new QComboBox(dialog); |
|
672 typeEdit->setObjectName(QString::fromUtf8("typeEdit")); |
|
673 typeEdit->setGeometry(QRect(160, 10, 121, 23)); |
|
674 typeEdit->addItem(tr("Stirred")); |
|
675 typeEdit->addItem(tr("Shaken")); |
|
676 typeEdit->addItem(tr("Simple")); |
|
677 typeEdit->setCurrentIndex(product->prop_type[row]); |
|
678 |
|
679 QDoubleSpinBox *volEdit = new QDoubleSpinBox(dialog); |
|
680 volEdit->setObjectName(QString::fromUtf8("volEdit")); |
|
681 volEdit->setGeometry(QRect(160, 40, 121, 24)); |
|
682 volEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
|
683 volEdit->setAccelerated(true); |
|
684 volEdit->setDecimals(3); |
|
685 volEdit->setSingleStep(0.01); |
|
686 volEdit->setValue(product->prop_volume[row]); |
|
687 volEdit->setMaximum(5); |
|
688 |
|
689 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); |
|
690 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); |
|
691 |
|
692 dialog->setModal(true); |
|
693 dialog->exec(); |
|
694 if (dialog->result() == QDialog::Rejected) { |
|
695 qDebug() << "reject"; |
|
696 } else { |
|
697 product->prop_type[row] = typeEdit->currentIndex(); |
|
698 product->prop_volume[row] = volEdit->value(); |
|
699 qDebug() << "accept"; |
|
700 calcYeast(); |
|
701 is_changed(); |
|
702 } |
|
703 |
|
704 disconnect(typeEdit, nullptr, nullptr, nullptr); |
|
705 disconnect(volEdit, nullptr, nullptr, nullptr); |
|
706 disconnect(buttonBox, nullptr, nullptr, nullptr); |
655 } |
707 } |
656 |
708 |
657 |
709 |
658 void EditProduct::addYeastRow_clicked() |
710 void EditProduct::addYeastRow_clicked() |
659 { |
711 { |