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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
/* This file is part of the KDE project
Copyright (C) 2000-2001 Bernd Gehrmann <bernd@tdevelop.org>
Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _FLAGBOXES_H_
#define _FLAGBOXES_H_
#include <kfile.h>
/**
@file flagboxes.h
Support classes for compiler plugins.
*/
#include <tqlistview.h>
#include <tqcheckbox.h>
#include <tqradiobutton.h>
#include <tqptrlist.h>
#include <tqstringlist.h>
class TQSpinBox;
class FlagListBox;
class FlagListToolTip;
class FlagCheckBoxController;
class FlagRadioButtonController;
class FlagPathEditController;
class FlagEditController;
class KLineEdit;
class TQPushButton;
class KURLRequester;
/**List item holding a compiler flag.*/
class FlagListItem : public TQCheckListItem
{
public:
FlagListItem(FlagListBox *parent, const TQString &flagstr,
const TQString &description);
FlagListItem(FlagListBox *parent, const TQString &flagstr,
const TQString &description, const TQString &offstr);
~FlagListItem()
{}
private:
TQString flag;
TQString off;
TQString desc;
friend class FlagListToolTip;
friend class FlagListBox;
};
/**List box item holding a compiler flag.*/
class FlagListBox : public TQListView
{
Q_OBJECT
TQ_OBJECT
public:
FlagListBox( TQWidget *parent=0, const char *name=0 );
~FlagListBox()
{}
void readFlags(TQStringList *list);
void writeFlags(TQStringList *list);
};
/**Check box item holding a compiler flag.*/
class FlagCheckBox : public TQCheckBox
{
Q_OBJECT
TQ_OBJECT
public:
FlagCheckBox(TQWidget *parent, FlagCheckBoxController *controller,
const TQString &flagstr, const TQString &description);
FlagCheckBox(TQWidget *parent, FlagCheckBoxController *controller,
const TQString &flagstr, const TQString &description,
const TQString &offstr);
FlagCheckBox(TQWidget *parent, FlagCheckBoxController *controller,
const TQString &flagstr, const TQString &description,
const TQString &offstr, const TQString &defstr);
~FlagCheckBox()
{}
private:
TQString flag;
TQString off;
TQString def;
bool includeOff;
bool useDef;
bool defSet;
friend class FlagCheckBoxController;
};
/**Radiobutton item holding an option of a compiler flag.*/
class FlagRadioButton : public TQRadioButton
{
Q_OBJECT
TQ_OBJECT
public:
FlagRadioButton(TQWidget *parent, FlagRadioButtonController *controller,
const TQString &flagstr, const TQString &description);
~FlagRadioButton()
{}
private:
TQString flag;
friend class FlagRadioButtonController;
};
/**Path editor if path is a compiler flag.*/
class FlagPathEdit: public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
/**If the pathDelimiter is not empty then path edit can contain a list of paths*/
FlagPathEdit(TQWidget *parent, TQString pathDelimiter, FlagPathEditController *controller,
const TQString &flagstr, const TQString &description, KFile::Mode mode = KFile::Directory);
~FlagPathEdit() {}
void setText(const TQString text);
bool isEmpty();
TQString text();
private slots:
void showPathDetails();
private:
KLineEdit *edit;
TQPushButton *details;
KURLRequester *url;
TQString delimiter;
TQString flag;
TQString m_description;
friend class FlagPathEditController;
};
/**List editor if list is a compiler flag.*/
class FlagListEdit: public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
/**If the listDelimiter is not empty then list edit can contain a list of entries*/
FlagListEdit(TQWidget *parent, TQString listDelimiter, FlagEditController *controller,
const TQString &flagstr, const TQString &description);
~FlagListEdit() {}
void setText(const TQString text);
void appendText(const TQString text);
bool isEmpty();
TQString text();
TQStringList flags();
private slots:
void showListDetails();
private:
KLineEdit *edit;
TQPushButton *details;
TQString delimiter;
TQString flag;
TQString m_description;
friend class FlagEditController;
};
/**Spin editor of a compiler flag.*/
class FlagSpinEdit: public TQWidget
{
public:
FlagSpinEdit(TQWidget *parent, int minVal, int maxVal, int incr, int defaultVal, FlagEditController *controller,
const TQString &flagstr, const TQString &description);
~FlagSpinEdit() {}
void setText(const TQString text);
TQString text();
bool isDefault();
TQString flags();
private:
int m_defaultVal;
TQString flag;
TQSpinBox *spb;
friend class FlagEditController;
};
/**Controller for path editors.*/
class FlagPathEditController
{
public:
FlagPathEditController();
~FlagPathEditController();
void readFlags(TQStringList *list);
void writeFlags(TQStringList *list);
private:
void addPathEdit(FlagPathEdit *item);
TQPtrList<FlagPathEdit> plist;
friend class FlagPathEdit;
};
/**Controller for flag editors.*/
class FlagEditController
{
public:
FlagEditController();
~FlagEditController();
void readFlags(TQStringList *list);
void writeFlags(TQStringList *list);
private:
void addListEdit(FlagListEdit *item);
void addSpinBox(FlagSpinEdit *item);
TQPtrList<FlagListEdit> plist;
TQPtrList<FlagSpinEdit> slist;
friend class FlagListEdit;
friend class FlagSpinEdit;
};
/**Controller for check box editors.*/
class FlagCheckBoxController
{
public:
/**"multi key" is a list of options like -vxyz (-vx -vy -vz)
multiKeys must contain a list of option names like {-v}
in the above example.
*/
FlagCheckBoxController(TQStringList multiKeys = TQStringList());
~FlagCheckBoxController()
{}
void readFlags(TQStringList *list);
void writeFlags(TQStringList *list);
void addCheckBox(FlagCheckBox *item);
private:
TQPtrList<FlagCheckBox> cblist;
TQStringList m_multiKeys;
};
/**Controller for radiobutton editors.*/
class FlagRadioButtonController
{
public:
/**multiKeys is a list of options like -vxyz (-vx -vy -vz)
multiKeys must contain a list of option names like {-v}
in the above example.
*/
FlagRadioButtonController(TQStringList multiKeys = TQStringList());
~FlagRadioButtonController()
{}
void readFlags(TQStringList *list);
void writeFlags(TQStringList *list);
void addRadioButton(FlagRadioButton *item);
private:
TQPtrList<FlagRadioButton> cblist;
TQStringList m_multiKeys;
};
#endif
|