45 ui->color_methodEdit->addItem("Naudts"); |
46 ui->color_methodEdit->addItem("Naudts"); |
46 |
47 |
47 ui->ibu_methodEdit->addItem("Tinseth"); |
48 ui->ibu_methodEdit->addItem("Tinseth"); |
48 ui->ibu_methodEdit->addItem("Rager"); |
49 ui->ibu_methodEdit->addItem("Rager"); |
49 ui->ibu_methodEdit->addItem("Daniels"); |
50 ui->ibu_methodEdit->addItem("Daniels"); |
|
51 |
|
52 for (int i = 0; i < my_acids.size(); i++) { |
|
53 qDebug() << i << my_acids.at(i).name; |
|
54 ui->mw_acidPick->addItem(my_acids.at(i).name); |
|
55 ui->sp_acidtypeEdit->addItem(my_acids.at(i).name); |
|
56 } |
|
57 |
|
58 ui->sp_sourceEdit->addItem(tr("Source 1")); |
|
59 ui->sp_sourceEdit->addItem(tr("Source 2")); |
|
60 ui->sp_sourceEdit->addItem(tr("Mixed")); |
50 |
61 |
51 ui->beerstyleEdit->addItem(""); // First add a dummy |
62 ui->beerstyleEdit->addItem(""); // First add a dummy |
52 query.prepare("SELECT style_guide,style_letter,name FROM profile_styles ORDER BY style_guide,style_letter,name"); |
63 query.prepare("SELECT style_guide,style_letter,name FROM profile_styles ORDER BY style_guide,style_letter,name"); |
53 query.exec(); |
64 query.exec(); |
54 query.first(); |
65 query.first(); |
158 if (parseError.error != QJsonParseError::NoError) { |
169 if (parseError.error != QJsonParseError::NoError) { |
159 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
170 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
160 } else if (fermentables.isArray()) { |
171 } else if (fermentables.isArray()) { |
161 for (int i = 0; i < fermentables.array().size(); i++) { |
172 for (int i = 0; i < fermentables.array().size(); i++) { |
162 QJsonObject obj = fermentables.array().at(i).toObject(); |
173 QJsonObject obj = fermentables.array().at(i).toObject(); |
|
174 qDebug() << i << obj; |
163 Fermentables f; |
175 Fermentables f; |
164 f.f_name = obj["f_name"].toString(); |
176 f.f_name = obj["f_name"].toString(); |
165 f.f_origin = obj["f_origin"].toString(); |
177 f.f_origin = obj["f_origin"].toString(); |
166 f.f_supplier = obj["f_supplier"].toString(); |
178 f.f_supplier = obj["f_supplier"].toString(); |
167 f.f_amount = obj["f_amount"].toDouble(); |
179 f.f_amount = obj["f_amount"].toDouble(); |
200 if (parseError.error != QJsonParseError::NoError) { |
212 if (parseError.error != QJsonParseError::NoError) { |
201 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset; |
213 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset; |
202 } else if (hops.isArray()) { |
214 } else if (hops.isArray()) { |
203 for (int i = 0; i < hops.array().size(); i++) { |
215 for (int i = 0; i < hops.array().size(); i++) { |
204 QJsonObject obj = hops.array().at(i).toObject(); |
216 QJsonObject obj = hops.array().at(i).toObject(); |
205 qDebug() << i << obj; |
217 // qDebug() << i << obj; |
206 Hops h; |
218 Hops h; |
207 h.h_name = obj["h_name"].toString(); |
219 h.h_name = obj["h_name"].toString(); |
208 h.h_origin = obj["h_origin"].toString(); |
220 h.h_origin = obj["h_origin"].toString(); |
209 h.h_amount = obj["h_amount"].toDouble(); |
221 h.h_amount = obj["h_amount"].toDouble(); |
210 h.h_cost = obj["h_cost"].toDouble(); |
222 h.h_cost = obj["h_cost"].toDouble(); |
226 } |
238 } |
227 } else { |
239 } else { |
228 qDebug() << "empty hops"; |
240 qDebug() << "empty hops"; |
229 } |
241 } |
230 |
242 |
|
243 qDebug() << query.value(86).toString(); |
231 const auto& m_json = query.value(86).toString(); |
244 const auto& m_json = query.value(86).toString(); |
232 if (!m_json.trimmed().isEmpty()) { |
245 if (!m_json.trimmed().isEmpty()) { |
233 const auto& formattedJson = QString("%1").arg(m_json); |
246 const auto& formattedJson = QString("%1").arg(m_json); |
234 QJsonDocument miscs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
247 QJsonDocument miscs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
235 if (parseError.error != QJsonParseError::NoError) { |
248 if (parseError.error != QJsonParseError::NoError) { |
236 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset; |
249 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset; |
237 } else if (miscs.isArray()) { |
250 } else if (miscs.isArray()) { |
238 for (int i = 0; i < miscs.array().size(); i++) { |
251 for (int i = 0; i < miscs.array().size(); i++) { |
239 QJsonObject obj = miscs.array().at(i).toObject(); |
252 QJsonObject obj = miscs.array().at(i).toObject(); |
240 qDebug() << i << obj; |
253 qDebug() << i << obj; |
241 Miscs m; |
254 Miscs m; |
242 m.m_name = obj["m_name"].toString(); |
255 m.m_name = obj["m_name"].toString(); |
243 m.m_amount = obj["m_amount"].toDouble(); |
256 m.m_amount = obj["m_amount"].toDouble(); |
244 m.m_type = obj["m_type"].toInt(); |
257 m.m_type = obj["m_type"].toInt(); |
245 m.m_use_use = obj["m_type"].toInt(); |
258 m.m_use_use = obj["m_use_use"].toInt(); |
246 m.m_time = obj["m_time"].toDouble(); |
259 m.m_time = obj["m_time"].toDouble(); |
247 m.m_amount_is_weight = obj["m_amount_is_weight"].toInt() ? true:false; |
260 m.m_amount_is_weight = obj["m_amount_is_weight"].toInt() ? true:false; |
248 m.m_cost = obj["m_cost"].toDouble(); |
261 m.m_cost = obj["m_cost"].toDouble(); |
249 recipe->miscs.append(m); |
262 recipe->miscs.append(m); |
250 } |
263 } |
263 } else if (yeasts.isArray()) { |
277 } else if (yeasts.isArray()) { |
264 for (int i = 0; i < yeasts.array().size(); i++) { |
278 for (int i = 0; i < yeasts.array().size(); i++) { |
265 QJsonObject obj = yeasts.array().at(i).toObject(); |
279 QJsonObject obj = yeasts.array().at(i).toObject(); |
266 qDebug() << i << obj; |
280 qDebug() << i << obj; |
267 Yeasts y; |
281 Yeasts y; |
|
282 /* First some defaults for newer fields. */ |
|
283 y.y_tolerance = y.y_harvest_time = y.y_pitch_temperature = y.y_zymocide = 0; |
|
284 y.y_sta1 = y.y_bacteria = y.y_harvest_top = y.y_pofpos = false; |
|
285 y.y_gr_hl_lo = 50; |
|
286 y.y_sg_lo = 1.04; |
|
287 y.y_gr_hl_hi = 80; |
|
288 y.y_sg_hi = 1.08; |
|
289 /* Now get what we have got */ |
268 y.y_name = obj["y_name"].toString(); |
290 y.y_name = obj["y_name"].toString(); |
269 y.y_laboratory = obj["y_laboratory"].toString(); |
291 y.y_laboratory = obj["y_laboratory"].toString(); |
270 y.y_product_id = obj["y_product_id"].toString(); |
292 y.y_product_id = obj["y_product_id"].toString(); |
271 y.y_amount = obj["y_amount"].toDouble(); |
293 y.y_amount = obj["y_amount"].toDouble(); |
272 y.y_type = obj["y_type"].toInt(); |
294 y.y_type = obj["y_type"].toInt(); |
289 y.y_gr_hl_lo = obj["y_gr_hl_lo"].toInt(); |
311 y.y_gr_hl_lo = obj["y_gr_hl_lo"].toInt(); |
290 y.y_sg_lo = obj["y_sg_lo"].toDouble(); |
312 y.y_sg_lo = obj["y_sg_lo"].toDouble(); |
291 y.y_gr_hl_hi = obj["y_gr_hl_hi"].toInt(); |
313 y.y_gr_hl_hi = obj["y_gr_hl_hi"].toInt(); |
292 y.y_sg_hi = obj["y_sg_hi"].toDouble(); |
314 y.y_sg_hi = obj["y_sg_hi"].toDouble(); |
293 y.y_cost = obj["y_cost"].toDouble(); |
315 y.y_cost = obj["y_cost"].toDouble(); |
|
316 |
|
317 // Upgrade fields from current database: |
|
318 // y_tolerance y_sta1 y_bacteria y_harvest_top y_harvest_time y_pitch_temperature |
|
319 // y_pofpos y_zymocide y_gr_hl_lo y_sg_lo y_gr_hl_hi y_sg_hi |
294 recipe->yeasts.append(y); |
320 recipe->yeasts.append(y); |
295 } |
321 } |
296 qDebug() << "yeasts" << recipe->yeasts.size(); |
322 qDebug() << "yeasts" << recipe->yeasts.size(); |
297 } |
323 } |
298 } else { |
324 } else { |
306 if (parseError.error != QJsonParseError::NoError) { |
332 if (parseError.error != QJsonParseError::NoError) { |
307 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
333 qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
308 } else if (mashs.isArray()) { |
334 } else if (mashs.isArray()) { |
309 for (int i = 0; i < mashs.array().size(); i++) { |
335 for (int i = 0; i < mashs.array().size(); i++) { |
310 QJsonObject obj = mashs.array().at(i).toObject(); |
336 QJsonObject obj = mashs.array().at(i).toObject(); |
311 // qDebug() << i << obj; |
337 qDebug() << i << obj; |
312 Mashs m; |
338 Mashs m; |
313 m.step_name = obj["step_name"].toString(); |
339 m.step_name = obj["step_name"].toString(); |
314 m.step_type = obj["step_type"].toInt(); |
340 m.step_type = obj["step_type"].toInt(); |
315 m.step_volume = obj["step_volume"].toDouble(); |
341 m.step_volume = obj["step_volume"].toDouble(); |
316 m.step_infuse_amount = obj["step_infuse_amount"].toDouble(); |
342 m.step_infuse_amount = obj["step_infuse_amount"].toDouble(); |
492 connect(ui->hop_tasteShow, &QProgressBar::valueChanged, this, &EditRecipe::on_Flavour_valueChanged); |
518 connect(ui->hop_tasteShow, &QProgressBar::valueChanged, this, &EditRecipe::on_Flavour_valueChanged); |
493 connect(ui->hop_aromaShow, &QProgressBar::valueChanged, this, &EditRecipe::on_Aroma_valueChanged); |
519 connect(ui->hop_aromaShow, &QProgressBar::valueChanged, this, &EditRecipe::on_Aroma_valueChanged); |
494 connect(ui->addHop, SIGNAL(clicked()), this, SLOT(on_addHopRow_clicked())); |
520 connect(ui->addHop, SIGNAL(clicked()), this, SLOT(on_addHopRow_clicked())); |
495 |
521 |
496 // All signals from tab "Miscs" |
522 // All signals from tab "Miscs" |
497 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
523 ui->miscsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); |
498 |
524 |
499 // All signals from tab "Yeasts" |
525 // All signals from tab "Yeasts" |
500 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
|
501 |
526 |
502 // All signals from tab "Mash" |
527 // All signals from tab "Mash" |
503 // connect(ui->hopsTable, SIGNAL(cellChanged(int, int)), this, SLOT(cell_Changed(int, int))); |
|
504 |
528 |
505 // All signals from tab "Water" |
529 // All signals from tab "Water" |
506 |
530 |
507 ui->saveButton->setEnabled(false); |
531 ui->saveButton->setEnabled(false); |
508 ui->deleteButton->setEnabled((id >= 0) ? true:false); |
532 ui->deleteButton->setEnabled((id >= 0) ? true:false); |
709 query.bindValue(":json_fermentables", "[]"); |
734 query.bindValue(":json_fermentables", "[]"); |
710 } else { |
735 } else { |
711 QJsonArray array; |
736 QJsonArray array; |
712 for (int i = 0; i < recipe->fermentables.size(); i++) { |
737 for (int i = 0; i < recipe->fermentables.size(); i++) { |
713 QJsonObject obj; |
738 QJsonObject obj; |
714 obj.insert("f_acid_to_ph_57", round(recipe->fermentables.at(i).f_acid_to_ph_57 * 100000) / 100000); |
|
715 obj.insert("f_add_after_boil", recipe->fermentables.at(i).f_add_after_boil); |
|
716 obj.insert("f_added", recipe->fermentables.at(i).f_added); |
|
717 obj.insert("f_adjust_to_total_100", recipe->fermentables.at(i).f_adjust_to_total_100); |
|
718 obj.insert("f_amount", round(recipe->fermentables.at(i).f_amount * 10000) / 10000); |
|
719 obj.insert("f_coarse_fine_diff", round(recipe->fermentables.at(i).f_coarse_fine_diff * 10) / 10); |
|
720 obj.insert("f_color", round(recipe->fermentables.at(i).f_color * 10) / 10); |
|
721 obj.insert("f_cost", round(recipe->fermentables.at(i).f_cost * 1000) / 1000); |
|
722 obj.insert("f_di_ph", round(recipe->fermentables.at(i).f_di_ph * 100000) / 100000); |
|
723 obj.insert("f_diastatic_power", round(recipe->fermentables.at(i).f_diastatic_power * 100000) / 100000); |
|
724 obj.insert("f_dissolved_protein", round(recipe->fermentables.at(i).f_dissolved_protein * 10) / 10); |
|
725 obj.insert("f_graintype", recipe->fermentables.at(i).f_graintype); |
|
726 obj.insert("f_max_in_batch", recipe->fermentables.at(i).f_max_in_batch); |
|
727 obj.insert("f_moisture", round(recipe->fermentables.at(i).f_moisture * 10) / 10); |
|
728 obj.insert("f_name", recipe->fermentables.at(i).f_name); |
739 obj.insert("f_name", recipe->fermentables.at(i).f_name); |
729 obj.insert("f_origin", recipe->fermentables.at(i).f_origin); |
740 obj.insert("f_origin", recipe->fermentables.at(i).f_origin); |
730 obj.insert("f_percentage", round(recipe->fermentables.at(i).f_percentage * 10) / 10); |
|
731 obj.insert("f_protein", round(recipe->fermentables.at(i).f_protein * 10) / 10); |
|
732 obj.insert("f_recommend_mash", recipe->fermentables.at(i).f_recommend_mash); |
|
733 obj.insert("f_supplier", recipe->fermentables.at(i).f_supplier); |
741 obj.insert("f_supplier", recipe->fermentables.at(i).f_supplier); |
|
742 obj.insert("f_amount", round(recipe->fermentables.at(i).f_amount * 10000) / 10000); |
|
743 obj.insert("f_cost", round(recipe->fermentables.at(i).f_cost * 1000) / 1000); |
734 obj.insert("f_type", recipe->fermentables.at(i).f_type); |
744 obj.insert("f_type", recipe->fermentables.at(i).f_type); |
735 obj.insert("f_yield", round(recipe->fermentables.at(i).f_yield * 10) / 10); |
745 obj.insert("f_yield", round(recipe->fermentables.at(i).f_yield * 10) / 10); |
|
746 obj.insert("f_color", round(recipe->fermentables.at(i).f_color * 10) / 10); |
|
747 obj.insert("f_coarse_fine_diff", round(recipe->fermentables.at(i).f_coarse_fine_diff * 10) / 10); |
|
748 obj.insert("f_moisture", round(recipe->fermentables.at(i).f_moisture * 10) / 10); |
|
749 obj.insert("f_diastatic_power", round(recipe->fermentables.at(i).f_diastatic_power * 100000) / 100000); |
|
750 obj.insert("f_protein", round(recipe->fermentables.at(i).f_protein * 10) / 10); |
|
751 obj.insert("f_dissolved_protein", round(recipe->fermentables.at(i).f_dissolved_protein * 10) / 10); |
|
752 obj.insert("f_max_in_batch", recipe->fermentables.at(i).f_max_in_batch); |
|
753 obj.insert("f_graintype", recipe->fermentables.at(i).f_graintype); |
|
754 obj.insert("f_added", recipe->fermentables.at(i).f_added); |
|
755 obj.insert("f_recommend_mash", recipe->fermentables.at(i).f_recommend_mash ? 1:0); |
|
756 obj.insert("f_add_after_boil", recipe->fermentables.at(i).f_add_after_boil ? 1:0); |
|
757 obj.insert("f_adjust_to_total_100", recipe->fermentables.at(i).f_adjust_to_total_100 ? 1:0); |
|
758 obj.insert("f_percentage", round(recipe->fermentables.at(i).f_percentage * 10) / 10); |
|
759 obj.insert("f_di_ph", round(recipe->fermentables.at(i).f_di_ph * 100000) / 100000); |
|
760 obj.insert("f_acid_to_ph_57", round(recipe->fermentables.at(i).f_acid_to_ph_57 * 100000) / 100000); |
|
761 qDebug() << "fermentables_Json" << i << obj; |
736 array.append(obj); /* Append this object */ |
762 array.append(obj); /* Append this object */ |
737 } |
763 } |
738 QJsonDocument doc; |
764 QJsonDocument doc; |
739 doc.setArray(array); |
765 doc.setArray(array); |
740 // qDebug() << doc.toJson(QJsonDocument::Compact); |
766 // qDebug() << doc.toJson(QJsonDocument::Compact); |
752 obj.insert("h_amount", round(recipe->hops.at(i).h_amount * 10000) / 10000); |
778 obj.insert("h_amount", round(recipe->hops.at(i).h_amount * 10000) / 10000); |
753 obj.insert("h_cost", round(recipe->hops.at(i).h_cost * 100) / 100); |
779 obj.insert("h_cost", round(recipe->hops.at(i).h_cost * 100) / 100); |
754 obj.insert("h_type", recipe->hops.at(i).h_type); |
780 obj.insert("h_type", recipe->hops.at(i).h_type); |
755 obj.insert("h_form", recipe->hops.at(i).h_form); |
781 obj.insert("h_form", recipe->hops.at(i).h_form); |
756 obj.insert("h_useat", recipe->hops.at(i).h_useat); |
782 obj.insert("h_useat", recipe->hops.at(i).h_useat); |
757 obj.insert("h_time", recipe->hops.at(i).h_time); |
783 obj.insert("h_time", round(recipe->hops.at(i).h_time)); |
758 obj.insert("h_alpha", round(recipe->hops.at(i).h_alpha * 100) / 100); |
784 obj.insert("h_alpha", round(recipe->hops.at(i).h_alpha * 100) / 100); |
759 obj.insert("h_beta", round(recipe->hops.at(i).h_beta * 100) / 100); |
785 obj.insert("h_beta", round(recipe->hops.at(i).h_beta * 100) / 100); |
760 obj.insert("h_hsi", round(recipe->hops.at(i).h_hsi * 100) / 100); |
786 obj.insert("h_hsi", round(recipe->hops.at(i).h_hsi * 100) / 100); |
761 obj.insert("h_humulene", round(recipe->hops.at(i).h_humulene * 100) / 100); |
787 obj.insert("h_humulene", round(recipe->hops.at(i).h_humulene * 100) / 100); |
762 obj.insert("h_caryophyllene", round(recipe->hops.at(i).h_caryophyllene * 100) / 100); |
788 obj.insert("h_caryophyllene", round(recipe->hops.at(i).h_caryophyllene * 100) / 100); |
763 obj.insert("h_cohumulone", round(recipe->hops.at(i).h_cohumulone * 100) / 100); |
789 obj.insert("h_cohumulone", round(recipe->hops.at(i).h_cohumulone * 100) / 100); |
764 obj.insert("h_myrcene", round(recipe->hops.at(i).h_myrcene * 100) / 100); |
790 obj.insert("h_myrcene", round(recipe->hops.at(i).h_myrcene * 100) / 100); |
765 obj.insert("h_total_oil", round(recipe->hops.at(i).h_total_oil * 100) / 100); |
791 obj.insert("h_total_oil", round(recipe->hops.at(i).h_total_oil * 100) / 100); |
766 // qDebug() << "hops_Json" << i << obj; |
792 qDebug() << "hops_Json" << i << obj; |
767 array.append(obj); /* Append this object */ |
793 array.append(obj); /* Append this object */ |
768 } |
794 } |
769 QJsonDocument doc; |
795 QJsonDocument doc; |
770 doc.setArray(array); |
796 doc.setArray(array); |
771 query.bindValue(":json_hops", doc.toJson(QJsonDocument::Compact)); |
797 query.bindValue(":json_hops", doc.toJson(QJsonDocument::Compact)); |
779 QJsonObject obj; |
805 QJsonObject obj; |
780 obj.insert("m_name", recipe->miscs.at(i).m_name); |
806 obj.insert("m_name", recipe->miscs.at(i).m_name); |
781 obj.insert("m_amount", round(recipe->miscs.at(i).m_amount * 10000) / 10000); |
807 obj.insert("m_amount", round(recipe->miscs.at(i).m_amount * 10000) / 10000); |
782 obj.insert("m_type", recipe->miscs.at(i).m_type); |
808 obj.insert("m_type", recipe->miscs.at(i).m_type); |
783 obj.insert("m_use_use", recipe->miscs.at(i).m_use_use); |
809 obj.insert("m_use_use", recipe->miscs.at(i).m_use_use); |
784 obj.insert("m_time", recipe->miscs.at(i).m_time); |
810 obj.insert("m_time", round(recipe->miscs.at(i).m_time)); |
785 obj.insert("m_amount_is_weight", recipe->miscs.at(i).m_amount_is_weight); |
811 obj.insert("m_amount_is_weight", recipe->miscs.at(i).m_amount_is_weight ? 1:0); |
786 obj.insert("m_cost", recipe->miscs.at(i).m_cost); |
812 obj.insert("m_cost", round(recipe->miscs.at(i).m_cost * 10000) / 10000); |
787 // qDebug() << "miscs_Json" << i << obj; |
813 qDebug() << "miscs_Json" << i << obj; |
788 array.append(obj); /* Append this object */ |
814 array.append(obj); /* Append this object */ |
789 } |
815 } |
790 QJsonDocument doc; |
816 QJsonDocument doc; |
791 doc.setArray(array); |
817 doc.setArray(array); |
792 // qDebug() << doc.toJson(QJsonDocument::Compact); |
818 // qDebug() << doc.toJson(QJsonDocument::Compact); |
811 obj.insert("y_attenuation", round(recipe->yeasts.at(i).y_attenuation * 10) / 10); |
837 obj.insert("y_attenuation", round(recipe->yeasts.at(i).y_attenuation * 10) / 10); |
812 obj.insert("y_cells", recipe->yeasts.at(i).y_cells); |
838 obj.insert("y_cells", recipe->yeasts.at(i).y_cells); |
813 obj.insert("y_tolerance", round(recipe->yeasts.at(i).y_tolerance * 10) / 10); |
839 obj.insert("y_tolerance", round(recipe->yeasts.at(i).y_tolerance * 10) / 10); |
814 obj.insert("y_inventory", round(recipe->yeasts.at(i).y_inventory * 10000) / 10000); |
840 obj.insert("y_inventory", round(recipe->yeasts.at(i).y_inventory * 10000) / 10000); |
815 obj.insert("y_use", recipe->yeasts.at(i).y_use); |
841 obj.insert("y_use", recipe->yeasts.at(i).y_use); |
816 obj.insert("y_sta1", recipe->yeasts.at(i).y_sta1); |
842 obj.insert("y_sta1", recipe->yeasts.at(i).y_sta1 ? 1:0); |
817 obj.insert("y_bacteria", recipe->yeasts.at(i).y_bacteria); |
843 obj.insert("y_bacteria", recipe->yeasts.at(i).y_bacteria ? 1:0); |
818 obj.insert("y_harvest_top", recipe->yeasts.at(i).y_harvest_top); |
844 obj.insert("y_harvest_top", recipe->yeasts.at(i).y_harvest_top ? 1:0); |
819 obj.insert("y_harvest_time", recipe->yeasts.at(i).y_harvest_time); |
845 obj.insert("y_harvest_time", recipe->yeasts.at(i).y_harvest_time); |
820 obj.insert("y_pitch_temperature", round(recipe->yeasts.at(i).y_pitch_temperature * 10) / 10); |
846 obj.insert("y_pitch_temperature", round(recipe->yeasts.at(i).y_pitch_temperature * 10) / 10); |
821 obj.insert("y_pofpos", recipe->yeasts.at(i).y_pofpos); |
847 obj.insert("y_pofpos", recipe->yeasts.at(i).y_pofpos ? 1:0); |
822 obj.insert("y_zymocide", recipe->yeasts.at(i).y_zymocide); |
848 obj.insert("y_zymocide", recipe->yeasts.at(i).y_zymocide); |
823 obj.insert("y_gr_hl_lo", recipe->yeasts.at(i).y_gr_hl_lo); |
849 obj.insert("y_gr_hl_lo", recipe->yeasts.at(i).y_gr_hl_lo); |
824 obj.insert("y_sg_lo", round(recipe->yeasts.at(i).y_sg_lo * 1000) / 1000); |
850 obj.insert("y_sg_lo", round(recipe->yeasts.at(i).y_sg_lo * 1000) / 1000); |
825 obj.insert("y_gr_hl_hi", recipe->yeasts.at(i).y_gr_hl_hi); |
851 obj.insert("y_gr_hl_hi", recipe->yeasts.at(i).y_gr_hl_hi); |
826 obj.insert("y_sg_hi", round(recipe->yeasts.at(i).y_sg_hi * 1000) / 1000); |
852 obj.insert("y_sg_hi", round(recipe->yeasts.at(i).y_sg_hi * 1000) / 1000); |
827 obj.insert("y_cost", recipe->yeasts.at(i).y_cost); |
853 obj.insert("y_cost", round(recipe->yeasts.at(i).y_cost * 1000) / 1000); |
828 // qDebug() << "yeasts_Json" << i << obj; |
854 qDebug() << "yeasts_Json" << i << obj; |
829 array.append(obj); /* Append this object */ |
855 array.append(obj); /* Append this object */ |
830 } |
856 } |
831 QJsonDocument doc; |
857 QJsonDocument doc; |
832 doc.setArray(array); |
858 doc.setArray(array); |
833 // qDebug() << doc.toJson(QJsonDocument::Compact); |
859 // qDebug() << doc.toJson(QJsonDocument::Compact); |
848 obj.insert("step_temp", round(recipe->mashs.at(i).step_temp * 100) / 100); |
874 obj.insert("step_temp", round(recipe->mashs.at(i).step_temp * 100) / 100); |
849 obj.insert("step_time", round(recipe->mashs.at(i).step_time * 100) / 100); |
875 obj.insert("step_time", round(recipe->mashs.at(i).step_time * 100) / 100); |
850 obj.insert("ramp_time", round(recipe->mashs.at(i).ramp_time * 100) / 100); |
876 obj.insert("ramp_time", round(recipe->mashs.at(i).ramp_time * 100) / 100); |
851 obj.insert("end_temp", round(recipe->mashs.at(i).end_temp * 100) / 100); |
877 obj.insert("end_temp", round(recipe->mashs.at(i).end_temp * 100) / 100); |
852 obj.insert("step_wg_ratio", round(recipe->mashs.at(i).step_wg_ratio * 100) / 100); |
878 obj.insert("step_wg_ratio", round(recipe->mashs.at(i).step_wg_ratio * 100) / 100); |
853 // qDebug() << "mashs_Json" << i << obj; |
879 qDebug() << "mashs_Json" << i << obj; |
854 array.append(obj); /* Append this object */ |
880 array.append(obj); /* Append this object */ |
855 } |
881 } |
856 QJsonDocument doc; |
882 QJsonDocument doc; |
857 doc.setArray(array); |
883 doc.setArray(array); |
858 // qDebug() << doc.toJson(QJsonDocument::Compact); |
884 // qDebug() << doc.toJson(QJsonDocument::Compact); |