Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux/fpc-iii.git] / scripts / kconfig / qconf.h
blob3715b3e7212c9adccdc25483e632487a64360b54
1 /*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
6 #if QT_VERSION < 0x040000
7 #include <qlistview.h>
8 #else
9 #include <q3listview.h>
10 #endif
11 #include <qsettings.h>
13 #if QT_VERSION < 0x040000
14 #define Q3ValueList QValueList
15 #define Q3PopupMenu QPopupMenu
16 #define Q3ListView QListView
17 #define Q3ListViewItem QListViewItem
18 #define Q3VBox QVBox
19 #define Q3TextBrowser QTextBrowser
20 #define Q3MainWindow QMainWindow
21 #define Q3Action QAction
22 #define Q3ToolBar QToolBar
23 #define Q3ListViewItemIterator QListViewItemIterator
24 #define Q3FileDialog QFileDialog
25 #endif
27 class ConfigView;
28 class ConfigList;
29 class ConfigItem;
30 class ConfigLineEdit;
31 class ConfigMainWindow;
33 class ConfigSettings : public QSettings {
34 public:
35 Q3ValueList<int> readSizes(const QString& key, bool *ok);
36 bool writeSizes(const QString& key, const Q3ValueList<int>& value);
39 enum colIdx {
40 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
42 enum listMode {
43 singleMode, menuMode, symbolMode, fullMode, listMode
45 enum optionMode {
46 normalOpt = 0, allOpt, promptOpt
49 class ConfigList : public Q3ListView {
50 Q_OBJECT
51 typedef class Q3ListView Parent;
52 public:
53 ConfigList(ConfigView* p, const char *name = 0);
54 void reinit(void);
55 ConfigView* parent(void) const
57 return (ConfigView*)Parent::parent();
59 ConfigItem* findConfigItem(struct menu *);
61 protected:
62 void keyPressEvent(QKeyEvent *e);
63 void contentsMousePressEvent(QMouseEvent *e);
64 void contentsMouseReleaseEvent(QMouseEvent *e);
65 void contentsMouseMoveEvent(QMouseEvent *e);
66 void contentsMouseDoubleClickEvent(QMouseEvent *e);
67 void focusInEvent(QFocusEvent *e);
68 void contextMenuEvent(QContextMenuEvent *e);
70 public slots:
71 void setRootMenu(struct menu *menu);
73 void updateList(ConfigItem *item);
74 void setValue(ConfigItem* item, tristate val);
75 void changeValue(ConfigItem* item);
76 void updateSelection(void);
77 void saveSettings(void);
78 signals:
79 void menuChanged(struct menu *menu);
80 void menuSelected(struct menu *menu);
81 void parentSelected(void);
82 void gotFocus(struct menu *);
84 public:
85 void updateListAll(void)
87 updateAll = true;
88 updateList(NULL);
89 updateAll = false;
91 ConfigList* listView()
93 return this;
95 ConfigItem* firstChild() const
97 return (ConfigItem *)Parent::firstChild();
99 int mapIdx(colIdx idx)
101 return colMap[idx];
103 void addColumn(colIdx idx, const QString& label)
105 colMap[idx] = Parent::addColumn(label);
106 colRevMap[colMap[idx]] = idx;
108 void removeColumn(colIdx idx)
110 int col = colMap[idx];
111 if (col >= 0) {
112 Parent::removeColumn(col);
113 colRevMap[col] = colMap[idx] = -1;
116 void setAllOpen(bool open);
117 void setParentMenu(void);
119 bool menuSkip(struct menu *);
121 template <class P>
122 void updateMenuList(P*, struct menu*);
124 bool updateAll;
126 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
127 QPixmap choiceYesPix, choiceNoPix;
128 QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
130 bool showName, showRange, showData;
131 enum listMode mode;
132 enum optionMode optMode;
133 struct menu *rootEntry;
134 QColorGroup disabledColorGroup;
135 QColorGroup inactivedColorGroup;
136 Q3PopupMenu* headerPopup;
138 private:
139 int colMap[colNr];
140 int colRevMap[colNr];
143 class ConfigItem : public Q3ListViewItem {
144 typedef class Q3ListViewItem Parent;
145 public:
146 ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
147 : Parent(parent, after), menu(m), visible(v), goParent(false)
149 init();
151 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
152 : Parent(parent, after), menu(m), visible(v), goParent(false)
154 init();
156 ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
157 : Parent(parent, after), menu(0), visible(v), goParent(true)
159 init();
161 ~ConfigItem(void);
162 void init(void);
163 void okRename(int col);
164 void updateMenu(void);
165 void testUpdateMenu(bool v);
166 ConfigList* listView() const
168 return (ConfigList*)Parent::listView();
170 ConfigItem* firstChild() const
172 return (ConfigItem *)Parent::firstChild();
174 ConfigItem* nextSibling() const
176 return (ConfigItem *)Parent::nextSibling();
178 void setText(colIdx idx, const QString& text)
180 Parent::setText(listView()->mapIdx(idx), text);
182 QString text(colIdx idx) const
184 return Parent::text(listView()->mapIdx(idx));
186 void setPixmap(colIdx idx, const QPixmap& pm)
188 Parent::setPixmap(listView()->mapIdx(idx), pm);
190 const QPixmap* pixmap(colIdx idx) const
192 return Parent::pixmap(listView()->mapIdx(idx));
194 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
196 ConfigItem* nextItem;
197 struct menu *menu;
198 bool visible;
199 bool goParent;
202 class ConfigLineEdit : public QLineEdit {
203 Q_OBJECT
204 typedef class QLineEdit Parent;
205 public:
206 ConfigLineEdit(ConfigView* parent);
207 ConfigView* parent(void) const
209 return (ConfigView*)Parent::parent();
211 void show(ConfigItem *i);
212 void keyPressEvent(QKeyEvent *e);
214 public:
215 ConfigItem *item;
218 class ConfigView : public Q3VBox {
219 Q_OBJECT
220 typedef class Q3VBox Parent;
221 public:
222 ConfigView(QWidget* parent, const char *name = 0);
223 ~ConfigView(void);
224 static void updateList(ConfigItem* item);
225 static void updateListAll(void);
227 bool showName(void) const { return list->showName; }
228 bool showRange(void) const { return list->showRange; }
229 bool showData(void) const { return list->showData; }
230 public slots:
231 void setShowName(bool);
232 void setShowRange(bool);
233 void setShowData(bool);
234 void setOptionMode(QAction *);
235 signals:
236 void showNameChanged(bool);
237 void showRangeChanged(bool);
238 void showDataChanged(bool);
239 public:
240 ConfigList* list;
241 ConfigLineEdit* lineEdit;
243 static ConfigView* viewList;
244 ConfigView* nextView;
246 static QAction *showNormalAction;
247 static QAction *showAllAction;
248 static QAction *showPromptAction;
251 class ConfigInfoView : public Q3TextBrowser {
252 Q_OBJECT
253 typedef class Q3TextBrowser Parent;
254 public:
255 ConfigInfoView(QWidget* parent, const char *name = 0);
256 bool showDebug(void) const { return _showDebug; }
258 public slots:
259 void setInfo(struct menu *menu);
260 void saveSettings(void);
261 void setShowDebug(bool);
263 signals:
264 void showDebugChanged(bool);
265 void menuSelected(struct menu *);
267 protected:
268 void symbolInfo(void);
269 void menuInfo(void);
270 QString debug_info(struct symbol *sym);
271 static QString print_filter(const QString &str);
272 static void expr_print_help(void *data, struct symbol *sym, const char *str);
273 Q3PopupMenu* createPopupMenu(const QPoint& pos);
274 void contentsContextMenuEvent(QContextMenuEvent *e);
276 struct symbol *sym;
277 struct menu *_menu;
278 bool _showDebug;
281 class ConfigSearchWindow : public QDialog {
282 Q_OBJECT
283 typedef class QDialog Parent;
284 public:
285 ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
287 public slots:
288 void saveSettings(void);
289 void search(void);
291 protected:
292 QLineEdit* editField;
293 QPushButton* searchButton;
294 QSplitter* split;
295 ConfigView* list;
296 ConfigInfoView* info;
298 struct symbol **result;
301 class ConfigMainWindow : public Q3MainWindow {
302 Q_OBJECT
304 static Q3Action *saveAction;
305 static void conf_changed(void);
306 public:
307 ConfigMainWindow(void);
308 public slots:
309 void changeMenu(struct menu *);
310 void setMenuLink(struct menu *);
311 void listFocusChanged(void);
312 void goBack(void);
313 void loadConfig(void);
314 bool saveConfig(void);
315 void saveConfigAs(void);
316 void searchConfig(void);
317 void showSingleView(void);
318 void showSplitView(void);
319 void showFullView(void);
320 void showIntro(void);
321 void showAbout(void);
322 void saveSettings(void);
324 protected:
325 void closeEvent(QCloseEvent *e);
327 ConfigSearchWindow *searchWindow;
328 ConfigView *menuView;
329 ConfigList *menuList;
330 ConfigView *configView;
331 ConfigList *configList;
332 ConfigInfoView *helpText;
333 Q3ToolBar *toolBar;
334 Q3Action *backAction;
335 QSplitter* split1;
336 QSplitter* split2;