54 ui->st_nameEdit->setText(query.value(3).toString()); |
63 ui->st_nameEdit->setText(query.value(3).toString()); |
55 ui->st_groupEdit->setText(query.value(4).toString()); |
64 ui->st_groupEdit->setText(query.value(4).toString()); |
56 ui->st_guideEdit->setText(query.value(5).toString()); |
65 ui->st_guideEdit->setText(query.value(5).toString()); |
57 ui->st_catEdit->setText(query.value(6).toString()); |
66 ui->st_catEdit->setText(query.value(6).toString()); |
58 ui->st_catnrEdit->setText(query.value(7).toString()); |
67 ui->st_catnrEdit->setText(query.value(7).toString()); |
59 ui->st_typeEdit->setText(query.value(8).toString()); |
68 ui->st_typeEdit->setText(s_types[query.value(8).toInt()]); |
60 |
69 |
61 ui->nameEdit->setText(query.value(21).toString()); |
70 ui->nameEdit->setText(query.value(21).toString()); |
62 ui->notesEdit->setPlainText(query.value(22).toString()); |
71 ui->notesEdit->setPlainText(query.value(22).toString()); |
63 ui->typeEdit->setCurrentIndex(query.value(23).toInt()); |
72 ui->typeEdit->setCurrentIndex(query.value(23).toInt()); |
64 ui->batch_sizeEdit->setValue(query.value(24).toDouble()); |
73 ui->batch_sizeEdit->setValue(query.value(24).toDouble()); |
65 ui->boil_sizeEdit->setValue(query.value(25).toDouble()); |
74 ui->boil_sizeEdit->setValue(query.value(25).toDouble()); |
66 ui->boil_timeEdit->setValue(query.value(26).toInt()); |
75 ui->boil_timeEdit->setValue(query.value(26).toInt()); |
67 ui->efficiencyEdit->setValue(query.value(27).toDouble()); |
76 ui->efficiencyEdit->setValue(query.value(27).toDouble()); |
68 |
77 |
69 ui->est_ogEdit->setValue(query.value(28).toDouble()); |
78 ui->est_ogEdit->setValue(query.value(28).toDouble()); |
|
79 ui->est_og2Edit->setValue(query.value(28).toDouble()); |
|
80 ui->est_og3Edit->setValue(query.value(28).toDouble()); |
70 ui->est_ogShow->setRange(query.value(9).toDouble(), query.value(10).toDouble()); |
81 ui->est_ogShow->setRange(query.value(9).toDouble(), query.value(10).toDouble()); |
71 ui->est_ogShow->setPrecision(3); |
82 ui->est_ogShow->setPrecision(3); |
72 ui->est_ogShow->setMarkerTextIsValue(true); |
83 ui->est_ogShow->setMarkerTextIsValue(true); |
73 ui->est_ogShow->setValue(query.value(28).toDouble()); |
84 ui->est_ogShow->setValue(query.value(28).toDouble()); |
74 |
85 |
75 ui->est_fgEdit->setValue(query.value(29).toDouble()); |
86 ui->est_fgEdit->setValue(query.value(29).toDouble()); |
|
87 ui->est_fg3Edit->setValue(query.value(29).toDouble()); |
76 ui->est_fgShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
88 ui->est_fgShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
77 ui->est_fgShow->setPrecision(3); |
89 ui->est_fgShow->setPrecision(3); |
78 ui->est_fgShow->setMarkerTextIsValue(true); |
90 ui->est_fgShow->setMarkerTextIsValue(true); |
79 ui->est_fgShow->setValue(query.value(29).toDouble()); |
91 ui->est_fgShow->setValue(query.value(29).toDouble()); |
80 |
92 |
81 ui->est_abvEdit->setValue(query.value(30).toDouble()); |
93 ui->est_abvEdit->setValue(query.value(30).toDouble()); |
|
94 ui->est_abv2Edit->setValue(query.value(30).toDouble()); |
82 ui->est_abvShow->setRange(query.value(19).toDouble(), query.value(20).toDouble()); |
95 ui->est_abvShow->setRange(query.value(19).toDouble(), query.value(20).toDouble()); |
83 ui->est_abvShow->setPrecision(1); |
96 ui->est_abvShow->setPrecision(1); |
84 ui->est_abvShow->setMarkerTextIsValue(true); |
97 ui->est_abvShow->setMarkerTextIsValue(true); |
85 ui->est_abvShow->setValue(query.value(30).toDouble()); |
98 ui->est_abvShow->setValue(query.value(30).toDouble()); |
86 |
99 |
87 QColor color = Utils::ebc_to_color(query.value(31).toInt()); |
100 QColor color = Utils::ebc_to_color(query.value(31).toInt()); |
88 ui->est_colorEdit->setValue(query.value(31).toDouble()); |
101 ui->est_colorEdit->setValue(query.value(31).toDouble()); |
89 ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(query.value(31).toInt())); |
102 ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(query.value(31).toInt())); |
|
103 ui->est_color2Edit->setValue(query.value(31).toDouble()); |
|
104 ui->est_color2Edit->setStyleSheet(Utils::ebc_to_style(query.value(31).toInt())); |
90 ui->est_colorShow->setPrecision(0); |
105 ui->est_colorShow->setPrecision(0); |
91 ui->est_colorShow->setMarkerTextIsValue(true); |
106 ui->est_colorShow->setMarkerTextIsValue(true); |
92 ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
107 ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
93 ui->est_colorShow->setValue(query.value(31).toDouble()); |
108 ui->est_colorShow->setValue(query.value(31).toDouble()); |
94 |
109 |
95 ui->color_methodEdit->setCurrentIndex(query.value(32).toInt()); |
110 ui->color_methodEdit->setCurrentIndex(query.value(32).toInt()); |
96 |
111 |
97 ui->est_ibuEdit->setValue(query.value(33).toDouble()); |
112 ui->est_ibuEdit->setValue(query.value(33).toDouble()); |
|
113 ui->est_ibu2Edit->setValue(query.value(33).toDouble()); |
98 ui->est_ibuShow->setPrecision(0); |
114 ui->est_ibuShow->setPrecision(0); |
99 ui->est_ibuShow->setMarkerTextIsValue(true); |
115 ui->est_ibuShow->setMarkerTextIsValue(true); |
100 ui->est_ibuShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
116 ui->est_ibuShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
101 ui->est_ibuShow->setValue(query.value(33).toDouble()); |
117 ui->est_ibuShow->setValue(query.value(33).toDouble()); |
102 |
118 |
154 // 79 wb_total_alkalinity |
170 // 79 wb_total_alkalinity |
155 // 80 wb_ph |
171 // 80 wb_ph |
156 // 81 wa_acid_name |
172 // 81 wa_acid_name |
157 // 82 wa_acid_perc |
173 // 82 wa_acid_perc |
158 // 83 wa_base_name |
174 // 83 wa_base_name |
159 // 84 json_fermentables |
175 |
|
176 /* |
|
177 * Progress bars. |
|
178 * perc_maltShow pmalts = mashkg / (dataRecord.boil_size / 3) * 100; |
|
179 * perc_sugarsShow if (row.f_type == 1 && row.f_added < 4) // Sugar |
|
180 * psugar += row.f_percentage; |
|
181 * perc_caraShow if (row.f_graintype == 2 && row.f_added < 4) // Crystal |
|
182 * pcara += row.f_percentage; |
|
183 * lintner if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) |
|
184 * lintner += row.f_diastatic_power * row.f_amount; |
|
185 * lintner = parseFloat(lintner / mashkg) |
|
186 * |
|
187 * perc_malts range(0, 120) |
|
188 * stop: 90, color: '#008C00' |
|
189 * stop: 100, color: '#EB7331' |
|
190 * stop: 120, color: '#FF0000' |
|
191 * |
|
192 * perc_sugars range(0, 50) |
|
193 * stop: 20, color: '#008C00' |
|
194 * stop: 50, color: '#FF0000' |
|
195 * perc_cara range(0, 50) |
|
196 * stop: 25, color: '#008C00' |
|
197 * stop: 50, color: '#FF0000' |
|
198 * lintner range(0, 200) |
|
199 * stop: 30, color: '#FF0000' red |
|
200 * stop: 40, color: '#EB7331' orange |
|
201 * stop: 200, color: '#008C00' green |
|
202 */ |
|
203 |
|
204 // ui->lintnerShow->setValue(52); |
|
205 if (ui->lintnerShow->value() < 30) |
|
206 ui->lintnerShow->setStyleSheet(bar_red); |
|
207 else if (ui->lintnerShow->value() < 40) |
|
208 ui->lintnerShow->setStyleSheet(bar_orange); |
|
209 else |
|
210 ui->lintnerShow->setStyleSheet(bar_green); |
|
211 |
|
212 QJsonParseError parseError; |
|
213 const auto& json = query.value(84).toString(); |
|
214 if (!json.trimmed().isEmpty()) { |
|
215 const auto& formattedJson = QString("%1").arg(json); |
|
216 this->fermentables = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
|
217 if (parseError.error != QJsonParseError::NoError) |
|
218 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
|
219 } else { |
|
220 qDebug() << "empty fermentables"; |
|
221 } |
|
222 |
160 // 85 json_hops |
223 // 85 json_hops |
161 // 86 json_miscs |
224 // 86 json_miscs |
162 // 87 json_yeasts |
225 // 87 json_yeasts |
163 // 88 json_mashs |
226 // 88 json_mashs |
164 } else { |
227 } else { |
165 /* Set some defaults */ |
228 /* Set some defaults */ |
166 } |
229 |
167 |
230 const auto& formattedJson = QString("[]"); |
|
231 this->fermentables = QJsonDocument::fromJson(formattedJson.toUtf8()); |
|
232 this->hops = QJsonDocument::fromJson(formattedJson.toUtf8()); |
|
233 this->miscs = QJsonDocument::fromJson(formattedJson.toUtf8()); |
|
234 this->yeasts = QJsonDocument::fromJson(formattedJson.toUtf8()); |
|
235 this->mashs = QJsonDocument::fromJson(formattedJson.toUtf8()); |
|
236 } |
|
237 |
|
238 // All signals from tab "Generic" |
168 connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditRecipe::is_changed); |
239 connect(ui->lockedEdit, &QCheckBox::stateChanged, this, &EditRecipe::is_changed); |
169 |
|
170 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditRecipe::is_changed); |
240 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditRecipe::is_changed); |
171 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed())); |
241 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed())); |
172 connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); |
242 connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); |
173 connect(ui->batch_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
243 connect(ui->batch_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
174 connect(ui->boil_timeEdit, &QSpinBox::textChanged, this, &EditRecipe::is_changed); |
244 connect(ui->boil_timeEdit, &QSpinBox::textChanged, this, &EditRecipe::is_changed); |
175 connect(ui->efficiencyEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
245 connect(ui->efficiencyEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
176 |
246 connect(ui->beerstyleEdit, &QComboBox::currentTextChanged, this, &EditRecipe::style_changed); |
|
247 connect(ui->est_ogEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
177 connect(ui->color_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); |
248 connect(ui->color_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); |
178 |
|
179 connect(ui->ibu_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); |
249 connect(ui->ibu_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); |
|
250 |
|
251 // All signals from tab "Fermentables" |
|
252 connect(ui->est_og2Edit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); |
|
253 // connect(ui->fermentablesTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
|
254 |
|
255 // All signals from tab "Hops" |
|
256 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
|
257 |
|
258 // All signals from tab "Miscs" |
|
259 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
|
260 |
|
261 // All signals from tab "Yeasts" |
|
262 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
|
263 |
|
264 // All signals from tab "Mash" |
|
265 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
|
266 |
|
267 // All signals from tab "Water" |
180 |
268 |
181 ui->saveButton->setEnabled(false); |
269 ui->saveButton->setEnabled(false); |
182 ui->deleteButton->setEnabled((id >= 0) ? true:false); |
270 ui->deleteButton->setEnabled((id >= 0) ? true:false); |
|
271 |
|
272 emit refreshAll(); |
183 } |
273 } |
184 |
274 |
185 |
275 |
186 EditRecipe::~EditRecipe() |
276 EditRecipe::~EditRecipe() |
187 { |
277 { |
188 qDebug() << "EditRecipe done start"; |
278 qDebug() << "EditRecipe done start"; |
189 delete ui; |
279 delete ui; |
190 emit entry_changed(); |
280 emit entry_changed(); |
191 qDebug() << "EditRecipe done final"; |
281 qDebug() << "EditRecipe done final"; |
|
282 } |
|
283 |
|
284 |
|
285 void EditRecipe::refreshFermentables() |
|
286 { |
|
287 QString w; |
|
288 QWidget* pWidget; |
|
289 QHBoxLayout* pLayout; |
|
290 QTableWidgetItem *item; |
|
291 QLabel *label; |
|
292 double d; |
|
293 int j; |
|
294 int total = 0; |
|
295 |
|
296 qDebug() << "refreshFermentables" << this->fermentables << this->fermentables.isArray() << this->fermentables.array().size(); |
|
297 /* During filling the table turn off the cellChanged signal because every cell that is filled |
|
298 * triggers the cellChanged signal. The QTableWidget has no better signal to use. */ |
|
299 this->ignoreChanges = true; |
|
300 |
|
301 const QStringList labels({tr("Fermentable"), tr("EBC"), tr("Type"), tr("Graintype"), tr("When"), tr("Yield"), tr("Amount"), tr("Procent"), tr("100%"), tr("Button")}); |
|
302 ui->fermentablesTable->setColumnCount(10); |
|
303 ui->fermentablesTable->setColumnWidth(0, 350); /* Fermentable */ |
|
304 ui->fermentablesTable->setColumnWidth(1, 50); /* Color */ |
|
305 ui->fermentablesTable->setColumnWidth(2, 75); /* Type */ |
|
306 ui->fermentablesTable->setColumnWidth(3, 75); /* Graintype */ |
|
307 ui->fermentablesTable->setColumnWidth(4, 75); /* Added */ |
|
308 ui->fermentablesTable->setColumnWidth(5, 75); /* Yield */ |
|
309 ui->fermentablesTable->setColumnWidth(6, 75); /* Amount */ |
|
310 ui->fermentablesTable->setColumnWidth(7, 60); /* Procent */ |
|
311 ui->fermentablesTable->setColumnWidth(8, 50); /* 100% */ |
|
312 ui->fermentablesTable->setColumnWidth(9, 80); /* Button */ |
|
313 ui->fermentablesTable->setHorizontalHeaderLabels(labels); |
|
314 ui->fermentablesTable->verticalHeader()->hide(); |
|
315 ui->fermentablesTable->setRowCount(this->fermentables.array().size()); |
|
316 |
|
317 if (this->fermentables.isArray()) { |
|
318 for (int i = 0; i < this->fermentables.array().size(); i++) { |
|
319 QJsonObject obj = this->fermentables.array().at(i).toObject(); |
|
320 |
|
321 w = obj["f_supplier"].toString()+" / "+obj["f_name"].toString(); |
|
322 ui->fermentablesTable->setItem(i, 0, new QTableWidgetItem(w)); |
|
323 |
|
324 if (obj["f_color"].isString()) |
|
325 d = QString(obj["f_color"].toString()).toDouble(); |
|
326 else |
|
327 d = obj["f_color"].toDouble(); |
|
328 w = QString("%1").arg(d, 1, 'f', 0, '0'); |
|
329 item = new QTableWidgetItem(w); |
|
330 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
|
331 ui->fermentablesTable->setItem(i, 1, item); |
|
332 |
|
333 if (obj["f_type"].isString()) |
|
334 j = QString(obj["f_type"].toString()).toInt(); |
|
335 else |
|
336 j = obj["f_type"].toInt(); |
|
337 item = new QTableWidgetItem(f_types[j]); |
|
338 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
|
339 ui->fermentablesTable->setItem(i, 2, item); |
|
340 |
|
341 if (obj["f_graintype"].isString()) |
|
342 j = QString(obj["f_graintype"].toString()).toInt(); |
|
343 else |
|
344 j = obj["f_graintype"].toInt(); |
|
345 item = new QTableWidgetItem(f_graintypes[j]); |
|
346 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
|
347 ui->fermentablesTable->setItem(i, 3, item); |
|
348 |
|
349 if (obj["f_added"].isString()) |
|
350 j = QString(obj["f_added"].toString()).toInt(); |
|
351 else |
|
352 j = obj["f_added"].toInt(); |
|
353 item = new QTableWidgetItem(f_added[j]); |
|
354 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
|
355 ui->fermentablesTable->setItem(i, 4, item); |
|
356 |
|
357 if (obj["f_yield"].isString()) |
|
358 d = QString(obj["f_yield"].toString()).toDouble(); |
|
359 else |
|
360 d = obj["f_yield"].toDouble(); |
|
361 w = QString("%1%").arg(d, 2, 'f', 1, '0'); |
|
362 item = new QTableWidgetItem(w); |
|
363 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
|
364 ui->fermentablesTable->setItem(i, 5, item); |
|
365 |
|
366 if (obj["f_amount"].isString()) |
|
367 d = QString(obj["f_amount"].toString()).toDouble(); |
|
368 else |
|
369 d = obj["f_amount"].toDouble(); |
|
370 w = QString("%1 Kg").arg(d, 4, 'f', 3, '0'); |
|
371 item = new QTableWidgetItem(w); |
|
372 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
|
373 ui->fermentablesTable->setItem(i, 6, item); |
|
374 |
|
375 if (obj["f_percentage"].isString()) |
|
376 d = QString(obj["f_percentage"].toString()).toDouble(); |
|
377 else |
|
378 d = obj["f_percentage"].toDouble(); |
|
379 w = QString("%1%").arg(d, 2, 'f', 1, '0'); |
|
380 item = new QTableWidgetItem(w); |
|
381 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
|
382 ui->fermentablesTable->setItem(i, 7, item); |
|
383 |
|
384 if (obj["f_adjust_to_total_100"].toString().toInt()) { |
|
385 pWidget = new QWidget(); |
|
386 label = new QLabel; |
|
387 label->setPixmap(QPixmap(":icons/silk/tick.png")); |
|
388 pLayout = new QHBoxLayout(pWidget); |
|
389 pLayout->addWidget(label); |
|
390 pLayout->setAlignment(Qt::AlignCenter); |
|
391 pLayout->setContentsMargins(0, 0, 0, 0); |
|
392 pWidget->setLayout(pLayout); |
|
393 ui->fermentablesTable->setCellWidget(i, 8, pWidget); |
|
394 } else { |
|
395 ui->fermentablesTable->removeCellWidget(i, 8); |
|
396 } |
|
397 |
|
398 /* Add the Delete row button */ |
|
399 pWidget = new QWidget(); |
|
400 QPushButton* btn_edit = new QPushButton(); |
|
401 btn_edit->setObjectName(QString("%1").arg(i)); /* Send row with the button */ |
|
402 btn_edit->setText(tr("Delete")); |
|
403 connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_deleteFermentRow_clicked())); |
|
404 pLayout = new QHBoxLayout(pWidget); |
|
405 pLayout->addWidget(btn_edit); |
|
406 pLayout->setContentsMargins(5, 0, 5, 0); |
|
407 pWidget->setLayout(pLayout); |
|
408 ui->fermentablesTable->setCellWidget(i, 9, pWidget); |
|
409 } |
|
410 } |
|
411 |
|
412 this->ignoreChanges = false; |
|
413 } |
|
414 |
|
415 |
|
416 void EditRecipe::refreshHops() |
|
417 { |
|
418 } |
|
419 |
|
420 |
|
421 void EditRecipe::refreshMiscs() |
|
422 { |
|
423 } |
|
424 |
|
425 |
|
426 void EditRecipe::refreshYeasts() |
|
427 { |
|
428 } |
|
429 |
|
430 |
|
431 void EditRecipe::refreshMashs() |
|
432 { |
|
433 } |
|
434 |
|
435 |
|
436 void EditRecipe::refreshAll() |
|
437 { |
|
438 refreshFermentables(); |
|
439 |
|
440 calcFermentables(); |
|
441 } |
|
442 |
|
443 |
|
444 void EditRecipe::calcFermentables() |
|
445 { |
|
446 int i; |
|
447 bool my_100 = false; |
|
448 double psugar = 0, pcara = 0, d, s = 0, x; |
|
449 double vol = 0; // Volume sugars after boil |
|
450 double addedS = 0; // Added sugars after boil |
|
451 double addedmass = 0; // Added mass after boil |
|
452 double mvol = 0; // Mash volume |
|
453 double lintner = 0; // Total recipe lintner |
|
454 double mashkg = 0; |
|
455 double sugarsf = 0; // fermentable sugars mash + boil |
|
456 double sugarsm = 0; // fermentable sugars in mash |
|
457 double sugardensity = 1.611; // kg/l in solution |
|
458 QJsonObject obj; |
|
459 |
|
460 qDebug() << "calcFermentables()"; |
|
461 |
|
462 // Get mashtemp and mashtime from the Mash schedule. |
|
463 |
|
464 if (this->fermentables.array().size() < 1) { |
|
465 qDebug() << " no fermentables, return."; |
|
466 return; |
|
467 } |
|
468 |
|
469 for (i = 0; i < this->fermentables.array().size(); i++) { |
|
470 obj = this->fermentables.array().at(i).toObject(); |
|
471 if (obj["f_adjust_to_total_100"].toInt()) { |
|
472 my_100 = true; |
|
473 } |
|
474 if (obj["f_type"].toInt() == 1 && obj["f_added"].toInt() < 4) // Sugars |
|
475 psugar += obj["f_percentage"].toDouble(); |
|
476 if (obj["f_graintype"].toInt() == 2 && obj["f_added"].toInt() < 4) // Crystal/Cara |
|
477 pcara += obj["f_percentage"].toDouble(); |
|
478 d = obj["f_amount"].toDouble() * (obj["f_yield"].toDouble() / 100) * (1 - obj["f_moisture"].toDouble() / 100); |
|
479 if (obj["f_added"].toInt() == 0) { // Mash |
|
480 if (mvol > 0) { // If mash volume is known |
|
481 mvol += obj["f_amount"].toDouble() * obj["f_moisture"].toDouble() / 100; |
|
482 s += d; |
|
483 } |
|
484 d = ui->efficiencyEdit->value() / 100 * d; |
|
485 sugarsm += d; |
|
486 mashkg += obj["f_amount"].toDouble(); |
|
487 } |
|
488 if (obj["f_added"].toInt() == 0 || obj["f_added"].toInt() == 1) // Mash or boil |
|
489 sugarsf += d; |
|
490 if (obj["f_added"].toInt() == 2 || obj["f_added"].toInt() == 3) { // Fermentation or lagering |
|
491 x = (obj["f_yield"].toDouble() / 100) * (1 - obj["f_moisture"].toDouble() / 100); |
|
492 addedS += obj["f_amount"].toDouble() * x; |
|
493 addedmass += obj["f_amount"].toDouble(); |
|
494 vol += (x * sugardensity + (1 - x) * 1) * obj["f_amount"].toDouble(); |
|
495 } |
|
496 if (obj["f_added"].toInt() == 0 && (obj["f_type"].toInt() == 0 || obj["f_type"].toInt() == 4) && obj["f_color"].toDouble() < 50) { |
|
497 lintner += obj["f_diastatic_power"].toDouble() * obj["f_amount"].toDouble(); |
|
498 } |
|
499 if (obj["f_added"].toInt() < 4) { |
|
500 // colors |
|
501 } |
|
502 } |
|
503 |
|
504 qDebug() << " lintner" << lintner << " mashkg" << mashkg << "final" << round(lintner / mashkg); |
|
505 ui->lintnerShow->setValue(round(lintner / mashkg)); |
192 } |
506 } |
193 |
507 |
194 |
508 |
195 /* |
509 /* |
196 * Window header, mark any change with '**' |
510 * Window header, mark any change with '**' |