| 1 | /*************************************************************************** |
| 2 | export.cpp |
| 3 | ------------------- |
| 4 | Export methods for the Recipe class |
| 5 | ------------------- |
| 6 | Copyright 2005-2008 David Johnson |
| 7 | Please see the header file for copyright and license information. |
| 8 | ***************************************************************************/ |
| 9 | |
| 10 | #include <QApplication> |
| 11 | #include <QFile> |
| 12 | #include <QInputDialog> |
| 13 | #include <QLocale> |
| 14 | #include <QMessageBox> |
| 15 | #include <QPrinter> |
| 16 | #include <QTextDocument> |
| 17 | #include <QTextStream> |
| 18 | |
| 19 | #include "beerxmlreader.h"cxx . . $ `<file>/src/beerxmlreader.h`/ |
| 20 | #include "data.h"cxx . . $ `<file>/src/data.h`/ |
| 21 | #include "resource.h"cxx . . $ `<file>/src/resource.h`/ |
| 22 | #include "textprinter.h"cxx . . $ `<file>/src/textprinter.h`/ |
| 23 | |
| 24 | #include "recipe.h"cxx . . $ `<file>/src/recipe.h`/ |
| 25 | |
| 26 | using namespace Resource; |
| 27 | |
| 28 | static QStringcxx . . $ QString# escapecxx . . $ escape(fd988a2ab94d906b).(const QStringcxx . . $ QString# &s); |
| 29 | static QStringcxx . . $ QString# underlinecxx . . $ underline(fd988a2ab94d906b).(const QStringcxx . . $ QString# &line); |
| 30 | |
| 31 | ////////////////////////////////////////////////////////////////////////////// |
| 32 | // escape() |
| 33 | // -------- |
| 34 | // Escape special xml/html characters |
| 35 | |
| 36 | QStringcxx . . $ QString# escapecxx . . $ escape(fd988a2ab94d906b).(const QStringcxx . . $ QString# &s) |
| 37 | { |
| 38 | QStringcxx . . $ QString# x = scxx . . $ QString#QString(132dd6869045752b).; |
| 39 | x.replacecxx . . $ QString#replace(8e47db4decbc2d66).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('&'), QLatin1Stringcxx . . $ QLatin1String#QLatin1String(aac1607cfe1c1740).("&")); |
| 40 | x.replacecxx . . $ QString#replace(8e47db4decbc2d66).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('<'), QLatin1Stringcxx . . $ QLatin1String#QLatin1String(aac1607cfe1c1740).("<")); |
| 41 | x.replacecxx . . $ QString#replace(8e47db4decbc2d66).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('>'), QLatin1Stringcxx . . $ QLatin1String#QLatin1String(aac1607cfe1c1740).(">")); |
| 42 | x.replacecxx . . $ QString#replace(8e47db4decbc2d66).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('\''), QLatin1Stringcxx . . $ QLatin1String#QLatin1String(aac1607cfe1c1740).("'")); |
| 43 | x.replacecxx . . $ QString#replace(8e47db4decbc2d66).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('"'), QLatin1Stringcxx . . $ QLatin1String#QLatin1String(aac1607cfe1c1740).(""")); |
| 44 | return xcxx . . $ QString#QString(28715ad661ad3cec).; |
| 45 | } |
| 46 | |
| 47 | QStringcxx . . $ QString# underlinecxx . . $ underline(fd988a2ab94d906b).(const QStringcxx . . $ QString# &line) |
| 48 | { |
| 49 | QStringcxx . . $ QString# textcxx . . $ QString#QString(ced63f7c635d850d).; |
| 50 | text =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). line +cxx . . $ operator+(501d4570f8fec4c9). '\n' +cxx . . $ operator+(fab9b4f80031f353). text.fillcxx . . $ QString#fill(feec2fc69f0958b3).('-'cxx . . $ QChar#QChar(f349c77f591a7878)., line.lengthcxx . . $ QString#length(455f465bc33b4cdf).()) +cxx . . $ operator+(501d4570f8fec4c9). '\n'; |
| 51 | return textcxx . . $ QString#QString(28715ad661ad3cec).; |
| 52 | } |
| 53 | |
| 54 | ////////////////////////////////////////////////////////////////////////////// |
| 55 | // exportHTML() |
| 56 | // ------------ |
| 57 | // Export recipe as html |
| 58 | |
| 59 | bool Recipecxx . . $ Recipe#::exportHtmlcxx . . $ Recipe#exportHtml(e1defb592416720d).(const QStringcxx . . $ QString# &filename) |
| 60 | { |
| 61 | if (!filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 62 | QFilecxx . . $ QFile# datafilecxx . . $ QFile#QFile(3520e46b33348bf6).(filename); |
| 63 | if (!datafile.opencxx . . $ QFile#open(dca164408be960c8).(QFilecxx . . $ QFile#::WriteOnlycxx . . $ QIODevice#WriteOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QFilecxx . . $ QFile#::Textcxx . . $ QIODevice#Text.)) { |
| 64 | // error opening file |
| 65 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Error: Cannot open file" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). filename; |
| 66 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0, TITLEcxx . . $ QString#QString(45672f3c6961a244)., |
| 67 | QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Cannot write file %1:\n%2") |
| 68 | .argcxx . . $ QString#arg(bc823072288cbbb5).(filename) |
| 69 | .argcxx . . $ QString#arg(bc823072288cbbb5).(datafile.errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).())); |
| 70 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 71 | return false; |
| 72 | } |
| 73 | |
| 74 | QTextStreamcxx . . $ QTextStream# datacxx . . $ QTextStream#QTextStream(bebe8f2dee7f9e86).(&datafile); |
| 75 | QApplicationcxx . . $ QApplication#::setOverrideCursorcxx . . $ QGuiApplication#setOverrideCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::WaitCursorcxx . . $ Qt/WaitCursor.); |
| 76 | |
| 77 | data <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). recipeHTMLcxx . . $ Recipe#recipeHTML(ea4b39313763ec41).(); |
| 78 | |
| 79 | QApplicationcxx . . $ QApplication#::restoreOverrideCursorcxx . . $ QGuiApplication#restoreOverrideCursor(49f6e7a06ebc5aa8).(); |
| 80 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 81 | return true; |
| 82 | } |
| 83 | return false; |
| 84 | } |
| 85 | |
| 86 | ////////////////////////////////////////////////////////////////////////////// |
| 87 | // recipeHTML() |
| 88 | // ------------ |
| 89 | // Get the html of the recipe for printing and exporting |
| 90 | |
| 91 | const QStringcxx . . $ QString# Recipecxx . . $ Recipe#::recipeHTMLcxx . . $ Recipe#recipeHTML(ea4b39313763ec41).() |
| 92 | { |
| 93 | const QStringcxx . . $ QString# header = "<big><strong>%1</strong></big>\n"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 94 | const QStringcxx . . $ QString# table = "<table summary=\"%1\" border=0 cellpadding=0 cellspacing=%2>\n"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 95 | const QStringcxx . . $ QString# th = "<td><strong>%1</strong></td>\n"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 96 | |
| 97 | // heading |
| 98 | QStringcxx . . $ QString# html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 99 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<html>\n<head>\n"; |
| 100 | html +=cxx . . $ QString#`operator+=`(49ea8750b4987a17). "<meta name=\"generator\" content=\"" +cxx . . $ operator+(c76e440e68d4afec). TITLEcxx . . $ Resource/TITLE. +cxx . . $ operator+(8f17b704cda0d21f). " " +cxx . . $ operator+(8f17b704cda0d21f). VERSIONcxx . . $ `src/resource.h:40:9`! +cxx . . $ operator+(8f17b704cda0d21f). " \">\n"; |
| 101 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<title>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(title_cxx . . $ Recipe#title_.) +cxx . . $ operator+(3d22f08efddf8107). "</title>\n"; |
| 102 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<meta name=\"author\" content=\"" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(brewer_cxx . . $ Recipe#brewer_.) +cxx . . $ operator+(3d22f08efddf8107). "\">\n"; |
| 103 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<style type='text/css'>\n"; |
| 104 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "body { font-family: sans-serif; }\n"; |
| 105 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</style>\n"; |
| 106 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</head>\n\n"; |
| 107 | |
| 108 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<body>\n"; |
| 109 | |
| 110 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). table.argcxx . . $ QString#arg(bc823072288cbbb5).("header"cxx . . $ QString#QString(85c52e162fed56f9).).argcxx . . $ QString#arg(bc823072288cbbb5).("5 bgcolor=\"#CCCCCC\" width=\"100%\""cxx . . $ QString#QString(85c52e162fed56f9).); |
| 111 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<tr><td>\n" +cxx . . $ operator+(c75c3ae4eb9af1a8). header.argcxx . . $ QString#arg(bc823072288cbbb5).(escapecxx . . $ escape(fd988a2ab94d906b).(title_cxx . . $ Recipe#title_.)) +cxx . . $ operator+(3d22f08efddf8107). "</td></tr>\n"; |
| 112 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</table>\n<p>\n\n"; |
| 113 | |
| 114 | // recipe table |
| 115 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). table.argcxx . . $ QString#arg(bc823072288cbbb5).("recipe"cxx . . $ QString#QString(85c52e162fed56f9).).argcxx . . $ QString#arg(64ab2ed17cc11715).(0); |
| 116 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<tbody>\n<tr>\n"; |
| 117 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe")); |
| 118 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 119 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(title_cxx . . $ Recipe#title_.) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 120 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"25\"></td>\n"; |
| 121 | |
| 122 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Style")); |
| 123 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 124 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(style_cxx . . $ Recipe#style_..namecxx . . $ Style#name(a2fb7a6ce195d51).()) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 125 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n<tr>\n"; |
| 126 | |
| 127 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Brewer")); |
| 128 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 129 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(brewer_cxx . . $ Recipe#brewer_.) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 130 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 131 | |
| 132 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Batch")); |
| 133 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 134 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). size_cxx . . $ Recipe#size_..toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 135 | |
| 136 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "</tr>\n<tr>\n" +cxx . . $ operator+(c75c3ae4eb9af1a8). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).(methodcxx . . $ Recipe#method(4365c3963150523e).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).())); |
| 137 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n</tbody>\n</table>\n<p>\n\n"; |
| 138 | |
| 139 | // characteristics table |
| 140 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). header.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Characteristics")); |
| 141 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). table.argcxx . . $ QString#arg(bc823072288cbbb5).("characteristics"cxx . . $ QString#QString(85c52e162fed56f9).).argcxx . . $ QString#arg(64ab2ed17cc11715).(0); |
| 142 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<tbody>\n<tr>\n"; |
| 143 | |
| 144 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Gravity")); |
| 145 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 146 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(og_cxx . . $ Recipe#og_., 'f', 3) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" OG</td>\n"); |
| 147 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"25\"></td>\n"; |
| 148 | |
| 149 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Estimated FG")); |
| 150 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 151 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(FGEstimatecxx . . $ Recipe#FGEstimate(31fa7155c10fdd13).(), 'f', 3) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" FG</td>\n"); |
| 152 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n<tr>\n"; |
| 153 | |
| 154 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Bitterness")); |
| 155 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 156 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(ibu_cxx . . $ Recipe#ibu_., 'f', 0) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" IBU</td>\n"); |
| 157 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 158 | |
| 159 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Alcohol by Volume")); |
| 160 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 161 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(ABVcxx . . $ Recipe#ABV(31fa7155c10fdd13).() * 100.0, 'f', 1) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("%</td>\n"); |
| 162 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n<tr>\n"; |
| 163 | |
| 164 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Color")); |
| 165 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 166 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(srm_cxx . . $ Recipe#srm_., 'f', 0) +cxx . . $ operator+(eab1ea5b6c36e9b2). DEGREEcxx . . $ Resource/DEGREE. +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" SRM</td>\n"); |
| 167 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 168 | |
| 169 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Alcohol by Weight")); |
| 170 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 171 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(ABWcxx . . $ Recipe#ABW(31fa7155c10fdd13).() * 100.0, 'f', 1) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("%</td>\n"); |
| 172 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n</tbody>\n</table>\n<p>\n\n"; |
| 173 | |
| 174 | // ingredients table |
| 175 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). header.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Ingredients")); |
| 176 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). table.argcxx . . $ QString#arg(bc823072288cbbb5).("ingredients"cxx . . $ QString#QString(85c52e162fed56f9).).argcxx . . $ QString#arg(64ab2ed17cc11715).(0); |
| 177 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<tbody>\n"; |
| 178 | |
| 179 | // grains |
| 180 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<tr>\n" +cxx . . $ operator+(c75c3ae4eb9af1a8). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Quantity")); |
| 181 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 182 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Grain")); |
| 183 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 184 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Type")); |
| 185 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 186 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Use")); |
| 187 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n\n"; |
| 188 | |
| 189 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Grain grain, grains_) { |
| 190 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<tr>\n<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). grain.weightcxx . . $ Grain#weight(e805bc742de5fe4b).().toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 191 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 192 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(grain.namecxx . . $ Grain#name(a2fb7a6ce195d51).()) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 193 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 194 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). grain.typecxx . . $ Grain#type(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 195 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 196 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). grain.usecxx . . $ Grain#use(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). "</td>\n</tr>\n\n"; |
| 197 | } |
| 198 | |
| 199 | // hops |
| 200 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<tr>\n" +cxx . . $ operator+(c75c3ae4eb9af1a8). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Quantity")); |
| 201 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 202 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Hop")); |
| 203 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 204 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Type")); |
| 205 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 206 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Time")); |
| 207 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n\n"; |
| 208 | |
| 209 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Hop hop, hops_) { |
| 210 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<tr>\n<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). hop.weightcxx . . $ Hop#weight(e805bc742de5fe4b).().toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 211 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 212 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(hop.namecxx . . $ Hop#name(a2fb7a6ce195d51).()) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 213 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 214 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). hop.typecxx . . $ Hop#type(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 215 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 216 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td colspan=2>" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(hop.timecxx . . $ Hop#time(ddd8539a2fcdd4ce).()) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" minutes</td>\n</tr>\n\n"); |
| 217 | } |
| 218 | |
| 219 | // misc ingredients |
| 220 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<tr>\n" +cxx . . $ operator+(c75c3ae4eb9af1a8). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Quantity")); |
| 221 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 222 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Misc")); |
| 223 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td width=\"15\"></td>\n"; |
| 224 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). th.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Notes")); |
| 225 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tr>\n\n"; |
| 226 | |
| 227 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Misc misc, miscs_) { |
| 228 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<tr>\n<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). misc.quantitycxx . . $ Misc#quantity(48cf8e1c6c284286).().toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 229 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 230 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(misc.namecxx . . $ Misc#name(a2fb7a6ce195d51).()) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 231 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 232 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td>" +cxx . . $ operator+(c75c3ae4eb9af1a8). misc.typecxx . . $ Misc#type(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). "</td>\n"; |
| 233 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "<td></td>\n"; |
| 234 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<td colspan=3>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(misc.notescxx . . $ Misc#notes(a2fb7a6ce195d51).()) +cxx . . $ operator+(3d22f08efddf8107). "</td>\n</tr>\n\n"; |
| 235 | } |
| 236 | |
| 237 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</tbody>\n</table>\n<p>\n\n"; |
| 238 | |
| 239 | // notes |
| 240 | // TODO: using replace() might be dangerous if we ever use richtext in notes |
| 241 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). header.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Notes")) +cxx . . $ operator+(3d22f08efddf8107). "\n"; |
| 242 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<p>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(recipenotes_cxx . . $ Recipe#recipenotes_.).replacecxx . . $ QString#replace(e91996333fe0469b).('\n'cxx . . $ QChar#QChar(f349c77f591a7878)., "<br>\n"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "\n</p>\n<p>\n"; |
| 243 | |
| 244 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). header.argcxx . . $ QString#arg(bc823072288cbbb5).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Batch Notes")) +cxx . . $ operator+(3d22f08efddf8107). "\n"; |
| 245 | html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<p>" +cxx . . $ operator+(c75c3ae4eb9af1a8). escapecxx . . $ escape(fd988a2ab94d906b).(batchnotes_cxx . . $ Recipe#batchnotes_.).replacecxx . . $ QString#replace(e91996333fe0469b).('\n'cxx . . $ QChar#QChar(f349c77f591a7878)., "<br>\n"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "\n</p>\n"; |
| 246 | |
| 247 | html +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</body>\n</html>\n"; |
| 248 | |
| 249 | return htmlcxx . . $ QString#QString(28715ad661ad3cec).; |
| 250 | } |
| 251 | |
| 252 | ////////////////////////////////////////////////////////////////////////////// |
| 253 | // exportText() |
| 254 | // ------------ |
| 255 | // Export recipe as text |
| 256 | |
| 257 | bool Recipecxx . . $ Recipe#::exportTextcxx . . $ Recipe#exportText(e1defb592416720d).(const QStringcxx . . $ QString# &filename) |
| 258 | { |
| 259 | if (!filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 260 | QFilecxx . . $ QFile# datafilecxx . . $ QFile#QFile(3520e46b33348bf6).(filename); |
| 261 | if (!datafile.opencxx . . $ QFile#open(dca164408be960c8).(QFilecxx . . $ QFile#::WriteOnlycxx . . $ QIODevice#WriteOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QFilecxx . . $ QFile#::Textcxx . . $ QIODevice#Text.)) { |
| 262 | // error opening file |
| 263 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Error: Cannot open file" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). filename; |
| 264 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0, TITLEcxx . . $ QString#QString(45672f3c6961a244)., |
| 265 | QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Cannot write file %1:\n%2") |
| 266 | .argcxx . . $ QString#arg(bc823072288cbbb5).(filename) |
| 267 | .argcxx . . $ QString#arg(bc823072288cbbb5).(datafile.errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).())); |
| 268 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 269 | return false; |
| 270 | } |
| 271 | |
| 272 | QTextStreamcxx . . $ QTextStream# datacxx . . $ QTextStream#QTextStream(bebe8f2dee7f9e86).(&datafile); |
| 273 | QApplicationcxx . . $ QApplication#::setOverrideCursorcxx . . $ QGuiApplication#setOverrideCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::WaitCursorcxx . . $ Qt/WaitCursor.); |
| 274 | |
| 275 | data <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). recipeTextcxx . . $ Recipe#recipeText(ea4b39313763ec41).(); |
| 276 | |
| 277 | QApplicationcxx . . $ QApplication#::restoreOverrideCursorcxx . . $ QGuiApplication#restoreOverrideCursor(49f6e7a06ebc5aa8).(); |
| 278 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 279 | return true; |
| 280 | } |
| 281 | return false; |
| 282 | } |
| 283 | |
| 284 | ////////////////////////////////////////////////////////////////////////////// |
| 285 | // recipeText() |
| 286 | // ------------ |
| 287 | // Get the ascii text of the recipe for exporting |
| 288 | |
| 289 | const QStringcxx . . $ QString# Recipecxx . . $ Recipe#::recipeTextcxx . . $ Recipe#recipeText(ea4b39313763ec41).() |
| 290 | { |
| 291 | // title stuff |
| 292 | QStringcxx . . $ QString# text = underlinecxx . . $ underline(fd988a2ab94d906b).(titlecxx . . $ Recipe#title(a2fb7a6ce195d51).()); |
| 293 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Brewer: ") +cxx . . $ operator+(fab9b4f80031f353). brewer_cxx . . $ Recipe#brewer_. +cxx . . $ operator+(501d4570f8fec4c9). '\n'; |
| 294 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Style: ") +cxx . . $ operator+(fab9b4f80031f353). style_cxx . . $ Recipe#style_..namecxx . . $ Style#name(a2fb7a6ce195d51).() +cxx . . $ operator+(501d4570f8fec4c9). '\n'; |
| 295 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Batch: ") +cxx . . $ operator+(fab9b4f80031f353). size_cxx . . $ Recipe#size_..toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2); |
| 296 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(methodcxx . . $ Recipe#method(4365c3963150523e).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()); |
| 297 | text +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "\n\n"; |
| 298 | |
| 299 | // style stuff |
| 300 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). underlinecxx . . $ underline(fd988a2ab94d906b).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Characteristics")); |
| 301 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Gravity: ") +cxx . . $ operator+(fab9b4f80031f353). |
| 302 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(og_cxx . . $ Recipe#og_., 'f', 3) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" OG\n"); |
| 303 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Bitterness: ") +cxx . . $ operator+(fab9b4f80031f353). |
| 304 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(ibu_cxx . . $ Recipe#ibu_., 'f', 0) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" IBU\n"); |
| 305 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Color: ") +cxx . . $ operator+(fab9b4f80031f353). |
| 306 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(srm_cxx . . $ Recipe#srm_., 'f', 0) +cxx . . $ operator+(eab1ea5b6c36e9b2). DEGREEcxx . . $ Resource/DEGREE. +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" SRM\n"); |
| 307 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Estimated FG: ") +cxx . . $ operator+(fab9b4f80031f353). |
| 308 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(FGEstimatecxx . . $ Recipe#FGEstimate(31fa7155c10fdd13).(), 'f', 3) +cxx . . $ operator+(501d4570f8fec4c9). '\n'; |
| 309 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Alcohol by Volume: ") +cxx . . $ operator+(fab9b4f80031f353). |
| 310 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(ABVcxx . . $ Recipe#ABV(31fa7155c10fdd13).() * 100.0, 'f', 1) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("%\n"); |
| 311 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Alcohol by Weight: ") +cxx . . $ operator+(fab9b4f80031f353). |
| 312 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(ABWcxx . . $ Recipe#ABW(31fa7155c10fdd13).() * 100.0, 'f', 1) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("%\n\n"); |
| 313 | |
| 314 | // ingredients |
| 315 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). underlinecxx . . $ underline(fd988a2ab94d906b).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Ingredients")); |
| 316 | |
| 317 | // grains |
| 318 | // using a map will sort the grains |
| 319 | QMultiMapcxx . . $ QMultiMap#<QStringcxx . . $ QString#, Graincxx . . $ Grain#> gmapcxx . . $ QMultiMap#QMultiMap(ced63f7c635d850d).; |
| 320 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Grain grain, grains_) gmap.insertcxx . . $ QMultiMap#insert(9bf047f9fc4d1418).(grain.namecxx . . $ Grain#name(a2fb7a6ce195d51).(), grain); |
| 321 | |
| 322 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Grain grain, gmap.values()) { |
| 323 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). grain.namecxx . . $ Grain#name(a2fb7a6ce195d51).().leftJustifiedcxx . . $ QString#leftJustified(63a88914f7cad4ec).(30, ' 'cxx . . $ QChar#QChar(f349c77f591a7878).); |
| 324 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). grain.weightcxx . . $ Grain#weight(e805bc742de5fe4b).().toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2) +cxx . . $ operator+(3d22f08efddf8107). ", "; |
| 325 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). grain.typecxx . . $ Grain#type(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). ", "; |
| 326 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). grain.usecxx . . $ Grain#use(a2fb7a6ce195d51).() +cxx . . $ operator+(501d4570f8fec4c9). '\n'; |
| 327 | } |
| 328 | text +=cxx . . $ QString#`operator+=`(284c8d83f6f77cb5). '\n'; |
| 329 | |
| 330 | // hops |
| 331 | // using a map will sort the hops |
| 332 | QMultiMapcxx . . $ QMultiMap#<QStringcxx . . $ QString#, Hopcxx . . $ Hop#> hmapcxx . . $ QMultiMap#QMultiMap(ced63f7c635d850d).; |
| 333 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Hop hop, hops_) hmap.insertcxx . . $ QMultiMap#insert(9bf047f9fc4d1418).(hop.namecxx . . $ Hop#name(a2fb7a6ce195d51).(), hop); |
| 334 | |
| 335 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Hop hop, hmap.values()) { |
| 336 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). hop.namecxx . . $ Hop#name(a2fb7a6ce195d51).().leftJustifiedcxx . . $ QString#leftJustified(63a88914f7cad4ec).(30, ' 'cxx . . $ QChar#QChar(f349c77f591a7878).); |
| 337 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). hop.weightcxx . . $ Hop#weight(e805bc742de5fe4b).().toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2) +cxx . . $ operator+(3d22f08efddf8107). ", "; |
| 338 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). hop.typecxx . . $ Hop#type(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). ", "; |
| 339 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(hop.timecxx . . $ Hop#time(ddd8539a2fcdd4ce).()) +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ Recipe#tr(75d9f1c324b4579d).(" minutes\n"); |
| 340 | } |
| 341 | text +=cxx . . $ QString#`operator+=`(284c8d83f6f77cb5). '\n'; |
| 342 | |
| 343 | // misc ingredients |
| 344 | // using a map will sort the ingredients |
| 345 | QMultiMapcxx . . $ QMultiMap#<QStringcxx . . $ QString#, Misccxx . . $ Misc#> mmapcxx . . $ QMultiMap#QMultiMap(ced63f7c635d850d).; |
| 346 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Misc misc, miscs_) mmap.insertcxx . . $ QMultiMap#insert(9bf047f9fc4d1418).(misc.namecxx . . $ Misc#name(a2fb7a6ce195d51).(), misc); |
| 347 | |
| 348 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (Misc misc, mmap.values()) { |
| 349 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). misc.namecxx . . $ Misc#name(a2fb7a6ce195d51).().leftJustifiedcxx . . $ QString#leftJustified(63a88914f7cad4ec).(30, ' 'cxx . . $ QChar#QChar(f349c77f591a7878).); |
| 350 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). misc.quantitycxx . . $ Misc#quantity(48cf8e1c6c284286).().toStringcxx . . $ Quantity#toString(3f3c3d0e9c0eb37f).(2) +cxx . . $ operator+(3d22f08efddf8107). ", "; |
| 351 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). misc.typecxx . . $ Misc#type(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). ", "; |
| 352 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). misc.notescxx . . $ Misc#notes(a2fb7a6ce195d51).() +cxx . . $ operator+(501d4570f8fec4c9). '\n'; |
| 353 | } |
| 354 | text +=cxx . . $ QString#`operator+=`(284c8d83f6f77cb5). '\n'; |
| 355 | |
| 356 | // notes |
| 357 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). underlinecxx . . $ underline(fd988a2ab94d906b).(trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Notes")); |
| 358 | |
| 359 | // TODO: wrap long notes |
| 360 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Recipe Notes:\n") +cxx . . $ operator+(fab9b4f80031f353). recipenotes_cxx . . $ Recipe#recipenotes_. +cxx . . $ operator+(3d22f08efddf8107). "\n\n"; |
| 361 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Batch Notes:\n") +cxx . . $ operator+(fab9b4f80031f353). batchnotes_cxx . . $ Recipe#batchnotes_. +cxx . . $ operator+(3d22f08efddf8107). "\n\n"; |
| 362 | |
| 363 | return textcxx . . $ QString#QString(28715ad661ad3cec).; |
| 364 | } |
| 365 | |
| 366 | ////////////////////////////////////////////////////////////////////////////// |
| 367 | // exportBeerXML() |
| 368 | // --------------- |
| 369 | // Export recipe to BeerXML format |
| 370 | |
| 371 | bool Recipecxx . . $ Recipe#::exportBeerXMLcxx . . $ Recipe#exportBeerXML(e1defb592416720d).(const QStringcxx . . $ QString# &filename) |
| 372 | { |
| 373 | // open file |
| 374 | QFilecxx . . $ QFile# datafilecxx . . $ QFile#QFile(3520e46b33348bf6).(filename); |
| 375 | if (!datafile.opencxx . . $ QFile#open(dca164408be960c8).(QFilecxx . . $ QFile#::WriteOnlycxx . . $ QIODevice#WriteOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QFilecxx . . $ QFile#::Textcxx . . $ QIODevice#Text.)) { |
| 376 | // error opening file |
| 377 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Error: Cannot open file" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). filename; |
| 378 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0, TITLEcxx . . $ QString#QString(45672f3c6961a244)., |
| 379 | QObjectcxx . . $ QObject#:: trcxx . . $ QObject#tr(75d9f1c324b4579d).("Cannot write file %1:\n%2") |
| 380 | .argcxx . . $ QString#arg(bc823072288cbbb5).(filename) |
| 381 | .argcxx . . $ QString#arg(bc823072288cbbb5).(datafile.errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).())); |
| 382 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 383 | return false; |
| 384 | } |
| 385 | |
| 386 | QApplicationcxx . . $ QApplication#::setOverrideCursorcxx . . $ QGuiApplication#setOverrideCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::WaitCursorcxx . . $ Qt/WaitCursor.); |
| 387 | |
| 388 | // write out xml |
| 389 | BeerXmlWritercxx . . $ BeerXmlWriter# writercxx . . $ BeerXmlWriter#BeerXmlWriter(bebe8f2dee7f9e86).(&datafile); |
| 390 | writer.writeRecipecxx . . $ BeerXmlWriter#writeRecipe(b1877db5cb6732a7).(this); |
| 391 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 392 | |
| 393 | // recipe is saved, so set flags accordingly |
| 394 | setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(false); |
| 395 | QApplicationcxx . . $ QApplication#::restoreOverrideCursorcxx . . $ QGuiApplication#restoreOverrideCursor(49f6e7a06ebc5aa8).(); |
| 396 | return true; |
| 397 | } |
| 398 | |
| 399 | ////////////////////////////////////////////////////////////////////////////// |
| 400 | // importBeerXml() |
| 401 | // --------------- |
| 402 | // Import recipe from BeerXML format. Assumes beerXmlFormat() has been called |
| 403 | |
| 404 | bool Recipecxx . . $ Recipe#::importBeerXmlcxx . . $ Recipe#importBeerXml(e1defb592416720d).(const QStringcxx . . $ QString# &filename) |
| 405 | { |
| 406 | // open file |
| 407 | QFilecxx . . $ QFile# datafilecxx . . $ QFile#QFile(3520e46b33348bf6).(filename); |
| 408 | if (!datafile.opencxx . . $ QFile#open(dca164408be960c8).(QFilecxx . . $ QFile#::ReadOnlycxx . . $ QIODevice#ReadOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QFilecxx . . $ QFile#::Textcxx . . $ QIODevice#Text.)) { |
| 409 | // error opening file |
| 410 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Error: Cannot open" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). filename; |
| 411 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0, TITLEcxx . . $ QString#QString(45672f3c6961a244)., |
| 412 | QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Cannot read file %1:\n%2") |
| 413 | .argcxx . . $ QString#arg(bc823072288cbbb5).(filename) |
| 414 | .argcxx . . $ QString#arg(bc823072288cbbb5).(datafile.errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).())); |
| 415 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 416 | return false; |
| 417 | } |
| 418 | |
| 419 | QApplicationcxx . . $ QApplication#::setOverrideCursorcxx . . $ QGuiApplication#setOverrideCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::WaitCursorcxx . . $ Qt/WaitCursor.); |
| 420 | title_cxx . . $ Recipe#title_..clearcxx . . $ QString#clear(49f6e7a06ebc5aa8).(); |
| 421 | brewer_cxx . . $ Recipe#brewer_..clearcxx . . $ QString#clear(49f6e7a06ebc5aa8).(); |
| 422 | size_cxx . . $ Recipe#size_. =cxx . . $ Volume#`operator=`(dbe4f9802804587b). Datacxx . . $ Data#::instancecxx . . $ Data#instance(ddf71f0b6dfdf13b).()->defaultSizecxx . . $ Data#defaultSize(72d6f2be71f69f8b).(); |
| 423 | style_cxx . . $ Recipe#style_. =cxx . . $ Style#`operator=`(73c14b8dd1039aa8). Datacxx . . $ Data#::instancecxx . . $ Data#instance(ddf71f0b6dfdf13b).()->defaultStylecxx . . $ Data#defaultStyle(c446394d65978504).(); |
| 424 | grains_cxx . . $ Recipe#grains_..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 425 | hops_cxx . . $ Recipe#hops_..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 426 | miscs_cxx . . $ Recipe#miscs_..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 427 | recipenotes_cxx . . $ Recipe#recipenotes_..clearcxx . . $ QString#clear(49f6e7a06ebc5aa8).(); |
| 428 | batchnotes_cxx . . $ Recipe#batchnotes_..clearcxx . . $ QString#clear(49f6e7a06ebc5aa8).(); |
| 429 | |
| 430 | // parse file |
| 431 | BeerXmlReadercxx . . $ BeerXmlReader# readercxx . . $ BeerXmlReader#BeerXmlReader(bebe8f2dee7f9e86).(&datafile); |
| 432 | bool status = reader.readRecipecxx . . $ BeerXmlReader#readRecipe(b1877db5cb6732a7).(this); |
| 433 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 434 | |
| 435 | if (!status) { |
| 436 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Error: Problem reading file" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). filename; |
| 437 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). reader.errorStringcxx . . $ QXmlStreamReader#errorString(6ef7b6c27b00b43d).(); |
| 438 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0, TITLEcxx . . $ QString#QString(45672f3c6961a244)., |
| 439 | trcxx . . $ Recipe#tr(75d9f1c324b4579d).("Error reading file %1").argcxx . . $ QString#arg(bc823072288cbbb5).(filename)); |
| 440 | QApplicationcxx . . $ QApplication#::restoreOverrideCursorcxx . . $ QGuiApplication#restoreOverrideCursor(49f6e7a06ebc5aa8).(); |
| 441 | return false; |
| 442 | } |
| 443 | |
| 444 | |
| 445 | // calculate the numbers |
| 446 | recalccxx . . $ Recipe#recalc(49f6e7a06ebc5aa8).(); |
| 447 | |
| 448 | // just loaded recipes are not modified |
| 449 | setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(false); |
| 450 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! recipeChangedcxx . . $ Recipe#recipeChanged(49f6e7a06ebc5aa8).(); |
| 451 | |
| 452 | QApplicationcxx . . $ QApplication#::restoreOverrideCursorcxx . . $ QGuiApplication#restoreOverrideCursor(49f6e7a06ebc5aa8).(); |
| 453 | return true; |
| 454 | } |
| 455 | |
| 456 | ////////////////////////////////////////////////////////////////////////////// |
| 457 | // exportPdf() |
| 458 | // ------------ |
| 459 | // Export recipe as pdf |
| 460 | |
| 461 | bool Recipecxx . . $ Recipe#::exportPdfcxx . . $ Recipe#exportPdf(fbad90219c7ca024).(TextPrintercxx . . $ TextPrinter# *textprinter, const QStringcxx . . $ QString# &filename) |
| 462 | { |
| 463 | if (textprinter && (!filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).())) { |
| 464 | QTextDocumentcxx . . $ QTextDocument# documentcxx . . $ QTextDocument#QTextDocument(749de1b6ae65bddd).; |
| 465 | document.setHtmlcxx . . $ QTextDocument#setHtml(3520e46b33348bf6).(recipeHTMLcxx . . $ Recipe#recipeHTML(ea4b39313763ec41).()); |
| 466 | textprinter->exportPdfcxx . . $ TextPrinter#exportPdf(760d0a8378c561f9).(&document, QStringcxx . . $ QString#QString(ced63f7c635d850d).(), filename); |
| 467 | return true; |
| 468 | } |
| 469 | return false; |
| 470 | } |