1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef INDENTHANDLER_H
#define INDENTHANDLER_H
#include <tqwidget.h>
#include <tqvaluevector.h>
class MainWindow;
class UiGuiErrorMessage;
class UiGuiIniFileParser;
class UiGuiSettings;
class TQCheckBox;
class TQComboBox;
class TQLabel;
class TQLineEdit;
class TQSpinBox;
class TQToolBox;
class TQToolButton;
class TQVBoxLayout;
class IndentHandler : public TQWidget
{
Q_OBJECT
public:
IndentHandler(int indenterID, MainWindow *mainWindow = nullptr, TQWidget *parent = nullptr);
~IndentHandler();
TQString generateShellScript(const TQString &configFilename);
///-- TQString callIndenter(TQString sourceCode, TQString inputFileExtension);
bool loadConfigFile(const TQString &filePathName);
void resetToDefaultValues();
TQStringList getAvailableIndenters();
///-- TQString getPossibleIndenterFileExtensions();
TQString getParameterString();
TQString getIndenterCfgFile();
///-- TQString getManual();
TQString getCurrentIndenterName();
void contextMenuEvent(TQContextMenuEvent *event);
signals:
void indenterSettingsChanged();
///-- void selectedIndenterIndexChanged(int index);
///-- protected:
///-- bool event(TQEvent *event);
///-- void wheelEvent(TQWheelEvent *event);
private slots:
void setIndenter(int indenterID);
void showIndenterManual() const;
void openConfigFileDialog();
void saveasIndentCfgFileDialog();
void createIndenterCallShellScript();
void resetIndenterParameter();
void handleChangedIndenterSettings();
void indenterProcessFinished();
private:
///-- TQString callExecutableIndenter(TQString sourceCode, TQString inputFileExtension);
///-- TQString callJavaScriptIndenter(TQString sourceCode);
void saveConfigFile(const TQString &filePathName, const TQString ¶meterString);
void readIndentIniFile(const TQString &iniFilePath);
bool createIndenterCallString();
// Holds a reference to all created pages of the parameter categories toolbox and their layout
struct IndenterParameterCategoryPage
{
TQWidget *widget;
TQVBoxLayout *vboxLayout;
};
TQValueVector<IndenterParameterCategoryPage> m_indenterParameterCategoryPages;
// Holds a reference to all checkboxes needed for boolean parameters and their names
struct ParamBoolean
{
TQString paramName;
TQString trueString;
TQString falseString;
TQCheckBox *checkBox;
};
TQValueVector<ParamBoolean> m_paramBooleans;
// Holds a reference to all line edits needed for parameter setting and the parameters name
struct ParamString
{
TQString paramName;
TQString paramCallName;
TQCheckBox *valueEnabledChkBox;
TQLineEdit *lineEdit;
TQLabel *label;
};
TQValueVector<ParamString> m_paramStrings;
// Hold a reference to all spin boxes needed for parameter setting and the parameters name
struct ParamNumeric
{
TQString paramName;
TQString paramCallName;
TQCheckBox *valueEnabledChkBox;
TQSpinBox *spinBox;
TQLabel *label;
};
TQValueVector<ParamNumeric> m_paramNumerics;
// Hold a reference to all combo boxes needed for parameter setting and the parameters name
struct ParamMultiple
{
TQString paramName;
TQString paramCallName;
TQCheckBox *valueEnabledChkBox;
TQComboBox *comboBox;
TQStringList choicesStrings;
TQStringList choicesStringsReadable;
};
TQValueVector<ParamMultiple> m_paramMultiples;
UiGuiSettings *m_settings;
TQComboBox *m_indenterSelectionCombobox;
TQToolButton *m_indenterParameterHelpButton;
// Vertical layout box, into which the toolbox will be added
TQVBoxLayout *m_toolBoxContainerLayout;
TQToolBox *m_indenterParameterCategoriesToolBox;
UiGuiIniFileParser *m_indenterSettings;
TQStringList m_indenterParameters;
// The indenters name in a descriptive form
TQString m_indenterName;
// The indenters file name (w/o extension), that is being called
TQString m_indenterFileName;
TQString m_indenterDirectoryStr;
TQString m_tempDirectoryStr;
TQString m_settingsDirectoryStr;
TQStringList m_indenterIniFileList;
TQString m_globalConfigFilename;
TQString m_cfgFileParameterEnding;
TQString m_parameterOrder;
TQString m_inputFileParameter;
TQString m_inputFileName;
TQString m_outputFileParameter;
TQString m_outputFileName;
TQString m_fileTypes;
TQString m_useCfgFileParameter;
TQString m_indenterShowHelpParameter;
MainWindow *m_mainWindow;
TQWidget *m_parent;
UiGuiErrorMessage *m_errorMessageDialog;
TQString m_indenterExecutableCallString;
TQString m_indenterExecutableSuffix;
bool m_indenterProcessFinished;
///-- //TODO: This function should go into a string helper/tool class/file.
///-- TQString encodeToHTML(const TQString &text);
};
#endif // INDENTHANDLER_H
|