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
|
/* This file is part of the KDE project
Copyright (C) 2000-2001 Bernd Gehrmann <bernd@kdevelop.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 <qlistview.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qptrlist.h>
#include <qstringlist.h>
class QSpinBox;
class FlagListBox;
class FlagListToolTip;
class FlagCheckBoxController;
class FlagRadioButtonController;
class FlagPathEditController;
class FlagEditController;
class KLineEdit;
class QPushButton;
class KURLRequester;
/**List item holding a compiler flag.*/
class FlagListItem : public QCheckListItem
{
public:
FlagListItem(FlagListBox *parent, const QString &flagstr,
const QString &description);
FlagListItem(FlagListBox *parent, const QString &flagstr,
const QString &description, const QString &offstr);
~FlagListItem()
{}
private:
QString flag;
QString off;
QString desc;
friend class FlagListToolTip;
friend class FlagListBox;
};
/**List box item holding a compiler flag.*/
class FlagListBox : public QListView
{
Q_OBJECT
public:
FlagListBox( QWidget *parent=0, const char *name=0 );
~FlagListBox()
{}
void readFlags(QStringList *list);
void writeFlags(QStringList *list);
};
/**Check box item holding a compiler flag.*/
class FlagCheckBox : public QCheckBox
{
Q_OBJECT
public:
FlagCheckBox(QWidget *parent, FlagCheckBoxController *controller,
const QString &flagstr, const QString &description);
FlagCheckBox(QWidget *parent, FlagCheckBoxController *controller,
const QString &flagstr, const QString &description,
const QString &offstr);
FlagCheckBox(QWidget *parent, FlagCheckBoxController *controller,
const QString &flagstr, const QString &description,
const QString &offstr, const QString &defstr);
~FlagCheckBox()
{}
private:
QString flag;
QString off;
QString def;
bool includeOff;
bool useDef;
bool defSet;
friend class FlagCheckBoxController;
};
/**Radiobutton item holding an option of a compiler flag.*/
class FlagRadioButton : public QRadioButton
{
Q_OBJECT
public:
FlagRadioButton(QWidget *parent, FlagRadioButtonController *controller,
const QString &flagstr, const QString &description);
~FlagRadioButton()
{}
private:
QString flag;
friend class FlagRadioButtonController;
};
/**Path editor if path is a compiler flag.*/
class FlagPathEdit: public QWidget
{
Q_OBJECT
public:
/**If the pathDelimiter is not empty then path edit can contain a list of paths*/
FlagPathEdit(QWidget *parent, QString pathDelimiter, FlagPathEditController *controller,
const QString &flagstr, const QString &description, KFile::Mode mode = KFile::Directory);
~FlagPathEdit() {}
void setText(const QString text);
bool isEmpty();
QString text();
private slots:
void showPathDetails();
private:
KLineEdit *edit;
QPushButton *details;
KURLRequester *url;
QString delimiter;
QString flag;
QString m_description;
friend class FlagPathEditController;
};
/**List editor if list is a compiler flag.*/
class FlagListEdit: public QWidget
{
Q_OBJECT
public:
/**If the listDelimiter is not empty then list edit can contain a list of entries*/
FlagListEdit(QWidget *parent, QString listDelimiter, FlagEditController *controller,
const QString &flagstr, const QString &description);
~FlagListEdit() {}
void setText(const QString text);
void appendText(const QString text);
bool isEmpty();
QString text();
QStringList flags();
private slots:
void showListDetails();
private:
KLineEdit *edit;
QPushButton *details;
QString delimiter;
QString flag;
QString m_description;
friend class FlagEditController;
};
/**Spin editor of a compiler flag.*/
class FlagSpinEdit: public QWidget
{
public:
FlagSpinEdit(QWidget *parent, int minVal, int maxVal, int incr, int defaultVal, FlagEditController *controller,
const QString &flagstr, const QString &description);
~FlagSpinEdit() {}
void setText(const QString text);
QString text();
bool isDefault();
QString flags();
private:
int m_defaultVal;
QString flag;
QSpinBox *spb;
friend class FlagEditController;
};
/**Controller for path editors.*/
class FlagPathEditController
{
public:
FlagPathEditController();
~FlagPathEditController();
void readFlags(QStringList *list);
void writeFlags(QStringList *list);
private:
void addPathEdit(FlagPathEdit *item);
QPtrList<FlagPathEdit> plist;
friend class FlagPathEdit;
};
/**Controller for flag editors.*/
class FlagEditController
{
public:
FlagEditController();
~FlagEditController();
void readFlags(QStringList *list);
void writeFlags(QStringList *list);
private:
void addListEdit(FlagListEdit *item);
void addSpinBox(FlagSpinEdit *item);
QPtrList<FlagListEdit> plist;
QPtrList<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(QStringList multiKeys = QStringList());
~FlagCheckBoxController()
{}
void readFlags(QStringList *list);
void writeFlags(QStringList *list);
void addCheckBox(FlagCheckBox *item);
private:
QPtrList<FlagCheckBox> cblist;
QStringList 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(QStringList multiKeys = QStringList());
~FlagRadioButtonController()
{}
void readFlags(QStringList *list);
void writeFlags(QStringList *list);
void addRadioButton(FlagRadioButton *item);
private:
QPtrList<FlagRadioButton> cblist;
QStringList m_multiKeys;
};
#endif
|