| 1 | /*************************************************************************** |
| 2 | qbrew.h |
| 3 | ------------------- |
| 4 | Controller class for QBrew |
| 5 | ------------------- |
| 6 | Copyright 2006-2008 David Johnson |
| 7 | All rights reserved. |
| 8 | |
| 9 | Redistribution and use in source and binary forms, with or without |
| 10 | modification, are permitted provided that the following conditions |
| 11 | are met: |
| 12 | |
| 13 | 1. Redistributions of source code must retain the above copyright |
| 14 | notice, this list of conditions and the following disclaimer. |
| 15 | |
| 16 | 2. Redistributions in binary form must reproduce the above copyright |
| 17 | notice, this list of conditions and the following disclaimer in the |
| 18 | documentation and/or other materials provided with the distribution. |
| 19 | |
| 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | ***************************************************************************/ |
| 32 | |
| 33 | #ifndef QBREW_H |
| 34 | #define QBREW_Hcxx . . $ `src/qbrew.h:34:9`! |
| 35 | |
| 36 | #include <QMainWindow> |
| 37 | |
| 38 | #include "ui_mainwindow.h"cxx . . $ `<file>/build/ui_mainwindow.h`/ |
| 39 | #include "configstate.h"cxx . . $ `<file>/src/configstate.h`/ |
| 40 | |
| 41 | class QCloseEventcxx . . $ QCloseEvent#; |
| 42 | class QTimercxx . . $ QTimer#; |
| 43 | |
| 44 | class AlcoholToolcxx . . $ AlcoholTool#; |
| 45 | class Configurecxx . . $ Configure#; |
| 46 | class Datacxx . . $ Data#; |
| 47 | class DatabaseToolcxx . . $ DatabaseTool#; |
| 48 | class HelpViewercxx . . $ HelpViewer#; |
| 49 | class HydrometerToolcxx . . $ HydrometerTool#; |
| 50 | class Recipecxx . . $ Recipe#; |
| 51 | class TextPrintercxx . . $ TextPrinter#; |
| 52 | class Viewcxx . . $ View#; |
| 53 | |
| 54 | class QBrewcxx . . $ QBrew# : public QMainWindowcxx . . $ QMainWindow# { |
| 55 | Q_OBJECTcxx . . $ QBrew#staticMetaObject. |
| 56 | public: |
| 57 | ~cxx . . $ QBrew#`~QBrew`(ced63f7c635d850d).QBrewcxx . . $ QBrew#(); |
| 58 | // return pointer to the singleton |
| 59 | static QBrewcxx . . $ QBrew# *instancecxx . . $ QBrew#instance(40173339d0c531b3).(); |
| 60 | // initialize qbrew |
| 61 | void initializecxx . . $ QBrew#initialize(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename = ""cxx . . $ QString#QString(85c52e162fed56f9).); |
| 62 | |
| 63 | // return out the base dir for the help documents |
| 64 | QStringcxx . . $ QString# docBasecxx . . $ QBrew#docBase(4365c3963150523e).(); |
| 65 | // return the base dir for the data files |
| 66 | QStringcxx . . $ QString# dataBasecxx . . $ QBrew#dataBase(4365c3963150523e).(); |
| 67 | |
| 68 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 69 | // generate a new recipe |
| 70 | void fileNewcxx . . $ QBrew#fileNew(49f6e7a06ebc5aa8).(); |
| 71 | // open a recipe |
| 72 | void fileOpencxx . . $ QBrew#fileOpen(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename = ""cxx . . $ QString#QString(85c52e162fed56f9).); |
| 73 | // open a recent recipe |
| 74 | void fileRecentcxx . . $ QBrew#fileRecent(49f6e7a06ebc5aa8).(); |
| 75 | // save a recipe |
| 76 | void fileSavecxx . . $ QBrew#fileSave(49f6e7a06ebc5aa8).(); |
| 77 | // save a recipe under a different filename |
| 78 | void fileSaveAscxx . . $ QBrew#fileSaveAs(49f6e7a06ebc5aa8).(); |
| 79 | // export the recipe to non-native format |
| 80 | void fileExportcxx . . $ QBrew#fileExport(49f6e7a06ebc5aa8).(); |
| 81 | // print preview |
| 82 | void filePrintPreviewcxx . . $ QBrew#filePrintPreview(49f6e7a06ebc5aa8).(); |
| 83 | // print the recipe |
| 84 | void filePrintcxx . . $ QBrew#filePrint(49f6e7a06ebc5aa8).(); |
| 85 | |
| 86 | // show the alcohol tool |
| 87 | void toolsAlcoholcxx . . $ QBrew#toolsAlcohol(49f6e7a06ebc5aa8).(); |
| 88 | // show the hydrometer tool |
| 89 | void toolsHydrometercxx . . $ QBrew#toolsHydrometer(49f6e7a06ebc5aa8).(); |
| 90 | // show the database tool |
| 91 | void toolsDatabasecxx . . $ QBrew#toolsDatabase(49f6e7a06ebc5aa8).(); |
| 92 | |
| 93 | // toggle the statusbar |
| 94 | void optionsStatusbarcxx . . $ QBrew#optionsStatusbar(b45ddcbc8423892c).(bool on); |
| 95 | // display the setup dialog |
| 96 | void optionsConfigurecxx . . $ QBrew#optionsConfigure(49f6e7a06ebc5aa8).(); |
| 97 | |
| 98 | // displays help contents |
| 99 | void helpContentscxx . . $ QBrew#helpContents(49f6e7a06ebc5aa8).(); |
| 100 | // displays primer |
| 101 | void helpPrimercxx . . $ QBrew#helpPrimer(49f6e7a06ebc5aa8).(); |
| 102 | // displays context help cursor |
| 103 | void helpContextcxx . . $ QBrew#helpContext(49f6e7a06ebc5aa8).(); |
| 104 | // shows an about dialog for QBrew |
| 105 | void helpAboutcxx . . $ QBrew#helpAbout(49f6e7a06ebc5aa8).(); |
| 106 | |
| 107 | // received if view widgets have changed |
| 108 | void recipeModifiedcxx . . $ QBrew#recipeModified(49f6e7a06ebc5aa8).(); |
| 109 | |
| 110 | // setup recent file menu |
| 111 | void recentMenuShowcxx . . $ QBrew#recentMenuShow(49f6e7a06ebc5aa8).(); |
| 112 | |
| 113 | // apply states from config dialog |
| 114 | void applyGeneralStatecxx . . $ QBrew#applyGeneralState(76152a8faa96f310).(const GenConfigStatecxx . . $ GenConfigState# &state); |
| 115 | void applyRecipeStatecxx . . $ QBrew#applyRecipeState(b744b00dc6e74f5e).(const RecipeConfigStatecxx . . $ RecipeConfigState# &state); |
| 116 | void applyCalcStatecxx . . $ QBrew#applyCalcState(4810bf03babba259).(const CalcConfigStatecxx . . $ CalcConfigState# &state); |
| 117 | void saveConfigcxx . . $ QBrew#saveConfig(49f6e7a06ebc5aa8).(); |
| 118 | |
| 119 | // autosave timer |
| 120 | void autoSavecxx . . $ QBrew#autoSave(49f6e7a06ebc5aa8).(); |
| 121 | |
| 122 | private: |
| 123 | // singleton |
| 124 | QBrewcxx . . $ QBrew#QBrew(49f6e7a06ebc5aa8).(); |
| 125 | QBrewcxx . . $ QBrew#QBrew(a9e23cbc1d9a1301).(const QBrewcxx . . $ QBrew#&); |
| 126 | QBrewcxx . . $ QBrew# &operatorcxx . . $ QBrew#`operator=`(3aa506ae69fc9f45).=(const QBrewcxx . . $ QBrew#&); |
| 127 | |
| 128 | // filter events |
| 129 | bool eventFiltercxx . . $ QBrew#eventFilter(978aa4af1d030efa).(QObjectcxx . . $ QObject# *obj, QEventcxx . . $ QEvent# *event); |
| 130 | |
| 131 | // initialize actions |
| 132 | void initActionscxx . . $ QBrew#initActions(49f6e7a06ebc5aa8).(); |
| 133 | // initialize autosave |
| 134 | void initAutoSavecxx . . $ QBrew#initAutoSave(49f6e7a06ebc5aa8).(); |
| 135 | |
| 136 | // catch the close event |
| 137 | void closeEventcxx . . $ QBrew#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent# *e); |
| 138 | |
| 139 | // query user to save the current file |
| 140 | int querySavecxx . . $ QBrew#querySave(b126dc7c1de90089).(); |
| 141 | // query to overwrite existing file |
| 142 | int queryOverwritecxx . . $ QBrew#queryOverwrite(87a9b7c6fe1ccdba).(const QStringcxx . . $ QString# filename); |
| 143 | // add a file to recent file menu |
| 144 | void addRecentcxx . . $ QBrew#addRecent(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename); |
| 145 | // open a named file |
| 146 | bool openFilecxx . . $ QBrew#openFile(e1defb592416720d).(const QStringcxx . . $ QString# &filename); |
| 147 | // save a file |
| 148 | bool saveFilecxx . . $ QBrew#saveFile(e1defb592416720d).(const QStringcxx . . $ QString# &filename); |
| 149 | // backup the file |
| 150 | bool backupFilecxx . . $ QBrew#backupFile(c9857a73d68e59ba).(); |
| 151 | |
| 152 | // set window caption from file name |
| 153 | void setFileCaptioncxx . . $ QBrew#setFileCaption(3520e46b33348bf6).(const QStringcxx . . $ QString# &filename); |
| 154 | |
| 155 | // read in configuration |
| 156 | void readConfigcxx . . $ QBrew#readConfig(49f6e7a06ebc5aa8).(); |
| 157 | // write out configuration |
| 158 | void writeConfigcxx . . $ QBrew#writeConfig(49f6e7a06ebc5aa8).(); |
| 159 | // restore application state |
| 160 | void restoreStatecxx . . $ QBrew#restoreState(49f6e7a06ebc5aa8).(); |
| 161 | // save application state |
| 162 | void saveStatecxx . . $ QBrew#saveState(49f6e7a06ebc5aa8).(); |
| 163 | |
| 164 | private: |
| 165 | static QBrewcxx . . $ QBrew# *instance_cxx . . $ QBrew#instance_.; |
| 166 | |
| 167 | Uicxx . . $ Ui/::MainWindowcxx . . $ Ui/MainWindow# uicxx . . $ QBrew#ui.; |
| 168 | |
| 169 | Datacxx . . $ Data# *data_cxx . . $ QBrew#data_.; |
| 170 | Recipecxx . . $ Recipe# *recipe_cxx . . $ QBrew#recipe_.; |
| 171 | Viewcxx . . $ View# *view_cxx . . $ QBrew#view_.; |
| 172 | |
| 173 | AlcoholToolcxx . . $ AlcoholTool#* alcoholtool_cxx . . $ QBrew#alcoholtool_.; |
| 174 | DatabaseToolcxx . . $ DatabaseTool#* databasetool_cxx . . $ QBrew#databasetool_.; |
| 175 | HydrometerToolcxx . . $ HydrometerTool#* hydrometertool_cxx . . $ QBrew#hydrometertool_.; |
| 176 | Configurecxx . . $ Configure#* configure_cxx . . $ QBrew#configure_.; |
| 177 | HelpViewercxx . . $ HelpViewer#* handbook_cxx . . $ QBrew#handbook_.; |
| 178 | HelpViewercxx . . $ HelpViewer#* primer_cxx . . $ QBrew#primer_.; |
| 179 | |
| 180 | ConfigStatecxx . . $ ConfigState# state_cxx . . $ QBrew#state_.; |
| 181 | QStringcxx . . $ QString# filename_cxx . . $ QBrew#filename_.; |
| 182 | bool newflag_cxx . . $ QBrew#newflag_.; |
| 183 | bool backed_cxx . . $ QBrew#backed_.; |
| 184 | |
| 185 | QTimercxx . . $ QTimer# *autosave_cxx . . $ QBrew#autosave_.; |
| 186 | QStringcxx . . $ QString# autosavename_cxx . . $ QBrew#autosavename_.; |
| 187 | TextPrintercxx . . $ TextPrinter# *textprinter_cxx . . $ QBrew#textprinter_.; |
| 188 | }; |
| 189 | |
| 190 | #endif // QBREW_H |