58 ui->yeastsTable->verticalHeader()->hide(); |
58 ui->yeastsTable->verticalHeader()->hide(); |
59 ui->yeastsTable->setRowCount(recipe->yeasts.size()); |
59 ui->yeastsTable->setRowCount(recipe->yeasts.size()); |
60 |
60 |
61 for (int i = 0; i < recipe->yeasts.size(); i++) { |
61 for (int i = 0; i < recipe->yeasts.size(); i++) { |
62 |
62 |
63 ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(recipe->yeasts.at(i).y_name)); |
63 ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(recipe->yeasts.at(i).name)); |
64 ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(recipe->yeasts.at(i).y_laboratory)); |
64 ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(recipe->yeasts.at(i).laboratory)); |
65 ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(recipe->yeasts.at(i).y_product_id)); |
65 ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(recipe->yeasts.at(i).product_id)); |
66 |
66 |
67 item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(i).y_form]); |
67 item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(i).form]); |
68 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
68 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
69 ui->yeastsTable->setItem(i, 3, item); |
69 ui->yeastsTable->setItem(i, 3, item); |
70 |
70 |
71 item = new QTableWidgetItem(yeast_use[recipe->yeasts.at(i).y_use]); |
71 item = new QTableWidgetItem(yeast_use[recipe->yeasts.at(i).use]); |
72 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
72 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
73 ui->yeastsTable->setItem(i, 4, item); |
73 ui->yeastsTable->setItem(i, 4, item); |
74 |
74 |
75 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_min_temperature, 2, 'f', 1, '0')); |
75 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).min_temperature, 2, 'f', 1, '0')); |
76 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
76 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
77 ui->yeastsTable->setItem(i, 5, item); |
77 ui->yeastsTable->setItem(i, 5, item); |
78 |
78 |
79 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_max_temperature, 2, 'f', 1, '0')); |
79 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).max_temperature, 2, 'f', 1, '0')); |
80 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
80 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
81 ui->yeastsTable->setItem(i, 6, item); |
81 ui->yeastsTable->setItem(i, 6, item); |
82 |
82 |
83 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_tolerance, 2, 'f', 1, '0')); |
83 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).tolerance, 2, 'f', 1, '0')); |
84 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
84 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
85 ui->yeastsTable->setItem(i, 7, item); |
85 ui->yeastsTable->setItem(i, 7, item); |
86 |
86 |
87 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_attenuation, 2, 'f', 1, '0')); |
87 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).attenuation, 2, 'f', 1, '0')); |
88 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
88 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
89 ui->yeastsTable->setItem(i, 8, item); |
89 ui->yeastsTable->setItem(i, 8, item); |
90 |
90 |
91 if (recipe->yeasts.at(i).y_form == 0) |
91 if (recipe->yeasts.at(i).form == 0) |
92 item = new QTableWidgetItem(QString("%1 pack").arg(recipe->yeasts.at(i).y_amount, 1, 'f', 0, '0')); |
92 item = new QTableWidgetItem(QString("%1 pack").arg(recipe->yeasts.at(i).amount, 1, 'f', 0, '0')); |
93 else if (recipe->yeasts.at(i).y_form == 1) |
93 else if (recipe->yeasts.at(i).form == 1) |
94 item = new QTableWidgetItem(QString("%1 gr").arg(recipe->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); |
94 item = new QTableWidgetItem(QString("%1 gr").arg(recipe->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
95 else |
95 else |
96 item = new QTableWidgetItem(QString("%1 ml").arg(recipe->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); |
96 item = new QTableWidgetItem(QString("%1 ml").arg(recipe->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); |
97 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
97 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
98 ui->yeastsTable->setItem(i, 9, item); |
98 ui->yeastsTable->setItem(i, 9, item); |
99 |
99 |
100 pWidget = new QWidget(); |
100 pWidget = new QWidget(); |
101 QPushButton* btn_dele = new QPushButton(); |
101 QPushButton* btn_dele = new QPushButton(); |
139 |
139 |
140 if (recipe->yeasts.size() == 0) |
140 if (recipe->yeasts.size() == 0) |
141 return; // No yeast in recipe. |
141 return; // No yeast in recipe. |
142 |
142 |
143 for (int i = 0; i < recipe->yeasts.size(); i++) { |
143 for (int i = 0; i < recipe->yeasts.size(); i++) { |
144 if (recipe->yeasts.at(i).y_use == 0) { // Primary |
144 if (recipe->yeasts.at(i).use == 0) { // Primary |
145 if (recipe->yeasts.at(i).y_form == 1) { |
145 if (recipe->yeasts.at(i).form == 1) { |
146 /* |
146 /* |
147 * Dry yeast, build the formule with the yeast parameters. |
147 * Dry yeast, build the formule with the yeast parameters. |
148 * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ |
148 * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ |
149 */ |
149 */ |
150 ui->yeastProcedure->setCurrentIndex(2); |
150 ui->yeastProcedure->setCurrentIndex(2); |
151 ui->lo_gr_hlEdit->setValue(recipe->yeasts.at(i).y_gr_hl_lo); |
151 ui->lo_gr_hlEdit->setValue(recipe->yeasts.at(i).gr_hl_lo); |
152 ui->hi_gr_hlEdit->setValue(recipe->yeasts.at(i).y_gr_hl_hi); |
152 ui->hi_gr_hlEdit->setValue(recipe->yeasts.at(i).gr_hl_hi); |
153 ui->lo_sgEdit->setValue(recipe->yeasts.at(i).y_sg_lo); |
153 ui->lo_sgEdit->setValue(recipe->yeasts.at(i).sg_lo); |
154 ui->hi_sgEdit->setValue(recipe->yeasts.at(i).y_sg_hi); |
154 ui->hi_sgEdit->setValue(recipe->yeasts.at(i).sg_hi); |
155 double og = recipe->yeasts.at(i).y_sg_lo; |
155 double og = recipe->yeasts.at(i).sg_lo; |
156 double f1 = recipe->yeasts.at(i).y_gr_hl_lo / 100.0; |
156 double f1 = recipe->yeasts.at(i).gr_hl_lo / 100.0; |
157 double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; |
157 double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; |
158 double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); |
158 double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); |
159 qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; |
159 qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; |
160 double yeast_grams = round(volume * multiplier * 100.0) / 100.0; // * (100 / dataRecord.starter_viability), 2); |
160 double yeast_grams = round(volume * multiplier * 100.0) / 100.0; // * (100 / dataRecord.starter_viability), 2); |
161 double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; |
161 double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; |
273 { |
273 { |
274 QTableWidgetItem *item; |
274 QTableWidgetItem *item; |
275 |
275 |
276 qDebug() << "yeast_amount_changed()" << recipe->yeasts_row << val; |
276 qDebug() << "yeast_amount_changed()" << recipe->yeasts_row << val; |
277 |
277 |
278 if (recipe->yeasts.at(recipe->yeasts_row).y_form == 0) { |
278 if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { |
279 recipe->yeasts[recipe->yeasts_row].y_amount = val; |
279 recipe->yeasts[recipe->yeasts_row].amount = val; |
280 item = new QTableWidgetItem(QString("%1 pack").arg(val, 1, 'f', 0, '0')); |
280 item = new QTableWidgetItem(QString("%1 pack").arg(val, 1, 'f', 0, '0')); |
281 } else if (recipe->yeasts.at(recipe->yeasts_row).y_form == 1) { |
281 } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { |
282 recipe->yeasts[recipe->yeasts_row].y_amount = val / 1000.0; |
282 recipe->yeasts[recipe->yeasts_row].amount = val / 1000.0; |
283 item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0')); |
283 item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0')); |
284 } else { |
284 } else { |
285 recipe->yeasts[recipe->yeasts_row].y_amount = val / 1000.0; |
285 recipe->yeasts[recipe->yeasts_row].amount = val / 1000.0; |
286 item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0')); |
286 item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0')); |
287 } |
287 } |
288 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
288 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
289 ui->yeastsTable->setItem(recipe->yeasts_row, 9, item); |
289 ui->yeastsTable->setItem(recipe->yeasts_row, 9, item); |
290 |
290 |
308 /* |
308 /* |
309 * Search the yeast pointed by the index and instock flag. |
309 * Search the yeast pointed by the index and instock flag. |
310 */ |
310 */ |
311 QString sql = "SELECT name,laboratory,product_id,type,form,min_temperature,max_temperature,flocculation,attenuation," |
311 QString sql = "SELECT name,laboratory,product_id,type,form,min_temperature,max_temperature,flocculation,attenuation," |
312 "cells,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide," |
312 "cells,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide," |
313 "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost FROM inventory_yeasts "; |
313 "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost FROM inventoryeasts "; |
314 if (instock) |
314 if (instock) |
315 sql.append("WHERE inventory > 0 "); |
315 sql.append("WHERE inventory > 0 "); |
316 sql.append("ORDER BY laboratory,product_id,name"); |
316 sql.append("ORDER BY laboratory,product_id,name"); |
317 query.prepare(sql); |
317 query.prepare(sql); |
318 query.exec(); |
318 query.exec(); |
323 qDebug() << "found" << query.value(0).toString() << query.value(2).toString(); |
323 qDebug() << "found" << query.value(0).toString() << query.value(2).toString(); |
324 |
324 |
325 /* |
325 /* |
326 * Replace the yeast record contents |
326 * Replace the yeast record contents |
327 */ |
327 */ |
328 recipe->yeasts[recipe->yeasts_row].y_name = query.value(0).toString(); |
328 recipe->yeasts[recipe->yeasts_row].name = query.value(0).toString(); |
329 recipe->yeasts[recipe->yeasts_row].y_laboratory = query.value(1).toString(); |
329 recipe->yeasts[recipe->yeasts_row].laboratory = query.value(1).toString(); |
330 recipe->yeasts[recipe->yeasts_row].y_product_id = query.value(2).toString(); |
330 recipe->yeasts[recipe->yeasts_row].product_id = query.value(2).toString(); |
331 recipe->yeasts[recipe->yeasts_row].y_type = query.value(3).toInt(); |
331 recipe->yeasts[recipe->yeasts_row].type = query.value(3).toInt(); |
332 recipe->yeasts[recipe->yeasts_row].y_form = query.value(4).toInt(); |
332 recipe->yeasts[recipe->yeasts_row].form = query.value(4).toInt(); |
333 recipe->yeasts[recipe->yeasts_row].y_min_temperature = query.value(5).toDouble(); |
333 recipe->yeasts[recipe->yeasts_row].min_temperature = query.value(5).toDouble(); |
334 recipe->yeasts[recipe->yeasts_row].y_max_temperature = query.value(6).toDouble(); |
334 recipe->yeasts[recipe->yeasts_row].max_temperature = query.value(6).toDouble(); |
335 recipe->yeasts[recipe->yeasts_row].y_flocculation = query.value(7).toInt(); |
335 recipe->yeasts[recipe->yeasts_row].flocculation = query.value(7).toInt(); |
336 recipe->yeasts[recipe->yeasts_row].y_attenuation = query.value(8).toDouble(); |
336 recipe->yeasts[recipe->yeasts_row].attenuation = query.value(8).toDouble(); |
337 recipe->yeasts[recipe->yeasts_row].y_cells = query.value(9).toDouble(); |
337 recipe->yeasts[recipe->yeasts_row].cells = query.value(9).toDouble(); |
338 recipe->yeasts[recipe->yeasts_row].y_tolerance = query.value(10).toDouble(); |
338 recipe->yeasts[recipe->yeasts_row].tolerance = query.value(10).toDouble(); |
339 recipe->yeasts[recipe->yeasts_row].y_sta1 = query.value(11).toInt() ? true:false; |
339 recipe->yeasts[recipe->yeasts_row].sta1 = query.value(11).toInt() ? true:false; |
340 recipe->yeasts[recipe->yeasts_row].y_bacteria = query.value(12).toInt() ? true:false; |
340 recipe->yeasts[recipe->yeasts_row].bacteria = query.value(12).toInt() ? true:false; |
341 recipe->yeasts[recipe->yeasts_row].y_harvest_top = query.value(13).toInt() ? true:false; |
341 recipe->yeasts[recipe->yeasts_row].harvest_top = query.value(13).toInt() ? true:false; |
342 recipe->yeasts[recipe->yeasts_row].y_harvest_time = query.value(14).toInt(); |
342 recipe->yeasts[recipe->yeasts_row].harvest_time = query.value(14).toInt(); |
343 recipe->yeasts[recipe->yeasts_row].y_pitch_temperature = query.value(15).toDouble(); |
343 recipe->yeasts[recipe->yeasts_row].pitch_temperature = query.value(15).toDouble(); |
344 recipe->yeasts[recipe->yeasts_row].y_pofpos = query.value(16).toInt() ? true:false; |
344 recipe->yeasts[recipe->yeasts_row].pofpos = query.value(16).toInt() ? true:false; |
345 recipe->yeasts[recipe->yeasts_row].y_zymocide = query.value(17).toInt(); |
345 recipe->yeasts[recipe->yeasts_row].zymocide = query.value(17).toInt(); |
346 recipe->yeasts[recipe->yeasts_row].y_gr_hl_lo = query.value(18).toInt(); |
346 recipe->yeasts[recipe->yeasts_row].gr_hl_lo = query.value(18).toInt(); |
347 recipe->yeasts[recipe->yeasts_row].y_sg_lo = query.value(19).toDouble(); |
347 recipe->yeasts[recipe->yeasts_row].sg_lo = query.value(19).toDouble(); |
348 recipe->yeasts[recipe->yeasts_row].y_gr_hl_hi = query.value(20).toInt(); |
348 recipe->yeasts[recipe->yeasts_row].gr_hl_hi = query.value(20).toInt(); |
349 recipe->yeasts[recipe->yeasts_row].y_sg_hi = query.value(21).toDouble(); |
349 recipe->yeasts[recipe->yeasts_row].sg_hi = query.value(21).toDouble(); |
350 recipe->yeasts[recipe->yeasts_row].y_cost = query.value(22).toDouble(); |
350 recipe->yeasts[recipe->yeasts_row].cost = query.value(22).toDouble(); |
351 |
351 |
352 /* |
352 /* |
353 * Update the visible fields |
353 * Update the visible fields |
354 */ |
354 */ |
355 ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_name); |
355 ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).name); |
356 ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_laboratory); |
356 ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).laboratory); |
357 yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_product_id); |
357 yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).product_id); |
358 if (recipe->yeasts.at(recipe->yeasts_row).y_form == 0) { |
358 if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { |
359 yamountEdit->setDecimals(0); |
359 yamountEdit->setDecimals(0); |
360 yamountEdit->setSingleStep(1.0); |
360 yamountEdit->setSingleStep(1.0); |
361 yamountLabel->setText(tr("Total packs:")); |
361 yamountLabel->setText(tr("Total packs:")); |
362 } else if (recipe->yeasts.at(recipe->yeasts_row).y_form == 1) { |
362 } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { |
363 yamountEdit->setDecimals(1); |
363 yamountEdit->setDecimals(1); |
364 yamountEdit->setSingleStep(0.5); |
364 yamountEdit->setSingleStep(0.5); |
365 yamountLabel->setText(tr("Amount in gr:")); |
365 yamountLabel->setText(tr("Amount in gr:")); |
366 } else { |
366 } else { |
367 yamountEdit->setDecimals(1); |
367 yamountEdit->setDecimals(1); |
368 yamountEdit->setSingleStep(0.5); |
368 yamountEdit->setSingleStep(0.5); |
369 yamountLabel->setText(tr("Amount in ml:")); |
369 yamountLabel->setText(tr("Amount in ml:")); |
370 } |
370 } |
371 |
371 |
372 ui->yeastsTable->setItem(recipe->yeasts_row, 0, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).y_name)); |
372 ui->yeastsTable->setItem(recipe->yeasts_row, 0, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).name)); |
373 ui->yeastsTable->setItem(recipe->yeasts_row, 1, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).y_laboratory)); |
373 ui->yeastsTable->setItem(recipe->yeasts_row, 1, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).laboratory)); |
374 ui->yeastsTable->setItem(recipe->yeasts_row, 2, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).y_product_id)); |
374 ui->yeastsTable->setItem(recipe->yeasts_row, 2, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).product_id)); |
375 |
375 |
376 item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(recipe->yeasts_row).y_form]); |
376 item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(recipe->yeasts_row).form]); |
377 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
377 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
378 ui->yeastsTable->setItem(recipe->yeasts_row, 3, item); |
378 ui->yeastsTable->setItem(recipe->yeasts_row, 3, item); |
379 |
379 |
380 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_min_temperature, 2, 'f', 1, '0')); |
380 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).min_temperature, 2, 'f', 1, '0')); |
381 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
381 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
382 ui->yeastsTable->setItem(recipe->yeasts_row, 5, item); |
382 ui->yeastsTable->setItem(recipe->yeasts_row, 5, item); |
383 |
383 |
384 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_max_temperature, 2, 'f', 1, '0')); |
384 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).max_temperature, 2, 'f', 1, '0')); |
385 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
385 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
386 ui->yeastsTable->setItem(recipe->yeasts_row, 6, item); |
386 ui->yeastsTable->setItem(recipe->yeasts_row, 6, item); |
387 |
387 |
388 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_tolerance, 2, 'f', 1, '0')); |
388 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).tolerance, 2, 'f', 1, '0')); |
389 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
389 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
390 ui->yeastsTable->setItem(recipe->yeasts_row, 7, item); |
390 ui->yeastsTable->setItem(recipe->yeasts_row, 7, item); |
391 |
391 |
392 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_attenuation, 2, 'f', 1, '0')); |
392 item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).attenuation, 2, 'f', 1, '0')); |
393 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
393 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
394 ui->yeastsTable->setItem(recipe->yeasts_row, 8, item); |
394 ui->yeastsTable->setItem(recipe->yeasts_row, 8, item); |
395 |
395 |
396 calcYeast(); |
396 calcYeast(); |
397 is_changed(); |
397 is_changed(); |
498 useatLabel->setGeometry(QRect(10, 160, 141, 20)); |
498 useatLabel->setGeometry(QRect(10, 160, 141, 20)); |
499 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
499 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
500 |
500 |
501 ynameEdit = new QLineEdit(dialog); |
501 ynameEdit = new QLineEdit(dialog); |
502 ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
502 ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
503 ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_name); |
503 ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).name); |
504 ynameEdit->setGeometry(QRect(160, 10, 511, 23)); |
504 ynameEdit->setGeometry(QRect(160, 10, 511, 23)); |
505 ynameEdit->setReadOnly(true); |
505 ynameEdit->setReadOnly(true); |
506 ylaboratoryEdit = new QLineEdit(dialog); |
506 ylaboratoryEdit = new QLineEdit(dialog); |
507 ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); |
507 ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); |
508 ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_laboratory); |
508 ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).laboratory); |
509 ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); |
509 ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); |
510 ylaboratoryEdit->setReadOnly(true); |
510 ylaboratoryEdit->setReadOnly(true); |
511 yproduct_idEdit = new QLineEdit(dialog); |
511 yproduct_idEdit = new QLineEdit(dialog); |
512 yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); |
512 yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); |
513 yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_product_id); |
513 yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).product_id); |
514 yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); |
514 yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); |
515 yproduct_idEdit->setReadOnly(true); |
515 yproduct_idEdit->setReadOnly(true); |
516 yselectEdit = new QComboBox(dialog); |
516 yselectEdit = new QComboBox(dialog); |
517 yselectEdit->setObjectName(QString::fromUtf8("selectEdit")); |
517 yselectEdit->setObjectName(QString::fromUtf8("selectEdit")); |
518 yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
518 yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
523 yamountEdit = new QDoubleSpinBox(dialog); |
523 yamountEdit = new QDoubleSpinBox(dialog); |
524 yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
524 yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
525 yamountEdit->setGeometry(QRect(160, 130, 121, 24)); |
525 yamountEdit->setGeometry(QRect(160, 130, 121, 24)); |
526 yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
526 yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
527 yamountEdit->setAccelerated(true); |
527 yamountEdit->setAccelerated(true); |
528 if (recipe->yeasts.at(recipe->yeasts_row).y_form == 0) { |
528 if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { |
529 yamountEdit->setDecimals(0); |
529 yamountEdit->setDecimals(0); |
530 yamountEdit->setSingleStep(1.0); |
530 yamountEdit->setSingleStep(1.0); |
531 yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).y_amount); |
531 yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount); |
532 } else if (recipe->yeasts.at(recipe->yeasts_row).y_form == 1) { |
532 } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { |
533 yamountEdit->setDecimals(1); |
533 yamountEdit->setDecimals(1); |
534 yamountEdit->setSingleStep(0.5); |
534 yamountEdit->setSingleStep(0.5); |
535 yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).y_amount * 1000.0); |
535 yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount * 1000.0); |
536 } else { |
536 } else { |
537 yamountEdit->setDecimals(1); |
537 yamountEdit->setDecimals(1); |
538 yamountEdit->setSingleStep(0.5); |
538 yamountEdit->setSingleStep(0.5); |
539 yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).y_amount * 1000.0); |
539 yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount * 1000.0); |
540 } |
540 } |
541 yamountEdit->setMaximum(1000000000.0); |
541 yamountEdit->setMaximum(1000000000.0); |
542 useatEdit = new QComboBox(dialog); |
542 useatEdit = new QComboBox(dialog); |
543 useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
543 useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
544 useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
544 useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
545 useatEdit->addItem(tr("Primary")); |
545 useatEdit->addItem(tr("Primary")); |
546 useatEdit->addItem(tr("Secondary")); |
546 useatEdit->addItem(tr("Secondary")); |
547 useatEdit->addItem(tr("Tertiary")); |
547 useatEdit->addItem(tr("Tertiary")); |
548 useatEdit->addItem(tr("Bottle")); |
548 useatEdit->addItem(tr("Bottle")); |
549 useatEdit->setCurrentIndex(recipe->yeasts.at(recipe->yeasts_row).y_use); |
549 useatEdit->setCurrentIndex(recipe->yeasts.at(recipe->yeasts_row).use); |
550 |
550 |
551 yeast_instock_changed(true); |
551 yeast_instock_changed(true); |
552 |
552 |
553 connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::yeast_select_changed); |
553 connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::yeast_select_changed); |
554 connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::yeast_amount_changed); |
554 connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::yeast_amount_changed); |