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