Debian Codegraph @

src/qbrew.cpp

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /***************************************************************************
2 qbrew.cpp
3 -------------------
4 Control class for QBrew
5 -------------------
6 Copyright 2006-2008 David Johnson
7 Please see the header file for copyright and license information.
8 ***************************************************************************/
9
•10 #include <QtWidgets>
11
12 #include "alcoholtool.h"cxx . . $ `<file>/src/alcoholtool.h`/
13 #include "configure.h"cxx . . $ `<file>/src/configure.h`/
14 #include "data.h"cxx . . $ `<file>/src/data.h`/
15 #include "databasetool.h"cxx . . $ `<file>/src/databasetool.h`/
16 #include "recipe.h"cxx . . $ `<file>/src/recipe.h`/
17 #include "helpviewer.h"cxx . . $ `<file>/src/helpviewer.h`/
18 #include "hydrometertool.h"cxx . . $ `<file>/src/hydrometertool.h`/
19 #include "resource.h"cxx . . $ `<file>/src/resource.h`/
20 #include "textprinter.h"cxx . . $ `<file>/src/textprinter.h`/
21 #include "view.h"cxx . . $ `<file>/src/view.h`/
22
23 #include "qbrew.h"cxx . . $ `<file>/src/qbrew.h`/
24
25 using namespace Resource;
26
27 QBrewcxx . . $ QBrew# *QBrewcxx . . $ QBrew#::instance_cxx . . $ QBrew#instance_. = 0;
28 static QMutexcxx . . $ QMutex# instancelockcxx . . $ instancelock.;
29
30 //////////////////////////////////////////////////////////////////////////////
31 // Construction, Destruction, Initialization //
32 //////////////////////////////////////////////////////////////////////////////
33
34 //////////////////////////////////////////////////////////////////////////////
35 // QBrew()
36 // ------------
37 // Private constructor
38
39 QBrewcxx . . $ QBrew#::QBrewcxx . . $ QBrew#QBrew(49f6e7a06ebc5aa8).()
40 : data_cxx . . $ QBrew#data_.(0), recipe_cxx . . $ QBrew#recipe_.(0), view_cxx . . $ QBrew#view_.(0), alcoholtool_cxx . . $ QBrew#alcoholtool_.(0), databasetool_cxx . . $ QBrew#databasetool_.(0),
41 hydrometertool_cxx . . $ QBrew#hydrometertool_.(0), configure_cxx . . $ QBrew#configure_.(0), handbook_cxx . . $ QBrew#handbook_.(0), primer_cxx . . $ QBrew#primer_.(0), state_cxx . . $ QBrew#state_.(),
42 filename_cxx . . $ QBrew#filename_.(), newflag_cxx . . $ QBrew#newflag_.(false), backed_cxx . . $ QBrew#backed_.(false), autosave_cxx . . $ QBrew#autosave_.(0),
43 autosavename_cxx . . $ QBrew#autosavename_.(), textprinter_cxx . . $ QBrew#textprinter_.(0)
44 { ; }
45
46 //////////////////////////////////////////////////////////////////////////////
47 // initialize()
48 // ------------
49 // Initialize mainwindow
50
51 void QBrewcxx . . $ QBrew#::initializecxx . . $ QBrew#initialize(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename)
52 {
53 setAttributecxx . . $ QWidget#setAttribute(52fc7bf162518f7f).(Qtcxx . . $ Qt/::WA_DeleteOnClosecxx . . $ Qt/WA_DeleteOnClose.);
54 readConfigcxx . . $ QBrew#readConfig(49f6e7a06ebc5aa8).();
55
56 // show splashscreen
57 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..showsplashcxx . . $ GenConfigState#showsplash.
58 && QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(dataBasecxx . . $ QBrew#dataBase(4365c3963150523e).() +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ QBrew#tr(75d9f1c324b4579d).("splash.png"))) {
59 QSplashScreencxx . . $ QSplashScreen# *splash = new QSplashScreencxx . . $ QSplashScreen#(dataBasecxx . . $ QPixmap#QPixmap(dec4543235ec9b46).() +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ QBrew#tr(75d9f1c324b4579d).("splash.png"),
60 Qtcxx . . $ QFlags#QFlags(93d577a3e9528307).::WindowStaysOnTopHintcxx . . $ Qt/WindowStaysOnTopHint.);
61 splash->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
62 QApplicationcxx . . $ QApplication#::flushcxx . . $ QCoreApplication#flush(49f6e7a06ebc5aa8).();
63 QTimercxx . . $ QTimer#::singleShotcxx . . $ QTimer#singleShot(24d02da3284e5f26).(3000, splash, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(close()));
64 }
65
66 // setup look and feel
67 setWindowIconcxx . . $ QWidget#setWindowIcon(71dcdac178620ed6).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/pics/qbrew.png"cxx . . $ QString#QString(85c52e162fed56f9).));
68 if ((state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..lookfeelcxx . . $ GenConfigState#lookfeel. !=cxx . . $ `operator!=`(5bc2975d2d751687). QApplicationcxx . . $ QApplication#::stylecxx . . $ QApplication#style(8bb4f2215cbcf478).()->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).()) &&
69 (QStyleFactorycxx . . $ QStyleFactory#::keyscxx . . $ QStyleFactory#keys(669a05bc42dd57cc).().containscxx . . $ QStringList#contains(8cce4688c16f48f3).(state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..lookfeelcxx . . $ GenConfigState#lookfeel.))) {
70 QApplicationcxx . . $ QApplication#::setStylecxx . . $ QApplication#setStyle(1028a3ea1bbca2e8).(state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..lookfeelcxx . . $ GenConfigState#lookfeel.);
71 }
72
73 // setup UI
74 uicxx . . $ QBrew#ui..setupUicxx . . $ Ui_MainWindow#setupUi(f2c32f691ede4a4e).(this);
75 initActionscxx . . $ QBrew#initActions(49f6e7a06ebc5aa8).();
•76 #if defined (Q_OS_MAC)
77 // initial defaults for mac
78 setUnifiedTitleAndToolBarOnMac(false);
79 ui.maintoolbar->setVisible(false);
80 #endif
81
82 // restore window state
83 restoreStatecxx . . $ QBrew#restoreState(49f6e7a06ebc5aa8).();
84
85 // initialize data
86 data_cxx . . $ QBrew#data_. = Datacxx . . $ Data#::instancecxx . . $ Data#instance(ddf71f0b6dfdf13b).();
87 data_cxx . . $ QBrew#data_.->initializecxx . . $ Data#initialize(24ed027017280a9f).(state_cxx . . $ QBrew#state_.);
88
89 // initialize calculations
90 data_cxx . . $ QBrew#data_.->setSteepYieldcxx . . $ Data#setSteepYield(ba8836b59fb42830).(state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..steepyieldcxx . . $ CalcConfigState#steepyield.);
91 data_cxx . . $ QBrew#data_.->setTinsethcxx . . $ Data#setTinseth(b45ddcbc8423892c).(state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..tinsethcxx . . $ CalcConfigState#tinseth.);
92 data_cxx . . $ QBrew#data_.->setMoreycxx . . $ Data#setMorey(b45ddcbc8423892c).(state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..moreycxx . . $ CalcConfigState#morey.);
93
94 // create recipe
95 recipe_cxx . . $ QBrew#recipe_. = new Recipecxx . . $ Recipe#(this);
96 connectcxx . . $ QObject#connect(158df1d9a01a3410).(recipe_cxx . . $ QBrew#recipe_., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(recipeModified()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(recipeModified()));
97
98 // create view
99 view_cxx . . $ QBrew#view_. = new Viewcxx . . $ View#(this, recipe_cxx . . $ QBrew#recipe_.);
100
101 // load or create a recipe
102 bool emptyfilename = (filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() ||
103 (filename ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.)));
104 if (emptyfilename &&
105 (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..loadlastcxx . . $ GenConfigState#loadlast. && !state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).())) {
106 if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..firstcxx . . $ QList#first(19b2b6f17af048b).())) {
107 filename_cxx . . $ QBrew#filename_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..firstcxx . . $ QList#first(19b2b6f17af048b).();
108 }
109 } else {
110 filename_cxx . . $ QBrew#filename_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). filename;
111 }
112 emptyfilename = (filename_cxx . . $ QBrew#filename_..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() ||
113 (filename_cxx . . $ QBrew#filename_. ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.)));
114 if (!emptyfilename) {
115 openFilecxx . . $ QBrew#openFile(e1defb592416720d).(filename_cxx . . $ QBrew#filename_.);
116 } else {
117 recipe_cxx . . $ QBrew#recipe_.->newRecipecxx . . $ Recipe#newRecipe(49f6e7a06ebc5aa8).();
118 newflag_cxx . . $ QBrew#newflag_. = true;
119 backed_cxx . . $ QBrew#backed_. = false;
120 filename_cxx . . $ QBrew#filename_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.) +cxx . . $ operator+(3d22f08efddf8107). "." +cxx . . $ operator+(4bea96b16517258e). FILE_EXTcxx . . $ Resource/FILE_EXT.;
121 setWindowTitlecxx . . $ QWidget#setWindowTitle(3520e46b33348bf6).(TITLEcxx . . $ QString#QString(45672f3c6961a244). +cxx . . $ operator+(8f17b704cda0d21f). " " +cxx . . $ operator+(8f17b704cda0d21f). VERSIONcxx . . $ `src/resource.h:40:9`! +cxx . . $ operator+(8f17b704cda0d21f). " [*]");
122 }
123
124 // connections
125 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..menuopenrecentcxx . . $ Ui_MainWindow#menuopenrecent., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(aboutToShow()),
126 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(recentMenuShow()));
127
128 // other initialization
129 initAutoSavecxx . . $ QBrew#initAutoSave(49f6e7a06ebc5aa8).();
130 setCentralWidgetcxx . . $ QMainWindow#setCentralWidget(108f35f7aa7f3cf9).(view_cxx . . $ QBrew#view_.);
131 view_cxx . . $ QBrew#view_.->refreshcxx . . $ View#refresh(49f6e7a06ebc5aa8).();
132 textprinter_cxx . . $ QBrew#textprinter_. = new TextPrintercxx . . $ TextPrinter#TextPrinter(749de1b6ae65bddd).(this);
133 }
134
135 //////////////////////////////////////////////////////////////////////////////
136 // ~QBrew()
137 // -------------
138 // Private destructor
139
140 QBrewcxx . . $ QBrew#::~cxx . . $ QBrew#`~QBrew`(ced63f7c635d850d).QBrewcxx . . $ QBrew#()
141 {
142 saveStatecxx . . $ QBrew#saveState(49f6e7a06ebc5aa8).();
143
144 // make sure any open windows are closed
145 if (alcoholtool_cxx . . $ QBrew#alcoholtool_.) alcoholtool_cxx . . $ QBrew#alcoholtool_.->closecxx . . $ QWidget#close(c9857a73d68e59ba).();
146 if (hydrometertool_cxx . . $ QBrew#hydrometertool_.) hydrometertool_cxx . . $ QBrew#hydrometertool_.->closecxx . . $ QWidget#close(c9857a73d68e59ba).();
147 if (databasetool_cxx . . $ QBrew#databasetool_.) databasetool_cxx . . $ QBrew#databasetool_.->closecxx . . $ QWidget#close(c9857a73d68e59ba).();
148 if (configure_cxx . . $ QBrew#configure_.) configure_cxx . . $ QBrew#configure_.->closecxx . . $ QWidget#close(c9857a73d68e59ba).();
149 if (handbook_cxx . . $ QBrew#handbook_.) handbook_cxx . . $ QBrew#handbook_.->closecxx . . $ QWidget#close(c9857a73d68e59ba).();
150 if (primer_cxx . . $ QBrew#primer_.) primer_cxx . . $ QBrew#primer_.->closecxx . . $ QWidget#close(c9857a73d68e59ba).();
151 }
152
153 //////////////////////////////////////////////////////////////////////////////
154 // instance()
155 // ----------
156 // Return pointer to the instance
157
158 QBrewcxx . . $ QBrew# *QBrewcxx . . $ QBrew#::instancecxx . . $ QBrew#instance(40173339d0c531b3).()
159 {
160 if (!instance_cxx . . $ QBrew#instance_.) {
161 QMutexLockercxx . . $ QMutexLocker# lockcxx . . $ QMutexLocker#QMutexLocker(beb12293d355549c).(&instancelockcxx . . $ instancelock.);
162 if (!instance_cxx . . $ QBrew#instance_.) instance_cxx . . $ QBrew#instance_. = new QBrewcxx . . $ QBrew#();
163 }
164 return instance_cxx . . $ QBrew#instance_.;
165 }
166
167 //////////////////////////////////////////////////////////////////////////////
168 // initActions()
169 // -------------
170 // Initialize the actions
171
172 void QBrewcxx . . $ QBrew#::initActionscxx . . $ QBrew#initActions(49f6e7a06ebc5aa8).()
173 {
174 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionfilenewcxx . . $ Ui_MainWindow#actionfilenew., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
175 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(fileNew()));
176 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionfileopencxx . . $ Ui_MainWindow#actionfileopen., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
177 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(fileOpen()));
178 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionfilesavecxx . . $ Ui_MainWindow#actionfilesave., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
179 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(fileSave()));
180 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionfilesaveascxx . . $ Ui_MainWindow#actionfilesaveas., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
181 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(fileSaveAs()));
182 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionfileprintpreviewcxx . . $ Ui_MainWindow#actionfileprintpreview., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
183 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(filePrintPreview()));
184 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionfileprintcxx . . $ Ui_MainWindow#actionfileprint., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
185 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(filePrint()));
186 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionfileexportcxx . . $ Ui_MainWindow#actionfileexport., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
187 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(fileExport()));
188 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionexitcxx . . $ Ui_MainWindow#actionexit., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()), qAppcxx . . $ `<external>/6022697617041041825/qapplication.h:70:9`!,
189 SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(closeAllWindows()));
190
191 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionalcoholtoolcxx . . $ Ui_MainWindow#actionalcoholtool., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
192 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(toolsAlcohol()));
193 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionhydrometertoolcxx . . $ Ui_MainWindow#actionhydrometertool., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
194 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(toolsHydrometer()));
195 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actiondatabasetoolcxx . . $ Ui_MainWindow#actiondatabasetool., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
196 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(toolsDatabase()));
197
198 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actiontogglestatusbarcxx . . $ Ui_MainWindow#actiontogglestatusbar., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(toggled(bool)),
199 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(optionsStatusbar(bool)));
200 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionconfigurecxx . . $ Ui_MainWindow#actionconfigure., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
201 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(optionsConfigure()));
202
203 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionhelpcontentscxx . . $ Ui_MainWindow#actionhelpcontents., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
204 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(helpContents()));
205 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionprimercxx . . $ Ui_MainWindow#actionprimer., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
206 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(helpPrimer()));
207 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actioncontexthelpcxx . . $ Ui_MainWindow#actioncontexthelp., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
208 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(helpContext()));
209 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ QBrew#ui..actionaboutcxx . . $ Ui_MainWindow#actionabout., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(helpAbout()));
210
211 #if (QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! < QT_VERSION_CHECKcxx . . $ `<external>/15045578679651060896/qglobal.h:61:9`!(4, 4, 0))
212 ui.actionfileprintpreview->setVisible(false);
213 #endif
214
215 // insert toolbar toggle action
216 uicxx . . $ QBrew#ui..maintoolbarcxx . . $ Ui_MainWindow#maintoolbar.->toggleViewActioncxx . . $ QToolBar#toggleViewAction(50f6a0536a8019cb).()->setStatusTipcxx . . $ QAction#setStatusTip(3520e46b33348bf6).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Toggle the toolbar"));
217 uicxx . . $ QBrew#ui..maintoolbarcxx . . $ Ui_MainWindow#maintoolbar.->toggleViewActioncxx . . $ QToolBar#toggleViewAction(50f6a0536a8019cb).()->setWhatsThiscxx . . $ QAction#setWhatsThis(3520e46b33348bf6).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Enable or disable the Toolbar"));
218 uicxx . . $ QBrew#ui..menuoptionscxx . . $ Ui_MainWindow#menuoptions.->insertActioncxx . . $ QWidget#insertAction(c5438a09579c6160).(uicxx . . $ QBrew#ui..actiontogglestatusbarcxx . . $ Ui_MainWindow#actiontogglestatusbar.,
219 uicxx . . $ QBrew#ui..maintoolbarcxx . . $ Ui_MainWindow#maintoolbar.->toggleViewActioncxx . . $ QToolBar#toggleViewAction(50f6a0536a8019cb).());
220 }
221
222 //////////////////////////////////////////////////////////////////////////////
223 // initAutoSave()
224 // ---------------
225 // Initialize the autosave timer
226
227 void QBrewcxx . . $ QBrew#::initAutoSavecxx . . $ QBrew#initAutoSave(49f6e7a06ebc5aa8).()
228 {
229 // destroy existing timer, if any
230 if (autosave_cxx . . $ QBrew#autosave_.) {
231 autosave_cxx . . $ QBrew#autosave_.->stopcxx . . $ QTimer#stop(49f6e7a06ebc5aa8).();
232 disconnectcxx . . $ QObject#disconnect(cc30ff19c637f8ed).(autosave_cxx . . $ QBrew#autosave_., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(timeout()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(autoSave()));
233 delete autosave_cxx . . $ QBrew#autosave_.; autosave_cxx . . $ QBrew#autosave_. = 0;
234 }
235
236 autosavename_cxx . . $ QBrew#autosavename_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). QDircxx . . $ QDir#::currentPathcxx . . $ QDir#currentPath(4365c3963150523e).() +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ QBrew#tr(75d9f1c324b4579d).("/autosave.") +cxx . . $ operator+(4bea96b16517258e). FILE_EXTcxx . . $ Resource/FILE_EXT.;
237
238 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..autosavecxx . . $ GenConfigState#autosave.) {
239 autosave_cxx . . $ QBrew#autosave_. = new QTimercxx . . $ QTimer#QTimer(749de1b6ae65bddd).(this);
240 connectcxx . . $ QObject#connect(158df1d9a01a3410).(autosave_cxx . . $ QBrew#autosave_., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(timeout()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(autoSave()));
241 autosave_cxx . . $ QBrew#autosave_.->startcxx . . $ QTimer#start(d4f767463ce0a6b3).(state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..saveintervalcxx . . $ GenConfigState#saveinterval. * 60000);
242 }
243 }
244
245 //////////////////////////////////////////////////////////////////////////////
246 // File Menu Implementation //
247 //////////////////////////////////////////////////////////////////////////////
248
249 //////////////////////////////////////////////////////////////////////////////
250 // fileNew()
251 // ---------
252 // Create a new recipe
253
254 void QBrewcxx . . $ QBrew#::fileNewcxx . . $ QBrew#fileNew(49f6e7a06ebc5aa8).()
255 {
256 if (recipe_cxx . . $ QBrew#recipe_.->modifiedcxx . . $ Recipe#modified(50ce9a9e25b4a850).()) {
257 // query user to save file
258 switch (querySavecxx . . $ QBrew#querySave(b126dc7c1de90089).()) {
259 case QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.:
260 fileSavecxx . . $ QBrew#fileSave(49f6e7a06ebc5aa8).();
261 break;
262 case QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.:
263 break;
264 case QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.:
265 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Canceled..."), 2000);
266 // exit function
267 return;
268 }
269 }
270
271 // create a new file
272 recipe_cxx . . $ QBrew#recipe_.->newRecipecxx . . $ Recipe#newRecipe(49f6e7a06ebc5aa8).();
273 newflag_cxx . . $ QBrew#newflag_. = true;
274 backed_cxx . . $ QBrew#backed_. = false;
275
276 uicxx . . $ QBrew#ui..actionfilesavecxx . . $ Ui_MainWindow#actionfilesave.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(true);
277
278 filename_cxx . . $ QBrew#filename_. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.);
279 setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(filename_cxx . . $ QBrew#filename_.);
280 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Created new recipe"), 2000);
281 }
282
283 //////////////////////////////////////////////////////////////////////////////
284 // fileOpen()
285 // ----------
286 // Open a recipe
287
288 void QBrewcxx . . $ QBrew#::fileOpencxx . . $ QBrew#fileOpen(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename)
289 {
290 if (recipe_cxx . . $ QBrew#recipe_.->modifiedcxx . . $ Recipe#modified(50ce9a9e25b4a850).()) {
291 // query user to save file
292 switch (querySavecxx . . $ QBrew#querySave(b126dc7c1de90089).()) {
293 case QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.:
294 fileSavecxx . . $ QBrew#fileSave(49f6e7a06ebc5aa8).();
295 break;
296 case QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.:
297 break;
298 case QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.:
299 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Canceled..."), 2000);
300 return;
301 }
302 }
303
304 // open the file
305 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Opening recipe..."));
306 QStringcxx . . $ QString# fnamecxx . . $ QString#QString(ced63f7c635d850d).;
307 if (filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) {
308 fname =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QFileDialogcxx . . $ QFileDialog#::getOpenFileNamecxx . . $ QFileDialog#getOpenFileName(a6b29be4bec65236).(this,
309 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Open..."),
310 QStringcxx . . $ QString#QString(ced63f7c635d850d).(),
311 trcxx . . $ QBrew#tr(75d9f1c324b4579d).(OPEN_FILTERcxx . . $ Resource/OPEN_FILTER.));
312 } else {
313 fname =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). filename;
314 }
315 if (openFilecxx . . $ QBrew#openFile(e1defb592416720d).(fname)) {
316 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Loaded recipe"), 2000);
317 } else {
318 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Load failed"), 2000);
319 }
320 }
321
322 //////////////////////////////////////////////////////////////////////////////
323 // fileRecent()
324 // -----------
325 // Selection has been made from recent file menu
326
327 void QBrewcxx . . $ QBrew#::fileRecentcxx . . $ QBrew#fileRecent(49f6e7a06ebc5aa8).()
328 {
329 QActioncxx . . $ QAction# *action = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QActioncxx . . $ QAction# *>(sendercxx . . $ QObject#sender(2dbb680a34285c44).());
330 if (!action) return;
331
332 if (recipe_cxx . . $ QBrew#recipe_.->modifiedcxx . . $ Recipe#modified(50ce9a9e25b4a850).()) {
333 // file needs to be saved, what do we do
334 switch (querySavecxx . . $ QBrew#querySave(b126dc7c1de90089).()) {
335 case QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.:
336 fileSavecxx . . $ QBrew#fileSave(49f6e7a06ebc5aa8).();
337 break;
338 case QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.:
339 break;
340 case QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.:
341 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Canceled..."), 2000);
342 return;
343 }
344 }
345
346 // open the file
347 QStringcxx . . $ QString# fname = action->textcxx . . $ QAction#text(6ef7b6c27b00b43d).();
348 if (openFilecxx . . $ QBrew#openFile(e1defb592416720d).(fname)) {
349 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Loaded recipe"), 2000);
350 addRecentcxx . . $ QBrew#addRecent(3520e46b33348bf6).(fname);
351 }
352 }
353
354 //////////////////////////////////////////////////////////////////////////////
355 // fileSave()
356 // ----------
357 // Save a recipe
358
359 void QBrewcxx . . $ QBrew#::fileSavecxx . . $ QBrew#fileSave(49f6e7a06ebc5aa8).()
360 {
361 if (newflag_cxx . . $ QBrew#newflag_.) {
362 fileSaveAscxx . . $ QBrew#fileSaveAs(49f6e7a06ebc5aa8).();
363 } else {
364 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..autobackupcxx . . $ GenConfigState#autobackup.) {
365 if (!backupFilecxx . . $ QBrew#backupFile(c9857a73d68e59ba).())
366 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, TITLEcxx . . $ QString#QString(45672f3c6961a244).,
367 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("%1 was unable to make a backup of %2")
368 .argcxx . . $ QString#arg(bc823072288cbbb5).(PACKAGEcxx . . $ `src/resource.h:39:9`!).argcxx . . $ QString#arg(bc823072288cbbb5).(filename_cxx . . $ QBrew#filename_.));
369 }
370 if (saveFilecxx . . $ QBrew#saveFile(e1defb592416720d).(filename_cxx . . $ QBrew#filename_.)) {
371 // successful in saving file
372 newflag_cxx . . $ QBrew#newflag_. = false;
373 uicxx . . $ QBrew#ui..actionfilesavecxx . . $ Ui_MainWindow#actionfilesave.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(false);
374 setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(filename_cxx . . $ QBrew#filename_.);
375 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Saved recipe"), 2000);
376 } else {
377 // error in saving file
378 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, TITLEcxx . . $ QString#QString(45672f3c6961a244).,
379 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("%1 was unable to save %2")
380 .argcxx . . $ QString#arg(bc823072288cbbb5).(PACKAGEcxx . . $ `src/resource.h:39:9`!).argcxx . . $ QString#arg(bc823072288cbbb5).(filename_cxx . . $ QBrew#filename_.));
381 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Error in saving recipe"), 2000);
382 }
383 }
384 }
385
386 //////////////////////////////////////////////////////////////////////////////
387 // fileSaveAs()
388 // ------------
389 // Save a recipe under a new name
390
391 void QBrewcxx . . $ QBrew#::fileSaveAscxx . . $ QBrew#fileSaveAs(49f6e7a06ebc5aa8).()
392 {
393 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Saving recipe under new filename..."));
394 QStringcxx . . $ QString# selectedcxx . . $ QString#QString(ced63f7c635d850d).;
395 QStringcxx . . $ QString# fnamecxx . . $ QString#QString(ced63f7c635d850d).;
396 fname =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QFileDialogcxx . . $ QFileDialog#::getSaveFileNamecxx . . $ QFileDialog#getSaveFileName(a6b29be4bec65236).(this,
397 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Save As..."),
398 QStringcxx . . $ QString#QString(ced63f7c635d850d).(),
399 trcxx . . $ QBrew#tr(75d9f1c324b4579d).(SAVE_FILTERcxx . . $ Resource/SAVE_FILTER.),
400 &selected,
401 QFileDialogcxx . . $ QFlags#QFlags(93d577a3e9528307).::DontConfirmOverwritecxx . . $ QFileDialog#DontConfirmOverwrite.);
402 if (!fname.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { // we got a filename
403 // add suffix if there is none
404 if (!QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(fname)) {
405 if (fname.indexOfcxx . . $ QString#indexOf(75b556ba78e4903c).('.'cxx . . $ QChar#QChar(f349c77f591a7878).) == -1) fname +=cxx . . $ QString#`operator+=`(49ea8750b4987a17). '.' +cxx . . $ operator+(c379cb7ee61e6501). FILE_EXTcxx . . $ Resource/FILE_EXT.;
406 }
407
408 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..autobackupcxx . . $ GenConfigState#autobackup.) backupFilecxx . . $ QBrew#backupFile(c9857a73d68e59ba).();
409 if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(fname)) {
410 // overwrite?
411 switch (queryOverwritecxx . . $ QBrew#queryOverwrite(87a9b7c6fe1ccdba).(fnamecxx . . $ QString#QString(132dd6869045752b).)) {
412 case QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.:
413 break;
414 case QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.:
415 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Canceled..."), 2000);
416 return;
417 }
418 }
419
420 if (saveFilecxx . . $ QBrew#saveFile(e1defb592416720d).(fname)) {
421 // successfully saved
422 newflag_cxx . . $ QBrew#newflag_. = false;
423 addRecentcxx . . $ QBrew#addRecent(3520e46b33348bf6).(fname);
424 uicxx . . $ QBrew#ui..actionfilesavecxx . . $ Ui_MainWindow#actionfilesave.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(false);
425 setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(fname);
426 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Saved recipe"), 2000);
427 // save name of file
428 filename_cxx . . $ QBrew#filename_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). fname;
429 } else {
430 // error in saving
431 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, TITLEcxx . . $ QString#QString(45672f3c6961a244).,
432 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Unable to save to %1")
433 .argcxx . . $ QString#arg(bc823072288cbbb5).(QFileInfocxx . . $ QFileInfo#(filename_cxx . . $ QBrew#filename_.).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).()));
434 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Error in saving recipe"), 2000);
435 }
436 } else {
437 // no file chosen
438 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Saving aborted"), 2000);
439 }
440 }
441
442 //////////////////////////////////////////////////////////////////////////////
443 // fileExport()
444 // ------------
445 // Export recipe to non-native format
446
447 void QBrewcxx . . $ QBrew#::fileExportcxx . . $ QBrew#fileExport(49f6e7a06ebc5aa8).()
448 {
449 bool status = false;
450 QStringcxx . . $ QString# selectedcxx . . $ QString#QString(ced63f7c635d850d).;
451 QStringcxx . . $ QString# fnamecxx . . $ QString#QString(ced63f7c635d850d).;
452 QStringcxx . . $ QString# dirfilecxx . . $ QString#QString(ced63f7c635d850d).;
453
454 fname =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QFileDialogcxx . . $ QFileDialog#::getSaveFileNamecxx . . $ QFileDialog#getSaveFileName(a6b29be4bec65236).(this,
455 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Export..."),
456 QStringcxx . . $ QString#QString(ced63f7c635d850d).(),
457 trcxx . . $ QBrew#tr(75d9f1c324b4579d).(EXPORT_FILTERcxx . . $ Resource/EXPORT_FILTER.),
458 &selected,
459 QFileDialogcxx . . $ QFlags#QFlags(93d577a3e9528307).::DontConfirmOverwritecxx . . $ QFileDialog#DontConfirmOverwrite.);
460
461 if (!fname.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { // we got a filename
462 // add suffix if there is none
463 if (!QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(fname)) {
464 if (fname.indexOfcxx . . $ QString#indexOf(75b556ba78e4903c).('.'cxx . . $ QChar#QChar(f349c77f591a7878).) == -1) {
465 if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(HTML_FILTERcxx . . $ Resource/HTML_FILTER.)) fname +=cxx . . $ QString#`operator+=`(d02845eef0c33901). ".html";
466 else if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(BEERXML_FILTERcxx . . $ Resource/BEERXML_FILTER.)) fname +=cxx . . $ QString#`operator+=`(d02845eef0c33901). ".xml";
467 else if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(PDF_FILTERcxx . . $ Resource/PDF_FILTER.)) fname +=cxx . . $ QString#`operator+=`(d02845eef0c33901). ".pdf";
468 else if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(TEXT_FILTERcxx . . $ Resource/TEXT_FILTER.)) fname +=cxx . . $ QString#`operator+=`(d02845eef0c33901). ".txt";
469 }
470 }
471
472 if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(fname)) {
473 // overwrite?
474 switch (queryOverwritecxx . . $ QBrew#queryOverwrite(87a9b7c6fe1ccdba).(fnamecxx . . $ QString#QString(132dd6869045752b).)) {
475 case QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.:
476 break;
477 case QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.:
478 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Canceled..."), 2000);
479 return;
480 }
481 }
482
483 // export recipe
484 if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(HTML_FILTERcxx . . $ Resource/HTML_FILTER.)) {
485 status = recipe_cxx . . $ QBrew#recipe_.->exportHtmlcxx . . $ Recipe#exportHtml(e1defb592416720d).(fname);
486 } else if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(BEERXML_FILTERcxx . . $ Resource/BEERXML_FILTER.)) {
487 status = recipe_cxx . . $ QBrew#recipe_.->exportBeerXMLcxx . . $ Recipe#exportBeerXML(e1defb592416720d).(fname);
488 } else if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(PDF_FILTERcxx . . $ Resource/PDF_FILTER.)) {
489 status = recipe_cxx . . $ QBrew#recipe_.->exportPdfcxx . . $ Recipe#exportPdf(fbad90219c7ca024).(textprinter_cxx . . $ QBrew#textprinter_., fname);
490 } else if (selected ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(TEXT_FILTERcxx . . $ Resource/TEXT_FILTER.)) {
491 status = recipe_cxx . . $ QBrew#recipe_.->exportTextcxx . . $ Recipe#exportText(e1defb592416720d).(fname);
492 }
493 if (status) {
494 // successfully exported
495 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Exported recipe"), 2000);
496 } else {
497 // error in exporting
498 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, TITLEcxx . . $ QString#QString(45672f3c6961a244).,
499 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Unable to export to %1")
500 .argcxx . . $ QString#arg(bc823072288cbbb5).(QFileInfocxx . . $ QFileInfo#(filename_cxx . . $ QBrew#filename_.).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).()));
501 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Error exporting recipe"), 2000);
502 }
503 } else {
504 // no file chosen
505 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Export aborted"), 2000 );
506 }
507 }
508
509 //////////////////////////////////////////////////////////////////////////////
510 // filePrintPreview()
511 // ------------
512 // Print the recipe
513
514 void QBrewcxx . . $ QBrew#::filePrintPreviewcxx . . $ QBrew#filePrintPreview(49f6e7a06ebc5aa8).()
515 {
516 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Print preview..."));
517
518 recipe_cxx . . $ QBrew#recipe_.->previewRecipecxx . . $ Recipe#previewRecipe(79329d6b37ebd6ba).(textprinter_cxx . . $ QBrew#textprinter_.);
519 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
520 }
521
522 //////////////////////////////////////////////////////////////////////////////
523 // filePrint()
524 // ------------
525 // Print the recipe
526
527 void QBrewcxx . . $ QBrew#::filePrintcxx . . $ QBrew#filePrint(49f6e7a06ebc5aa8).()
528 {
529 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Printing..."));
530
531 recipe_cxx . . $ QBrew#recipe_.->printRecipecxx . . $ Recipe#printRecipe(79329d6b37ebd6ba).(textprinter_cxx . . $ QBrew#textprinter_.);
532 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
533 }
534
535 //////////////////////////////////////////////////////////////////////////////
536 // Tools Menu Implementation //
537 //////////////////////////////////////////////////////////////////////////////
538
539 //////////////////////////////////////////////////////////////////////////////
540 // toolsAlcohol()
541 // --------------
542 // A utility dialog for alchohol calculation
543
544 void QBrewcxx . . $ QBrew#::toolsAlcoholcxx . . $ QBrew#toolsAlcohol(49f6e7a06ebc5aa8).()
545 {
546 if (!alcoholtool_cxx . . $ QBrew#alcoholtool_.) alcoholtool_cxx . . $ QBrew#alcoholtool_. = new AlcoholToolcxx . . $ AlcoholTool#(this);
547 alcoholtool_cxx . . $ QBrew#alcoholtool_.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
548 alcoholtool_cxx . . $ QBrew#alcoholtool_.->raisecxx . . $ QWidget#raise(49f6e7a06ebc5aa8).();
549 if (alcoholtool_cxx . . $ QBrew#alcoholtool_.->isMinimizedcxx . . $ QWidget#isMinimized(50ce9a9e25b4a850).()) alcoholtool_cxx . . $ QBrew#alcoholtool_.->showNormalcxx . . $ QWidget#showNormal(49f6e7a06ebc5aa8).();
550
551 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
552 }
553
554 //////////////////////////////////////////////////////////////////////////////
555 // toolsHydrometer()
556 // -----------------
557 // A utility dialog for hydrometer correction
558
559 void QBrewcxx . . $ QBrew#::toolsHydrometercxx . . $ QBrew#toolsHydrometer(49f6e7a06ebc5aa8).()
560 {
561 if (!hydrometertool_cxx . . $ QBrew#hydrometertool_.) hydrometertool_cxx . . $ QBrew#hydrometertool_. = new HydrometerToolcxx . . $ HydrometerTool#(this);
562 hydrometertool_cxx . . $ QBrew#hydrometertool_.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
563 hydrometertool_cxx . . $ QBrew#hydrometertool_.->raisecxx . . $ QWidget#raise(49f6e7a06ebc5aa8).();
564 if (hydrometertool_cxx . . $ QBrew#hydrometertool_.->isMinimizedcxx . . $ QWidget#isMinimized(50ce9a9e25b4a850).()) hydrometertool_cxx . . $ QBrew#hydrometertool_.->showNormalcxx . . $ QWidget#showNormal(49f6e7a06ebc5aa8).();
565
566 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
567 }
568
569 //////////////////////////////////////////////////////////////////////////////
570 // toolsDatabase()
571 // ---------------
572 // A database editor for ingredients
573
574 void QBrewcxx . . $ QBrew#::toolsDatabasecxx . . $ QBrew#toolsDatabase(49f6e7a06ebc5aa8).()
575 {
576 if (!databasetool_cxx . . $ QBrew#databasetool_.)
577 databasetool_cxx . . $ QBrew#databasetool_. = new DatabaseToolcxx . . $ DatabaseTool#DatabaseTool(108f35f7aa7f3cf9).(this);
578 databasetool_cxx . . $ QBrew#databasetool_.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
579 databasetool_cxx . . $ QBrew#databasetool_.->raisecxx . . $ QWidget#raise(49f6e7a06ebc5aa8).();
580 if (databasetool_cxx . . $ QBrew#databasetool_.->isMinimizedcxx . . $ QWidget#isMinimized(50ce9a9e25b4a850).()) databasetool_cxx . . $ QBrew#databasetool_.->showNormalcxx . . $ QWidget#showNormal(49f6e7a06ebc5aa8).();
581
582 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
583 }
584
585 //////////////////////////////////////////////////////////////////////////////
586 // Options Menu Implementation //
587 //////////////////////////////////////////////////////////////////////////////
588
589 //////////////////////////////////////////////////////////////////////////////
590 // optionsSatusbar()
591 // -----------------
592 // Toggle statusbar status
593
594 void QBrewcxx . . $ QBrew#::optionsStatusbarcxx . . $ QBrew#optionsStatusbar(b45ddcbc8423892c).(bool on)
595 {
596 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(on);
597 state_cxx . . $ QBrew#state_..windowcxx . . $ ConfigState#window..statusbarcxx . . $ WinConfigState#statusbar. = on;
598 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
599 }
600
601 //////////////////////////////////////////////////////////////////////////////
602 // optionsConfigure()
603 // ------------
604 // Display the configuration dialog
605
606 void QBrewcxx . . $ QBrew#::optionsConfigurecxx . . $ QBrew#optionsConfigure(49f6e7a06ebc5aa8).()
607 {
608 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Configuring %1 ...").argcxx . . $ QString#arg(bc823072288cbbb5).(PACKAGEcxx . . $ `src/resource.h:39:9`!), 2000);
609
610 if (!configure_cxx . . $ QBrew#configure_.) {
611 configure_cxx . . $ QBrew#configure_. = new Configurecxx . . $ Configure#(this);
612
613 connectcxx . . $ QObject#connect(158df1d9a01a3410).(configure_cxx . . $ QBrew#configure_., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(generalApply(const GenConfigState&)),
614 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(applyGeneralState(const GenConfigState&)));
615 connectcxx . . $ QObject#connect(158df1d9a01a3410).(configure_cxx . . $ QBrew#configure_., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(recipeApply(const RecipeConfigState&)),
616 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(applyRecipeState(const RecipeConfigState&)));
617 connectcxx . . $ QObject#connect(158df1d9a01a3410).(configure_cxx . . $ QBrew#configure_., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(calcApply(const CalcConfigState&)),
618 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(applyCalcState(const CalcConfigState&)));
619 connectcxx . . $ QObject#connect(158df1d9a01a3410).(configure_cxx . . $ QBrew#configure_., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(configureAccept()),
620 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(saveConfig()));
621 }
622
623 if (!configure_cxx . . $ QBrew#configure_.->isVisiblecxx . . $ QWidget#isVisible(50ce9a9e25b4a850).()) {
624 configure_cxx . . $ QBrew#configure_.->setStatecxx . . $ Configure#setState(24ed027017280a9f).(state_cxx . . $ QBrew#state_.);
625 }
626 configure_cxx . . $ QBrew#configure_.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).(); // non-modal
627 configure_cxx . . $ QBrew#configure_.->raisecxx . . $ QWidget#raise(49f6e7a06ebc5aa8).();
628 if (configure_cxx . . $ QBrew#configure_.->isMinimizedcxx . . $ QWidget#isMinimized(50ce9a9e25b4a850).()) configure_cxx . . $ QBrew#configure_.->showNormalcxx . . $ QWidget#showNormal(49f6e7a06ebc5aa8).();
629
630 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
631 }
632
633 //////////////////////////////////////////////////////////////////////////////
634 // Help Menu Implementation //
635 //////////////////////////////////////////////////////////////////////////////
636
637 //////////////////////////////////////////////////////////////////////////////
638 // helpContents()
639 // --------------
640 // Display the application manual
641
642 void QBrewcxx . . $ QBrew#::helpContentscxx . . $ QBrew#helpContents(49f6e7a06ebc5aa8).()
643 {
644 QStringcxx . . $ QString# home = docBasecxx . . $ QBrew#docBase(4365c3963150523e).() +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(HELP_FILEcxx . . $ Resource/HELP_FILE.);
645
646 if (!handbook_cxx . . $ QBrew#handbook_.) handbook_cxx . . $ QBrew#handbook_. = new HelpViewercxx . . $ HelpViewer#(home, 0);
647 handbook_cxx . . $ QBrew#handbook_.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
648 handbook_cxx . . $ QBrew#handbook_.->raisecxx . . $ QWidget#raise(49f6e7a06ebc5aa8).();
649 if (handbook_cxx . . $ QBrew#handbook_.->isMinimizedcxx . . $ QWidget#isMinimized(50ce9a9e25b4a850).()) handbook_cxx . . $ QBrew#handbook_.->showNormalcxx . . $ QWidget#showNormal(49f6e7a06ebc5aa8).();
650
651 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
652 }
653
654 //////////////////////////////////////////////////////////////////////////////
655 // helpPrimer()
656 // --------------
657 // Display the brewing primer
658
659 void QBrewcxx . . $ QBrew#::helpPrimercxx . . $ QBrew#helpPrimer(49f6e7a06ebc5aa8).()
660 {
661 QStringcxx . . $ QString# home = docBasecxx . . $ QBrew#docBase(4365c3963150523e).() +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(PRIMER_FILEcxx . . $ Resource/PRIMER_FILE.);
662
663 if (!primer_cxx . . $ QBrew#primer_.) primer_cxx . . $ QBrew#primer_. = new HelpViewercxx . . $ HelpViewer#(home, 0);
664 primer_cxx . . $ QBrew#primer_.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
665 primer_cxx . . $ QBrew#primer_.->raisecxx . . $ QWidget#raise(49f6e7a06ebc5aa8).();
666 if (primer_cxx . . $ QBrew#primer_.->isMinimizedcxx . . $ QWidget#isMinimized(50ce9a9e25b4a850).()) primer_cxx . . $ QBrew#primer_.->showNormalcxx . . $ QWidget#showNormal(49f6e7a06ebc5aa8).();
667
668 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
669 }
670
671 //////////////////////////////////////////////////////////////////////////////
672 // helpContext()
673 // -------------
674 // Display context help cursor
675
676 void QBrewcxx . . $ QBrew#::helpContextcxx . . $ QBrew#helpContext(49f6e7a06ebc5aa8).()
677 {
678 QWhatsThiscxx . . $ QWhatsThis#::enterWhatsThisModecxx . . $ QWhatsThis#enterWhatsThisMode(49f6e7a06ebc5aa8).();
679 }
680
681 //////////////////////////////////////////////////////////////////////////////
682 // helpAbout()
683 // -----------
684 // Display the About dialog
685
686 void QBrewcxx . . $ QBrew#::helpAboutcxx . . $ QBrew#helpAbout(49f6e7a06ebc5aa8).()
687 {
688 QStringcxx . . $ QString# messagecxx . . $ QString#QString(ced63f7c635d850d).;
689
690 message =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). "<center><nobr><big><strong>" +cxx . . $ operator+(c76e440e68d4afec). TITLEcxx . . $ Resource/TITLE. +cxx . . $ operator+(57364c1b23444736). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(" Version ")
691 +cxx . . $ operator+(3d22f08efddf8107). VERSIONcxx . . $ `src/resource.h:40:9`! +cxx . . $ operator+(3d22f08efddf8107). "</strong></big></nobr></center>";
692 message +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<p align=center><strong>" +cxx . . $ operator+(c75c3ae4eb9af1a8). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DESCRIPTIONcxx . . $ Resource/DESCRIPTION.) +cxx . . $ operator+(3d22f08efddf8107). "</strong></p>";
693 message +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "<p align=center>" +cxx . . $ operator+(c75c3ae4eb9af1a8). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(COPYRIGHTcxx . . $ Resource/COPYRIGHT.) +cxx . . $ operator+(501d4570f8fec4c9). ' ' +cxx . . $ operator+(4bea96b16517258e). AUTHORcxx . . $ Resource/AUTHOR. +cxx . . $ operator+(3d22f08efddf8107). "</p>";
694 message +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). trcxx . . $ QBrew#tr(75d9f1c324b4579d).("<p align=center><small>Contributions by ")
695 +cxx . . $ operator+(4bea96b16517258e). CONTRIBUTORScxx . . $ Resource/CONTRIBUTORS. +cxx . . $ operator+(3d22f08efddf8107). "</small></p>";
696
697 QMessageBoxcxx . . $ QMessageBox#::aboutcxx . . $ QMessageBox#about(4dd15af3e405760c).(this, trcxx . . $ QBrew#tr(75d9f1c324b4579d).("About ") +cxx . . $ operator+(4bea96b16517258e). TITLEcxx . . $ Resource/TITLE., message);
698 }
699
700 //////////////////////////////////////////////////////////////////////////////
701 // Settings //
702 //////////////////////////////////////////////////////////////////////////////
703
704 //////////////////////////////////////////////////////////////////////////////
705 // applyGeneralState()
706 // -------------------
707 // Set the general configuration state
708
709 void QBrewcxx . . $ QBrew#::applyGeneralStatecxx . . $ QBrew#applyGeneralState(76152a8faa96f310).(const GenConfigStatecxx . . $ GenConfigState# &state)
710 {
711 GenConfigStatecxx . . $ GenConfigState# oldstate = state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general.;
712 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general. =cxx . . $ GenConfigState#`operator=`(166ae37d4d648f25). state;
713
714 // apply immediate state changes
715 if (state.lookfeelcxx . . $ GenConfigState#lookfeel. !=cxx . . $ `operator!=`(5bc2975d2d751687). oldstate.lookfeelcxx . . $ GenConfigState#lookfeel.) {
716 QApplicationcxx . . $ QApplication#::setStylecxx . . $ QApplication#setStyle(1028a3ea1bbca2e8).(state.lookfeelcxx . . $ GenConfigState#lookfeel.);
717 }
718 if ((state.autosavecxx . . $ GenConfigState#autosave. != oldstate.autosavecxx . . $ GenConfigState#autosave.) ||
719 (state.saveintervalcxx . . $ GenConfigState#saveinterval. != oldstate.saveintervalcxx . . $ GenConfigState#saveinterval.)) {
720 initAutoSavecxx . . $ QBrew#initAutoSave(49f6e7a06ebc5aa8).();
721 }
722 if (state.recentnumcxx . . $ GenConfigState#recentnum. < oldstate.recentnumcxx . . $ GenConfigState#recentnum.) {
723 while (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..countcxx . . $ QList#count(455f465bc33b4cdf).() > state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentnumcxx . . $ GenConfigState#recentnum.) {
724 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).();
725 }
726 }
727 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
728 }
729
730 //////////////////////////////////////////////////////////////////////////////
731 // applyRecipeState()
732 // ------------------
733 // Set the recipe configuration state
734
735 void QBrewcxx . . $ QBrew#::applyRecipeStatecxx . . $ QBrew#applyRecipeState(b744b00dc6e74f5e).(const RecipeConfigStatecxx . . $ RecipeConfigState# &state)
736 {
737 RecipeConfigStatecxx . . $ RecipeConfigState# oldstate = state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe.;
738 state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe. =cxx . . $ RecipeConfigState#`operator=`(526b29b2fedc2ceb). state;
739
740 // apply state changes
741 if (state.batchcxx . . $ RecipeConfigState#batch. != oldstate.batchcxx . . $ RecipeConfigState#batch.) {
742 if (state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..unitscxx . . $ CalcConfigState#units. ==cxx . . $ QString#`operator==`(4b967917d5ca120d). UNIT_METRICcxx . . $ Resource/UNIT_METRIC.) {
743 data_cxx . . $ QBrew#data_.->setDefaultSizecxx . . $ Data#setDefaultSize(c63af3d33c27c499).(Volumecxx . . $ Volume#Volume(2884c06fcedbb8a7).(state.batchcxx . . $ RecipeConfigState#batch., Volumecxx . . $ Volume#::litercxx . . $ Volume#liter.));
744 } else if (state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..unitscxx . . $ CalcConfigState#units. ==cxx . . $ QString#`operator==`(4b967917d5ca120d). UNIT_UScxx . . $ Resource/UNIT_US.) {
745 data_cxx . . $ QBrew#data_.->setDefaultSizecxx . . $ Data#setDefaultSize(c63af3d33c27c499).(Volumecxx . . $ Volume#Volume(2884c06fcedbb8a7).(state.batchcxx . . $ RecipeConfigState#batch., Volumecxx . . $ Volume#::galloncxx . . $ Volume#gallon.));
746 }
747 }
748 if (state.stylecxx . . $ RecipeConfigState#style. !=cxx . . $ `operator!=`(5bc2975d2d751687). oldstate.stylecxx . . $ RecipeConfigState#style.) {
749 data_cxx . . $ QBrew#data_.->setDefaultStylecxx . . $ Data#setDefaultStyle(3520e46b33348bf6).(state.stylecxx . . $ RecipeConfigState#style.);
750 }
751 if (state.hoptypecxx . . $ RecipeConfigState#hoptype. !=cxx . . $ `operator!=`(5bc2975d2d751687). oldstate.hoptypecxx . . $ RecipeConfigState#hoptype.) {
752 data_cxx . . $ QBrew#data_.->setDefaultHopTypecxx . . $ Data#setDefaultHopType(3520e46b33348bf6).(state.hoptypecxx . . $ RecipeConfigState#hoptype.);
753 }
754
755 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
756 }
757
758 //////////////////////////////////////////////////////////////////////////////
759 // applyCalcState()
760 // ----------------
761 // Set the calc configuration state
762
763 void QBrewcxx . . $ QBrew#::applyCalcStatecxx . . $ QBrew#applyCalcState(4810bf03babba259).(const CalcConfigStatecxx . . $ CalcConfigState# &state)
764 {
765 CalcConfigStatecxx . . $ CalcConfigState# oldstate = state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc.;
766 state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc. =cxx . . $ CalcConfigState#`operator=`(d7f33c49d7fa2d71). state;
767
768 // apply state changes
769 if (state.steepyieldcxx . . $ CalcConfigState#steepyield. != oldstate.steepyieldcxx . . $ CalcConfigState#steepyield.) {
770 data_cxx . . $ QBrew#data_.->setSteepYieldcxx . . $ Data#setSteepYield(ba8836b59fb42830).(state.steepyieldcxx . . $ CalcConfigState#steepyield.);
771 }
772 if (state.efficiencycxx . . $ CalcConfigState#efficiency. != oldstate.efficiencycxx . . $ CalcConfigState#efficiency.) {
773 data_cxx . . $ QBrew#data_.->setEfficiencycxx . . $ Data#setEfficiency(ba8836b59fb42830).(state.efficiencycxx . . $ CalcConfigState#efficiency.);
774 }
775 if (state.moreycxx . . $ CalcConfigState#morey. != oldstate.moreycxx . . $ CalcConfigState#morey.) {
776 data_cxx . . $ QBrew#data_.->setMoreycxx . . $ Data#setMorey(b45ddcbc8423892c).(state.moreycxx . . $ CalcConfigState#morey.);
777 }
778 if (state.tinsethcxx . . $ CalcConfigState#tinseth. != oldstate.tinsethcxx . . $ CalcConfigState#tinseth.) {
779 data_cxx . . $ QBrew#data_.->setTinsethcxx . . $ Data#setTinseth(b45ddcbc8423892c).(state.tinsethcxx . . $ CalcConfigState#tinseth.);
780 }
781 if (state.unitscxx . . $ CalcConfigState#units. !=cxx . . $ `operator!=`(5bc2975d2d751687). oldstate.unitscxx . . $ CalcConfigState#units.) {
782 if (state.unitscxx . . $ CalcConfigState#units. ==cxx . . $ QString#`operator==`(4b967917d5ca120d). UNIT_METRICcxx . . $ Resource/UNIT_METRIC.) {
783 data_cxx . . $ QBrew#data_.->setDefaultSizecxx . . $ Data#setDefaultSize(c63af3d33c27c499).(Volumecxx . . $ Volume#Volume(2884c06fcedbb8a7).(state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe..batchcxx . . $ RecipeConfigState#batch.,
784 Volumecxx . . $ Volume#::litercxx . . $ Volume#liter.));
785 data_cxx . . $ QBrew#data_.->setDefaultGrainUnitcxx . . $ Data#setDefaultGrainUnit(2fc4c5da330f3b75).(Weightcxx . . $ Weight#::kilogramcxx . . $ Weight#kilogram.);
786 data_cxx . . $ QBrew#data_.->setDefaultHopUnitcxx . . $ Data#setDefaultHopUnit(2fc4c5da330f3b75).(Weightcxx . . $ Weight#::gramcxx . . $ Weight#gram.);
787 data_cxx . . $ QBrew#data_.->setDefaultTempUnitcxx . . $ Data#setDefaultTempUnit(2fc4c5da330f3b75).(Temperaturecxx . . $ Temperature#::celsiuscxx . . $ Temperature#celsius.);
788 } else if (state.unitscxx . . $ CalcConfigState#units. ==cxx . . $ QString#`operator==`(4b967917d5ca120d). UNIT_UScxx . . $ Resource/UNIT_US.) {
789 data_cxx . . $ QBrew#data_.->setDefaultSizecxx . . $ Data#setDefaultSize(c63af3d33c27c499).(Volumecxx . . $ Volume#Volume(2884c06fcedbb8a7).(state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe..batchcxx . . $ RecipeConfigState#batch.,
790 Volumecxx . . $ Volume#::galloncxx . . $ Volume#gallon.));
791 data_cxx . . $ QBrew#data_.->setDefaultGrainUnitcxx . . $ Data#setDefaultGrainUnit(2fc4c5da330f3b75).(Weightcxx . . $ Weight#::poundcxx . . $ Weight#pound.);
792 data_cxx . . $ QBrew#data_.->setDefaultHopUnitcxx . . $ Data#setDefaultHopUnit(2fc4c5da330f3b75).(Weightcxx . . $ Weight#::ouncecxx . . $ Weight#ounce.);
793 data_cxx . . $ QBrew#data_.->setDefaultTempUnitcxx . . $ Data#setDefaultTempUnit(2fc4c5da330f3b75).(Temperaturecxx . . $ Temperature#::fahrenheitcxx . . $ Temperature#fahrenheit.);
794 }
795 // delete hydrometer tool
796 if (hydrometertool_cxx . . $ QBrew#hydrometertool_.) {
797 delete hydrometertool_cxx . . $ QBrew#hydrometertool_.;
798 hydrometertool_cxx . . $ QBrew#hydrometertool_. = 0;
799 }
800 }
801
802
803 // recalculate
804 recipe_cxx . . $ QBrew#recipe_.->recalccxx . . $ Recipe#recalc(49f6e7a06ebc5aa8).();
805 view_cxx . . $ QBrew#view_.->flushcxx . . $ View#flush(49f6e7a06ebc5aa8).();
806
807 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
808 }
809
810 //////////////////////////////////////////////////////////////////////////////
811 // saveConfig()
812 // -----------
813 // Save the configuration (when OK pressed in dialog)
814
815 void QBrewcxx . . $ QBrew#::saveConfigcxx . . $ QBrew#saveConfig(49f6e7a06ebc5aa8).()
816 {
817 writeConfigcxx . . $ QBrew#writeConfig(49f6e7a06ebc5aa8).();
818 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Saved configuration"), 2000);
819 }
820
821 //////////////////////////////////////////////////////////////////////////////
822 // readConfig()
823 // ------------
824 // Read configuration from settings file
825
826 void QBrewcxx . . $ QBrew#::readConfigcxx . . $ QBrew#readConfig(49f6e7a06ebc5aa8).()
827 {
828 QSettingscxx . . $ QSettings# configcxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
829 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("/") +cxx . . $ operator+(3d22f08efddf8107). PACKAGEcxx . . $ `src/resource.h:39:9`!);
830
831 // read general config
832 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_GENERALcxx . . $ QString#QString(45672f3c6961a244).);
833 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..lookfeelcxx . . $ GenConfigState#lookfeel. =cxx . . $ QString#`operator=`(4f35bf974e7f8568).
834 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_LOOK_FEELcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..generalcxx . . $ ConfigState#general..lookfeelcxx . . $ GenConfigState#lookfeel.).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
835 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..showsplashcxx . . $ GenConfigState#showsplash. =
836 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_SHOW_SPLASHcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..showsplashcxx . . $ GenConfigState#showsplash.).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).();
837 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..autosavecxx . . $ GenConfigState#autosave. =
838 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_AUTOSAVEcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..autosavecxx . . $ GenConfigState#autosave.).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).();
839 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..saveintervalcxx . . $ GenConfigState#saveinterval. =
840 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_SAVEINTERVALcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(d4f767463ce0a6b3)..generalcxx . . $ ConfigState#general..saveintervalcxx . . $ GenConfigState#saveinterval.).toUIntcxx . . $ QVariant#toUInt(870b63f89c7fb98).();
841 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..autobackupcxx . . $ GenConfigState#autobackup. =
842 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_AUTOBACKUPcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..autobackupcxx . . $ GenConfigState#autobackup.).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).();
843 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..loadlastcxx . . $ GenConfigState#loadlast. =
844 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_LOADLASTcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..loadlastcxx . . $ GenConfigState#loadlast.).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).();
845 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentnumcxx . . $ GenConfigState#recentnum. =
846 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_RECENTNUMcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(d4f767463ce0a6b3)..generalcxx . . $ ConfigState#general..recentnumcxx . . $ GenConfigState#recentnum.).toUIntcxx . . $ QVariant#toUInt(870b63f89c7fb98).();
847 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
848
849 // read recipe config
850 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_RECIPEcxx . . $ QString#QString(45672f3c6961a244).);
851 state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe..batchcxx . . $ RecipeConfigState#batch. =
852 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_RECIPE_BATCHcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(ba8836b59fb42830)..recipecxx . . $ ConfigState#recipe..batchcxx . . $ RecipeConfigState#batch.).toDoublecxx . . $ QVariant#toDouble(1bd8e57dd4a29c14).();
853 state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe..stylecxx . . $ RecipeConfigState#style. =cxx . . $ QString#`operator=`(4f35bf974e7f8568).
854 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_RECIPE_STYLEcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..recipecxx . . $ ConfigState#recipe..stylecxx . . $ RecipeConfigState#style.).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
855 // TODO: CONF_RECIPE_HOPFORM is deprecated (0.4.0)
856 if (config.containscxx . . $ QSettings#contains(f3b39adf77d9c36c).(CONF_RECIPE_HOPFORMcxx . . $ QString#QString(45672f3c6961a244).)) {
857 state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe..hoptypecxx . . $ RecipeConfigState#hoptype. =cxx . . $ QString#`operator=`(4f35bf974e7f8568).
858 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_RECIPE_HOPFORMcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..recipecxx . . $ ConfigState#recipe..hoptypecxx . . $ RecipeConfigState#hoptype.).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
859 config.removecxx . . $ QSettings#remove(3520e46b33348bf6).(CONF_RECIPE_HOPFORMcxx . . $ QString#QString(45672f3c6961a244).);
860 } else {
861 state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe..hoptypecxx . . $ RecipeConfigState#hoptype. =cxx . . $ QString#`operator=`(4f35bf974e7f8568).
862 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_RECIPE_HOPTYPEcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..recipecxx . . $ ConfigState#recipe..hoptypecxx . . $ RecipeConfigState#hoptype.).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
863 }
864 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
865
866 // read calc config
867 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_CALCcxx . . $ QString#QString(45672f3c6961a244).);
868 state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..steepyieldcxx . . $ CalcConfigState#steepyield. =
869 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_CALC_STEEPYIELDcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(ba8836b59fb42830)..calccxx . . $ ConfigState#calc..steepyieldcxx . . $ CalcConfigState#steepyield.).toDoublecxx . . $ QVariant#toDouble(1bd8e57dd4a29c14).();
870 state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..efficiencycxx . . $ CalcConfigState#efficiency. =
871 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_CALC_EFFICIENCYcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(ba8836b59fb42830)..calccxx . . $ ConfigState#calc..efficiencycxx . . $ CalcConfigState#efficiency.).toDoublecxx . . $ QVariant#toDouble(1bd8e57dd4a29c14).();
872 state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..moreycxx . . $ CalcConfigState#morey. =
873 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_CALC_MOREYcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..calccxx . . $ ConfigState#calc..moreycxx . . $ CalcConfigState#morey.).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).();
874 state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..tinsethcxx . . $ CalcConfigState#tinseth. =
875 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_CALC_TINSETHcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..calccxx . . $ ConfigState#calc..tinsethcxx . . $ CalcConfigState#tinseth.).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).();
876 state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..unitscxx . . $ CalcConfigState#units. =cxx . . $ QString#`operator=`(4f35bf974e7f8568).
877 config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_CALC_UNITScxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..calccxx . . $ ConfigState#calc..unitscxx . . $ CalcConfigState#units.).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
878 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
879
880 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
881 }
882
883 //////////////////////////////////////////////////////////////////////////////
884 // writeConfig()
885 // -------------
886 // Write configuration to settings file
887
888 void QBrewcxx . . $ QBrew#::writeConfigcxx . . $ QBrew#writeConfig(49f6e7a06ebc5aa8).()
889 {
890 QSettingscxx . . $ QSettings# configcxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
891 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("/") +cxx . . $ operator+(3d22f08efddf8107). PACKAGEcxx . . $ `src/resource.h:39:9`!);
892
893 // write general config
894 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_GENERALcxx . . $ QString#QString(45672f3c6961a244).);
895 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_LOOK_FEELcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..generalcxx . . $ ConfigState#general..lookfeelcxx . . $ GenConfigState#lookfeel.);
896 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_SHOW_SPLASHcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..showsplashcxx . . $ GenConfigState#showsplash.);
897 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_AUTOSAVEcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..autosavecxx . . $ GenConfigState#autosave.);
898 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_SAVEINTERVALcxx . . $ QString#QString(45672f3c6961a244)., (cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).int)state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..saveintervalcxx . . $ GenConfigState#saveinterval.);
899 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_AUTOBACKUPcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..autobackupcxx . . $ GenConfigState#autobackup.);
900 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_LOADLASTcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..generalcxx . . $ ConfigState#general..loadlastcxx . . $ GenConfigState#loadlast.);
901 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_RECENTNUMcxx . . $ QString#QString(45672f3c6961a244)., (cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).int)state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentnumcxx . . $ GenConfigState#recentnum.);
902 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
903
904 // write recipe config
905 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_RECIPEcxx . . $ QString#QString(45672f3c6961a244).);
906 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_RECIPE_BATCHcxx . . $ QString#QString(45672f3c6961a244)., (cxx . . $ QVariant#QVariant(ba8836b59fb42830).double)state_cxx . . $ QBrew#state_..recipecxx . . $ ConfigState#recipe..batchcxx . . $ RecipeConfigState#batch.);
907 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_RECIPE_STYLEcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..recipecxx . . $ ConfigState#recipe..stylecxx . . $ RecipeConfigState#style.);
908 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_RECIPE_HOPTYPEcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..recipecxx . . $ ConfigState#recipe..hoptypecxx . . $ RecipeConfigState#hoptype.);
909 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
910
911 // write calc config
912 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_CALCcxx . . $ QString#QString(45672f3c6961a244).);
913 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_CALC_STEEPYIELDcxx . . $ QString#QString(45672f3c6961a244)., (cxx . . $ QVariant#QVariant(ba8836b59fb42830).double)state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..steepyieldcxx . . $ CalcConfigState#steepyield.);
914 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_CALC_EFFICIENCYcxx . . $ QString#QString(45672f3c6961a244)., (cxx . . $ QVariant#QVariant(ba8836b59fb42830).double)state_cxx . . $ QBrew#state_..calccxx . . $ ConfigState#calc..efficiencycxx . . $ CalcConfigState#efficiency.);
915 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_CALC_MOREYcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..calccxx . . $ ConfigState#calc..moreycxx . . $ CalcConfigState#morey.);
916 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_CALC_TINSETHcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..calccxx . . $ ConfigState#calc..tinsethcxx . . $ CalcConfigState#tinseth.);
917 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_CALC_UNITScxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(3520e46b33348bf6)..calccxx . . $ ConfigState#calc..unitscxx . . $ CalcConfigState#units.);
918 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
919
920 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
921 }
922
923 //////////////////////////////////////////////////////////////////////////////
924 // restoreState()
925 // ------------
926 // Restore application state
927
928 void QBrewcxx . . $ QBrew#::restoreStatecxx . . $ QBrew#restoreState(49f6e7a06ebc5aa8).()
929 {
930 QSettingscxx . . $ QSettings# configcxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
931 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("/") +cxx . . $ operator+(3d22f08efddf8107). PACKAGEcxx . . $ `src/resource.h:39:9`!);
932
933 // read window state
934 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_WINDOWcxx . . $ QString#QString(45672f3c6961a244).);
935 state_cxx . . $ QBrew#state_..windowcxx . . $ ConfigState#window..statusbarcxx . . $ WinConfigState#statusbar. = config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_WIN_STATUSBARcxx . . $ QString#QString(45672f3c6961a244).,
936 state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..windowcxx . . $ ConfigState#window..statusbarcxx . . $ WinConfigState#statusbar.).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).();
937
938 QByteArraycxx . . $ QByteArray# mainwindow = config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_WIN_MAINWINDOWcxx . . $ QString#QString(45672f3c6961a244).).toByteArraycxx . . $ QVariant#toByteArray(a96750bfbcb1fbe9).();
939 QMainWindowcxx . . $ QMainWindow#::restoreStatecxx . . $ QMainWindow#restoreState(eb4ac98757633405).(mainwindow);
940 resizecxx . . $ QWidget#resize(1c5f201b4c2f0aba).(config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_WIN_SIZEcxx . . $ QString#QString(45672f3c6961a244)., QSizecxx . . $ QVariant#QVariant(1c5f201b4c2f0aba).(600, 400)).toSizecxx . . $ QVariant#toSize(4b3b776e5ee2b367).());
941 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
942
943 // read general state
944 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_GENERALcxx . . $ QString#QString(45672f3c6961a244).);
945 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles. =cxx . . $ QStringList#`operator=`(335bb966c1744308). config.valuecxx . . $ QSettings#value(12a1b1749da49362).(CONF_GEN_RECENTFILEScxx . . $ QString#QString(45672f3c6961a244).).toStringListcxx . . $ QVariant#toStringList(e1dbd5c4feadc8f5).();
946 while (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..countcxx . . $ QList#count(455f465bc33b4cdf).() > state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentnumcxx . . $ GenConfigState#recentnum.) {
947 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).();
948 }
949
950 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
951
952 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
953
954 // show or hide statusbar depending on initial setting
955 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(state_cxx . . $ QBrew#state_..windowcxx . . $ ConfigState#window..statusbarcxx . . $ WinConfigState#statusbar.);
956 uicxx . . $ QBrew#ui..actiontogglestatusbarcxx . . $ Ui_MainWindow#actiontogglestatusbar.->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(state_cxx . . $ QBrew#state_..windowcxx . . $ ConfigState#window..statusbarcxx . . $ WinConfigState#statusbar.);
957 }
958
959 //////////////////////////////////////////////////////////////////////////////
960 // saveSate()
961 // ----------
962 // Save application state
963
964 void QBrewcxx . . $ QBrew#::saveStatecxx . . $ QBrew#saveState(49f6e7a06ebc5aa8).()
965 {
966 // load config from settings
967 QSettingscxx . . $ QSettings# configcxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
968 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("/") +cxx . . $ operator+(3d22f08efddf8107). PACKAGEcxx . . $ `src/resource.h:39:9`!);
969
970 // write window state
971 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_WINDOWcxx . . $ QString#QString(45672f3c6961a244).);
972 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_WIN_MAINWINDOWcxx . . $ QString#QString(45672f3c6961a244)., QMainWindowcxx . . $ QVariant#QVariant(45672f3c6961a244).::saveStatecxx . . $ QMainWindow#saveState(1e245adf2d5d15b2).());
973 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_WIN_SIZEcxx . . $ QString#QString(45672f3c6961a244)., sizecxx . . $ QVariant#QVariant(1c5f201b4c2f0aba).());
974 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_WIN_STATUSBARcxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(b45ddcbc8423892c)..windowcxx . . $ ConfigState#window..statusbarcxx . . $ WinConfigState#statusbar.);
975
976 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
977
978 // write general state
979 config.beginGroupcxx . . $ QSettings#beginGroup(3520e46b33348bf6).(CONFGROUP_GENERALcxx . . $ QString#QString(45672f3c6961a244).);
980 config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CONF_GEN_RECENTFILEScxx . . $ QString#QString(45672f3c6961a244)., state_cxx . . $ QVariant#QVariant(631c0101495f0328)..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles.);
981 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
982
983 config.endGroupcxx . . $ QSettings#endGroup(49f6e7a06ebc5aa8).();
984 }
985
986 //////////////////////////////////////////////////////////////////////////////
987 // Miscellaneous //
988 //////////////////////////////////////////////////////////////////////////////
989
990 //////////////////////////////////////////////////////////////////////////////
991 // openFile()
992 // ----------
993 // Open the named file
994
995 bool QBrewcxx . . $ QBrew#::openFilecxx . . $ QBrew#openFile(e1defb592416720d).(const QStringcxx . . $ QString# &filename)
996 {
997
998 if (!filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) {
999 if (recipe_cxx . . $ QBrew#recipe_.->nativeFormatcxx . . $ Recipe#nativeFormat(e1defb592416720d).(filename)) {
1000 if (recipe_cxx . . $ QBrew#recipe_.->loadRecipecxx . . $ Recipe#loadRecipe(e1defb592416720d).(filename)) {
1001 filename_cxx . . $ QBrew#filename_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). filename;
1002 setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(filename_cxx . . $ QBrew#filename_.);
1003 } else {
1004 // load was unsuccessful
1005 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, TITLEcxx . . $ QString#QString(45672f3c6961a244).,
1006 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Unable to load the recipe %1")
1007 .argcxx . . $ QString#arg(bc823072288cbbb5).(QFileInfocxx . . $ QFileInfo#(filename_cxx . . $ QBrew#filename_.).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).()));
1008 return false;
1009 }
1010 } else {
1011 bool status = false;
1012 // attempt to import file
1013 if (recipe_cxx . . $ QBrew#recipe_.->beerXmlFormatcxx . . $ Recipe#beerXmlFormat(e1defb592416720d).(filename)) {
1014 status = recipe_cxx . . $ QBrew#recipe_.->importBeerXmlcxx . . $ Recipe#importBeerXml(e1defb592416720d).(filename);
1015 if (status) {
1016 // set filename to the default (forces a saveas)
1017 filename_cxx . . $ QBrew#filename_. =cxx . . $ QString#`operator=`(49ea8750b4987a17). DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.;
1018 setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(filename_cxx . . $ QBrew#filename_.);
1019 }
1020 }
1021 if (!status) {
1022 // import was unsuccessful
1023 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, TITLEcxx . . $ QString#QString(45672f3c6961a244).,
1024 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Unable to import the file %1")
1025 .argcxx . . $ QString#arg(bc823072288cbbb5).(QFileInfocxx . . $ QFileInfo#(filename).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).()));
1026 return false;
1027 }
1028 }
1029
1030 newflag_cxx . . $ QBrew#newflag_. = false;
1031 backed_cxx . . $ QBrew#backed_. = false;
1032 addRecentcxx . . $ QBrew#addRecent(3520e46b33348bf6).(filename_cxx . . $ QBrew#filename_.);
1033 uicxx . . $ QBrew#ui..actionfilesavecxx . . $ Ui_MainWindow#actionfilesave.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(false);
1034
1035 return true;
1036 }
1037 // empty filename
1038 return false;
1039 }
1040
1041 //////////////////////////////////////////////////////////////////////////////
1042 // saveFile()
1043 // ----------
1044 // Save a file
1045
1046 bool QBrewcxx . . $ QBrew#::saveFilecxx . . $ QBrew#saveFile(e1defb592416720d).(const QStringcxx . . $ QString# &filename)
1047 {
1048 bool status = true;
1049
1050 if (!filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) {
1051 status = recipe_cxx . . $ QBrew#recipe_.->saveRecipecxx . . $ Recipe#saveRecipe(e1defb592416720d).(filename);
1052
1053 if (status) {
1054 // remove old autosave file if present
1055 if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(autosavename_cxx . . $ QBrew#autosavename_.)) {
1056 QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(autosavename_cxx . . $ QBrew#autosavename_.);
1057 initAutoSavecxx . . $ QBrew#initAutoSave(49f6e7a06ebc5aa8).();
1058 }
1059 }
1060 }
1061
1062 return status;
1063 }
1064
1065 //////////////////////////////////////////////////////////////////////////////
1066 // backupFile()
1067 // ------------
1068 // Backup the current file
1069
1070 bool QBrewcxx . . $ QBrew#::backupFilecxx . . $ QBrew#backupFile(c9857a73d68e59ba).()
1071 {
1072 if (backed_cxx . . $ QBrew#backed_.) return true;
1073
1074 bool status = false;
1075 if (!filename_cxx . . $ QBrew#filename_..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() && (filename_cxx . . $ QBrew#filename_. !=cxx . . $ `operator!=`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.))) {
1076 if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(filename_cxx . . $ QBrew#filename_. +cxx . . $ operator+(501d4570f8fec4c9). '~'))
1077 QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(filename_cxx . . $ QBrew#filename_. +cxx . . $ operator+(501d4570f8fec4c9). '~');
1078 status = QFilecxx . . $ QFile#::copycxx . . $ QFile#copy(edf9e4f73813982f).(filename_cxx . . $ QBrew#filename_., filename_cxx . . $ QBrew#filename_. +cxx . . $ operator+(501d4570f8fec4c9). '~');
1079 if (status) backed_cxx . . $ QBrew#backed_. = true;
1080 }
1081 return status;
1082 }
1083
1084 //////////////////////////////////////////////////////////////////////////////
1085 // recentMenuShow()
1086 // ----------------
1087 // about to show recent file menu
1088
1089 void QBrewcxx . . $ QBrew#::recentMenuShowcxx . . $ QBrew#recentMenuShow(49f6e7a06ebc5aa8).()
1090 {
1091 uicxx . . $ QBrew#ui..menuopenrecentcxx . . $ Ui_MainWindow#menuopenrecent.->clearcxx . . $ QMenu#clear(49f6e7a06ebc5aa8).();
1092
1093 QActioncxx . . $ QAction# *action;
1094 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`!(QString recentfile, state_.general.recentfiles) {
1095 action = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(recentfile, uicxx . . $ QBrew#ui..menuopenrecentcxx . . $ Ui_MainWindow#menuopenrecent.);
1096 connectcxx . . $ QObject#connect(158df1d9a01a3410).(action, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()),
1097 this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(fileRecent()));
1098 uicxx . . $ QBrew#ui..menuopenrecentcxx . . $ Ui_MainWindow#menuopenrecent.->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(action);
1099 }
1100 }
1101
1102 //////////////////////////////////////////////////////////////////////////////
1103 // addRecent()
1104 // -----------
1105 // Add a file to the recent files list
1106
1107 void QBrewcxx . . $ QBrew#::addRecentcxx . . $ QBrew#addRecent(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename)
1108 {
1109 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentnumcxx . . $ GenConfigState#recentnum. == 0) return;
1110
1111 QFileInfocxx . . $ QFileInfo# finfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(filename);
1112 QStringcxx . . $ QString# filepath = finfo.absoluteFilePathcxx . . $ QFileInfo#absoluteFilePath(6ef7b6c27b00b43d).();
1113
1114 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..containscxx . . $ QStringList#contains(8cce4688c16f48f3).(filepath))
1115 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..removeAllcxx . . $ QList#removeAll(dd8e59d271e40448).(filepath);
1116 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..countcxx . . $ QList#count(455f465bc33b4cdf).() >= state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentnumcxx . . $ GenConfigState#recentnum.)
1117 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).();
1118 state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..recentfilescxx . . $ GenConfigState#recentfiles..prependcxx . . $ QList#prepend(77d9f17553126ecb).(filepath);
1119 }
1120
1121 //////////////////////////////////////////////////////////////////////////////
1122 // autoSave()
1123 // ----------
1124 // Time to autosave
1125
1126 void QBrewcxx . . $ QBrew#::autoSavecxx . . $ QBrew#autoSave(49f6e7a06ebc5aa8).()
1127 {
1128 if (!recipe_cxx . . $ QBrew#recipe_.->modifiedcxx . . $ Recipe#modified(50ce9a9e25b4a850).()) return;
1129 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).("Autosaving recipe..."), 2000);
1130 if ((filename_cxx . . $ QBrew#filename_..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) || (filename_cxx . . $ QBrew#filename_. ==cxx . . $ `operator==`(5bc2975d2d751687). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.))) {
1131 recipe_cxx . . $ QBrew#recipe_.->saveRecipecxx . . $ Recipe#saveRecipe(e1defb592416720d).(autosavename_cxx . . $ QBrew#autosavename_.);
1132 } else {
1133 if (state_cxx . . $ QBrew#state_..generalcxx . . $ ConfigState#general..autobackupcxx . . $ GenConfigState#autobackup.) backupFilecxx . . $ QBrew#backupFile(c9857a73d68e59ba).();
1134 recipe_cxx . . $ QBrew#recipe_.->saveRecipecxx . . $ Recipe#saveRecipe(e1defb592416720d).(filename_cxx . . $ QBrew#filename_.);
1135 }
1136 // remove "modified" from caption
1137 setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(filename_cxx . . $ QBrew#filename_.);
1138 }
1139
1140 //////////////////////////////////////////////////////////////////////////////
1141 // setFileCaption()
1142 // ----------------
1143 // Set the window caption from file name
1144
1145 void QBrewcxx . . $ QBrew#::setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename)
1146 {
1147 setWindowModifiedcxx . . $ QWidget#setWindowModified(b45ddcbc8423892c).(false); // clear modified *
1148
1149 QStringcxx . . $ QString# shownnamecxx . . $ QString#QString(ced63f7c635d850d).;
1150 if (filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) shownname =cxx . . $ QString#`operator=`(4f35bf974e7f8568). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(DEFAULT_FILEcxx . . $ Resource/DEFAULT_FILE.);
1151 else shownname =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QFileInfocxx . . $ QFileInfo#(filename).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).();
1152
1153 setWindowTitlecxx . . $ QWidget#setWindowTitle(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1 - %2[*]").argcxx . . $ QString#arg(bc823072288cbbb5).(TITLEcxx . . $ QString#QString(85c52e162fed56f9)..constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()).argcxx . . $ QString#arg(bc823072288cbbb5).(shownname));
1154 }
1155
1156 //////////////////////////////////////////////////////////////////////////////
1157 // querySave()
1158 // -----------
1159 // Ask the user if they want to save their work before going on
1160
1161 int QBrewcxx . . $ QBrew#::querySavecxx . . $ QBrew#querySave(b126dc7c1de90089).()
1162 {
1163 return QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(34f54820ac3d7911).(this, TITLEcxx . . $ Resource/TITLE. +cxx . . $ operator+(57364c1b23444736). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(" - Save?"),
1164 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("<p>Do you wish to save your work first?"),
1165 QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.,
1166 QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.,
1167 QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.);
1168 }
1169
1170 //////////////////////////////////////////////////////////////////////////////
1171 // queryOverwrite()
1172 // -----------
1173 // Ask the user if they want to overwrite an existing file
1174
1175 int QBrewcxx . . $ QBrew#::queryOverwritecxx . . $ QBrew#queryOverwrite(87a9b7c6fe1ccdba).(const QStringcxx . . $ QString# filename)
1176 {
1177 return QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(21b6fd1dd558cc82).(this, TITLEcxx . . $ Resource/TITLE. +cxx . . $ operator+(57364c1b23444736). trcxx . . $ QBrew#tr(75d9f1c324b4579d).(" - Overwrite?"),
1178 trcxx . . $ QBrew#tr(75d9f1c324b4579d).("<p>Are you sure you want to "
1179 "overwrite the file \"%1\"")
1180 .argcxx . . $ QString#arg(bc823072288cbbb5).(filename),
1181 QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.,
1182 QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.);
1183 }
1184
1185 //////////////////////////////////////////////////////////////////////////////
1186 // recipeModified()
1187 // ------------------
1188 // Received when recipe is modified
1189
1190 void QBrewcxx . . $ QBrew#::recipeModifiedcxx . . $ QBrew#recipeModified(49f6e7a06ebc5aa8).()
1191 {
1192 uicxx . . $ QBrew#ui..actionfilesavecxx . . $ Ui_MainWindow#actionfilesave.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(true);
1193 setWindowModifiedcxx . . $ QWidget#setWindowModified(b45ddcbc8423892c).(true);
1194 }
1195
1196 //////////////////////////////////////////////////////////////////////////////
1197 // closeEvent()
1198 // -----------
1199 // Catch the close event
1200
1201 void QBrewcxx . . $ QBrew#::closeEventcxx . . $ QBrew#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent#* e)
1202 {
1203 if (!recipe_cxx . . $ QBrew#recipe_.->modifiedcxx . . $ Recipe#modified(50ce9a9e25b4a850).()) {
1204 e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).();
1205 } else {
1206 // file needs to be saved, what do we do
1207 switch (querySavecxx . . $ QBrew#querySave(b126dc7c1de90089).()) {
1208 case QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.:
1209 fileSavecxx . . $ QBrew#fileSave(49f6e7a06ebc5aa8).();
1210 e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).();
1211 break;
1212 case QMessageBoxcxx . . $ QMessageBox#::Cancelcxx . . $ QMessageBox#Cancel.:
1213 statusBarcxx . . $ QMainWindow#statusBar(422c485dd0fc791b).()->showMessagecxx . . $ QStatusBar#showMessage(29ed8fcd127906b1).(trcxx . . $ QBrew#tr(75d9f1c324b4579d).(READYcxx . . $ Resource/READY.), 2000);
1214 e->ignorecxx . . $ QEvent#ignore(49f6e7a06ebc5aa8).();
1215 break;
1216 case QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.:
1217 default:
1218 e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).();
1219 }
1220 }
1221 }
1222
1223 //////////////////////////////////////////////////////////////////////////////
1224 // eventFilter()
1225 // -----------
1226 // Filter events
1227
1228 bool QBrewcxx . . $ QBrew#::eventFiltercxx . . $ QBrew#eventFilter(978aa4af1d030efa).(QObjectcxx . . $ QObject# *obj, QEventcxx . . $ QEvent# *event)
1229 {
1230 // necessary on Mac
1231 if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::FileOpencxx . . $ QEvent#FileOpen.) {
1232 QFileOpenEventcxx . . $ QFileOpenEvent# *openevent = static_cast<QFileOpenEventcxx . . $ QFileOpenEvent# *>(event);
1233 fileOpencxx . . $ QBrew#fileOpen(3520e46b33348bf6).(openevent->filecxx . . $ QFileOpenEvent#file(6ef7b6c27b00b43d).());
1234 return true;
1235 } else {
1236 // standard event processing
1237 return QObjectcxx . . $ QObject#::eventFiltercxx . . $ QObject#eventFilter(978aa4af1d030efa).(obj, event);
1238 }
1239 }
1240
1241 //////////////////////////////////////////////////////////////////////////////
1242 // dataBase()
1243 // ---------
1244 // Figure out the base directory for the data
1245
1246 QStringcxx . . $ QString# QBrewcxx . . $ QBrew#::dataBasecxx . . $ QBrew#dataBase(4365c3963150523e).()
1247 {
1248 // TODO: can QDesktopServices help us here?
1249 QStringcxx . . $ QString# base = qAppcxx . . $ `<external>/6022697617041041825/qapplication.h:70:9`!->applicationDirPathcxx . . $ QCoreApplication#applicationDirPath(4365c3963150523e).();
1250
•1251 #if defined(Q_OS_UNIXcxx . . $ `<external>/5130987379601705141/qsystemdetection.h:201:11`!)
1252 if (QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("qbrew/?$"cxx . . $ QString#QString(85c52e162fed56f9).).indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(base) != -1) {
1253 // we have our own application directory (it ends in 'qbrew')
1254 base +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "/";
1255 } else if (QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("bin/?$"cxx . . $ QString#QString(85c52e162fed56f9).).indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(base) != -1) {
1256 // we are in the bin dir of a filesystem hiearchy like '/usr/local/bin'
1257 base +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "/../share/qbrew/";
1258 } else {
1259 // otherwise punt
1260 base +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "/";
1261 }
1262
•1263 #elif defined(Q_OS_MAC)
1264 if (QRegExp("Contents/MacOS/?$").indexIn(base) != -1) {
1265 // we're pointing inside an application bundle
1266 base += "/../Resources/";
1267 } else {
1268 // otherwise punt
1269 base += "/";
1270 }
1271
1272 #else // Win32 and others
1273 base += "/";
1274 #endif
1275 return QDircxx . . $ QDir#::cleanPathcxx . . $ QDir#cleanPath(fd988a2ab94d906b).(base) +cxx . . $ operator+(3d22f08efddf8107). "/";
1276 }
1277
1278 //////////////////////////////////////////////////////////////////////////////
1279 // docBase()
1280 // ---------
1281 // Figure out the base directory for the documentation
1282
1283 QStringcxx . . $ QString# QBrewcxx . . $ QBrew#::docBasecxx . . $ QBrew#docBase(4365c3963150523e).()
1284 {
1285 QStringcxx . . $ QString# base = qAppcxx . . $ `<external>/6022697617041041825/qapplication.h:70:9`!->applicationDirPathcxx . . $ QCoreApplication#applicationDirPath(4365c3963150523e).();
1286
•1287 #if defined(Q_OS_UNIXcxx . . $ `<external>/5130987379601705141/qsystemdetection.h:201:11`!)
1288 if (QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("qbrew/?$"cxx . . $ QString#QString(85c52e162fed56f9).).indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(base) != -1) {
1289 // we have our own application directory (it ends in 'qbrew')
1290 base +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "/doc/";
1291 } else if (QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("bin/?$"cxx . . $ QString#QString(85c52e162fed56f9).).indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(base) != -1) {
1292 // we are in the bin dir of a filesystem hiearchy like '/usr/local/bin'
1293 base +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "/../share/doc/qbrew/";
1294 } else {
1295 // otherwise punt'
1296 base +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "/doc/";
1297 }
1298
•1299 #elif defined(Q_OS_MAC)
1300 if (QRegExp("Contents/MacOS/?$").indexIn(base) != -1) {
1301 // we're pointing inside an application bundle
1302 base += "/../Resources/en.lproj/";
1303 } else if (QFile::exists(base + "/en.lproj/")) {
1304 // some other hierarchy using Mac style l10n
1305 base += "/en.lproj/";
1306 } else {
1307 // otherwise punt
1308 base += "/doc/";
1309 }
1310
1311 #else // Win32 and others
1312 base += "/doc/";
1313 #endif
1314 return QDircxx . . $ QDir#::cleanPathcxx . . $ QDir#cleanPath(fd988a2ab94d906b).(base) +cxx . . $ operator+(3d22f08efddf8107). "/";
1315 }