423 } |
423 } |
424 |
424 |
425 |
425 |
426 void EditProduct::toforumProduct() |
426 void EditProduct::toforumProduct() |
427 { |
427 { |
|
428 const QStringList recipetypes({ "Extract", "Partial Mash", "All Grain" }); |
|
429 const QStringList color_method({ "Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" }); |
|
430 const QStringList ibu_method({ "Tinseth", "Rager", "Daniels", "Garetz", "Mosher", "Noonan" }); |
|
431 const QStringList fermentable_added({ "Maischen", "Koken", "Hoofd/nagisting", "Lageren", "Bottelen", "Fusten" }); |
|
432 const QStringList hop_forms({ "Pellet", "Plug", "Bloemen", "Verse hop", "Cryo" }); |
|
433 const QStringList hop_use({ "Maischen", "First wort", "Koken", "Vlamuit", "Whirlpool", "Drooghop" }); |
|
434 const QStringList misc_type({ "Spice", "Herb", "Smaakstof", "Klaren", "Brouwzout", "Gist voeding", "Overig" }); |
|
435 const QStringList misc_use({ "Starter", "Maischen", "Koken", "Hoofdgisting", "Nagisting", "Bottelen" }); |
|
436 const QStringList yeast_form({ "Vloeibaar", "Droog", "Schuine buis", "Opkweek", "Ingevroren", "Flesbodem", "Gedroogd" }); |
|
437 const QStringList yeast_use({ "Hoofdgisting", "Nagisting", "Lageren", "Bottelen", "Fusten" }); |
|
438 const QStringList step_type({ "Infusie", "Verwarmen", "Decoctie" }); |
|
439 |
|
440 QString memo = QString("[u][b]BMSapp v"); |
|
441 memo.append(VERSIONSTRING); // For some stupid reason this must be on it's own. |
|
442 memo.append(" - Datum export: " + QDate::currentDate().toString("dd-MMM-yyyy") + "[/b][/u]\n\n\n"); |
|
443 memo.append("[u][b]Basis[/b][/u]\n[tabular]\n"); |
|
444 memo.append("[head]Omschrijving[/head][head]Waarde[/head]\n"); |
|
445 memo.append("[row][data]Bier naam[/data][data]" + product->name + "[/data][/row]\n"); |
|
446 memo.append("[row][data]Bier stijl[/data][data]" + product->st_name + "[/data][/row]\n"); |
|
447 memo.append("[row][data]Recept type[/data][data]" + recipetypes[product->type] + "[/data][/row]\n"); |
|
448 memo.append("[row][data]Batch grootte[/data][data]" + QString::number(product->batch_size, 'f', 1) + " L[/data][/row]\n"); |
|
449 memo.append("[row][data]Kooktijd[/data][data]" + QString::number(product->boil_time, 'f', 0) + " minuten[/data][/row]\n"); |
|
450 memo.append("[row][data]Brouwzaal rendement[/data][data]" + QString::number(product->efficiency, 'f', 1) + "%[/data][/row]\n"); |
|
451 memo.append("[row][data]Geschatte begin densiteit[/data][data]" + QString::number(product->est_og, 'f', 3) + " SG[/data][/row]\n"); |
|
452 memo.append("[row][data]Geschatte eind densiteit[/data][data]" + QString::number(product->est_fg, 'f', 3) + " SG[/data][/row]\n"); |
|
453 memo.append("[row][data]Geschat alcohol[/data][data]" + QString::number(product->est_abv, 'f', 1) + "%[/data][/row]\n"); |
|
454 memo.append("[row][data]Kleur (" + color_method[product->color_method] + ")[/data][data]" + QString::number(product->est_color, 'f', 0) + " EBC[/data][/row]\n"); |
|
455 memo.append("[row][data]Bitterheid (" + ibu_method[product->ibu_method] + ")[/data][data]" + QString::number(product->est_ibu, 'f', 1) + " IBU[/data][/row]\n"); |
|
456 memo.append("[/tabular]\n\n"); |
|
457 |
|
458 memo.append("[u][b]Vergistbare ingrediënten[/b][/u]\n"); |
|
459 memo.append("[tabular]\n"); |
|
460 memo.append("[head]Mout, granen en suikers[/head][head]EBC[/head][head]Gewicht kg[/head][head]%[/head][head]Gebruik tijdens[/head]\n"); |
|
461 for (int i = 0; i < product->fermentables.size(); i++) { |
|
462 memo.append("[row][data]" + product->fermentables.at(i).f_name + " (" + product->fermentables.at(i).f_supplier + ")[/data]"); |
|
463 memo.append("[data]" + QString::number(product->fermentables.at(i).f_color) + "[/data]"); |
|
464 memo.append("[data]" + QString::number(product->fermentables.at(i).f_amount, 'f', 3) + "[/data]"); |
|
465 memo.append("[data]" + QString::number(product->fermentables.at(i).f_percentage, 'f', 1) + "[/data]"); |
|
466 memo.append("[data]" + fermentable_added[product->fermentables.at(i).f_added] + "[/data][/row]\n"); |
|
467 } |
|
468 memo.append("[/tabular]\n\n"); |
|
469 |
|
470 memo.append("[u][b]Hop[/b][/u]\n"); |
|
471 memo.append("[tabular]\n"); |
|
472 memo.append("[head]Hop[/head][head]Vorm[/head][head]Alpha[/head][head]IBU[/head][head]Gram[/head][head]Toevoegen moment[/head]\n"); |
|
473 for (int i = 0; i < product->hops.size(); i++) { |
|
474 double ibu = Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, product->batch_size, |
|
475 product->hops.at(i).h_amount, product->hops.at(i).h_time, product->hops.at(i).h_alpha, product->ibu_method, |
|
476 product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); |
|
477 memo.append("[row][data]" + product->hops.at(i).h_name + " (" + product->hops.at(i).h_origin + ")[/data]"); |
|
478 memo.append("[data]" + hop_forms[product->hops.at(i).h_form] + "[/data]"); |
|
479 memo.append("[data]" + QString::number(product->hops.at(i).h_alpha, 'f', 1) + "[/data]"); |
|
480 memo.append("[data]" + QString::number(ibu, 'f', 1) + "[/data]"); |
|
481 memo.append("[data]" + QString::number(product->hops.at(i).h_amount * 1000, 'f', 2) + "[/data]"); |
|
482 if (product->hops.at(i).h_useat == HOP_USEAT_BOIL || product->hops.at(i).h_useat == HOP_USEAT_WHIRLPOOL) |
|
483 memo.append("[data]" + hop_use[product->hops.at(i).h_useat] + " " + QString::number(product->hops.at(i).h_time) + " minuten[/data][/row]\n"); |
|
484 else if (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP) |
|
485 memo.append("[data]" + hop_use[product->hops.at(i).h_useat] + " " + QString::number(product->hops.at(i).h_time / 1440) + " dagen[/data][/row]\n"); |
|
486 else |
|
487 memo.append("[data]" + hop_use[product->hops.at(i).h_useat] + "[/data][/row]\n"); |
|
488 } |
|
489 memo.append("[/tabular]\n\n"); |
|
490 |
|
491 memo.append("[u][b]Diversen[/b][/u]\n"); |
|
492 memo.append("[tabular]\n"); |
|
493 memo.append("[head]Specerij, kruid, brouwzout[/head][head]Type grondstof[/head][head]Gebruik tijdens[/head][head]Hoeveel[/head]\n"); |
|
494 for (int i = 0; i < product->miscs.size(); i++) { |
|
495 memo.append("[row][data]" + product->miscs.at(i).m_name + "[/data]"); |
|
496 memo.append("[data]" + misc_type[product->miscs.at(i).m_type] + "[/data]"); |
|
497 if (product->miscs.at(i).m_use_use == MISC_USES_BOIL) |
|
498 memo.append("[data]" + misc_use[product->miscs.at(i).m_use_use] + " " + QString::number(product->miscs.at(i).m_time) + " min[/data]"); |
|
499 else |
|
500 memo.append("[data]" + misc_use[product->miscs.at(i).m_use_use] + "[/data]"); |
|
501 memo.append("[data]"+QString::number(product->miscs.at(i).m_amount * 1000, 'f', 2)+((product->miscs.at(i).m_amount_is_weight)?" gr":" ml")+"[/data][/row]\n"); |
|
502 } |
|
503 memo.append("[/tabular]\n\n"); |
|
504 |
|
505 memo.append("[u][b]Gist[/b][/u]\n"); |
|
506 memo.append("[tabular]\n"); |
|
507 memo.append("[head]Gistlab en code[/head][head]Omschrijving[/head][head]Gebruik[/head][head]Vorm[/head][head]Hoeveel[/head]\n"); |
|
508 for (int i = 0; i < product->yeasts.size(); i++) { |
|
509 memo.append("[row][data]" + product->yeasts.at(i).y_laboratory + " " + product->yeasts.at(i).y_product_id + "[/data]"); |
|
510 memo.append("[data]" + product->yeasts.at(i).y_name + "[/data]"); |
|
511 memo.append("[data]" + yeast_use[product->yeasts.at(i).y_use] + "[/data]"); |
|
512 memo.append("[data]" + yeast_form[product->yeasts.at(i).y_form] + "[/data]"); |
|
513 if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) |
|
514 memo.append("[data]" + QString::number(product->yeasts.at(i).y_amount, 'f', 0) + " pak[/data][/row]\n"); |
|
515 else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) |
|
516 memo.append("[data]" + QString::number(product->yeasts.at(i).y_amount * 1000, 'f', 1) + " gr[/data][/row]\n"); |
|
517 else |
|
518 memo.append("[data]" + QString::number(product->yeasts.at(i).y_amount * 1000, 'f', 0) + " ml[/data][/row]\n"); |
|
519 } |
|
520 memo.append("[/tabular]\n"); |
|
521 if (product->starter_enable) { |
|
522 double sv = 0; |
|
523 for (int i = 0; i < 4; i++) { |
|
524 if ((product->prop_volume[i] > 0) && (product->prop_volume[i] > sv)) |
|
525 sv = product->prop_volume[i]; |
|
526 } |
|
527 memo.append("Maak een giststarter van " + QString::number(sv, 'f', 1) + " liter.\n"); |
|
528 } |
|
529 memo.append("\n"); |
|
530 |
|
531 memo.append("[u][b]Maischen[/b][/u]\n"); |
|
532 memo.append("[tabular]\n"); |
|
533 memo.append("[head]Maisch stap[/head][head]Stap type[/head][head]Temperatuur[/head][head]Rust tijd[/head][head]Opwarm tijd[/head]\n"); |
|
534 for (int i = 0; i < product->mashs.size(); i++) { |
|
535 memo.append("[row][data]" + product->mashs.at(i).step_name + "[/data]"); |
|
536 if (product->mashs.at(i).step_type != 1) |
|
537 memo.append("[data]" + step_type[product->mashs.at(i).step_type]+" "+QString::number(product->mashs.at(i).step_infuse_amount, 'f', 1) + " L[/data]"); |
|
538 else |
|
539 memo.append("[data]" + step_type[product->mashs.at(i).step_type] + "[/data]"); |
|
540 memo.append("[data]" + QString::number(product->mashs.at(i).step_temp, 'f', 1) + " °C[/data]"); |
|
541 memo.append("[data]" + QString::number(product->mashs.at(i).step_time, 'f', 0) + " min[/data]"); |
|
542 memo.append("[data]" + QString::number(product->mashs.at(i).ramp_time, 'f', 0) + " min[/data][/row]\n"); |
|
543 } |
|
544 memo.append("[/tabular]\n\n"); |
|
545 |
|
546 memo.append("[u][b]Brouwwater[/b][/u]\n"); |
|
547 memo.append("[tabular]\n"); |
|
548 memo.append("[head]Omschrijving[/head][head]Waarde[/head]\n"); |
|
549 if (product->w2_name != "" && product->w2_amount > 0) { |
|
550 memo.append("[row][data]Maischwater 1[/data][data]" + product->w1_name + " " + QString::number(product->w1_amount, 'f', 1) + " Liter[/data][/row]\n"); |
|
551 memo.append("[row][data]Maischwater 2[/data][data]" + product->w2_name + " " + QString::number(product->w2_amount, 'f', 1) + " Liter[/data][/row]\n"); |
|
552 } else { |
|
553 memo.append("[row][data]Maischwater[/data][data]" + product->w1_name + " " + QString::number(product->w1_amount, 'f', 1) + " Liter[/data][/row]\n"); |
|
554 } |
|
555 memo.append("[row][data]Maischwater aanzuren tot[/data][data]" + QString::number(product->mash_ph, 'f', 1) + " pH[/data][/row]\n"); |
|
556 memo.append("[row][data]Spoelwater geschat[/data][data]" + QString::number(product->brew_sparge_est, 'f', 1) + " Liter[/data][/row]\n"); |
|
557 memo.append("[row][data]Spoelwater temperatuur[/data][data]" + QString::number(product->sparge_temp, 'f', 1) + " °C[/data][/row]\n"); |
|
558 memo.append("[row][data]Spoelwater aanzuren tot[/data][data]" + QString::number(product->sparge_ph, 'f', 1) + " pH[/data][/row]\n"); |
|
559 memo.append("[/tabular]\n\n"); |
|
560 |
|
561 memo.append("[u][b]Waterprofiel behandeld water[/b][/u]\n"); |
|
562 memo.append("[tabular]\n"); |
|
563 memo.append("[head]Ca[/head][head]Mg[/head][head]Na[/head][head]HCO3[/head][head]Cl[/head][head]SO4[/head]\n"); |
|
564 memo.append("[row][data]" + QString::number(product->wb_calcium, 'f', 1) + "[/data]"); |
|
565 memo.append("[data]" + QString::number(product->wb_magnesium, 'f', 1) + "[/data]"); |
|
566 memo.append("[data]" + QString::number(product->wb_sodium, 'f', 1) + "[/data]"); |
|
567 memo.append("[data]" + QString::number(product->wb_total_alkalinity * 61 / 50, 'f', 1) + "[/data]"); |
|
568 memo.append("[data]" + QString::number(product->wb_chloride, 'f', 1) + "[/data]"); |
|
569 memo.append("[data]" + QString::number(product->wb_sulfate, 'f', 1) + "[/data][/row]\n"); |
|
570 memo.append("[/tabular]\n\n"); |
|
571 |
|
572 qDebug().noquote() << memo; |
|
573 QGuiApplication::clipboard()->setText(memo, QClipboard::Clipboard); |
|
574 QGuiApplication::clipboard()->setText(memo, QClipboard::Selection); |
|
575 |
|
576 QMessageBox::information(this, tr("Export to forum"), tr("The recipe and all data are copied to the clipboard.\n" |
|
577 "You can \"paste\" this data in the forum screen in your web browser.")); |
428 } |
578 } |
429 |
579 |
430 |
580 |
431 void EditProduct::splitProduct() |
581 void EditProduct::splitProduct() |
432 { |
582 { |