59 ui->yeastsTable->verticalHeader()->hide(); |
59 ui->yeastsTable->verticalHeader()->hide(); |
60 ui->yeastsTable->setRowCount(product->yeasts.size()); |
60 ui->yeastsTable->setRowCount(product->yeasts.size()); |
61 |
61 |
62 for (int i = 0; i < product->yeasts.size(); i++) { |
62 for (int i = 0; i < product->yeasts.size(); i++) { |
63 |
63 |
64 ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(product->yeasts.at(i).y_name)); |
64 ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(product->yeasts.at(i).name)); |
65 ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(product->yeasts.at(i).y_laboratory)); |
65 ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(product->yeasts.at(i).laboratory)); |
66 ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(product->yeasts.at(i).y_product_id)); |
66 ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(product->yeasts.at(i).product_id)); |
67 |
67 |
68 item = new QTableWidgetItem(yeast_forms[product->yeasts.at(i).y_form]); |
68 item = new QTableWidgetItem(yeast_forms[product->yeasts.at(i).form]); |
69 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
69 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
70 ui->yeastsTable->setItem(i, 3, item); |
70 ui->yeastsTable->setItem(i, 3, item); |
71 |
71 |
72 item = new QTableWidgetItem(yeast_use[product->yeasts.at(i).y_use]); |
72 item = new QTableWidgetItem(yeast_use[product->yeasts.at(i).use]); |
73 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
73 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
74 ui->yeastsTable->setItem(i, 4, item); |
74 ui->yeastsTable->setItem(i, 4, item); |
75 |
75 |
76 item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).y_min_temperature, 2, 'f', 1, '0')); |
76 item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).min_temperature, 2, 'f', 1, '0')); |
77 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
77 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
78 ui->yeastsTable->setItem(i, 5, item); |
78 ui->yeastsTable->setItem(i, 5, item); |
79 |
79 |
80 item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).y_max_temperature, 2, 'f', 1, '0')); |
80 item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).max_temperature, 2, 'f', 1, '0')); |
81 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
81 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
82 ui->yeastsTable->setItem(i, 6, item); |
82 ui->yeastsTable->setItem(i, 6, item); |
83 |
83 |
84 item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).y_tolerance, 2, 'f', 1, '0')); |
84 item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).tolerance, 2, 'f', 1, '0')); |
85 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
85 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
86 ui->yeastsTable->setItem(i, 7, item); |
86 ui->yeastsTable->setItem(i, 7, item); |
87 |
87 |
88 item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).y_attenuation, 2, 'f', 1, '0')); |
88 item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).attenuation, 2, 'f', 1, '0')); |
89 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
89 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
90 ui->yeastsTable->setItem(i, 8, item); |
90 ui->yeastsTable->setItem(i, 8, item); |
91 |
91 |
92 if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) |
92 if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) |
93 item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).y_amount, 1, 'f', 0, '0')); |
93 item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).amount, 1, 'f', 0, '0')); |
94 else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) |
94 else if (product->yeasts.at(i).form == YEAST_FORMS_DRY || product->yeasts.at(i).form == YEAST_FORMS_DRIED) |
95 item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); |
95 item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
96 else |
96 else |
97 item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); |
97 item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
98 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
98 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
99 ui->yeastsTable->setItem(i, 9, item); |
99 ui->yeastsTable->setItem(i, 9, item); |
100 |
100 |
101 if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) |
101 if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) |
102 item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).y_inventory, 1, 'f', 0, '0')); |
102 item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).inventory, 1, 'f', 0, '0')); |
103 else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) |
103 else if (product->yeasts.at(i).form == YEAST_FORMS_DRY || product->yeasts.at(i).form == YEAST_FORMS_DRIED) |
104 item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).y_inventory * 1000.0, 3, 'f', 2, '0')); |
104 item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).inventory * 1000.0, 3, 'f', 2, '0')); |
105 else |
105 else |
106 item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).y_inventory * 1000.0, 3, 'f', 2, '0')); |
106 item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).inventory * 1000.0, 3, 'f', 2, '0')); |
107 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
107 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
108 if (product->yeasts.at(i).y_inventory < product->yeasts.at(i).y_amount) |
108 if (product->yeasts.at(i).inventory < product->yeasts.at(i).amount) |
109 item->setForeground(QBrush(QColor(Qt::red))); |
109 item->setForeground(QBrush(QColor(Qt::red))); |
110 ui->yeastsTable->setItem(i, 10, item); |
110 ui->yeastsTable->setItem(i, 10, item); |
111 |
111 |
112 pWidget = new QWidget(); |
112 pWidget = new QWidget(); |
113 QPushButton* btn_dele = new QPushButton(); |
113 QPushButton* btn_dele = new QPushButton(); |
185 return; // No yeast in product. |
185 return; // No yeast in product. |
186 |
186 |
187 calcViability(); |
187 calcViability(); |
188 |
188 |
189 for (int i = 0; i < product->yeasts.size(); i++) { |
189 for (int i = 0; i < product->yeasts.size(); i++) { |
190 if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { // Primary |
190 if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { // Primary |
191 if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { |
191 if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { |
192 /* |
192 /* |
193 * Dry yeast, build the formule with the yeast parameters. |
193 * Dry yeast, build the formule with the yeast parameters. |
194 * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ |
194 * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ |
195 */ |
195 */ |
196 ui->yeastProcedure->setCurrentIndex(2); |
196 ui->yeastProcedure->setCurrentIndex(2); |
197 ui->lo_gr_hlEdit->setValue(product->yeasts.at(i).y_gr_hl_lo); |
197 ui->lo_gr_hlEdit->setValue(product->yeasts.at(i).gr_hl_lo); |
198 ui->hi_gr_hlEdit->setValue(product->yeasts.at(i).y_gr_hl_hi); |
198 ui->hi_gr_hlEdit->setValue(product->yeasts.at(i).gr_hl_hi); |
199 ui->lo_sgEdit->setValue(product->yeasts.at(i).y_sg_lo); |
199 ui->lo_sgEdit->setValue(product->yeasts.at(i).sg_lo); |
200 ui->hi_sgEdit->setValue(product->yeasts.at(i).y_sg_hi); |
200 ui->hi_sgEdit->setValue(product->yeasts.at(i).sg_hi); |
201 double og = product->yeasts.at(i).y_sg_lo; |
201 double og = product->yeasts.at(i).sg_lo; |
202 double f1 = product->yeasts.at(i).y_gr_hl_lo / 100.0; |
202 double f1 = product->yeasts.at(i).gr_hl_lo / 100.0; |
203 double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; |
203 double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; |
204 double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); |
204 double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); |
205 qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; |
205 qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; |
206 double yeast_grams = round(volume * multiplier * 100.0) / product->starter_viability; |
206 double yeast_grams = round(volume * multiplier * 100.0) / product->starter_viability; |
207 double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; |
207 double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; |
208 double pitch_gr_hl = round(((product->yeasts.at(i).y_amount * 1000.0) / (volume * 0.01)) * 100.0) / 100.0; |
208 double pitch_gr_hl = round(((product->yeasts.at(i).amount * 1000.0) / (volume * 0.01)) * 100.0) / 100.0; |
209 ui->dry_needShow->setValue(yeast_grams); |
209 ui->dry_needShow->setValue(yeast_grams); |
210 ui->dry_pitchrateShow->setValue(yeast_gr_hl); |
210 ui->dry_pitchrateShow->setValue(yeast_gr_hl); |
211 ui->pitch_grShow->setValue(pitch_gr_hl); |
211 ui->pitch_grShow->setValue(pitch_gr_hl); |
212 ui->pitch_grShow->setStyleSheet((pitch_gr_hl < yeast_gr_hl) ? "background-color: red":""); |
212 ui->pitch_grShow->setStyleSheet((pitch_gr_hl < yeast_gr_hl) ? "background-color: red":""); |
213 |
213 |
782 qDebug() << "found" << query.value(0).toString() << query.value(2).toString(); |
782 qDebug() << "found" << query.value(0).toString() << query.value(2).toString(); |
783 |
783 |
784 /* |
784 /* |
785 * Replace the yeast record contents |
785 * Replace the yeast record contents |
786 */ |
786 */ |
787 product->yeasts[product->yeasts_row].y_name = query.value(0).toString(); |
787 product->yeasts[product->yeasts_row].name = query.value(0).toString(); |
788 product->yeasts[product->yeasts_row].y_laboratory = query.value(1).toString(); |
788 product->yeasts[product->yeasts_row].laboratory = query.value(1).toString(); |
789 product->yeasts[product->yeasts_row].y_product_id = query.value(2).toString(); |
789 product->yeasts[product->yeasts_row].product_id = query.value(2).toString(); |
790 product->yeasts[product->yeasts_row].y_type = query.value(3).toInt(); |
790 product->yeasts[product->yeasts_row].type = query.value(3).toInt(); |
791 product->yeasts[product->yeasts_row].y_form = query.value(4).toInt(); |
791 product->yeasts[product->yeasts_row].form = query.value(4).toInt(); |
792 product->yeasts[product->yeasts_row].y_min_temperature = query.value(5).toDouble(); |
792 product->yeasts[product->yeasts_row].min_temperature = query.value(5).toDouble(); |
793 product->yeasts[product->yeasts_row].y_max_temperature = query.value(6).toDouble(); |
793 product->yeasts[product->yeasts_row].max_temperature = query.value(6).toDouble(); |
794 product->yeasts[product->yeasts_row].y_flocculation = query.value(7).toInt(); |
794 product->yeasts[product->yeasts_row].flocculation = query.value(7).toInt(); |
795 product->yeasts[product->yeasts_row].y_attenuation = query.value(8).toDouble(); |
795 product->yeasts[product->yeasts_row].attenuation = query.value(8).toDouble(); |
796 product->yeasts[product->yeasts_row].y_cells = query.value(9).toDouble(); |
796 product->yeasts[product->yeasts_row].cells = query.value(9).toDouble(); |
797 product->yeasts[product->yeasts_row].y_tolerance = query.value(10).toDouble(); |
797 product->yeasts[product->yeasts_row].tolerance = query.value(10).toDouble(); |
798 product->yeasts[product->yeasts_row].y_sta1 = query.value(11).toInt() ? true:false; |
798 product->yeasts[product->yeasts_row].sta1 = query.value(11).toInt() ? true:false; |
799 product->yeasts[product->yeasts_row].y_bacteria = query.value(12).toInt() ? true:false; |
799 product->yeasts[product->yeasts_row].bacteria = query.value(12).toInt() ? true:false; |
800 product->yeasts[product->yeasts_row].y_harvest_top = query.value(13).toInt() ? true:false; |
800 product->yeasts[product->yeasts_row].harvest_top = query.value(13).toInt() ? true:false; |
801 product->yeasts[product->yeasts_row].y_harvest_time = query.value(14).toInt(); |
801 product->yeasts[product->yeasts_row].harvest_time = query.value(14).toInt(); |
802 product->yeasts[product->yeasts_row].y_pitch_temperature = query.value(15).toDouble(); |
802 product->yeasts[product->yeasts_row].pitch_temperature = query.value(15).toDouble(); |
803 product->yeasts[product->yeasts_row].y_pofpos = query.value(16).toInt() ? true:false; |
803 product->yeasts[product->yeasts_row].pofpos = query.value(16).toInt() ? true:false; |
804 product->yeasts[product->yeasts_row].y_zymocide = query.value(17).toInt(); |
804 product->yeasts[product->yeasts_row].zymocide = query.value(17).toInt(); |
805 product->yeasts[product->yeasts_row].y_gr_hl_lo = query.value(18).toInt(); |
805 product->yeasts[product->yeasts_row].gr_hl_lo = query.value(18).toInt(); |
806 product->yeasts[product->yeasts_row].y_sg_lo = query.value(19).toDouble(); |
806 product->yeasts[product->yeasts_row].sg_lo = query.value(19).toDouble(); |
807 product->yeasts[product->yeasts_row].y_gr_hl_hi = query.value(20).toInt(); |
807 product->yeasts[product->yeasts_row].gr_hl_hi = query.value(20).toInt(); |
808 product->yeasts[product->yeasts_row].y_sg_hi = query.value(21).toDouble(); |
808 product->yeasts[product->yeasts_row].sg_hi = query.value(21).toDouble(); |
809 product->yeasts[product->yeasts_row].y_cost = query.value(22).toDouble(); |
809 product->yeasts[product->yeasts_row].cost = query.value(22).toDouble(); |
810 product->yeasts[product->yeasts_row].y_inventory = query.value(23).toDouble(); |
810 product->yeasts[product->yeasts_row].inventory = query.value(23).toDouble(); |
811 |
811 |
812 /* |
812 /* |
813 * Update the visible fields |
813 * Update the visible fields |
814 */ |
814 */ |
815 const QSignalBlocker blocker1(yamountEdit); |
815 const QSignalBlocker blocker1(yamountEdit); |
816 ynameEdit->setText(product->yeasts.at(product->yeasts_row).y_name); |
816 ynameEdit->setText(product->yeasts.at(product->yeasts_row).name); |
817 ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).y_laboratory); |
817 ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).laboratory); |
818 yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).y_product_id); |
818 yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).product_id); |
819 if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) { |
819 if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) { |
820 if (oldform != YEAST_FORMS_LIQUID) |
820 if (oldform != YEAST_FORMS_LIQUID) |
821 product->yeasts[product->yeasts_row].y_amount = 1; |
821 product->yeasts[product->yeasts_row].amount = 1; |
822 yamountEdit->setValue(product->yeasts[product->yeasts_row].y_amount); |
822 yamountEdit->setValue(product->yeasts[product->yeasts_row].amount); |
823 yamountEdit->setDecimals(0); |
823 yamountEdit->setDecimals(0); |
824 yamountEdit->setSingleStep(1.0); |
824 yamountEdit->setSingleStep(1.0); |
825 yamountLabel->setText(tr("Total packs:")); |
825 yamountLabel->setText(tr("Total packs:")); |
826 } else if ((product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED)) { |
826 } else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) { |
827 if (oldform == YEAST_FORMS_LIQUID) |
827 if (oldform == YEAST_FORMS_LIQUID) |
828 product->yeasts[product->yeasts_row].y_amount = 0.01; |
828 product->yeasts[product->yeasts_row].amount = 0.01; |
829 yamountEdit->setValue(product->yeasts[product->yeasts_row].y_amount * 1000.0); |
829 yamountEdit->setValue(product->yeasts[product->yeasts_row].amount * 1000.0); |
830 yamountEdit->setDecimals(1); |
830 yamountEdit->setDecimals(1); |
831 yamountEdit->setSingleStep(0.5); |
831 yamountEdit->setSingleStep(0.5); |
832 yamountLabel->setText(tr("Amount in gr:")); |
832 yamountLabel->setText(tr("Amount in gr:")); |
833 } else { |
833 } else { |
834 if (oldform == YEAST_FORMS_LIQUID) |
834 if (oldform == YEAST_FORMS_LIQUID) |
835 product->yeasts[product->yeasts_row].y_amount = 0.01; |
835 product->yeasts[product->yeasts_row].amount = 0.01; |
836 yamountEdit->setValue(product->yeasts[product->yeasts_row].y_amount * 1000.0); |
836 yamountEdit->setValue(product->yeasts[product->yeasts_row].amount * 1000.0); |
837 yamountEdit->setDecimals(1); |
837 yamountEdit->setDecimals(1); |
838 yamountEdit->setSingleStep(0.5); |
838 yamountEdit->setSingleStep(0.5); |
839 yamountLabel->setText(tr("Amount in ml:")); |
839 yamountLabel->setText(tr("Amount in ml:")); |
840 } |
840 } |
841 |
841 |
842 ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_name)); |
842 ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).name)); |
843 ui->yeastsTable->setItem(product->yeasts_row, 1, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_laboratory)); |
843 ui->yeastsTable->setItem(product->yeasts_row, 1, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).laboratory)); |
844 ui->yeastsTable->setItem(product->yeasts_row, 2, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_product_id)); |
844 ui->yeastsTable->setItem(product->yeasts_row, 2, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).product_id)); |
845 |
845 |
846 item = new QTableWidgetItem(yeast_forms[product->yeasts.at(product->yeasts_row).y_form]); |
846 item = new QTableWidgetItem(yeast_forms[product->yeasts.at(product->yeasts_row).form]); |
847 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
847 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
848 ui->yeastsTable->setItem(product->yeasts_row, 3, item); |
848 ui->yeastsTable->setItem(product->yeasts_row, 3, item); |
849 |
849 |
850 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_min_temperature, 2, 'f', 1, '0')); |
850 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).min_temperature, 2, 'f', 1, '0')); |
851 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
851 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
852 ui->yeastsTable->setItem(product->yeasts_row, 5, item); |
852 ui->yeastsTable->setItem(product->yeasts_row, 5, item); |
853 |
853 |
854 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_max_temperature, 2, 'f', 1, '0')); |
854 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).max_temperature, 2, 'f', 1, '0')); |
855 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
855 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
856 ui->yeastsTable->setItem(product->yeasts_row, 6, item); |
856 ui->yeastsTable->setItem(product->yeasts_row, 6, item); |
857 |
857 |
858 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_tolerance, 2, 'f', 1, '0')); |
858 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).tolerance, 2, 'f', 1, '0')); |
859 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
859 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
860 ui->yeastsTable->setItem(product->yeasts_row, 7, item); |
860 ui->yeastsTable->setItem(product->yeasts_row, 7, item); |
861 |
861 |
862 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_attenuation, 2, 'f', 1, '0')); |
862 item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).attenuation, 2, 'f', 1, '0')); |
863 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
863 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
864 ui->yeastsTable->setItem(product->yeasts_row, 8, item); |
864 ui->yeastsTable->setItem(product->yeasts_row, 8, item); |
865 |
865 |
866 if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) |
866 if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) |
867 item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(product->yeasts_row).y_amount, 1, 'f', 0, '0')); |
867 item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(product->yeasts_row).amount, 1, 'f', 0, '0')); |
868 else if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY || product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED) |
868 else if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY || product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED) |
869 item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(product->yeasts_row).y_amount * 1000.0, 3, 'f', 2, '0')); |
869 item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(product->yeasts_row).amount * 1000.0, 3, 'f', 2, '0')); |
870 else |
870 else |
871 item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(product->yeasts_row).y_amount * 1000.0, 3, 'f', 2, '0')); |
871 item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(product->yeasts_row).amount * 1000.0, 3, 'f', 2, '0')); |
872 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
872 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
873 ui->yeastsTable->setItem(product->yeasts_row, 9, item); |
873 ui->yeastsTable->setItem(product->yeasts_row, 9, item); |
874 |
874 |
875 //calcYeast(); |
875 //calcYeast(); |
876 is_changed(); |
876 is_changed(); |
978 useatLabel->setGeometry(QRect(10, 160, 141, 20)); |
978 useatLabel->setGeometry(QRect(10, 160, 141, 20)); |
979 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
979 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
980 |
980 |
981 ynameEdit = new QLineEdit(dialog); |
981 ynameEdit = new QLineEdit(dialog); |
982 ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
982 ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
983 ynameEdit->setText(product->yeasts.at(product->yeasts_row).y_name); |
983 ynameEdit->setText(product->yeasts.at(product->yeasts_row).name); |
984 ynameEdit->setGeometry(QRect(160, 10, 511, 23)); |
984 ynameEdit->setGeometry(QRect(160, 10, 511, 23)); |
985 ynameEdit->setReadOnly(true); |
985 ynameEdit->setReadOnly(true); |
986 ylaboratoryEdit = new QLineEdit(dialog); |
986 ylaboratoryEdit = new QLineEdit(dialog); |
987 ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); |
987 ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); |
988 ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).y_laboratory); |
988 ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).laboratory); |
989 ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); |
989 ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); |
990 ylaboratoryEdit->setReadOnly(true); |
990 ylaboratoryEdit->setReadOnly(true); |
991 yproduct_idEdit = new QLineEdit(dialog); |
991 yproduct_idEdit = new QLineEdit(dialog); |
992 yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); |
992 yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); |
993 yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).y_product_id); |
993 yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).product_id); |
994 yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); |
994 yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); |
995 yproduct_idEdit->setReadOnly(true); |
995 yproduct_idEdit->setReadOnly(true); |
996 yselectEdit = new QComboBox(dialog); |
996 yselectEdit = new QComboBox(dialog); |
997 yselectEdit->setObjectName(QString::fromUtf8("selectEdit")); |
997 yselectEdit->setObjectName(QString::fromUtf8("selectEdit")); |
998 yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
998 yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
1004 yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
1004 yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
1005 yamountEdit->setGeometry(QRect(160, 130, 121, 24)); |
1005 yamountEdit->setGeometry(QRect(160, 130, 121, 24)); |
1006 yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1006 yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1007 yamountEdit->setAccelerated(true); |
1007 yamountEdit->setAccelerated(true); |
1008 yamountEdit->setMaximum(10000.0); |
1008 yamountEdit->setMaximum(10000.0); |
1009 if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) { |
1009 if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) { |
1010 yamountEdit->setDecimals(0); |
1010 yamountEdit->setDecimals(0); |
1011 yamountEdit->setSingleStep(1.0); |
1011 yamountEdit->setSingleStep(1.0); |
1012 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount); |
1012 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount); |
1013 } else if ((product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED)) { |
1013 } else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) { |
1014 yamountEdit->setDecimals(1); |
1014 yamountEdit->setDecimals(1); |
1015 yamountEdit->setSingleStep(0.5); |
1015 yamountEdit->setSingleStep(0.5); |
1016 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount * 1000.0); |
1016 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount * 1000.0); |
1017 } else { |
1017 } else { |
1018 yamountEdit->setDecimals(1); |
1018 yamountEdit->setDecimals(1); |
1019 yamountEdit->setSingleStep(0.5); |
1019 yamountEdit->setSingleStep(0.5); |
1020 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount * 1000.0); |
1020 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount * 1000.0); |
1021 } |
1021 } |
1022 yamountEdit->setMaximum(1000000000.0); |
1022 yamountEdit->setMaximum(1000000000.0); |
1023 useatEdit = new QComboBox(dialog); |
1023 useatEdit = new QComboBox(dialog); |
1024 useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
1024 useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
1025 useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
1025 useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
1026 useatEdit->addItem(tr("Primary")); |
1026 useatEdit->addItem(tr("Primary")); |
1027 useatEdit->addItem(tr("Secondary")); |
1027 useatEdit->addItem(tr("Secondary")); |
1028 useatEdit->addItem(tr("Tertiary")); |
1028 useatEdit->addItem(tr("Tertiary")); |
1029 useatEdit->addItem(tr("Bottle")); |
1029 useatEdit->addItem(tr("Bottle")); |
1030 useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).y_use); |
1030 useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).use); |
1031 |
1031 |
1032 yeast_instock_changed(true); |
1032 yeast_instock_changed(true); |
1033 |
1033 |
1034 connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_select_changed); |
1034 connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_select_changed); |
1035 connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::yeast_amount_changed); |
1035 connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::yeast_amount_changed); |