src/PrinterDialog.cpp

Mon, 20 Jun 2022 19:55:23 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 20 Jun 2022 19:55:23 +0200
changeset 301
fe6346211b5b
parent 284
33bb98c33e6a
child 336
e97f9e87d94b
permissions
-rw-r--r--

Finally the translation of string arrays is working.

52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * Printer.cpp is part of bmsapp.
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "PrinterDialog.h"
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
18 #include "Utils.h"
158
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
19 #include "EditRecipe.h"
175
f1ed3a2a94e9 Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents: 160
diff changeset
20 #include "EditProduct.h"
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 #include "config.h"
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
22 #include "global.h"
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include <QPrintPreviewDialog>
90
2396457a8167 Moved functions from bmsapp.cpp to MainWindow.cpp
Michiel Broek <mbroek@mbse.eu>
parents: 88
diff changeset
25 #include <QDebug>
2396457a8167 Moved functions from bmsapp.cpp to MainWindow.cpp
Michiel Broek <mbroek@mbse.eu>
parents: 88
diff changeset
26 #include <QtSql>
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 PrinterDialog::PrinterDialog(int job, int rec, QWidget* parent) : QDialog(parent)
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 {
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 qDebug() << "PrinterDialog start job" << job << "rec" << rec;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 p_job = job;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 p_rec = rec;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 QPrinter printer(QPrinter::ScreenResolution);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 QPrintPreviewDialog preview(&printer, this);
88
64cf5468fd22 Improve the CMakeLists.txt. Cleanup unused variables. Removed som debug messages.
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
38 connect(&preview, &QPrintPreviewDialog::paintRequested, this, &PrinterDialog::printDocument);
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 preview.exec();
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 }
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42
88
64cf5468fd22 Improve the CMakeLists.txt. Cleanup unused variables. Removed som debug messages.
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
43 PrinterDialog::~PrinterDialog() {}
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 void PrinterDialog::printDocument(QPrinter *printer)
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 {
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 qDebug() << "PrinterDialog printDocument()";
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 QRect rectangle;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 QRect boundingRect;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 QPainter painter;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 QString w;
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
54 QSqlQuery query;
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
56 const QColor c_header(255, 150, 100, 255);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
57 const QColor c_line1( 210, 245, 255, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
58 const QColor c_line2( 255, 255, 210, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
59 const QColor f_line( 250, 195, 65, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
60 const QColor h_line( 100, 250, 65, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
61 const QColor y_line( 175, 175, 255, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
62 const QColor mw_line( 240, 140, 130, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
63 const QColor mf_line( 95, 180, 25, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
64 const QColor ms_line( 240, 250, 65, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
65 const QColor mo_line( 210, 245, 255, 255);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
66 const QColor line( 175, 175, 255, 255); // also y_line
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
67 const QColor w_line( 120, 255, 250, 255);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
68
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
69 const QStringList y_unit({tr("pkg"), tr("gr"), tr("ml"), tr("ml"), tr("ml"), tr("ml"), tr("gr")});
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
70 const QStringList ibu_method({ "Tinseth", "Rager", "Daniels", "Garetz", "Mosher", "Noonan" });
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
71 const QStringList color_method({ "Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" });
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
72 const QStringList cooling_method({"-", tr("Emersion chiller"), tr("Counterflow chiller"), tr("Au bain marie"), tr("Natural") });
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 painter.begin(printer);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 qreal y = 0;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 if (p_job == PR_SUPPLIES) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
78 qInfo() << "Print supplies";
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
79
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
80 /*
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
81 * Print supplies in stock
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
82 */
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 double tot_fermentables = 0, tot_hops = 0, tot_yeasts = 0, tot_miscs = 0;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
85 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
86 y = 120;
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 /* Fermentables supplies header */
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
90 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
91 painter.drawText( 20, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
92 painter.drawText(100, y+4, 100, 20, Qt::AlignLeft, tr("Supplier"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
93 painter.drawText(200, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable"));
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 painter.drawText(460, y+4, 115, 20, Qt::AlignRight, tr("Stock"));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg"));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value"));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 y += 20;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
99 query.exec("SELECT type,name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY type,supplier,name");
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 query.first();
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 for (int i = 0 ; i < query.size() ; i++ ) {
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
102 if ((y + 20) > painter.device()->height()) {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
103 printer->newPage();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
104 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
105 y = 120;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
106 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
107 painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
108 painter.drawText( 20, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("FermentableType", g_fermentable_types[query.value(0).toInt()]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
109 painter.drawText(100, y+4, 100, 20, Qt::AlignLeft, query.value(2).toString());
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
110 painter.drawText(200, y+4, 260, 20, Qt::AlignLeft, query.value(1).toString());
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 w = QString("%1 kg").arg(query.value(3).toDouble(), 10, 'f', 3);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 painter.drawText(460, y+4, 115, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 w = QString("%1 €").arg(query.value(4).toDouble(), 8, 'f', 2);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 w = QString("%1 €").arg(query.value(3).toDouble() * query.value(4).toDouble(), 8, 'f', 2);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 tot_fermentables += (query.value(3).toDouble() * query.value(4).toDouble());
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 query.next();
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 y += 20;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
121 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
122 painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total"));
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 w = QString("%1 €").arg(tot_fermentables, 8, 'f', 2);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 y += 20;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
127 /* Hops supplies */
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 query.exec("SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name");
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 query.first();
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
130 if ((y + 80 + (query.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
131 printer->newPage();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
132 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
133 y = 120;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
134 } else {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
135 y += 40;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
136 }
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
139 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
140 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Country"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
141 painter.drawText(140, y+4, 240, 20, Qt::AlignLeft, tr("Hop name"));
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 painter.drawText(380, y+4, 80, 20, Qt::AlignLeft, tr("Form"));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 painter.drawText(460, y+4, 115, 20, Qt::AlignRight, tr("Stock"));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg"));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value"));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 y += 20;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 for (int i = 0; i < query.size(); i++) {
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
149 if ((y + 20) > painter.device()->height()) {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
150 printer->newPage();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
151 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
152 y = 120;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
153 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
154 painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
155 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, query.value(2).toString());
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
156 painter.drawText(140, y+4, 240, 20, Qt::AlignLeft, query.value(0).toString());
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
157 painter.drawText(380, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("HopForm", g_hop_forms[query.value(1).toInt()]));
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 if (query.value(3).toDouble() < 0.6)
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 w = QString("%1 gr").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 else
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 w = QString("%1 kg").arg(query.value(3).toDouble(), 10, 'f', 3);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 painter.drawText(460, y+4, 115, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 w = QString("%1 €").arg(query.value(4).toDouble(), 8, 'f', 2);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 w = QString("%1 €").arg(query.value(3).toDouble() * query.value(4).toDouble(), 8, 'f', 2);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 tot_hops += (query.value(3).toDouble() * query.value(4).toDouble());
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 query.next();
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 y += 20;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
171 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
172 painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total"));
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 w = QString("%1 €").arg(tot_hops, 8, 'f', 2);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 y += 20;
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
177 /* Yeasts supplies */
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 query.exec("SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id");
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 query.first();
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
180 if ((y + 80 + (query.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
181 printer->newPage();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
182 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
183 y = 120;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
184 } else {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
185 y += 40;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
186 }
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
187 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
188 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
189 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
190 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Laboratory"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
191 painter.drawText(140, y+4, 120, 20, Qt::AlignLeft, tr("Product"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
192 painter.drawText(260, y+4, 235, 20, Qt::AlignLeft, tr("Yeast"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
193 painter.drawText(495, y+4, 80, 20, Qt::AlignRight, tr("Stock"));
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
194 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg"));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
195 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value"));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
196 y += 20;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
197 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
198 for (int i = 0; i < query.size(); i++) {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
199 if ((y + 20) > painter.device()->height()) {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
200 printer->newPage();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
201 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
202 y = 120;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
203 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
204 painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
205 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, query.value(1).toString());
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
206 painter.drawText(140, y+4, 120, 20, Qt::AlignLeft, query.value(2).toString());
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
207 painter.drawText(260, y+4, 235, 20, Qt::AlignLeft, query.value(0).toString());
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
208 if (query.value(3).toInt() == 0)
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
209 w = QString("%1 %2").arg(query.value(4).toDouble(), 10, 'f', 1).arg(y_unit[query.value(3).toInt()]);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
210 else
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
211 w = QString("%1 %2").arg(query.value(4).toDouble() * 1000.0, 10, 'f', 1).arg(y_unit[query.value(3).toInt()]);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
212 painter.drawText(495, y+4, 80, 20, Qt::AlignRight, w);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
213 w = QString("%1 €").arg(query.value(5).toDouble(), 8, 'f', 2);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
214 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
215 w = QString("%1 €").arg(query.value(4).toDouble() * query.value(5).toDouble(), 8, 'f', 2);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
216 tot_yeasts += (query.value(4).toDouble() * query.value(5).toDouble());
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
217 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
218 query.next();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
219 y += 20;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
220 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
221 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
222 painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total"));
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
223 w = QString("%1 €").arg(tot_yeasts, 8, 'f', 2);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
224 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
225 y += 20;
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
227 /* Miscs supplies */
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 query.exec("SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name");
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 query.first();
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
230 if ((y + 80 + (query.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
231 printer->newPage();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
232 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
233 y = 120;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
234 } else {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
235 y += 40;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
236 }
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
237 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
238 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
239 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
240 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
241 painter.drawText(140, y+4, 320, 20, Qt::AlignLeft, tr("Ingredient"));
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
242 painter.drawText(460, y+4, 115, 20, Qt::AlignRight, tr("Stock"));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
243 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg"));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
244 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value"));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
245 y += 20;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
246 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
247 for (int i = 0; i < query.size(); i++) {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
248 if ((y + 20) > painter.device()->height()) {
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
249 printer->newPage();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
250 printHeader(&painter);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
251 y = 120;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
252 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
253 painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
254 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, QCoreApplication::translate("MiscType", g_misc_types[query.value(1).toInt()]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
255 painter.drawText(140, y+4, 320, 20, Qt::AlignLeft, query.value(0).toString());
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
256 if (query.value(2).toInt())
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
257 w = QString("%1 gr").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
258 else
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
259 w = QString("%1 ml").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
260 painter.drawText(460, y+4, 115, 20, Qt::AlignRight, w);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
261 w = QString("%1 €").arg(query.value(4).toDouble(), 8, 'f', 2);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
262 painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
263 w = QString("%1 €").arg(query.value(3).toDouble() * query.value(4).toDouble(), 8, 'f', 2);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
264 tot_miscs += (query.value(3).toDouble() * query.value(4).toDouble());
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
265 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
266 query.next();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
267 y += 20;
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
268 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
269 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
270 painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total"));
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
271 w = QString("%1 €").arg(tot_miscs, 8, 'f', 2);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
272 painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w);
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
273 y += 20;
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
274
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
275 } else if (p_job == PR_YEASTBANK) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
276 qInfo() << "Print yeastbank";
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
277
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
278 /*
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
279 * Print yeast in the private yeast bank.
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
280 */
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
281 printHeader(&painter);
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
282 y = 120;
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
283
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
284 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
285 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
286 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
287 painter.drawText( 20, y+4, 180, 20, Qt::AlignLeft, tr("Yeast"));
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
288 painter.drawText(200, y+4, 230, 20, Qt::AlignLeft, tr("Description"));
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
289 painter.drawText(430, y+4, 80, 20, Qt::AlignCenter, tr("Type"));
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
290 painter.drawText(510, y+4, 80, 20, Qt::AlignCenter, tr("Form"));
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
291 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("Stock"));
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
292 painter.drawText(665, y+4, 70, 20, Qt::AlignLeft, tr("Date"));
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
293 y += 20;
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
294 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
295 query.prepare("SELECT name,type,form,inventory,production_date,short_desc "
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
296 "FROM inventory_yeasts WHERE inventory > 0 AND laboratory = :my_lab ORDER BY product_id");
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
297 query.bindValue(":my_lab", my_yeastlab);
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
298 query.exec();
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
299 query.first();
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
300 for (int i = 0; i < query.size(); i++) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
301 painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
302 painter.drawText( 20, y+4, 180, 20, Qt::AlignLeft, query.value(0).toString());
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
303 painter.drawText(200, y+4, 230, 20, Qt::AlignLeft, query.value(5).toString());
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
304 painter.drawText(430, y+4, 80, 20, Qt::AlignCenter, QCoreApplication::translate("YeastType", g_yeast_types[query.value(1).toInt()]));
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
305 painter.drawText(510, y+4, 80, 20, Qt::AlignCenter, QCoreApplication::translate("YeastForm", g_yeast_forms[query.value(2).toInt()]));
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
306
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
307 if (query.value(2).toInt() == 0)
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
308 w = QString("%1 %2").arg(query.value(3).toDouble(), 10, 'f', 1).arg(y_unit[query.value(2).toInt()]);
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
309 else
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
310 w = QString("%1 %2").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1).arg(y_unit[query.value(2).toInt()]);
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
311 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, w);
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
312 painter.drawText(665, y+4, 70, 20, Qt::AlignLeft, query.value(4).toString());
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
313 query.next();
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
314 y += 20;
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
315 }
158
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
316 } else if (p_job == PR_RECIPE) {
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
317
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
318 qInfo() << "Print recipe" << recipe->record;
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
319
158
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
320 printHeader(&painter);
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
321 y = 120;
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
322 /* Generic header */
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
323 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
324 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
325 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
326 painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe overview"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
327 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
328 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
329 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
330 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Brew type"));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
331 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("Recipe_type", g_recipe_types[recipe->type]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
332 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
333 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Efficiency"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
334 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 %").arg(recipe->efficiency, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
335 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
336 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
337 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Boil time"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
338 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 minutes.").arg(recipe->boil_time, 1, 'f', 0));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
339 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
340 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Batch size"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
341 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L.").arg(recipe->batch_size, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
342 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
343 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
344 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Start SG"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
345 painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_og, 1, 'f', 3));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
346 painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_og_min, 1, 'f', 3).arg(recipe->st_og_max, 1, 'f', 3));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
347 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
348 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("End SG"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
349 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_fg, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
350 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_fg_min, 1, 'f', 3).arg(recipe->st_fg_max, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
351 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
352 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
353 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Estimated Alcohol"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
354 painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1%").arg(recipe->est_abv, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
355 painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_abv_min, 1, 'f', 1).arg(recipe->st_abv_max, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
356 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
357 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Estimated CO2 vol"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
358 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_carb, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
359 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_carb_min, 1, 'f', 1).arg(recipe->st_carb_max, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
360 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
361 painter.fillRect( 20, y, 150, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
362 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Color (") + color_method[recipe->color_method] + ")");
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
363 painter.fillRect(170, y, 180, 20, Utils::ebc_to_color(recipe->est_color));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
364 if (recipe->est_color > 30)
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
365 painter.setPen(Qt::white);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
366 painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1 EBC").arg(recipe->est_color, 1, 'f', 0));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
367 painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_color_min, 1, 'f', 0).arg(recipe->st_color_max, 1, 'f', 0));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
368 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
369 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
370 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("IBU (") + ibu_method[recipe->ibu_method] + ")");
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
371 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_ibu, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
372 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_ibu_min, 1, 'f', 0).arg(recipe->st_ibu_max, 1, 'f', 0));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
373 y += 40;
158
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
374
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
375 /* Fermentables */
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
376 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
377 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
378 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
379 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
380 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Percent"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
381 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Yield"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
382 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
383 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
384 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
385 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
386 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
387 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
388 double cost_fermentables = 0;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
389 QString soort, amount, use;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
390 for (int i = 0; i < recipe->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
391 double cost = recipe->fermentables.at(i).amount * recipe->fermentables.at(i).cost;
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
392 cost_fermentables += cost;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
393
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
394 if (recipe->fermentables.at(i).type == 0)
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
395 soort = QCoreApplication::translate("FermentableGraintype", g_fermentable_graintypes[recipe->fermentables.at(i).graintype]);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
396 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
397 soort = QCoreApplication::translate("FermentableType", g_fermentable_types[recipe->fermentables.at(i).type]);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
398
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
399 if (recipe->fermentables.at(i).amount > 100)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
400 amount = QString("%1 kg").arg(recipe->fermentables.at(i).amount, 1, 'f', 1);
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
401 else if (recipe->fermentables.at(i).amount > 10)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
402 amount = QString("%1 kg").arg(recipe->fermentables.at(i).amount, 1, 'f', 2);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
403 else
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
404 amount = QString("%1 gr").arg(recipe->fermentables.at(i).amount * 1000, 1, 'f', 0);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
405
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
406 painter.fillRect( 20, y, 715, 20, f_line);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
407
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
408 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->fermentables.at(i).name +
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
409 QString(", %1 EBC (").arg(recipe->fermentables.at(i).color, 1, 'f', 0) +
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
410 recipe->fermentables.at(i).supplier + ")");
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
411 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).percentage, 1, 'f', 1));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
412 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).yield, 1, 'f', 1));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
413 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
414 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("FermentableAdded", g_fermentable_added[recipe->fermentables.at(i).added]));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
415 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
416 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
417 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
418 }
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
419 painter.fillRect(670, y, 60, 20, c_line1);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
420 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_fermentables, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
421 y += 40;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
422
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
423 /* Hops */
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
424 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
425 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
426 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Hop"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
427 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Alpha"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
428 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("IBU"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
429 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
430 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
431 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
432 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
433 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
434 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
435 double cost_hops = 0;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
436 for (int i = 0; i < recipe->hops.size(); i++) {
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
437
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
438 double cost = recipe->hops.at(i).amount * recipe->hops.at(i).cost;
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
439 cost_hops += cost;
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
440 double ibu = Utils::toIBU(recipe->hops.at(i).useat, recipe->hops.at(i).form, recipe->preboil_sg, recipe->batch_size,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
441 recipe->hops.at(i).amount, recipe->hops.at(i).time, recipe->hops.at(i).alpha,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
442 recipe->ibu_method, 0, recipe->hops.at(i).time, 0, recipe->boil_time);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
443
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
444 if (recipe->hops.at(i).useat == 2 || recipe->hops.at(i).useat == 4) // Boil or Whirlpool
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
445 use = QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]) + QString(" %1 min").arg(recipe->hops.at(i).time);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
446 else if (recipe->hops.at(i).useat == 5) // Dryhop
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
447 use = QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]) + QString(" %1 days").arg(recipe->hops.at(i).time / 1440);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
448 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
449 use = QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
450
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
451 if (recipe->hops.at(i).amount > 1)
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
452 amount = QString("%1 kg").arg(recipe->hops.at(i).amount, 1, 'f', 3);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
453 else
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
454 amount = QString("%1 gr").arg(recipe->hops.at(i).amount * 1000, 1, 'f', 1);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
455
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
456 painter.fillRect( 20, y, 715, 20, h_line);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
457 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->hops.at(i).name + " (" + recipe->hops.at(i).origin + ")");
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
458 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->hops.at(i).alpha, 1, 'f', 1));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
459 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
460 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("HopForm", g_hop_forms[recipe->hops.at(i).form]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
461 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
462 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
463 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
464 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
465 }
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
466 painter.fillRect(670, y, 60, 20, c_line1);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
467 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_hops, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
468 y += 40;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
469
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
470 /* Yeasts */
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
471 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
472 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
473 painter.drawText( 20, y+4, 335, 20, Qt::AlignLeft, tr("Yeast"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
474 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Attn"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
475 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
476 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
477 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
478 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
479 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
480 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
481 double cost_yeasts = 0;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
482 for (int i = 0; i < recipe->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
483 double cost = recipe->yeasts.at(i).amount * recipe->yeasts.at(i).cost;
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
484 cost_yeasts += cost;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
485
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
486 if (recipe->yeasts.at(i).form == 0)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
487 amount = QString("%1 pack").arg(recipe->yeasts.at(i).amount, 1, 'f', 0);
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
488 else if (recipe->yeasts.at(i).form == 1 || recipe->yeasts.at(i).form == 6)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
489 amount = QString("%1 gr").arg(recipe->yeasts.at(i).amount * 1000.0, 1, 'f', 1);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
490 else
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
491 amount = QString("%1 ml").arg(recipe->yeasts.at(i).amount * 1000.0, 1, 'f', 1);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
492
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
493 painter.fillRect( 20, y, 715, 20, y_line);
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
494 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->yeasts.at(i).laboratory + " " +
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
495 recipe->yeasts.at(i).product_id + " (" +
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
496 recipe->yeasts.at(i).name + ")");
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
497 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->yeasts.at(i).attenuation, 1, 'f', 1));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
498 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastForm", g_yeast_forms[recipe->yeasts.at(i).form]));
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
499 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastUse", g_yeast_use[recipe->yeasts.at(i).use]));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
500 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
501 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
502 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
503 }
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
504 painter.fillRect(670, y, 60, 20, c_line1);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
505 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
506
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
507 if ((y + 80 + (recipe->miscs.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
508 printer->newPage();
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
509 printHeader(&painter);
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
510 y = 120;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
511 } else {
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
512 y += 40;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
513 }
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
514
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
515 /* Miscs */
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
516 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
517 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
518 painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, tr("Misc ingredient"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
519 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
520 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
521 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
522 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
523 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
524 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
525 double cost_miscs = 0;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
526 for (int i = 0; i < recipe->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
527 double cost = recipe->miscs.at(i).amount * recipe->miscs.at(i).cost;
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
528 cost_miscs += cost;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
529
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
530 if (recipe->miscs.at(i).use_use == 2)
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
531 use = QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(i).use_use]) + QString(" %1 min").arg(recipe->miscs.at(i).time);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
532 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
533 use = QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(i).use_use]);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
534
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
535 if (recipe->miscs.at(i).type == 4) // Water agent
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
536 painter.fillRect( 20, y, 715, 20, mw_line);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
537 else if (recipe->miscs.at(i).type == 3) // Fining
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
538 painter.fillRect( 20, y, 715, 20, mf_line);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
539 else if (recipe->miscs.at(i).type < 3 || recipe->miscs.at(i).type == 5) // Spice, Herb, Flavour, Yeast nutrient
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
540 painter.fillRect( 20, y, 715, 20, ms_line);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
541 else
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
542 painter.fillRect( 20, y, 715, 20, mo_line);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
543 painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, recipe->miscs.at(i).name);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
544 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("MiscType", g_misc_types[recipe->miscs.at(i).type]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
545 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
546 painter.drawText(605, y+4, 60, 20, Qt::AlignRight,
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
547 QString("%1 %2").arg(recipe->miscs.at(i).amount * 1000.0, 1, 'f', 1).arg(recipe->miscs.at(i).amount_is_weight ? "gr":"ml"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
548 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
549 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
550 }
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
551 painter.fillRect(670, y, 60, 20, c_line1);
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
552 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
553
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
554 if ((y + 60 + (recipe->mashs.size() * 20)) > painter.device()->height()) { /* Rows + header + blank */
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
555 printer->newPage();
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
556 printHeader(&painter);
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
557 y = 120;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
558 } else {
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
559 y += 40;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
560 }
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
561
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
562 /* Mash */
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
563 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
564 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
565 painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, tr("Mash step"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
566 painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, tr("Step type"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
567 painter.drawText(260, y+4, 60, 20, Qt::AlignRight, tr("Start °C"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
568 painter.drawText(325, y+4, 60, 20, Qt::AlignRight, tr("End °C"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
569 painter.drawText(390, y+4, 60, 20, Qt::AlignRight, tr("Time"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
570 painter.drawText(455, y+4, 60, 20, Qt::AlignRight, tr("Ramp"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
571 painter.drawText(520, y+4, 60, 20, Qt::AlignRight, tr("L/kg"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
572 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec L."));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
573 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec °C"));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
574 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
575 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
576 for (int i = 0; i < recipe->mashs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
577 painter.fillRect( 20, y, 715, 20, line);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
578 painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, recipe->mashs.at(i).step_name);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
579 painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("StepType", g_step_types[recipe->mashs.at(i).step_type]));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
580 painter.drawText(260, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_temp, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
581 painter.drawText(325, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).end_temp, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
582 painter.drawText(390, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_time, 1, 'f', 0));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
583 painter.drawText(455, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).ramp_time, 1, 'f', 0));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
584 painter.drawText(520, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_wg_ratio, 1, 'f', 2));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
585 if (recipe->mashs.at(i).step_type != 1) {
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
586 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_infuse_amount, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
587 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_infuse_temp, 1, 'f', 1));
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
588 }
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
589 y += 20;
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
590 }
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
591
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
592 if ((y + 80 + ((recipe->w2_amount > 0) ? 40:0)) > painter.device()->height()) { /* waters + header + blank */
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
593 printer->newPage();
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
594 printHeader(&painter);
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
595 y = 120;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
596 } else {
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
597 y += 40;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
598 }
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
599
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
600 /* Water */
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
601 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
602 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
603 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Water source"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
604 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, tr("Volume"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
605 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, tr("Ca"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
606 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, tr("Mg"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
607 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, tr("CaCO3"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
608 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, tr("Na"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
609 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, tr("Cl"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
610 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("SO4"));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
611 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("pH"));
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
612 y += 20;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
613 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
614 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
615 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, recipe->w1_name);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
616 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(recipe->w1_amount, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
617 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
618 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
619 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
620 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
621 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
622 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_sulfate, 1, 'f', 1));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
623 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_ph, 1, 'f', 2));
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
624 y += 20;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
625 if (recipe->w2_amount > 0) {
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
626 /*
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
627 * If there is dillution water, show it and the mixed result too.
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
628 */
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
629 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
630 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, recipe->w2_name);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
631 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(recipe->w2_amount, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
632 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
633 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
634 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
635 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
636 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
637 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_sulfate, 1, 'f', 1));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
638 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_ph, 1, 'f', 2));
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
639 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
640 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
641 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Mixed water"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
642 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(recipe->wg_amount, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
643 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
644 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
645 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
646 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
647 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
648 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_sulfate, 1, 'f', 1));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
649 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_ph, 1, 'f', 2));
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
650 y += 20;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
651 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
652 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
653 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated water"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
654 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
655 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
656 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
657 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
658 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
659 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sulfate, 1, 'f', 1));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
660 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_ph, 1, 'f', 2));
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
661 y += 20;
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
662
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
663 /*
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
664 * Print recipe notes if present.
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
665 */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
666 if (recipe->notes.length()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
667 QStringList lines = recipe->notes.split("\n");
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
668
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
669 if (lines.size() && recipe->notes != "") {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
670 if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
671 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
672 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
673 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
674 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
675 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
676 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
677
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
678 /* Notes header */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
679 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
680 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
681 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
682 painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe notes"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
683 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
684 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
685 for (int i = 0; i < lines.size(); i++) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
686 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
687 painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
688 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
689 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
690 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
691 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
692
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
693 } else if (p_job == PR_PRODUCT) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
694
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
695 qInfo() << "print product" << product->record;
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
696 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
697 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
698 /* Generic header */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
699 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
700 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
701 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
702 painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Product overview"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
703 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
704 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
705 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
706 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Brew type"));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
707 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("RecipeType", g_recipe_types[product->type]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
708 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
709 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Efficiency"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
710 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 %").arg(product->efficiency, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
711 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
712 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
713 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Boil time"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
714 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 minutes.").arg(product->boil_time, 1, 'f', 0));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
715 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
716 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Batch size"));
272
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
717 if (product->divide_type) {
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
718 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L. of %2 L.").arg(product->batch_size, 1, 'f', 1)
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
719 .arg(product->batch_size / product->divide_factor, 1, 'f', 1));
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
720 } else {
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
721 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L.").arg(product->batch_size, 1, 'f', 1));
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
722 }
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
723 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
724 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
725 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Start SG"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
726 painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_og, 1, 'f', 3));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
727 painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_og_min, 1, 'f', 3).arg(product->st_og_max, 1, 'f', 3));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
728 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
729 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("End SG"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
730 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_fg, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
731 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_fg_min, 1, 'f', 3).arg(product->st_fg_max, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
732 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
733 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
734 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Estimated Alcohol"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
735 painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1%").arg(product->est_abv, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
736 painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_abv_min, 1, 'f', 1).arg(product->st_abv_max, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
737 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
738 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Estimated CO2 vol"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
739 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_carb, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
740 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_carb_min, 1, 'f', 1).arg(product->st_carb_max, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
741 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
742 painter.fillRect( 20, y, 150, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
743 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Color (") + color_method[product->color_method] + ")");
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
744 painter.fillRect(170, y, 180, 20, Utils::ebc_to_color(product->est_color));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
745 if (product->est_color > 30)
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
746 painter.setPen(Qt::white);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
747 painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->est_color, 1, 'f', 0));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
748 painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_color_min, 1, 'f', 0).arg(product->st_color_max, 1, 'f', 0));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
749 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
750 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
751 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("IBU (") + ibu_method[product->ibu_method] + ")");
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
752 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_ibu, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
753 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_ibu_min, 1, 'f', 0).arg(product->st_ibu_max, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
754 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
755 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
756 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Beer style"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
757 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->st_name);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
758 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
759 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Stage"));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
760 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("ProdStages", g_prod_stages[product->stage]));
272
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
761 if (product->divide_parts) {
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
762 y += 20;
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
763 painter.fillRect( 20, y, 330, 20, c_line1);
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
764 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Split batch"));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
765 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("Splitter", g_prod_split[product->divide_type]));
272
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
766 painter.fillRect(405, y, 330, 20, c_line1);
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
767 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Batch number"));
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
768 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 of %2").arg(product->divide_part + 1).arg(product->divide_parts + 1));
4f0281b7b0bb Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents: 260
diff changeset
769 }
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
770 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
771
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
772 /* Fermentables */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
773 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
774 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
775 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
776 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
777 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Percent"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
778 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Yield"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
779 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
780 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
781 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
782 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
783 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
784 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
785 double cost_fermentables = 0;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
786 QString soort, amount, use;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
787 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
788 double cost = product->fermentables.at(i).amount * product->fermentables.at(i).cost;
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
789 cost_fermentables += cost;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
790
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
791 if (product->fermentables.at(i).type == 0)
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
792 soort = QCoreApplication::translate("FermentableGraintype", g_fermentable_graintypes[product->fermentables.at(i).graintype]);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
793 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
794 soort = QCoreApplication::translate("FermentableType", g_fermentable_types[product->fermentables.at(i).type]);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
795
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
796 if (product->fermentables.at(i).amount > 100)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
797 amount = QString("%1 kg").arg(product->fermentables.at(i).amount, 1, 'f', 1);
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
798 else if (product->fermentables.at(i).amount > 10)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
799 amount = QString("%1 kg").arg(product->fermentables.at(i).amount, 1, 'f', 2);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
800 else
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
801 amount = QString("%1 gr").arg(product->fermentables.at(i).amount * 1000, 1, 'f', 0);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
802
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
803 painter.fillRect( 20, y, 715, 20, f_line);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
804
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
805 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->fermentables.at(i).name +
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
806 QString(", %1 EBC (").arg(product->fermentables.at(i).color, 1, 'f', 0) +
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
807 product->fermentables.at(i).supplier + ")");
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
808 if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
809 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).percentage, 1, 'f', 1));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
810 else
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
811 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, "");
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
812 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).yield, 1, 'f', 1));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
813 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
814 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("FermentableAdded", g_fermentable_added[product->fermentables.at(i).added]));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
815 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
816 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
817 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
818 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
819 painter.fillRect(670, y, 60, 20, c_line1);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
820 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_fermentables, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
821 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
822
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
823 /* Hops */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
824 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
825 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
826 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Hop"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
827 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Alpha"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
828 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("IBU"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
829 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
830 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
831 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
832 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
833 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
834 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
835 double cost_hops = 0;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
836 for (int i = 0; i < product->hops.size(); i++) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
837
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
838 double cost = product->hops.at(i).amount * product->hops.at(i).cost;
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
839 cost_hops += cost;
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
840 double ibu = Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, product->batch_size,
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
841 product->hops.at(i).amount, product->hops.at(i).time, product->hops.at(i).alpha,
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
842 product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
843
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
844 if (product->hops.at(i).useat == 2 || product->hops.at(i).useat == 4) // Boil or Whirlpool
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
845 use = QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat]) + QString(" %1 min").arg(product->hops.at(i).time);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
846 else if (product->hops.at(i).useat == 5) // Dryhop
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
847 use = QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat]) + QString(" %1 days").arg(product->hops.at(i).time / 1440);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
848 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
849 use = QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat]);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
850
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
851 if (product->hops.at(i).amount > 1)
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
852 amount = QString("%1 kg").arg(product->hops.at(i).amount, 1, 'f', 3);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
853 else
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
854 amount = QString("%1 gr").arg(product->hops.at(i).amount * 1000, 1, 'f', 1);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
855
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
856 painter.fillRect( 20, y, 715, 20, h_line);
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
857 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->hops.at(i).name + " (" + product->hops.at(i).origin + ")");
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
858 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->hops.at(i).alpha, 1, 'f', 1));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
859 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
860 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("HopForm", g_hop_forms[product->hops.at(i).form]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
861 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
862 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
863 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
864 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
865 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
866 painter.fillRect(670, y, 60, 20, c_line1);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
867 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_hops, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
868 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
869
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
870 /* Yeasts */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
871 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
872 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
873 painter.drawText( 20, y+4, 335, 20, Qt::AlignLeft, tr("Yeast"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
874 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Attn"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
875 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
876 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
877 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
878 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
879 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
880 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
881 double cost_yeasts = 0;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
882 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
883 double cost = product->yeasts.at(i).amount * product->yeasts.at(i).cost;
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
884 cost_yeasts += cost;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
885
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
886 if (product->yeasts.at(i).form == 0)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
887 amount = QString("%1 pack").arg(product->yeasts.at(i).amount, 1, 'f', 0);
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
888 else if (product->yeasts.at(i).form == 1 || product->yeasts.at(i).form == 6)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
889 amount = QString("%1 gr").arg(product->yeasts.at(i).amount * 1000.0, 1, 'f', 1);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
890 else
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
891 amount = QString("%1 ml").arg(product->yeasts.at(i).amount * 1000.0, 1, 'f', 1);
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
892
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
893 painter.fillRect( 20, y, 715, 20, y_line);
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
894 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->yeasts.at(i).laboratory + " " +
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
895 product->yeasts.at(i).product_id + " (" +
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
896 product->yeasts.at(i).name + ")");
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
897 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->yeasts.at(i).attenuation, 1, 'f', 1));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
898 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastForm", g_yeast_forms[product->yeasts.at(i).form]));
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
899 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastUse", g_yeast_use[product->yeasts.at(i).use]));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
900 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
901 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
902 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
903 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
904 if (product->starter_enable && product->prop_volume[0]) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
905 int st = 0;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
906 double sv = 0;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
907 for (int i = 0; i < 4; i++) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
908 if (product->prop_volume[i] > 0.0) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
909 st++;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
910 if (product->prop_volume[i] > sv)
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
911 sv = product->prop_volume[i];
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
912 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
913 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
914 painter.fillRect( 20, y, 715, 20, y_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
915 painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, QString(tr("%1 step yeaststarter")).arg(st));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
916 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QString(tr("Before")));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
917 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, QString("%1 L").arg(sv, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
918 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
919 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
920 painter.fillRect(670, y, 60, 20, c_line1);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
921 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
922
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
923 if ((y + 80 + (product->miscs.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
924 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
925 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
926 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
927 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
928 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
929 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
930
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
931 /* Miscs */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
932 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
933 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
934 painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, tr("Misc ingredient"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
935 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
936 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
937 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
938 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
939 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
940 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
941 double cost_miscs = 0;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
942 for (int i = 0; i < product->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
943 double cost = product->miscs.at(i).amount * product->miscs.at(i).cost;
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
944 cost_miscs += cost;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
945
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
946 if (product->miscs.at(i).use_use == 2)
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
947 use = QCoreApplication::translate("MiscUse", g_misc_uses[product->miscs.at(i).use_use]) + QString(" %1 min").arg(product->miscs.at(i).time);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
948 else
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
949 use = QCoreApplication::translate("MiscUse", g_misc_uses[product->miscs.at(i).use_use]);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
950
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
951 if (product->miscs.at(i).type == 4) // Water agent
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
952 painter.fillRect( 20, y, 715, 20, mw_line);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
953 else if (product->miscs.at(i).type == 3) // Fining
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
954 painter.fillRect( 20, y, 715, 20, mf_line);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
955 else if (product->miscs.at(i).type < 3 || product->miscs.at(i).type == 5) // Spice, Herb, Flavour, Yeast nutrient
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
956 painter.fillRect( 20, y, 715, 20, ms_line);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
957 else
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
958 painter.fillRect( 20, y, 715, 20, mo_line);
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
959 painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, product->miscs.at(i).name);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
960 painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("MiscType", g_misc_types[product->miscs.at(i).type]));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
961 painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
962 painter.drawText(605, y+4, 60, 20, Qt::AlignRight,
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
963 QString("%1 %2").arg(product->miscs.at(i).amount * 1000.0, 1, 'f', 1).arg(product->miscs.at(i).amount_is_weight ? "gr":"ml"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
964 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
965 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
966 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
967 painter.fillRect(670, y, 60, 20, c_line1);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
968 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
969
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
970 if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) { /* Rows + header + blank */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
971 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
972 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
973 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
974 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
975 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
976 }
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
977
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
978 /* Mash */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
979 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
980 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
981 painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, tr("Mash step"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
982 painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, tr("Step type"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
983 painter.drawText(260, y+4, 60, 20, Qt::AlignRight, tr("Start °C"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
984 painter.drawText(325, y+4, 60, 20, Qt::AlignRight, tr("End °C"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
985 painter.drawText(390, y+4, 60, 20, Qt::AlignRight, tr("Time"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
986 painter.drawText(455, y+4, 60, 20, Qt::AlignRight, tr("Ramp"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
987 painter.drawText(520, y+4, 60, 20, Qt::AlignRight, tr("L/kg"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
988 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec L."));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
989 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec °C"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
990 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
991 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
992 for (int i = 0; i < product->mashs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
993 painter.fillRect( 20, y, 715, 20, line);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
994 painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, product->mashs.at(i).step_name);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
995 painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("StepType", g_step_types[product->mashs.at(i).step_type]));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
996 painter.drawText(260, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_temp, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
997 painter.drawText(325, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).end_temp, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
998 painter.drawText(390, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
999 painter.drawText(455, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).ramp_time, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1000 painter.drawText(520, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_wg_ratio, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1001 if (product->mashs.at(i).step_type != 1) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1002 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_amount, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1003 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1004 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1005 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1006 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1007
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1008 if ((y + 80 + ((product->w2_amount > 0) ? 40:0)) > painter.device()->height()) { /* waters + header + blank */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1009 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1010 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1011 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1012 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1013 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1014 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1015
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1016 /* Water */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1017 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1018 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1019 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Water source"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1020 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, tr("Volume"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1021 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, tr("Ca"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1022 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, tr("Mg"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1023 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, tr("CaCO3"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1024 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, tr("Na"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1025 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, tr("Cl"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1026 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("SO4"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1027 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("pH"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1028 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1029 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1030 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1031 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, product->w1_name);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1032 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->w1_amount, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1033 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1034 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1035 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1036 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1037 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1038 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_sulfate, 1, 'f', 1));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1039 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1040 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1041 if (product->w2_amount > 0) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1042 /*
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1043 * If there is dillution water, show it and the mixed result too.
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1044 */
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1045 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1046 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, product->w2_name);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1047 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->w2_amount, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1048 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1049 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1050 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1051 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1052 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1053 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_sulfate, 1, 'f', 1));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1054 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1055 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1056 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1057 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Mixed water"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1058 painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->wg_amount, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1059 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1060 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1061 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1062 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1063 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1064 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_sulfate, 1, 'f', 1));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1065 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1066 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1067 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1068 painter.fillRect( 20, y, 715, 20, w_line);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1069 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated water"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1070 painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_calcium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1071 painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_magnesium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1072 painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_total_alkalinity, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1073 painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_sodium, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1074 painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_chloride, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1075 painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_sulfate, 1, 'f', 1));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1076 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1077 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1078
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1079 /*
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1080 * Print product notes if present.
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1081 */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1082 if (product->notes.length()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1083 QStringList lines = product->notes.split("\n");
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1084
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1085 if (lines.size() && product->notes != "") {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1086 if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1087 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1088 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1089 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1090 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1091 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1092 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1093
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1094 /* Notes header */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1095 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1096 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1097 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1098 painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe notes"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1099 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1100 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1101 for (int i = 0; i < lines.size(); i++) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1102 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1103 painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1104 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1105 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1106 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1107 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1108
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1109 if (product->stage > PROD_STAGE_BREW) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1110 if ((y + 100) > painter.device()->height()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1111 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1112 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1113 y = 120;
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1114 } else {
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1115 y += 40;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1116 }
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1117 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1118 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1119 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1120 painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Product brewday"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1121 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1122 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1123 painter.fillRect( 20, y, 300, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1124 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Brewday start"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1125 painter.drawText(140, y+4, 180, 20, Qt::AlignLeft, product->brew_date_start.toString("dd MMM yyyy hh:mm"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1126 painter.fillRect(435, y, 300, 20, c_line1);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1127 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Brewday end"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1128 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, product->brew_date_end.toString("dd MMM yyyy hh:mm"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1129
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1130 /* Mash history */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1131 if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1132 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1133 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1134 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1135 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1136 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1137 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1138 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1139 painter.fillRect( 20, y, 715, 20, line);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1140 painter.drawText( 40, y+4, 250, 20, Qt::AlignLeft, tr("Mash step"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1141 painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, tr("Step type"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1142 painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, tr("Temperature"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1143 painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, tr("Minutes"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1144 painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, tr("SG"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1145 painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, tr("pH"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1146 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1147 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1148 for (int i = 0; i < product->mashs.size(); i++) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1149 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1150 painter.drawText( 20, y+4, 20, 20, Qt::AlignCenter, QString("%1").arg(i + 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1151 painter.drawText( 40, y+4, 250, 20, Qt::AlignLeft, product->mashs.at(i).step_name);
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
1152 painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, QCoreApplication::translate("StepType", g_step_types[product->mashs.at(i).step_type]));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1153 painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, QString("%1 - %2°C").
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1154 arg(product->mashs.at(i).step_temp, 1, 'f', 1).arg(product->mashs.at(i).end_temp, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1155 painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1156 painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_sg, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1157 painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_ph, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1158 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1159 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1160
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1161 /* Brew history */
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1162 if ((y + 470) > painter.device()->height()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1163 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1164 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1165 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1166 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1167 y += 20;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1168 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1169 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1170 painter.fillRect( 20, y, 715, 20, line);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1171 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Brew item"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1172 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, tr("Expected"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1173 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, tr("Reached"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1174 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, tr("Difference"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1175 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1176 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1177 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1178 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash pH"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1179 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->mash_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1180 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_mash_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1181 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->mash_ph, product->brew_mash_ph, 2, " pH"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1182 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1183 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1184 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash density"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1185 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_mash_sg));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1186 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_mash_sg));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1187 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_mash_sg, product->brew_mash_sg, 3, " SG"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1188 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1189 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1190 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash efficiency"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1191 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, "100%");
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1192 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_mash_efficiency, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1193 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(100.0, product->brew_mash_efficiency, 1, "%"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1194 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1195 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1196 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Sparge pH"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1197 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->sparge_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1198 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_sparge_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1199 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->sparge_ph, product->brew_sparge_ph, 2, " pH"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1200 y += 25;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1201
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1202 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1203 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil pH"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1204 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1205 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1206 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1207 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil density"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1208 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->preboil_sg));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1209 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_preboil_sg));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1210 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->preboil_sg, product->brew_preboil_sg, 3, " SG"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1211 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1212 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1213 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil volume"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1214 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->boil_size * 1.04, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1215 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_preboil_volume, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1216 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->boil_size * 1.04, product->brew_preboil_volume, 1, " L"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1217 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1218 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1219 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil efficiency"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1220 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1221 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_preboil_efficiency, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1222 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_preboil_efficiency, 1, "%"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1223 y += 25;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1224 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1225 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil pH"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1226 //painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1227 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_aboil_ph, 1, 'f', 2));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1228 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1229 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1230 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil density"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1231 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1232 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_aboil_sg));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1233 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_aboil_sg, 3, " SG"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1234 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1235 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1236 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil volume"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1237 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size * 1.04, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1238 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_aboil_volume, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1239 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size * 1.04, product->brew_aboil_volume, 1, " L"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1240 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1241 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1242 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil efficiency"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1243 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1244 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_aboil_efficiency, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1245 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_aboil_efficiency, 1, "%"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1246 y += 25;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1247 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1248 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Chiller and trub loss"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1249 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_trub_chiller_loss, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1250 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_tcloss, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1251 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_trub_chiller_loss, product->brew_fermenter_tcloss, 1, " L"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1252 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1253 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1254 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Top up water"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1255 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_top_up_water, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1256 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_extrawater, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1257 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_top_up_water, product->brew_fermenter_extrawater, 1, " L"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1258 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1259 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1260 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter volume"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1261 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size - product->eq_trub_chiller_loss, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1262 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_volume, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1263 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size - product->eq_trub_chiller_loss, product->brew_fermenter_volume, 1, " L"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1264 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1265 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1266 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter density"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1267 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1268 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_fermenter_sg));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1269 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_fermenter_sg, 3, " SG"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1270 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1271 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1272 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter color"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1273 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->est_color, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1274 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->brew_fermenter_color, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1275 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_color, product->brew_fermenter_color, 0, " EBC"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1276 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1277 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1278 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter IBU"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1279 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->est_ibu, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1280 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->brew_fermenter_ibu, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1281 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_ibu, product->brew_fermenter_ibu, 0, " IBU"));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1282 y += 25;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1283 painter.fillRect( 20, y, 430, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1284 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling method"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1285 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, cooling_method[product->brew_cooling_method]);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1286 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1287 painter.fillRect( 20, y, 430, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1288 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling temperature"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1289 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1°C").arg(product->brew_cooling_to, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1290 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1291 painter.fillRect( 20, y, 430, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1292 painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling time"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1293 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 min").arg(product->brew_cooling_time, 1, 'f', 0));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1294 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1295
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1296 if (product->stage > PROD_STAGE_TERTIARY) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1297 if ((y + 200) > painter.device()->height()) {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1298 printer->newPage();
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1299 printHeader(&painter);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1300 y = 120;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1301 } else {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1302 y += 40;
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1303 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1304 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1305 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1306 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1307 painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Product fermentation"));
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1308 y += 20;
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1309 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1310 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1311 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Primary start temp"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1312 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_start_temp, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1313 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1314 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Primary peak temp"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1315 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_max_temp, 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1316 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1317 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1318 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Primary end temp"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1319 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_end_temp, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1320 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1321 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Primary density"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1322 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->primary_end_sg, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1323 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1324 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1325 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Primary end date"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1326 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->primary_end_date.toString("dd MMM yyyy"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1327 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1328 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1329 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Secondary end temp"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1330 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->secondary_temp, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1331 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1332 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Secondary density"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1333 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->secondary_end_sg, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1334 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1335 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1336 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Secondary end date"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1337 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->secondary_end_date.toString("dd MMM yyyy"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1338 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1339 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1340 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Tertiary temperature"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1341 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->tertiary_temp, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1342 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1343 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Final density"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1344 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->fg, 1, 'f', 3));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1345 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1346 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1347 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Tertiary end date"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1348 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->package_date.toString("dd MMM yyyy"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1349 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1350 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Apperant attenuation"));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1351 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(Utils::calc_svg(product->brew_fermenter_sg, product->fg), 1, 'f', 1));
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1352 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1353
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1354 if (product->stage > PROD_STAGE_PACKAGE) {
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1355 if ((y + ((product->package_infuse_amount > 0) ? 305:265)) > painter.device()->height()) {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1356 printer->newPage();
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1357 printHeader(&painter);
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1358 y = 120;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1359 } else {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1360 y += 40;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1361 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1362 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1363 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1364 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1365 painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Package product"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1366 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1367 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1368 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1369 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Package date"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1370 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->package_date.toString("dd MMM yyyy"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1371 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1372 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Package volume"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1373 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->package_volume, 1, 'f', 1));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1374 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1375 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1376 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1377 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Alcohol volume"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1378 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->package_abv, 1, 'f', 2));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1379 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1380 if (product->package_infuse_amount > 0) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1381 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1382 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Infuse volume"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1383 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->package_infuse_amount, 1, 'f', 3));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1384 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1385 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Infuse alcohol"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1386 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->package_infuse_abv, 1, 'f', 2));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1387 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1388 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1389 painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, product->package_infuse_notes);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1390 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1391 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1392 y += 5;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1393 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1394 painter.fillRect( 20, y, 330, 20, line);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1395 painter.drawText( 20, y+2, 330, 20, Qt::AlignCenter, tr("Bottles"));
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1396 painter.fillRect(405, y, 330, 20, line);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1397 painter.drawText(405, y+2, 330, 20, Qt::AlignCenter, tr("Kegs"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1398 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1399 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1400 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1401 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Bottles volume"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1402 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->bottle_amount, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1403 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1404 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Kegs volume"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1405 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->keg_amount, 1, 'f', 1));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1406 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1407 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1408 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Bottles CO2 volumes"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1409 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->bottle_carbonation, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1410 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1411 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Kegs CO2 volumes"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1412 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->keg_carbonation, 1, 'f', 1));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1413 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1414 QString bsugar = "", ksugar = "";
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1415 double bamount = 0, kamount = 0;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1416 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1417 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1418 bsugar = product->fermentables.at(i).name;
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1419 bamount = product->fermentables.at(i).amount;
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1420 }
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1421 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1422 ksugar = product->fermentables.at(i).name;
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1423 kamount = product->fermentables.at(i).amount;
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1424 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1425 }
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1426 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1427 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Sugar"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1428 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, bsugar);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1429 painter.fillRect(405, y, 330, 20, c_line1);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1430 if (product->keg_forced_carb) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1431 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Forced carbonation"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1432 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, tr("Yes"));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1433 } else {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1434 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Sugar"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1435 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, ksugar);
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1436 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1437 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1438 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1439 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Sugar amount"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1440 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 Kg").arg(bamount, 1, 'f', 3));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1441 if (! product->keg_forced_carb) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1442 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1443 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Sugar amount"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1444 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 Kg").arg(kamount, 1, 'f', 3));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1445 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1446 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1447 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1448 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Water amount"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1449 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->bottle_priming_water, 1, 'f', 3));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1450 if (! product->keg_forced_carb) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1451 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1452 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Water amount"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1453 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->keg_priming_water, 1, 'f', 3));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1454 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1455 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1456 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1457 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Alcohol volume"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1458 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->bottle_abv, 1, 'f', 2));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1459 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1460 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Alcohol volume"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1461 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->keg_abv, 1, 'f', 2));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1462 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1463 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1464 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Pressure"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1465 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 bar").arg(product->bottle_bar, 1, 'f', 2));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1466 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1467 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Pressure"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1468 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 bar").arg(product->keg_bar, 1, 'f', 2));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1469 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1470 painter.fillRect( 20, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1471 painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Carbonation temp"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1472 painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->bottle_carbonation_temp, 1, 'f', 1));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1473 painter.fillRect(405, y, 330, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1474 painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Carbonation temp"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1475 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->keg_carbonation_temp, 1, 'f', 1));
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1476 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1477
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1478 if (product->stage > PROD_STAGE_TASTE) {
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1479 QStringList lines = product->taste_notes.split("\n");
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
1480
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1481 if (lines.size() && (product->taste_notes != "")) {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1482 if ((y + 220 + (lines.size() * 20)) > painter.device()->height()) {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1483 printer->newPage();
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1484 printHeader(&painter);
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1485 y = 120;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1486 } else {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1487 y += 40;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1488 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1489 } else {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1490 if ((y + 220) > painter.device()->height()) {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1491 printer->newPage();
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1492 printHeader(&painter);
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1493 y = 120;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1494 } else {
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1495 y += 40;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1496 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1497 }
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1498 painter.setFont(QFont("Helvetica", 9, QFont::Bold));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1499 painter.setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1500 painter.fillRect( 20, y, 715, 20, c_header);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1501 painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Tasting notes"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1502 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1503 painter.setFont(QFont("Helvetica", 9, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1504 painter.fillRect( 20, y, 300, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1505 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Tasting date"));
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1506 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, product->taste_date.toString("dd MMM yyyy"));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1507 painter.fillRect(435, y, 300, 20, c_line1);
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1508 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Taste score"));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1509 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1").arg(product->taste_rate, 1, 'f', 1));
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1510 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1511 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1512 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Color"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1513 painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_color);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1514 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1515 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1516 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Transparency"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1517 painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_transparency);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1518 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1519 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1520 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Head"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1521 painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_head);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1522 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1523 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1524 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Aroma"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1525 painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_aroma);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1526 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1527 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1528 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Taste"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1529 painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_taste);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1530 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1531 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1532 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Mouthfeel"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1533 painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_mouthfeel);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1534 y += 20;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1535 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1536 painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Aftertaste"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1537 painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_aftertaste);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1538 y += 25;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1539 for (int i = 0; i < lines.size(); i++) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1540 painter.fillRect( 20, y, 715, 20, c_line1);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1541 painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]);
238
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1542 y += 20;
047e99c90848 Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents: 237
diff changeset
1543 }
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1544 }
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1545
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1546 } else if (p_job == PR_CHECKLIST) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1547
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1548 double factor = 1.0 / product->divide_factor;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1549 double mashwater = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1550 int numsalts = 0;
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
1551
260
42b88d85fefc Fix default divide_size field in products. Update miscs table column 6 and 7 tooltips and display of the buttons after sort. After a new misc product is selected, update the current row index because the row may be moved. Fix some display misc values in the checklist, they were not multiplied by 1000. Fix display of some bars if the value was 24.
Michiel Broek <mbroek@mbse.eu>
parents: 255
diff changeset
1552 qInfo() << "Print checklist" << product->record << "factor" << factor << product->divide_factor;
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1553 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1554 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1555
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1556 /* First item, a yeast starter if needed, days before brewday. */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1557 if (product->starter_enable && product->prop_volume[0]) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1558 checkHeader(&painter, &y, tr("Make a yeast starter"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1559 int days = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1560 int last = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1561 QString s = "";
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1562 for (int i = 0; i < 4; i++) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1563 if (product->prop_volume[i]) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1564 last = i;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1565 if (product->prop_type[i] == STARTERS_STIRRED)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1566 days += 2;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1567 else if (product->prop_type[i] == STARTERS_SHAKEN)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1568 days += 4;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1569 else
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1570 days += 6; // Simple starter
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1571 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1572 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1573 checkLine(&painter, &y, QString(tr("Start about %1 days before brewday with the starter.")).arg(days));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1574 for (int i = 0; i < 4; i++) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1575 if (product->prop_volume[i]) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1576 checkLine(&painter, &y, QString(tr("Starter step %1 of %2 liter with SG %3")).arg(i+1).arg(product->prop_volume[i], 1, 'f', 3).
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1577 arg(product->starter_sg, 1, 'f', 3));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1578 QString w = tr(" until there is enough yeast");
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1579 if (product->prop_type[i] == STARTERS_STIRRED)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1580 checkLine(&painter, &y, QString(tr("about 24 hours on a stirplate"))+w);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1581 else if (product->prop_type[i] == STARTERS_SHAKEN)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1582 checkLine(&painter, &y, QString(tr("shake often for a few days"))+w);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1583 else
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1584 checkLine(&painter, &y, QString(tr("let it rest for almost a week"))+w);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1585 if (i < last) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1586 checkLine(&painter, &y, QString(tr("place starter in the fridge for 24 hours")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1587 checkLine(&painter, &y, QString(tr("remove starter from the fridge and decant")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1588 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1589 checkLine(&painter, &y, QString(tr("place starter in the fridge until brewday")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1590 checkLine(&painter, &y, QString(tr("remove starter from the fridge and decant")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1591 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1592 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1593 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1594 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1595 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1596
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1597 checkHeader(&painter, &y, tr("Mash water and treatment"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1598 checkLine(&painter, &y, QString("%1 liter water %2").arg(product->w1_amount * factor, 1, 'f', 1).arg(product->w1_name));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1599 mashwater += product->w1_amount * factor;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1600 if (product->w2_name != "" && product->w2_amount > 0) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1601 checkLine(&painter, &y, QString("%1 liter water %2").arg(product->w2_amount * factor, 1, 'f', 1).arg(product->w2_name));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1602 mashwater += product->w2_amount * factor;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1603 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1604 for (int i = 0; i < product->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1605 if (product->miscs.at(i).type == MISC_TYPES_WATER_AGENT) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1606 QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml";
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1607 checkLine(&painter, &y, QString("%1 %2 %3").arg(product->miscs.at(i).amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1608 numsalts++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1609 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1610 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1611 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1612
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1613 checkHeader(&painter, &y, tr("Weight and mill the malts"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1614 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1615 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1616 checkLine(&painter, &y, QString("%1 kg `%2` (%3)").arg(product->fermentables.at(i).amount * factor, 1, 'f', 3).
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1617 arg(product->fermentables.at(i).name).arg(product->fermentables.at(i).supplier));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1618 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1619 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1620 checkLine(&painter, &y, QString(tr("Mill the malts")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1621 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1622
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1623 checkHeader(&painter, &y, tr("Mash"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1624 int loop = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1625 double l, mvol = 0, msugars = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1626 for (int i = 0; i < product->mashs.size(); i++) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1627 if (product->mashs.at(i).step_type == 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1628 mvol += product->mashs.at(i).step_infuse_amount * factor; // We need this later
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1629 if (loop == 0) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1630 if (product->mashs.at(i).step_type == 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1631 l = product->mashs.at(i).step_infuse_amount * factor;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1632 else
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1633 l = mashwater;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1634 checkLine(&painter, &y, QString(tr("Heat %1 liter water to %2°C (%3 cm below kettle top)"))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1635 .arg(mashwater, 1, 'f', 1).arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1636 .arg(Utils::kettle_cm(l, product->eq_tun_volume, product->eq_tun_height), 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1637 if (numsalts > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1638 checkLine(&painter, &y, QString(tr("Add brouwzouten")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1639 checkLine(&painter, &y, QString(tr("Add malts and dough-in")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1640 for (int j = 0; j < product->hops.size(); j++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1641 if (product->hops.at(j).useat == HOP_USEAT_MASH) {
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1642 checkLine(&painter, &y, QString(tr("Add %1 gram `%2` hop")).arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 1)
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1643 .arg(product->hops.at(j).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1644 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1645 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1646 for (int j = 0; j < product->miscs.size(); j++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1647 if ((product->miscs.at(j).use_use == MISC_USES_MASH) && (product->miscs.at(j).type != MISC_TYPES_WATER_AGENT)) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1648 QString unit = (product->miscs.at(j).amount_is_weight) ? "gr":"ml";
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1649 checkLine(&painter, &y, QString(tr("Add %1 %2 `%3`")).arg(product->miscs.at(j).amount * 1000 * factor, 1, 'f', 2)
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1650 .arg(unit).arg(product->miscs.at(j).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1651 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1652 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1653 } else { // loop > 0
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1654 if (product->mashs.at(i).step_type == 0) { // Infusion
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1655 checkLine(&painter, &y, QString(tr("Add %1 liter water of %2°C")).arg(product->mashs.at(i).step_infuse_amount * factor, 1, 'f', 1)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1656 .arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1657 } else if (product->mashs.at(i).step_type == 1) { // Direct heat
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1658 checkLine(&painter, &y, QString(tr("Heat upto %1°C")).arg(product->mashs.at(i).step_temp, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1659 } else { // Decoction
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1660 checkLine(&painter, &y, QString(tr("Take, heat, boil and return %1 part of the mash"))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1661 .arg(product->mashs.at(i).step_infuse_amount * factor, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1662 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1663 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1664 if (product->mashs.at(i).step_temp != product->mashs.at(i).end_temp) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1665 checkInput(&painter, &y, QString(tr("%1 minutes from %2°C to %3°C")).arg(product->mashs.at(i).step_time)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1666 .arg(product->mashs.at(i).step_temp, 1, 'f', 1).arg(product->mashs.at(i).end_temp, 1, 'f', 1), QString(tr("Brix")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1667 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1668 checkInput(&painter, &y, QString(tr("%1 minutes at %2°C")).arg(product->mashs.at(i).step_time)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1669 .arg(product->mashs.at(i).step_temp, 1, 'f', 1), QString(tr("Brix")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1670 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1671 if (loop == 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1672 checkInput(&painter, &y, QString(tr("Measure and adjust pH (target %1 pH)")).arg(product->mash_ph, 1, 'f', 2), QString(tr("pH")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1673 loop++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1674 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1675 double est_masg_sg = 0, sugardensity = 1.611, grainabsorbtion = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1676 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1677 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) {
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1678 double d = product->fermentables.at(i).amount * factor * (product->fermentables.at(i).yield / 100) *
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1679 (1 - product->fermentables.at(i).moisture / 100);
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1680 mvol += product->fermentables.at(i).amount * factor * (product->fermentables.at(i).moisture / 100);
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1681 grainabsorbtion += my_grain_absorbtion * product->fermentables.at(i).amount * factor;
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1682 msugars += d;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1683 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1684 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1685 double v = msugars / sugardensity + mvol;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1686 double plato = 1000.0 * msugars / (v * 10.0); // deg. Plato
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1687 double mash_sg = Utils::plato_to_sg(plato);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1688 checkInput(&painter, &y, QString(tr("Target SG end mash: ")) + strDensity(mash_sg), QString(tr("SG")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1689 if ((y + 140) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1690 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1691 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1692 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1693 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1694 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1695 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1696
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1697 checkHeader(&painter, &y, tr("Lauter and Sparge"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1698 checkLine(&painter, &y, QString(tr("Heat %1 liter sparge water to %2°C")).arg(product->sparge_volume * factor, 1, 'f', 1)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1699 .arg(product->sparge_temp, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1700 checkInput(&painter, &y, QString(tr("Bring to %1 pH with %2 ml. `%3`")).arg(product->sparge_ph, 1, 'f', 2)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1701 .arg(product->sparge_acid_amount * 1000 * factor, 1, 'f', 2).arg(my_acids.at(product->sparge_acid_type).name_en), QString(tr("pH")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1702 checkLine(&painter, &y, QString(tr("Sparge with close to %1 liter water"))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1703 .arg(((product->boil_size * factor) - mashwater + grainabsorbtion + product->eq_lauter_deadspace) * 1.03, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1704 checkInput(&painter, &y, QString(tr("Target volume in boil kettle: %1 liter (%2 cm below kettle top)"))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1705 .arg(product->boil_size * factor * 1.04, 1, 'f', 1)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1706 .arg(Utils::kettle_cm(product->boil_size * factor * 1.04, product->eq_kettle_volume, product->eq_kettle_height), 1, 'f', 1),
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1707 QString(tr("cm")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1708 checkInput(&painter, &y, QString(tr("Target SG in boil kettle: ")) + strDensity(product->preboil_sg), QString(tr("SG")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1709 checkInput(&painter, &y, "", QString(tr("pH")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1710 for (int i = 0; i < product->hops.size(); i++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1711 if (product->hops.at(i).useat == HOP_USEAT_FWH) {
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1712 checkLine(&painter, &y, QString(tr("Add %1 gr `%2` hop after sparge")).arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1)
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1713 .arg(product->hops.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1714 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1715 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1716
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1717 if (checkSplit(&painter, &y, 1))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1718 factor = 1;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1719 /* Boil, how much space do we need */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1720 int lines = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1721 if (product->boil_time == 0) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1722 lines = 3;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1723 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1724 lines = 5;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1725 if (product->brew_cooling_method == 1)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1726 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1727 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1728 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1729 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1730 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1731 for (int i = 0; i < product->hops.size(); i++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1732 if (product->hops.at(i).useat == HOP_USEAT_BOIL || product->hops.at(i).useat == HOP_USEAT_AROMA)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1733 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1734 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1735 for (int i = 0; i < product->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1736 if (product->miscs.at(i).use_use == MISC_USES_BOIL)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1737 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1738 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1739 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1740 qDebug() << "check" << lines << y + (lines * 20) << painter.device()->height();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1741 if ((y + (lines * 20)) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1742 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1743 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1744 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1745 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1746 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1747 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1748 checkHeader(&painter, &y, tr("Boil"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1749 if (product->boil_time > 0) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1750 checkLine(&painter, &y, QString(tr("Total boiltime: %1 minutes")).arg(product->boil_time, 1, 'f', 0));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1751 for (int i = product->boil_time; i >= 0; i--) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1752 if (i == 10) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1753 for (int j = 0; j < product->fermentables.size(); j++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1754 if (product->fermentables.at(j).added == FERMENTABLE_ADDED_BOIL)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1755 checkLine(&painter, &y, QString(tr("%1 kg `%2` at 10 minutes before end of boil"))
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1756 .arg(product->fermentables.at(j).amount * factor, 1, 'f', 3)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1757 .arg(product->fermentables.at(j).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1758 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1759 if (product->brew_cooling_method == 1)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1760 checkLine(&painter, &y, QString(tr("Place emersion chiller at 10 minutes before end of boil")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1761 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1762 for (int j = 0; j < product->hops.size(); j++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1763 if ((product->hops.at(j).useat == HOP_USEAT_BOIL || product->hops.at(j).useat == HOP_USEAT_AROMA) && product->hops.at(j).time == i) {
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1764 if (i == 0)
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1765 checkLine(&painter, &y, QString(tr("%1 gr `%2` at flameout")).arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 2)
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1766 .arg(product->hops.at(j).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1767 else
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1768 checkLine(&painter, &y, QString(tr("%1 gr `%2` at %3 minutes before end of boil"))
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1769 .arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 2).arg(product->hops.at(j).name).arg(i));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1770 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1771 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1772 for (int j = 0; j < product->miscs.size(); j++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1773 if (product->miscs.at(j).use_use == MISC_USES_BOIL && product->miscs.at(j).time == i) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1774 QString unit = (product->miscs.at(j).amount_is_weight) ? "gr":"ml";
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1775 if (i == 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1776 checkLine(&painter, &y, QString(tr("%1 %2 `%3` at flameout"))
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1777 .arg(product->miscs.at(j).amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(j).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1778 else
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1779 checkLine(&painter, &y, QString(tr("%1 %2 `%3` at %4 minutes before end of boil"))
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1780 .arg(product->miscs.at(j).amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(j).name).arg(i));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1781 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1782 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1783 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1784 checkInput(&painter, &y, QString(tr("Target volume at end of boil: %1 liter (%2 cm below kettle top)"))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1785 .arg(product->batch_size * 1.04 * factor, 1, 'f', 1)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1786 .arg(Utils::kettle_cm(product->batch_size * 1.04 * factor, product->eq_kettle_volume, product->eq_kettle_height)),
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1787 QString(tr("cm")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1788 checkInput(&painter, &y, QString(tr("Target SG at end of boil: ")) + strDensity(product->est_og3), QString(tr("SG")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1789 checkInput(&painter, &y, "", QString(tr("pH")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1790 if (checkSplit(&painter, &y, 2))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1791 factor = 1;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1792 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1793 checkLine(&painter, &y, QString(tr("This is a `no-boil` recipe")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1794 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1795
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1796 /* Whirlpools and chilling */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1797 lines = 5;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1798 if (product->brew_whirlpool9)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1799 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1800 if (product->brew_whirlpool7)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1801 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1802 if (product->brew_whirlpool6)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1803 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1804 if (product->brew_whirlpool2)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1805 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1806 for (int i = 0; i < product->hops.size(); i++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1807 if (product->hops.at(i).useat == HOP_USEAT_WHIRLPOOL)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1808 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1809 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1810 if ((y + (lines * 20)) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1811 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1812 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1813 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1814 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1815 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1816 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1817 if ((product->brew_whirlpool9 + product->brew_whirlpool7 + product->brew_whirlpool6 + product->brew_whirlpool2) > 0) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1818 checkHeader(&painter, &y, tr("Whirlpool(s) and cooling"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1819 if (product->brew_whirlpool9 > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1820 checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp above 85°C")).arg(product->brew_whirlpool9, 1, 'f', 0));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1821 if (product->brew_whirlpool7 > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1822 checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp between 72 and 79°C")).arg(product->brew_whirlpool7, 1, 'f', 0));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1823 if (product->brew_whirlpool6 > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1824 checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp between 60 and 66°C")).arg(product->brew_whirlpool6, 1, 'f', 0));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1825 for (int i = 0; i < product->hops.size(); i++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1826 if (product->hops.at(i).useat == HOP_USEAT_WHIRLPOOL)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1827 checkLine(&painter, &y, QString(tr("%1 gr `%2` for %3 minutes in the whirlpool"))
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1828 .arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1).arg(product->hops.at(i).name)
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1829 .arg(product->hops.at(i).time));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1830 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1831 checkLine(&painter, &y, QString(tr("Cool to %1°C")).arg(product->brew_cooling_to, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1832 if (product->brew_whirlpool2 > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1833 checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes.")).arg(product->brew_whirlpool2, 1, 'f', 0));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1834 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1835 checkHeader(&painter, &y, tr("Cooling"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1836 checkLine(&painter, &y, QString(tr("Cool to %1°C")).arg(product->brew_cooling_to, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1837 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1838 checkLine(&painter, &y, QString(tr("Desinfect fermenter and pump and hoses if needed")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1839 checkInput(&painter, &y, QString(tr("Transfer wort to fermenter")), QString(tr("Liter")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1840 if (checkSplit(&painter, &y, 3))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1841 factor = 1;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1842
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1843 double climate = product->brew_cooling_to;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1844 lines = 3;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1845 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1846 if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) {
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1847 lines++;
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1848 if (product->yeasts.at(i).type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).pitch_temperature > 0))
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1849 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1850 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1851 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1852 if (product->brew_aeration_type > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1853 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1854 if (product->brew_fermenter_extrawater > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1855 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1856 if ((y + (lines * 20)) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1857 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1858 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1859 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1860 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1861 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1862 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1863 double dry = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1864 checkHeader(&painter, &y, tr("Yeast pitching and fermentation"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1865 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1866 if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1867 switch (product->yeasts.at(i).form) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1868 case YEAST_FORMS_LIQUID: checkLine(&painter, &y, QString(tr("%1 pack %2, `%3` yeast")).arg(product->yeasts.at(i).amount)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1869 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1870 break;
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1871 case YEAST_FORMS_DRY: dry += product->yeasts.at(i).amount * 1000 * factor;
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1872 case YEAST_FORMS_DRIED: checkLine(&painter, &y, QString(tr("%1 gram %2, `%3` yeast"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1873 .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1874 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1875 break;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1876 default: checkLine(&painter, &y, QString(tr("%1 ml %2, `%3` yeast"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1877 .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 0)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1878 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1879 break;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1880 }
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1881 if (product->yeasts.at(i).type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).pitch_temperature > 0)) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1882 checkLine(&painter, &y, QString(tr("Pitch yeast at %1°C")).arg(product->yeasts.at(i).pitch_temperature, 1, 'f', 1));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1883 climate = product->yeasts.at(i).pitch_temperature;
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1884 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1885 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1886 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1887 if (dry > 0) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1888 checkLine(&painter, &y, QString(tr("Pitch yeast dry into the wort")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1889 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1890 if (product->starter_enable && product->prop_volume[0])
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1891 checkLine(&painter, &y, QString(tr("Add decanted yeast starter")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1892 else
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1893 checkLine(&painter, &y, QString(tr("Add the yeast")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1894 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1895 if (product->brew_fermenter_extrawater)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1896 checkLine(&painter, &y, QString(tr("Add %1 liter water in the fermenter")).arg(product->brew_fermenter_extrawater * factor, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1897 if (product->brew_aeration_type > 0)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1898 checkLine(&painter, &y, QString(tr("Aerate %1 minutes with %2")).arg(product->brew_aeration_time)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1899 .arg((product->brew_aeration_type == 1) ? "air":"oxygen"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1900 checkLine(&painter, &y, QString(tr("Set fermentation start temperature to %1°C")).arg(climate, 1, 'f', 1));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1901 checkLine(&painter, &y, QString(tr("Start fermentation")));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1902
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1903 /* During primary fermentation */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1904 lines = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1905 for (int i = 0; i < product->fermentables.size(); i++)
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1906 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1907 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1908 for (int i = 0; i < product->miscs.size(); i++)
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1909 if (product->miscs.at(i).use_use == MISC_USES_PRIMARY)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1910 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1911 if (lines) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1912 if ((y + 20 + (lines * 20)) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1913 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1914 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1915 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1916 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1917 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1918 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1919 checkHeader(&painter, &y, tr("Primary fermentation"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1920 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1921 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1922 checkLine(&painter, &y, QString(tr("Add %1 kg `%2` on day 3 or 4")).arg(product->fermentables.at(i).amount * factor, 1, 'f', 3)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1923 .arg(product->fermentables.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1924 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1925 for (int i = 0; i < product->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1926 if (product->miscs.at(i).use_use == MISC_USES_PRIMARY) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1927 QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml";
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1928 checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` on day 3 or 4")).arg(product->miscs.at(i).amount * 1000 * factor, 1, 'f', 3)
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1929 .arg(unit).arg(product->miscs.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1930 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1931 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1932 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1933 if (checkSplit(&painter, &y, 4))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1934 factor = 1;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1935
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1936 /* During secondary fermentation, yeast */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1937 lines = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1938 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1939 if (product->yeasts.at(i).use == YEAST_USE_SECONDARY)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1940 lines++;
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1941 if (product->yeasts.at(i).harvest_time > 0)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1942 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1943 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1944 if (lines) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1945 if ((y + 20 + (lines * 20)) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1946 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1947 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1948 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1949 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1950 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1951 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1952 checkHeader(&painter, &y, tr("Secondary fermentation"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1953 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1954 if (product->yeasts.at(i).use == YEAST_USE_SECONDARY) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1955 if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) {
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1956 checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1957 .arg(product->yeasts.at(i).amount).arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1958 } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1959 checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1960 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1961 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1962 checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` yeast (with starter if needed)"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1963 .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1964 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1965 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1966 }
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1967 if (product->yeasts.at(i).harvest_time > 0) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1968 checkLine(&painter, &y, QString(tr("After %1 hours harvest yeast from the %2")).arg(product->yeasts.at(i).harvest_time)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1969 .arg((product->yeasts.at(i).harvest_top > 0) ? "top":"bottom"));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1970 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1971 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1972 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1973 if (checkSplit(&painter, &y, 5))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1974 factor = 1;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1975
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1976 /* During tertiary fermentation */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1977 lines = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1978 for (int i = 0; i < product->fermentables.size(); i++)
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
1979 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1980 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1981 for (int i = 0; i < product->hops.size(); i++)
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
1982 if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1983 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1984 for (int i = 0; i < product->miscs.size(); i++)
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
1985 if (product->miscs.at(i).use_use == MISC_USES_SECONDARY)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1986 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1987 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1988 if (product->yeasts.at(i).use == YEAST_USE_TERTIARY)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1989 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1990 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1991 if (lines) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1992 if ((y + 20 + (lines * 20)) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1993 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1994 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1995 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1996 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1997 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1998 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
1999 checkHeader(&painter, &y, tr("Tertiary fermentation"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2000 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2001 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2002 checkLine(&painter, &y, QString(tr("Add %1 kg `%2`")).arg(product->fermentables.at(i).amount * factor, 1, 'f', 3)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2003 .arg(product->fermentables.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2004 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2005 for (int i = 0; i < product->hops.size(); i++) {
282
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
2006 if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP) {
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
2007 checkLine(&painter, &y, QString(tr("Add %1 gram `%2` for %3 days")).arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1)
d1d208a857b0 Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 280
diff changeset
2008 .arg(product->hops.at(i).name).arg(product->hops.at(i).time / 1440));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2009 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2010 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2011 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2012 if (product->yeasts.at(i).use == YEAST_USE_TERTIARY) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2013 if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) {
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2014 checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2015 .arg(product->yeasts.at(i).amount).arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2016 } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2017 checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2018 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2019 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2020 checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` yeast (with starter if needed)"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2021 .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2022 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2023 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2024 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2025 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2026 for (int i = 0; i < product->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2027 if (product->miscs.at(i).use_use == MISC_USES_SECONDARY) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2028 QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml";
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2029 checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` for %4 days")).arg(product->miscs.at(i).amount * 1000.0 * factor, 1, 'f', 2)
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2030 .arg(unit).arg(product->miscs.at(i).name).arg(product->miscs.at(i).time / 1440));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2031 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2032 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2033 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2034 if (checkSplit(&painter, &y, 6))
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2035 factor = 1;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2036
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2037 /* During packaging */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2038 lines = 0;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2039 for (int i = 0; i < product->fermentables.size(); i++)
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2040 if (product->fermentables.at(i).added >= FERMENTABLE_ADDED_BOTTLE)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2041 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2042 for (int i = 0; i < product->miscs.size(); i++)
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2043 if (product->miscs.at(i).use_use == MISC_USES_BOTTLING)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2044 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2045 for (int i = 0; i < product->yeasts.size(); i++)
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2046 if (product->yeasts.at(i).use == YEAST_USE_BOTTLE)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2047 lines++;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2048 if (lines) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2049 if ((y + 20 + (lines * 20)) > painter.device()->height()) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2050 printer->newPage();
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2051 printHeader(&painter);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2052 y = 120;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2053 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2054 y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2055 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2056 checkHeader(&painter, &y, tr("Packaging"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2057 for (int i = 0; i < product->fermentables.size(); i++) {
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2058 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2059 checkLine(&painter, &y, QString(tr("Bottling add %1 kg `%2` with %3 liter water"))
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2060 .arg(product->fermentables.at(i).amount * factor, 1, 'f', 3)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2061 .arg(product->fermentables.at(i).name).arg(product->bottle_priming_water * factor, 1, 'f', 3));
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2062 if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS)
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2063 checkLine(&painter, &y, QString(tr("Kegging add %1 kg `%2` with %3 liter water"))
283
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2064 .arg(product->fermentables.at(i).amount * factor, 1, 'f', 3)
242a68fa7186 Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 282
diff changeset
2065 .arg(product->fermentables.at(i).name).arg(product->keg_priming_water * factor, 1, 'f', 3));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2066 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2067 for (int i = 0; i < product->yeasts.size(); i++) {
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2068 if (product->yeasts.at(i).use == YEAST_USE_BOTTLE) {
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2069 if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) {
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2070 checkLine(&painter, &y, QString(tr("Add %1, `%2` as bottle yeast"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2071 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2072 } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) {
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2073 checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` as bottle yeast"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2074 .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2075 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2076 } else {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2077 checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` as bottle yeast"))
284
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2078 .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1)
33bb98c33e6a Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2079 .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2080 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2081 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2082 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2083 for (int i = 0; i < product->miscs.size(); i++) {
280
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2084 if (product->miscs.at(i).use_use == MISC_USES_BOTTLING) {
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2085 QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml";
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2086 checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` during bottling")).arg(product->miscs.at(i).amount * 1000 * factor, 1, 'f', 2)
efc213beb605 Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents: 272
diff changeset
2087 .arg(unit).arg(product->miscs.at(i).name));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2088 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2089 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2090 }
160
2b62a032079f Completed print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
2091 }
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2092
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2093 painter.end();
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2094 }
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2095
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2096
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2097 void PrinterDialog::checkHeader(QPainter *painter, qreal *y, QString text)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2098 {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2099 painter->setFont(QFont("Arial", 10, QFont::Bold));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2100 painter->setPen(Qt::black);
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2101 painter->drawText(50, *y, 700, 20, Qt::AlignLeft, text);
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2102 painter->setFont(QFont("Arial", 10, QFont::Normal));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2103 *y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2104 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2105
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2106
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2107 /*
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2108 * Draw a checkbox and text.
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2109 */
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2110 void PrinterDialog::checkLine(QPainter *painter, qreal *y, QString text)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2111 {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2112 painter->drawRect(24, *y, 16, 16);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2113 painter->drawText(50, *y,630, 20, Qt::AlignLeft, text);
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2114 *y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2115 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2116
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2117
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2118 void PrinterDialog::checkInput(QPainter *painter, qreal *y, QString text, QString prompt)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2119 {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2120 if (text != "") {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2121 painter->drawRect(24, *y, 16, 16);
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2122 painter->drawText(50, *y,480, 20, Qt::AlignLeft, text);
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2123 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2124 painter->drawText(515, *y, 150, 20, Qt::AlignRight, QString(tr("Measured:")) + QString(" _________"));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2125 painter->drawText(675, *y, 60, 20, Qt::AlignLeft, prompt);
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2126 *y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2127 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2128
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2129
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2130 bool PrinterDialog::checkSplit(QPainter *painter, qreal *y, int moment)
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2131 {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2132 if (product->divide_type && product->divide_type == moment) {
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2133 *y += 20;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2134 painter->setFont(QFont("Helvetica", 14, QFont::Bold));
301
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
2135 painter->drawText(20, *y, 715, 20, Qt::AlignCenter,
fe6346211b5b Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
2136 QString(tr("%1 split the batch here!")).arg(QCoreApplication::translate("Splitter", g_prod_split[product->divide_type])));
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2137 painter->setFont(QFont("Arial", 10, QFont::Normal));
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2138 *y += 26;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2139 return true;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2140 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2141 return false;
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2142 }
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2143
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2144
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2145 QString PrinterDialog::strDiff(double v1, double v2, int decimals, QString suffix)
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2146 {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2147 return QString("%1%2%3").arg((v2 > v1) ? "+":"").arg(v2 - v1, 1, 'f', decimals).arg(suffix);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2148 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2149
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2150
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2151 QString PrinterDialog::strDensity(double density)
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2152 {
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2153 return QString("%1 SG %2°Brix %3°P").arg(density, 1, 'f', 3).arg(Utils::sg_to_brix(density), 1, 'f', 1).arg(Utils::sg_to_plato(density), 1, 'f', 1);
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2154 }
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2155
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2156
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2157 void PrinterDialog::printHeader(QPainter *painter)
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2158 {
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2159 QPixmap outPixmap = QPixmap();
133
08635b028dcf Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
2160 outPixmap.loadFromData(my_logoByteArray);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2161 int w = outPixmap.width();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2162 int h = outPixmap.height();
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2163 /* Make sure to keep the logo aspect ratio */
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2164 if (w == h) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2165 painter->drawPixmap(20, 0, 100, 100, outPixmap);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2166 } else if (w > h) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2167 painter->drawPixmap(20, 0, 100, (h * 100) / w, outPixmap);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2168 } else {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2169 painter->drawPixmap(20, 0, (w * 100) / h, 100, outPixmap);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2170 }
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2171
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2172 /* The fat header line */
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2173 painter->setFont(QFont("Helvetica",18, QFont::Bold));
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2174 if (p_job == PR_SUPPLIES) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2175 painter->drawText(140, 0, 500, 40, Qt::AlignLeft, tr("Inventory") + " " + my_brewery_name);
54
bba7be9034be Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents: 53
diff changeset
2176 } else if (p_job == PR_YEASTBANK) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2177 painter->drawText(140, 0, 500, 40, Qt::AlignLeft, tr("Yeastbank") + " " + my_brewery_name);
158
24bc2de721d9 Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
2178 } else if (p_job == PR_RECIPE) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2179 painter->drawText(140, 0, 500, 40, Qt::AlignLeft, recipe->name);
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2180 } else if (p_job == PR_PRODUCT || p_job == PR_CHECKLIST) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2181 painter->drawText(140, 0, 500, 40, Qt::AlignLeft, product->code + " " + product->name);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2182 } else {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2183 painter->drawText(140, 0, 500, 40, Qt::AlignLeft, "?? " + my_brewery_name);
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2184 }
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2185 /* The first normal header line */
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2186 painter->setFont(QFont("Helvetica",10, QFont::Normal));
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2187 painter->drawText(140,35, 80, 20, Qt::AlignLeft, tr("Date and time"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2188 painter->drawText(220,35, 400, 20, Qt::AlignLeft, ": " + QDateTime::currentDateTime().toString("dd-MMM-yyyy hh:mm"));
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
2189 if (p_job == PR_RECIPE) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2190 painter->drawText(140,55, 80, 20, Qt::AlignLeft, tr("Beer style"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2191 painter->drawText(220,55, 400, 20, Qt::AlignLeft, ": " + recipe->st_name);
159
231f5c8002e3 Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
2192 }
240
52efe638e79a Added print checklist
Michiel Broek <mbroek@mbse.eu>
parents: 238
diff changeset
2193 if (p_job == PR_PRODUCT || p_job == PR_CHECKLIST) {
255
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2194 painter->drawText(140,55, 80, 20, Qt::AlignLeft, tr("Beer style"));
f237db73d4c8 Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents: 240
diff changeset
2195 painter->drawText(220,55, 400, 20, Qt::AlignLeft, ": " + product->st_name);
237
f1032191578b Added most of print product
Michiel Broek <mbroek@mbse.eu>
parents: 208
diff changeset
2196 }
53
d36879f13d32 Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents: 52
diff changeset
2197 /* The report itself may print more lines from y = 55. */
52
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2198 }
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2199
ff7b3a41c9b5 After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2200

mercurial