Remove support for QT3 and older.
[deliverable/linux.git] / scripts / kconfig / qconf.h
CommitLineData
1da177e4
LT
1/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
5
133c5f7c 6#include <q3listview.h>
133c5f7c
AS
7#include <qsettings.h>
8
7fc925fd 9class ConfigView;
1da177e4
LT
10class ConfigList;
11class ConfigItem;
12class ConfigLineEdit;
13class ConfigMainWindow;
14
1da177e4
LT
15class ConfigSettings : public QSettings {
16public:
00d4f8fc 17 ConfigSettings();
133c5f7c
AS
18 Q3ValueList<int> readSizes(const QString& key, bool *ok);
19 bool writeSizes(const QString& key, const Q3ValueList<int>& value);
1da177e4
LT
20};
21
22enum colIdx {
23 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
24};
25enum listMode {
43bf612a 26 singleMode, menuMode, symbolMode, fullMode, listMode
1da177e4 27};
39a4897c
LZ
28enum optionMode {
29 normalOpt = 0, allOpt, promptOpt
30};
1da177e4 31
133c5f7c 32class ConfigList : public Q3ListView {
1da177e4 33 Q_OBJECT
133c5f7c 34 typedef class Q3ListView Parent;
1da177e4 35public:
7fc925fd 36 ConfigList(ConfigView* p, const char *name = 0);
1da177e4
LT
37 void reinit(void);
38 ConfigView* parent(void) const
39 {
40 return (ConfigView*)Parent::parent();
41 }
b65a47e1 42 ConfigItem* findConfigItem(struct menu *);
1da177e4
LT
43
44protected:
1da177e4
LT
45 void keyPressEvent(QKeyEvent *e);
46 void contentsMousePressEvent(QMouseEvent *e);
47 void contentsMouseReleaseEvent(QMouseEvent *e);
48 void contentsMouseMoveEvent(QMouseEvent *e);
49 void contentsMouseDoubleClickEvent(QMouseEvent *e);
50 void focusInEvent(QFocusEvent *e);
7fc925fd
RZ
51 void contextMenuEvent(QContextMenuEvent *e);
52
1da177e4
LT
53public slots:
54 void setRootMenu(struct menu *menu);
55
56 void updateList(ConfigItem *item);
57 void setValue(ConfigItem* item, tristate val);
58 void changeValue(ConfigItem* item);
59 void updateSelection(void);
7fc925fd 60 void saveSettings(void);
1da177e4 61signals:
43bf612a 62 void menuChanged(struct menu *menu);
1da177e4
LT
63 void menuSelected(struct menu *menu);
64 void parentSelected(void);
b65a47e1 65 void gotFocus(struct menu *);
1da177e4
LT
66
67public:
68 void updateListAll(void)
69 {
70 updateAll = true;
71 updateList(NULL);
72 updateAll = false;
73 }
74 ConfigList* listView()
75 {
76 return this;
77 }
78 ConfigItem* firstChild() const
79 {
80 return (ConfigItem *)Parent::firstChild();
81 }
82 int mapIdx(colIdx idx)
83 {
84 return colMap[idx];
85 }
86 void addColumn(colIdx idx, const QString& label)
87 {
88 colMap[idx] = Parent::addColumn(label);
89 colRevMap[colMap[idx]] = idx;
90 }
91 void removeColumn(colIdx idx)
92 {
93 int col = colMap[idx];
94 if (col >= 0) {
95 Parent::removeColumn(col);
96 colRevMap[col] = colMap[idx] = -1;
97 }
98 }
99 void setAllOpen(bool open);
100 void setParentMenu(void);
101
39a4897c
LZ
102 bool menuSkip(struct menu *);
103
1da177e4 104 template <class P>
19144d0b 105 void updateMenuList(P*, struct menu*);
1da177e4
LT
106
107 bool updateAll;
108
109 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
110 QPixmap choiceYesPix, choiceNoPix;
111 QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
112
39a4897c 113 bool showName, showRange, showData;
1da177e4 114 enum listMode mode;
39a4897c 115 enum optionMode optMode;
1da177e4
LT
116 struct menu *rootEntry;
117 QColorGroup disabledColorGroup;
118 QColorGroup inactivedColorGroup;
133c5f7c 119 Q3PopupMenu* headerPopup;
1da177e4
LT
120
121private:
122 int colMap[colNr];
123 int colRevMap[colNr];
124};
125
133c5f7c
AS
126class ConfigItem : public Q3ListViewItem {
127 typedef class Q3ListViewItem Parent;
1da177e4 128public:
133c5f7c 129 ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
1da177e4
LT
130 : Parent(parent, after), menu(m), visible(v), goParent(false)
131 {
132 init();
133 }
134 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
135 : Parent(parent, after), menu(m), visible(v), goParent(false)
136 {
137 init();
138 }
133c5f7c 139 ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
1da177e4
LT
140 : Parent(parent, after), menu(0), visible(v), goParent(true)
141 {
142 init();
143 }
144 ~ConfigItem(void);
145 void init(void);
1da177e4 146 void okRename(int col);
1da177e4
LT
147 void updateMenu(void);
148 void testUpdateMenu(bool v);
149 ConfigList* listView() const
150 {
151 return (ConfigList*)Parent::listView();
152 }
153 ConfigItem* firstChild() const
154 {
155 return (ConfigItem *)Parent::firstChild();
156 }
157 ConfigItem* nextSibling() const
158 {
159 return (ConfigItem *)Parent::nextSibling();
160 }
161 void setText(colIdx idx, const QString& text)
162 {
163 Parent::setText(listView()->mapIdx(idx), text);
164 }
165 QString text(colIdx idx) const
166 {
167 return Parent::text(listView()->mapIdx(idx));
168 }
169 void setPixmap(colIdx idx, const QPixmap& pm)
170 {
171 Parent::setPixmap(listView()->mapIdx(idx), pm);
172 }
173 const QPixmap* pixmap(colIdx idx) const
174 {
175 return Parent::pixmap(listView()->mapIdx(idx));
176 }
177 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
178
179 ConfigItem* nextItem;
180 struct menu *menu;
181 bool visible;
182 bool goParent;
183};
184
185class ConfigLineEdit : public QLineEdit {
186 Q_OBJECT
187 typedef class QLineEdit Parent;
188public:
43bf612a 189 ConfigLineEdit(ConfigView* parent);
1da177e4
LT
190 ConfigView* parent(void) const
191 {
192 return (ConfigView*)Parent::parent();
193 }
194 void show(ConfigItem *i);
195 void keyPressEvent(QKeyEvent *e);
196
197public:
198 ConfigItem *item;
199};
200
133c5f7c 201class ConfigView : public Q3VBox {
7fc925fd 202 Q_OBJECT
133c5f7c 203 typedef class Q3VBox Parent;
7fc925fd
RZ
204public:
205 ConfigView(QWidget* parent, const char *name = 0);
206 ~ConfigView(void);
207 static void updateList(ConfigItem* item);
208 static void updateListAll(void);
209
7fc925fd
RZ
210 bool showName(void) const { return list->showName; }
211 bool showRange(void) const { return list->showRange; }
212 bool showData(void) const { return list->showData; }
213public slots:
7fc925fd
RZ
214 void setShowName(bool);
215 void setShowRange(bool);
216 void setShowData(bool);
39a4897c 217 void setOptionMode(QAction *);
7fc925fd 218signals:
7fc925fd
RZ
219 void showNameChanged(bool);
220 void showRangeChanged(bool);
221 void showDataChanged(bool);
222public:
223 ConfigList* list;
224 ConfigLineEdit* lineEdit;
225
226 static ConfigView* viewList;
227 ConfigView* nextView;
39a4897c
LZ
228
229 static QAction *showNormalAction;
230 static QAction *showAllAction;
231 static QAction *showPromptAction;
7fc925fd
RZ
232};
233
133c5f7c 234class ConfigInfoView : public Q3TextBrowser {
43bf612a 235 Q_OBJECT
133c5f7c 236 typedef class Q3TextBrowser Parent;
43bf612a
RZ
237public:
238 ConfigInfoView(QWidget* parent, const char *name = 0);
239 bool showDebug(void) const { return _showDebug; }
240
241public slots:
242 void setInfo(struct menu *menu);
7fc925fd 243 void saveSettings(void);
43bf612a
RZ
244 void setShowDebug(bool);
245
246signals:
247 void showDebugChanged(bool);
b65a47e1 248 void menuSelected(struct menu *);
43bf612a
RZ
249
250protected:
ab45d190 251 void symbolInfo(void);
43bf612a
RZ
252 void menuInfo(void);
253 QString debug_info(struct symbol *sym);
254 static QString print_filter(const QString &str);
ab45d190 255 static void expr_print_help(void *data, struct symbol *sym, const char *str);
133c5f7c 256 Q3PopupMenu* createPopupMenu(const QPoint& pos);
7fc925fd 257 void contentsContextMenuEvent(QContextMenuEvent *e);
43bf612a 258
ab45d190 259 struct symbol *sym;
133c5f7c 260 struct menu *_menu;
43bf612a
RZ
261 bool _showDebug;
262};
263
264class ConfigSearchWindow : public QDialog {
265 Q_OBJECT
266 typedef class QDialog Parent;
267public:
63431e75 268 ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
7fc925fd 269
43bf612a 270public slots:
7fc925fd 271 void saveSettings(void);
43bf612a 272 void search(void);
7fc925fd 273
43bf612a
RZ
274protected:
275 QLineEdit* editField;
276 QPushButton* searchButton;
7fc925fd 277 QSplitter* split;
43bf612a
RZ
278 ConfigView* list;
279 ConfigInfoView* info;
280
281 struct symbol **result;
282};
283
133c5f7c 284class ConfigMainWindow : public Q3MainWindow {
1da177e4 285 Q_OBJECT
3b354c55 286
133c5f7c 287 static Q3Action *saveAction;
3b354c55 288 static void conf_changed(void);
1da177e4
LT
289public:
290 ConfigMainWindow(void);
291public slots:
1da177e4 292 void changeMenu(struct menu *);
b65a47e1 293 void setMenuLink(struct menu *);
1da177e4
LT
294 void listFocusChanged(void);
295 void goBack(void);
296 void loadConfig(void);
bac6aa86 297 bool saveConfig(void);
1da177e4 298 void saveConfigAs(void);
43bf612a 299 void searchConfig(void);
1da177e4
LT
300 void showSingleView(void);
301 void showSplitView(void);
302 void showFullView(void);
1da177e4
LT
303 void showIntro(void);
304 void showAbout(void);
305 void saveSettings(void);
306
307protected:
308 void closeEvent(QCloseEvent *e);
309
43bf612a 310 ConfigSearchWindow *searchWindow;
1da177e4
LT
311 ConfigView *menuView;
312 ConfigList *menuList;
313 ConfigView *configView;
314 ConfigList *configList;
43bf612a 315 ConfigInfoView *helpText;
133c5f7c
AS
316 Q3ToolBar *toolBar;
317 Q3Action *backAction;
1da177e4
LT
318 QSplitter* split1;
319 QSplitter* split2;
1da177e4 320};
This page took 0.808415 seconds and 5 git commands to generate.