Mercurial > hg > forks > UniversalIndentGUI
comparison src/IndentHandler.h @ 751:ac165b6ae67e
Done some refactoring:
- Moved includes into the cpp files where possible and using class pre-declarations if possible
- Made class member variable names begin with an underscore
- Made by uic created header files be used as class members instead of inherting them
- Renamed some variables to reflect their purpose better
- Added some NULL initializations and added some comments
- Rearranged some include and declaration code parts to be consistent and better readable
- Updated for QScintilla 2.4.5
- Made UiGuiSettings be accessed via a shared pointer only
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1028 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Thu, 14 Oct 2010 19:52:47 +0000 |
parents | aae5a8d04f70 |
children | f3631db17328 |
comparison
equal
deleted
inserted
replaced
750:a884b5861e93 | 751:ac165b6ae67e |
---|---|
19 | 19 |
20 #ifndef INDENTHANDLER_H | 20 #ifndef INDENTHANDLER_H |
21 #define INDENTHANDLER_H | 21 #define INDENTHANDLER_H |
22 | 22 |
23 #include <QWidget> | 23 #include <QWidget> |
24 #include <QToolBox> | |
25 #include <QVBoxLayout> | |
26 #include <QApplication> | |
27 #include <QCheckBox> | |
28 #include <QComboBox> | |
29 #include <QToolButton> | |
30 #include <QFile> | |
31 #include <QProcess> | |
32 #include <QSettings> | |
33 #include <QStringList> | |
34 #include <QLineEdit> | |
35 #include <QSpinBox> | |
36 #include <QLabel> | |
37 #include <QByteArray> | |
38 #include <QDir> | |
39 #include <QMessageBox> | |
40 #include <QMainWindow> | |
41 #include <QTextStream> | |
42 #include <QTextCodec> | |
43 #include <QtScript> | |
44 #include <QDesktopServices> | |
45 #include <QMenu> | |
46 #include <QAction> | |
47 #include <QContextMenuEvent> | |
48 #include <QFileDialog> | |
49 | 24 |
50 #include "UiGuiErrorMessage.h" | 25 class UiGuiErrorMessage; |
51 #include "TemplateBatchScript.h" | 26 class UiGuiIniFileParser; |
52 #include "UiGuiIniFileParser.h" | 27 |
53 #include "SettingsPaths.h" | 28 class QMenu; |
29 class QVBoxLayout; | |
30 class QLabel; | |
31 class QSpinBox; | |
32 class QComboBox; | |
33 class QCheckBox; | |
34 class QLineEdit; | |
35 class QToolButton; | |
36 class QToolBox; | |
54 | 37 |
55 | 38 |
56 class IndentHandler : public QWidget | 39 class IndentHandler : public QWidget |
57 { | 40 { |
58 Q_OBJECT | 41 Q_OBJECT |
104 void saveConfigFile(QString filePathName, QString parameterString); | 87 void saveConfigFile(QString filePathName, QString parameterString); |
105 void readIndentIniFile(QString iniFilePath); | 88 void readIndentIniFile(QString iniFilePath); |
106 bool createIndenterCallString(); | 89 bool createIndenterCallString(); |
107 void initIndenterMenu(); | 90 void initIndenterMenu(); |
108 | 91 |
109 //! Holds a reference to all created pages of the toolbox and the pages boxlayout | 92 //! Holds a reference to all created pages of the parameter categories toolbox and the pages boxlayout |
110 struct ToolBoxPage { | 93 struct IndenterParameterCategoryPage { |
111 QWidget *page; | 94 QWidget *widget; |
112 QVBoxLayout *vboxLayout; | 95 QVBoxLayout *vboxLayout; |
113 }; | 96 }; |
114 QVector<ToolBoxPage> toolBoxPages; | 97 QVector<IndenterParameterCategoryPage> _indenterParameterCategoryPages; |
115 | 98 |
116 //! Holds a reference to all checkboxes needed for boolean parameter setting and the parameters name | 99 //! Holds a reference to all checkboxes needed for boolean parameter setting and the parameters name |
117 struct ParamBoolean { | 100 struct ParamBoolean { |
118 QString paramName; | 101 QString paramName; |
119 QString trueString; | 102 QString trueString; |
120 QString falseString; | 103 QString falseString; |
121 QCheckBox *checkBox; | 104 QCheckBox *checkBox; |
122 }; | 105 }; |
123 QVector<ParamBoolean> paramBooleans; | 106 QVector<ParamBoolean> _paramBooleans; |
124 | 107 |
125 //! Holds a reference to all line edits needed for parameter setting and the parameters name | 108 //! Holds a reference to all line edits needed for parameter setting and the parameters name |
126 struct ParamString { | 109 struct ParamString { |
127 QString paramName; | 110 QString paramName; |
128 QString paramCallName; | 111 QString paramCallName; |
129 QCheckBox *valueEnabledChkBox; | 112 QCheckBox *valueEnabledChkBox; |
130 QLineEdit *lineEdit; | 113 QLineEdit *lineEdit; |
131 QLabel *label; | 114 QLabel *label; |
132 }; | 115 }; |
133 QVector<ParamString> paramStrings; | 116 QVector<ParamString> _paramStrings; |
134 | 117 |
135 //! Hold a reference to all spin boxes needed for parameter setting and the parameters name | 118 //! Hold a reference to all spin boxes needed for parameter setting and the parameters name |
136 struct ParamNumeric { | 119 struct ParamNumeric { |
137 QString paramName; | 120 QString paramName; |
138 QString paramCallName; | 121 QString paramCallName; |
139 QCheckBox *valueEnabledChkBox; | 122 QCheckBox *valueEnabledChkBox; |
140 QSpinBox *spinBox; | 123 QSpinBox *spinBox; |
141 QLabel *label; | 124 QLabel *label; |
142 }; | 125 }; |
143 QVector<ParamNumeric> paramNumerics; | 126 QVector<ParamNumeric> _paramNumerics; |
144 | 127 |
145 //! Hold a reference to all combo boxes needed for parameter setting and the parameters name | 128 //! Hold a reference to all combo boxes needed for parameter setting and the parameters name |
146 struct ParamMultiple { | 129 struct ParamMultiple { |
147 QString paramName; | 130 QString paramName; |
148 QString paramCallName; | 131 QString paramCallName; |
149 QCheckBox *valueEnabledChkBox; | 132 QCheckBox *valueEnabledChkBox; |
150 QComboBox *comboBox; | 133 QComboBox *comboBox; |
151 QStringList choicesStrings; | 134 QStringList choicesStrings; |
152 QStringList choicesStringsReadable; | 135 QStringList choicesStringsReadable; |
153 }; | 136 }; |
154 QVector<ParamMultiple> paramMultiples; | 137 QVector<ParamMultiple> _paramMultiples; |
155 | 138 |
156 QComboBox *indenterSelectionCombobox; | 139 QComboBox *_indenterSelectionCombobox; |
157 QToolButton *indenterParameterHelpButton; | 140 QToolButton *_indenterParameterHelpButton; |
158 QVBoxLayout *vboxLayout; | 141 //! Vertical layout box, into which the toolbox will be added |
159 QToolBox *toolBox; | 142 QVBoxLayout *_toolBoxContainerLayout; |
160 UiGuiIniFileParser *indenterSettings; | 143 QToolBox *_indenterParameterCategoriesToolBox; |
161 QStringList indenterParameters; | 144 UiGuiIniFileParser *_indenterSettings; |
145 QStringList _indenterParameters; | |
162 //! The indenters name in a descriptive form | 146 //! The indenters name in a descriptive form |
163 QString indenterName; | 147 QString _indenterName; |
164 //! The indenters file name (w/o extension), that is being called | 148 //! The indenters file name (w/o extension), that is being called |
165 QString indenterFileName; | 149 QString _indenterFileName; |
166 QString indenterDirctoryStr; | 150 QString _indenterDirctoryStr; |
167 QString tempDirctoryStr; | 151 QString _tempDirctoryStr; |
168 QString settingsDirctoryStr; | 152 QString _settingsDirctoryStr; |
169 QStringList indenterIniFileList; | 153 QStringList _indenterIniFileList; |
170 QString parameterOrder; | 154 QString _parameterOrder; |
171 QString globalConfigFilename_; | 155 QString _globalConfigFilename; |
172 QString cfgFileParameterEnding; | 156 QString _cfgFileParameterEnding; |
173 QString inputFileParameter; | 157 QString _inputFileParameter; |
174 QString inputFileName; | 158 QString _inputFileName; |
175 QString outputFileParameter; | 159 QString _outputFileParameter; |
176 QString outputFileName; | 160 QString _outputFileName; |
177 QString fileTypes; | 161 QString _fileTypes; |
178 QString useCfgFileParameter; | 162 QString _useCfgFileParameter; |
179 QString indenterShowHelpParameter; | 163 QString _indenterShowHelpParameter; |
180 QWidget *mainWindow; | 164 QWidget *_mainWindow; |
181 UiGuiErrorMessage *errorMessageDialog; | 165 UiGuiErrorMessage *_errorMessageDialog; |
182 QString indenterExecutableCallString; | 166 QString _indenterExecutableCallString; |
183 QString indenterExecutableSuffix; | 167 QString _indenterExecutableSuffix; |
184 | 168 |
185 QMenu *menuIndenter; | 169 QMenu *_menuIndenter; |
186 QAction *actionLoad_Indenter_Config_File; | 170 QAction *_actionLoadIndenterConfigFile; |
187 QAction *actionSave_Indenter_Config_File; | 171 QAction *_actionSaveIndenterConfigFile; |
188 QAction *actionCreateShellScript; | 172 QAction *_actionCreateShellScript; |
189 QAction *actionResetIndenterParameters; | 173 QAction *_actionResetIndenterParameters; |
190 void(*parameterChangedCallback)(void); | 174 //! Needed for the NPP plugin. |
191 void(*windowClosedCallback)(void); | 175 void(*_parameterChangedCallback)(void); |
176 //! Needed for the NPP plugin. | |
177 void(*_windowClosedCallback)(void); | |
192 | 178 |
179 //TODO: This function should go into a string helper/tool class/file. | |
193 QString encodeToHTML(const QString &text); | 180 QString encodeToHTML(const QString &text); |
194 }; | 181 }; |
195 | 182 |
196 #endif // INDENTHANDLER_H | 183 #endif // INDENTHANDLER_H |