src/EditRecipeExport.cpp

changeset 282
d1d208a857b0
parent 280
efc213beb605
child 283
242a68fa7186
equal deleted inserted replaced
281:af3dac6ff6c3 282:d1d208a857b0
114 114
115 xmlWriter->writeStartElement("HOPS"); 115 xmlWriter->writeStartElement("HOPS");
116 for (int i = 0; i < recipe->hops.size(); i++) { 116 for (int i = 0; i < recipe->hops.size(); i++) {
117 xmlWriter->writeStartElement("HOP"); 117 xmlWriter->writeStartElement("HOP");
118 xmlWriter->writeTextElement("VERSION", "1"); 118 xmlWriter->writeTextElement("VERSION", "1");
119 xmlWriter->writeTextElement("NAME", recipe->hops.at(i).h_name); 119 xmlWriter->writeTextElement("NAME", recipe->hops.at(i).name);
120 xmlWriter->writeTextElement("ALPHA", QString::number(recipe->hops.at(i).h_alpha, 'f', 1)); 120 xmlWriter->writeTextElement("ALPHA", QString::number(recipe->hops.at(i).alpha, 'f', 1));
121 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->hops.at(i).h_amount, 'f', 4)); 121 xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->hops.at(i).amount, 'f', 4));
122 xmlWriter->writeTextElement("USE", hop_use[recipe->hops.at(i).h_useat]); 122 xmlWriter->writeTextElement("USE", hop_use[recipe->hops.at(i).useat]);
123 xmlWriter->writeTextElement("TIME", QString::number(recipe->hops.at(i).h_time, 'f', 0)); 123 xmlWriter->writeTextElement("TIME", QString::number(recipe->hops.at(i).time, 'f', 0));
124 xmlWriter->writeTextElement("TYPE", hop_types[recipe->hops.at(i).h_type]); 124 xmlWriter->writeTextElement("TYPE", hop_types[recipe->hops.at(i).type]);
125 xmlWriter->writeTextElement("FORM", hop_forms[recipe->hops.at(i).h_form]); 125 xmlWriter->writeTextElement("FORM", hop_forms[recipe->hops.at(i).form]);
126 xmlWriter->writeTextElement("BETA", QString::number(recipe->hops.at(i).h_beta, 'f', 1)); 126 xmlWriter->writeTextElement("BETA", QString::number(recipe->hops.at(i).beta, 'f', 1));
127 xmlWriter->writeTextElement("HSI", QString::number(recipe->hops.at(i).h_hsi, 'f', 1)); 127 xmlWriter->writeTextElement("HSI", QString::number(recipe->hops.at(i).hsi, 'f', 1));
128 xmlWriter->writeTextElement("ORIGIN", recipe->hops.at(i).h_origin); 128 xmlWriter->writeTextElement("ORIGIN", recipe->hops.at(i).origin);
129 xmlWriter->writeEndElement(); 129 xmlWriter->writeEndElement();
130 } 130 }
131 xmlWriter->writeEndElement(); // HOPS 131 xmlWriter->writeEndElement(); // HOPS
132 132
133 xmlWriter->writeStartElement("FERMENTABLES"); 133 xmlWriter->writeStartElement("FERMENTABLES");
279 } 279 }
280 280
281 281
282 void EditRecipe::copyProduct() 282 void EditRecipe::copyProduct()
283 { 283 {
284 Product *p = new Product; 284 Product *p = new Product();
285 285
286 p->record = -1; 286 p->record = -1;
287 p->name = recipe->name + QString(" [duplicate]"); 287 p->name = recipe->name + QString(" [duplicate]");
288 p->code = ""; 288 p->code = "";
289 p->birth = QDate::currentDate(); 289 p->birth = QDate::currentDate();
290 p->stage = p->inventory_reduced = PROD_STAGE_PLAN; 290 p->stage = p->inventory_reduced = PROD_STAGE_PLAN;
291 p->notes = recipe->notes; 291 p->notes = recipe->notes;
292 p->log_brew = p->log_fermentation = p->log_ispindel = p->log_co2pressure = p->locked = false; 292 // p->log_brew = p->log_fermentation = p->log_ispindel = p->log_co2pressure = p->locked = false;
293 293
294 p->st_name = recipe->st_name; 294 p->st_name = recipe->st_name;
295 p->st_letter = recipe->st_letter; 295 p->st_letter = recipe->st_letter;
296 p->st_guide = recipe->st_guide; 296 p->st_guide = recipe->st_guide;
297 p->st_category = recipe->st_category; 297 p->st_category = recipe->st_category;
311 p->st_abv_max = recipe->st_abv_max; 311 p->st_abv_max = recipe->st_abv_max;
312 312
313 p->eq_name = QString("Not yet set"); 313 p->eq_name = QString("Not yet set");
314 p->eq_notes = QString(""); 314 p->eq_notes = QString("");
315 p->eq_tun_specific_heat = 0.11; 315 p->eq_tun_specific_heat = 0.11;
316 p->eq_tun_material = 0; 316 // p->eq_tun_material = 0;
317 p->eq_tun_volume = p->eq_tun_height = 20; 317 p->eq_tun_volume = p->eq_tun_height = 20;
318 p->eq_tun_weight = 2; 318 p->eq_tun_weight = 2;
319 p->eq_top_up_water = 0; 319 // p->eq_top_up_water = 0;
320 p->eq_trub_chiller_loss = 0.5; 320 p->eq_trub_chiller_loss = 0.5;
321 p->eq_evap_rate = 1.8; 321 p->eq_evap_rate = 1.8;
322 p->eq_calc_boil_volume = true; 322 p->eq_calc_boil_volume = true;
323 p->eq_top_up_kettle = 0; 323 // p->eq_top_up_kettle = 0;
324 p->eq_hop_utilization = 100; 324 p->eq_hop_utilization = 100;
325 p->eq_lauter_volume = p->eq_lauter_height = p->eq_kettle_volume = p->eq_kettle_height = p->eq_mash_volume = 20; 325 p->eq_lauter_volume = p->eq_lauter_height = p->eq_kettle_volume = p->eq_kettle_height = p->eq_mash_volume = 20;
326 p->eq_lauter_deadspace = 0.5; 326 p->eq_lauter_deadspace = 0.5;
327 p->eq_mash_max = 6; 327 p->eq_mash_max = 6;
328 p->eq_efficiency = p->efficiency = recipe->efficiency; 328 p->eq_efficiency = p->efficiency = recipe->efficiency;
337 p->est_color = recipe->est_color; 337 p->est_color = recipe->est_color;
338 p->est_ibu = recipe->est_ibu; 338 p->est_ibu = recipe->est_ibu;
339 p->est_abv = recipe->est_abv; 339 p->est_abv = recipe->est_abv;
340 340
341 p->brew_date_start = p->brew_date_end = QDateTime(); 341 p->brew_date_start = p->brew_date_end = QDateTime();
342 p->brew_mash_ph = p->brew_mash_sg = p->brew_mash_efficiency = 0; 342 // p->brew_mash_ph = p->brew_mash_sg = p->brew_mash_efficiency = 0;
343 p->brew_sparge_temperature = p->brew_sparge_volume = p->brew_sparge_est = p->brew_sparge_ph = 0; 343 // p->brew_sparge_temperature = p->brew_sparge_volume = p->brew_sparge_est = p->brew_sparge_ph = 0;
344 p->brew_preboil_volume = p->brew_preboil_sg = p->brew_preboil_ph = p->brew_preboil_efficiency = 0; 344 // p->brew_preboil_volume = p->brew_preboil_sg = p->brew_preboil_ph = p->brew_preboil_efficiency = 0;
345 p->brew_aboil_volume = p->brew_aboil_sg = p->brew_aboil_ph = p->brew_aboil_efficiency = 0; 345 // p->brew_aboil_volume = p->brew_aboil_sg = p->brew_aboil_ph = p->brew_aboil_efficiency = 0;
346 p->brew_cooling_method = p->brew_cooling_time = 0; 346 // p->brew_cooling_method = p->brew_cooling_time = 0;
347 p->brew_cooling_to = 20; 347 p->brew_cooling_to = 20;
348 p->brew_whirlpool9 = p->brew_whirlpool7 = p->brew_whirlpool6 = p->brew_whirlpool2 = 0; 348 // p->brew_whirlpool9 = p->brew_whirlpool7 = p->brew_whirlpool6 = p->brew_whirlpool2 = 0;
349 p->brew_fermenter_volume = p->brew_fermenter_extrawater = p->brew_fermenter_tcloss = 0; 349 // p->brew_fermenter_volume = p->brew_fermenter_extrawater = p->brew_fermenter_tcloss = 0;
350 p->brew_aeration_time = p->brew_aeration_speed = p->brew_aeration_type = 0; 350 // p->brew_aeration_time = p->brew_aeration_speed = p->brew_aeration_type = 0;
351 p->brew_fermenter_sg = p->brew_fermenter_ibu = p->brew_fermenter_color = 0; 351 // p->brew_fermenter_sg = p->brew_fermenter_ibu = p->brew_fermenter_color = 0;
352 352
353 p->og = p->fg = 0; 353 // p->og = p->fg = 0;
354 p->primary_start_temp = p->primary_max_temp = p->primary_end_temp = p->primary_end_sg = 0; 354 // p->primary_start_temp = p->primary_max_temp = p->primary_end_temp = p->primary_end_sg = 0;
355 p->primary_end_date = p->secondary_end_date = QDate(); 355 p->primary_end_date = p->secondary_end_date = QDate();
356 p->secondary_temp = p->secondary_end_sg = p->tertiary_temp = 0; 356 // p->secondary_temp = p->secondary_end_sg = p->tertiary_temp = 0;
357 p->package_date = QDate(); 357 p->package_date = QDate();
358 p->package_volume = p->package_infuse_amount = p->package_infuse_abv = p->package_abv = p->package_ph = 0; 358 // p->package_volume = p->package_infuse_amount = p->package_infuse_abv = p->package_abv = p->package_ph = 0;
359 p->package_infuse_notes = ""; 359 p->package_infuse_notes = "";
360 p->bottle_amount = p->bottle_carbonation = p->bottle_priming_amount = p->bottle_carbonation_temp = 0; 360 // p->bottle_amount = p->bottle_carbonation = p->bottle_priming_amount = p->bottle_carbonation_temp = 0;
361 p->keg_amount = p->keg_carbonation = p->keg_priming_amount = p->keg_carbonation_temp = 0; 361 // p->keg_amount = p->keg_carbonation = p->keg_priming_amount = p->keg_carbonation_temp = 0;
362 p->keg_pressure = 0; 362 // p->keg_pressure = 0;
363 p->bottle_priming_water = p->keg_priming_water = 0; 363 // p->bottle_priming_water = p->keg_priming_water = 0;
364 p->bottle_priming_sugar = p->keg_priming_sugar = 0; 364 // p->bottle_priming_sugar = p->keg_priming_sugar = 0;
365 p->taste_rate = 0; 365 // p->taste_rate = 0;
366 p->taste_date = QDate(); 366 p->taste_date = QDate();
367 p->taste_notes = p->taste_color = p->taste_transparency = p->taste_head = ""; 367 p->taste_notes = p->taste_color = p->taste_transparency = p->taste_head = "";
368 p->taste_aroma = p->taste_taste = p->taste_mouthfeel = p->taste_aftertaste = ""; 368 p->taste_aroma = p->taste_taste = p->taste_mouthfeel = p->taste_aftertaste = "";
369 369
370 p->sparge_temp = recipe->sparge_temp; 370 p->sparge_temp = recipe->sparge_temp;
414 p->wa_acid_name = recipe->wa_acid_name; 414 p->wa_acid_name = recipe->wa_acid_name;
415 p->wa_acid_perc = recipe->wa_acid_perc; 415 p->wa_acid_perc = recipe->wa_acid_perc;
416 p->wa_base_name = recipe->wa_base_name; 416 p->wa_base_name = recipe->wa_base_name;
417 417
418 p->starter_enable = false; 418 p->starter_enable = false;
419 p->starter_type = p->prop_type[0] = p->prop_type[1] = p->prop_type[2] = p->prop_type[3] = 0; 419 // p->starter_type = p->prop_type[0] = p->prop_type[1] = p->prop_type[2] = p->prop_type[3] = 0;
420 p->starter_viability = 100; 420 p->starter_viability = 100;
421 p->starter_sg = 1.037; 421 p->starter_sg = 1.037;
422 p->yeast_prod_date = QDate(); 422 p->yeast_prod_date = QDate();
423 p->yeast_pitchrate = p->prop_volume[0] = p->prop_volume[1] = p->prop_volume[2] = p->prop_volume[3] = 0; 423 // p->yeast_pitchrate = p->prop_volume[0] = p->prop_volume[1] = p->prop_volume[2] = p->prop_volume[3] = 0;
424 p->divide_type = p->divide_parts = p->divide_part = 0; 424 // p->divide_type = p->divide_parts = p->divide_part = 0;
425 p->divide_size = 0; 425 // p->divide_size = 0;
426 p->divide_factor = 1; 426 p->divide_factor = 1;
427 427
428 p->fermentables = recipe->fermentables; 428 p->fermentables = recipe->fermentables;
429 p->hops = recipe->hops; 429 p->hops = recipe->hops;
430 p->miscs = recipe->miscs; 430 p->miscs = recipe->miscs;
486 486
487 memo.append("[u][b]Hop[/b][/u]\n"); 487 memo.append("[u][b]Hop[/b][/u]\n");
488 memo.append("[tabular]\n"); 488 memo.append("[tabular]\n");
489 memo.append("[head]Hop[/head][head]Vorm[/head][head]Alpha[/head][head]IBU[/head][head]Gram[/head][head]Toevoegen moment[/head]\n"); 489 memo.append("[head]Hop[/head][head]Vorm[/head][head]Alpha[/head][head]IBU[/head][head]Gram[/head][head]Toevoegen moment[/head]\n");
490 for (int i = 0; i < recipe->hops.size(); i++) { 490 for (int i = 0; i < recipe->hops.size(); i++) {
491 double ibu = Utils::toIBU(recipe->hops.at(i).h_useat, recipe->hops.at(i).h_form, recipe->preboil_sg, recipe->batch_size, 491 double ibu = Utils::toIBU(recipe->hops.at(i).useat, recipe->hops.at(i).form, recipe->preboil_sg, recipe->batch_size,
492 recipe->hops.at(i).h_amount, recipe->hops.at(i).h_time, recipe->hops.at(i).h_alpha, recipe->ibu_method, 492 recipe->hops.at(i).amount, recipe->hops.at(i).time, recipe->hops.at(i).alpha, recipe->ibu_method,
493 0, recipe->hops.at(i).h_time, 0, recipe->boil_time); 493 0, recipe->hops.at(i).time, 0, recipe->boil_time);
494 memo.append("[row][data]" + recipe->hops.at(i).h_name + " (" + recipe->hops.at(i).h_origin + ")[/data]"); 494 memo.append("[row][data]" + recipe->hops.at(i).name + " (" + recipe->hops.at(i).origin + ")[/data]");
495 memo.append("[data]" + hop_forms[recipe->hops.at(i).h_form] + "[/data]"); 495 memo.append("[data]" + hop_forms[recipe->hops.at(i).form] + "[/data]");
496 memo.append("[data]" + QString::number(recipe->hops.at(i).h_alpha, 'f', 1) + "[/data]"); 496 memo.append("[data]" + QString::number(recipe->hops.at(i).alpha, 'f', 1) + "[/data]");
497 memo.append("[data]" + QString::number(ibu, 'f', 1) + "[/data]"); 497 memo.append("[data]" + QString::number(ibu, 'f', 1) + "[/data]");
498 memo.append("[data]" + QString::number(recipe->hops.at(i).h_amount * 1000, 'f', 2) + "[/data]"); 498 memo.append("[data]" + QString::number(recipe->hops.at(i).amount * 1000, 'f', 2) + "[/data]");
499 if (recipe->hops.at(i).h_useat == HOP_USEAT_BOIL || recipe->hops.at(i).h_useat == HOP_USEAT_WHIRLPOOL) 499 if (recipe->hops.at(i).useat == HOP_USEAT_BOIL || recipe->hops.at(i).useat == HOP_USEAT_WHIRLPOOL)
500 memo.append("[data]" + hop_use[recipe->hops.at(i).h_useat] + " " + QString::number(recipe->hops.at(i).h_time) + " minuten[/data][/row]\n"); 500 memo.append("[data]" + hop_use[recipe->hops.at(i).useat] + " " + QString::number(recipe->hops.at(i).time) + " minuten[/data][/row]\n");
501 else if (recipe->hops.at(i).h_useat == HOP_USEAT_DRY_HOP) 501 else if (recipe->hops.at(i).useat == HOP_USEAT_DRY_HOP)
502 memo.append("[data]" + hop_use[recipe->hops.at(i).h_useat] + " " + QString::number(recipe->hops.at(i).h_time / 1440) + " dagen[/data][/row]\n"); 502 memo.append("[data]" + hop_use[recipe->hops.at(i).useat] + " " + QString::number(recipe->hops.at(i).time / 1440) + " dagen[/data][/row]\n");
503 else 503 else
504 memo.append("[data]" + hop_use[recipe->hops.at(i).h_useat] + "[/data][/row]\n"); 504 memo.append("[data]" + hop_use[recipe->hops.at(i).useat] + "[/data][/row]\n");
505 } 505 }
506 memo.append("[/tabular]\n\n"); 506 memo.append("[/tabular]\n\n");
507 507
508 memo.append("[u][b]Diversen[/b][/u]\n"); 508 memo.append("[u][b]Diversen[/b][/u]\n");
509 memo.append("[tabular]\n"); 509 memo.append("[tabular]\n");

mercurial