Blame view

scripts/kconfig/qconf.h 7.76 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
  /*
   * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
   * Released under the terms of the GNU GPL v2.0.
   */
133c5f7c1   Alexander Stein   kconfig qconf: po...
5
  #if QT_VERSION < 0x040000
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
  #include <qlistview.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
  #else
133c5f7c1   Alexander Stein   kconfig qconf: po...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  #include <q3listview.h>
  #endif
  #include <qsettings.h>
  
  #if QT_VERSION < 0x040000
  #define Q3ValueList             QValueList
  #define Q3PopupMenu             QPopupMenu
  #define Q3ListView              QListView
  #define Q3ListViewItem          QListViewItem
  #define Q3VBox                  QVBox
  #define Q3TextBrowser           QTextBrowser
  #define Q3MainWindow            QMainWindow
  #define Q3Action                QAction
  #define Q3ToolBar               QToolBar
  #define Q3ListViewItemIterator  QListViewItemIterator
  #define Q3FileDialog            QFileDialog
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
  #endif
7fc925fd6   Roman Zippel   kconfig: finer cu...
25
  class ConfigView;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
28
29
  class ConfigList;
  class ConfigItem;
  class ConfigLineEdit;
  class ConfigMainWindow;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
  class ConfigSettings : public QSettings {
  public:
00d4f8fc2   Ben Hutchings   xconfig: Fix the ...
32
  	ConfigSettings();
133c5f7c1   Alexander Stein   kconfig qconf: po...
33
34
  	Q3ValueList<int> readSizes(const QString& key, bool *ok);
  	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
36
37
38
39
40
  };
  
  enum colIdx {
  	promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
  };
  enum listMode {
43bf612af   Roman Zippel   kconfig: Add sear...
41
  	singleMode, menuMode, symbolMode, fullMode, listMode
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
  };
39a4897c1   Li Zefan   xconfig: add supp...
43
44
45
  enum optionMode {
  	normalOpt = 0, allOpt, promptOpt
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46

133c5f7c1   Alexander Stein   kconfig qconf: po...
47
  class ConfigList : public Q3ListView {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
  	Q_OBJECT
133c5f7c1   Alexander Stein   kconfig qconf: po...
49
  	typedef class Q3ListView Parent;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
  public:
7fc925fd6   Roman Zippel   kconfig: finer cu...
51
  	ConfigList(ConfigView* p, const char *name = 0);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
54
55
56
  	void reinit(void);
  	ConfigView* parent(void) const
  	{
  		return (ConfigView*)Parent::parent();
  	}
b65a47e1a   Roman Zippel   kconfig: jump to ...
57
  	ConfigItem* findConfigItem(struct menu *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
59
  
  protected:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
62
63
64
65
  	void keyPressEvent(QKeyEvent *e);
  	void contentsMousePressEvent(QMouseEvent *e);
  	void contentsMouseReleaseEvent(QMouseEvent *e);
  	void contentsMouseMoveEvent(QMouseEvent *e);
  	void contentsMouseDoubleClickEvent(QMouseEvent *e);
  	void focusInEvent(QFocusEvent *e);
7fc925fd6   Roman Zippel   kconfig: finer cu...
66
  	void contextMenuEvent(QContextMenuEvent *e);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
69
70
71
72
73
  public slots:
  	void setRootMenu(struct menu *menu);
  
  	void updateList(ConfigItem *item);
  	void setValue(ConfigItem* item, tristate val);
  	void changeValue(ConfigItem* item);
  	void updateSelection(void);
7fc925fd6   Roman Zippel   kconfig: finer cu...
74
  	void saveSettings(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
  signals:
43bf612af   Roman Zippel   kconfig: Add sear...
76
  	void menuChanged(struct menu *menu);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
78
  	void menuSelected(struct menu *menu);
  	void parentSelected(void);
b65a47e1a   Roman Zippel   kconfig: jump to ...
79
  	void gotFocus(struct menu *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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
  
  public:
  	void updateListAll(void)
  	{
  		updateAll = true;
  		updateList(NULL);
  		updateAll = false;
  	}
  	ConfigList* listView()
  	{
  		return this;
  	}
  	ConfigItem* firstChild() const
  	{
  		return (ConfigItem *)Parent::firstChild();
  	}
  	int mapIdx(colIdx idx)
  	{
  		return colMap[idx];
  	}
  	void addColumn(colIdx idx, const QString& label)
  	{
  		colMap[idx] = Parent::addColumn(label);
  		colRevMap[colMap[idx]] = idx;
  	}
  	void removeColumn(colIdx idx)
  	{
  		int col = colMap[idx];
  		if (col >= 0) {
  			Parent::removeColumn(col);
  			colRevMap[col] = colMap[idx] = -1;
  		}
  	}
  	void setAllOpen(bool open);
  	void setParentMenu(void);
39a4897c1   Li Zefan   xconfig: add supp...
115
  	bool menuSkip(struct menu *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
116
  	template <class P>
19144d0be   Dave Jones   [PATCH] fix gcc4....
117
  	void updateMenuList(P*, struct menu*);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
118
119
120
121
122
123
  
  	bool updateAll;
  
  	QPixmap symbolYesPix, symbolModPix, symbolNoPix;
  	QPixmap choiceYesPix, choiceNoPix;
  	QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
39a4897c1   Li Zefan   xconfig: add supp...
124
  	bool showName, showRange, showData;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
125
  	enum listMode mode;
39a4897c1   Li Zefan   xconfig: add supp...
126
  	enum optionMode optMode;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
128
129
  	struct menu *rootEntry;
  	QColorGroup disabledColorGroup;
  	QColorGroup inactivedColorGroup;
133c5f7c1   Alexander Stein   kconfig qconf: po...
130
  	Q3PopupMenu* headerPopup;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
131
132
133
134
135
  
  private:
  	int colMap[colNr];
  	int colRevMap[colNr];
  };
133c5f7c1   Alexander Stein   kconfig qconf: po...
136
137
  class ConfigItem : public Q3ListViewItem {
  	typedef class Q3ListViewItem Parent;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
138
  public:
133c5f7c1   Alexander Stein   kconfig qconf: po...
139
  	ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140
141
142
143
144
145
146
147
148
  	: Parent(parent, after), menu(m), visible(v), goParent(false)
  	{
  		init();
  	}
  	ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
  	: Parent(parent, after), menu(m), visible(v), goParent(false)
  	{
  		init();
  	}
133c5f7c1   Alexander Stein   kconfig qconf: po...
149
  	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150
151
152
153
154
155
  	: Parent(parent, after), menu(0), visible(v), goParent(true)
  	{
  		init();
  	}
  	~ConfigItem(void);
  	void init(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
156
  	void okRename(int col);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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
  	void updateMenu(void);
  	void testUpdateMenu(bool v);
  	ConfigList* listView() const
  	{
  		return (ConfigList*)Parent::listView();
  	}
  	ConfigItem* firstChild() const
  	{
  		return (ConfigItem *)Parent::firstChild();
  	}
  	ConfigItem* nextSibling() const
  	{
  		return (ConfigItem *)Parent::nextSibling();
  	}
  	void setText(colIdx idx, const QString& text)
  	{
  		Parent::setText(listView()->mapIdx(idx), text);
  	}
  	QString text(colIdx idx) const
  	{
  		return Parent::text(listView()->mapIdx(idx));
  	}
  	void setPixmap(colIdx idx, const QPixmap& pm)
  	{
  		Parent::setPixmap(listView()->mapIdx(idx), pm);
  	}
  	const QPixmap* pixmap(colIdx idx) const
  	{
  		return Parent::pixmap(listView()->mapIdx(idx));
  	}
  	void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
  
  	ConfigItem* nextItem;
  	struct menu *menu;
  	bool visible;
  	bool goParent;
  };
  
  class ConfigLineEdit : public QLineEdit {
  	Q_OBJECT
  	typedef class QLineEdit Parent;
  public:
43bf612af   Roman Zippel   kconfig: Add sear...
199
  	ConfigLineEdit(ConfigView* parent);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
200
201
202
203
204
205
206
207
208
209
  	ConfigView* parent(void) const
  	{
  		return (ConfigView*)Parent::parent();
  	}
  	void show(ConfigItem *i);
  	void keyPressEvent(QKeyEvent *e);
  
  public:
  	ConfigItem *item;
  };
133c5f7c1   Alexander Stein   kconfig qconf: po...
210
  class ConfigView : public Q3VBox {
7fc925fd6   Roman Zippel   kconfig: finer cu...
211
  	Q_OBJECT
133c5f7c1   Alexander Stein   kconfig qconf: po...
212
  	typedef class Q3VBox Parent;
7fc925fd6   Roman Zippel   kconfig: finer cu...
213
214
215
216
217
  public:
  	ConfigView(QWidget* parent, const char *name = 0);
  	~ConfigView(void);
  	static void updateList(ConfigItem* item);
  	static void updateListAll(void);
7fc925fd6   Roman Zippel   kconfig: finer cu...
218
219
220
221
  	bool showName(void) const { return list->showName; }
  	bool showRange(void) const { return list->showRange; }
  	bool showData(void) const { return list->showData; }
  public slots:
7fc925fd6   Roman Zippel   kconfig: finer cu...
222
223
224
  	void setShowName(bool);
  	void setShowRange(bool);
  	void setShowData(bool);
39a4897c1   Li Zefan   xconfig: add supp...
225
  	void setOptionMode(QAction *);
7fc925fd6   Roman Zippel   kconfig: finer cu...
226
  signals:
7fc925fd6   Roman Zippel   kconfig: finer cu...
227
228
229
230
231
232
233
234
235
  	void showNameChanged(bool);
  	void showRangeChanged(bool);
  	void showDataChanged(bool);
  public:
  	ConfigList* list;
  	ConfigLineEdit* lineEdit;
  
  	static ConfigView* viewList;
  	ConfigView* nextView;
39a4897c1   Li Zefan   xconfig: add supp...
236
237
238
239
  
  	static QAction *showNormalAction;
  	static QAction *showAllAction;
  	static QAction *showPromptAction;
7fc925fd6   Roman Zippel   kconfig: finer cu...
240
  };
133c5f7c1   Alexander Stein   kconfig qconf: po...
241
  class ConfigInfoView : public Q3TextBrowser {
43bf612af   Roman Zippel   kconfig: Add sear...
242
  	Q_OBJECT
133c5f7c1   Alexander Stein   kconfig qconf: po...
243
  	typedef class Q3TextBrowser Parent;
43bf612af   Roman Zippel   kconfig: Add sear...
244
245
246
247
248
249
  public:
  	ConfigInfoView(QWidget* parent, const char *name = 0);
  	bool showDebug(void) const { return _showDebug; }
  
  public slots:
  	void setInfo(struct menu *menu);
7fc925fd6   Roman Zippel   kconfig: finer cu...
250
  	void saveSettings(void);
43bf612af   Roman Zippel   kconfig: Add sear...
251
252
253
254
  	void setShowDebug(bool);
  
  signals:
  	void showDebugChanged(bool);
b65a47e1a   Roman Zippel   kconfig: jump to ...
255
  	void menuSelected(struct menu *);
43bf612af   Roman Zippel   kconfig: Add sear...
256
257
  
  protected:
ab45d190f   Roman Zippel   kconfig: create l...
258
  	void symbolInfo(void);
43bf612af   Roman Zippel   kconfig: Add sear...
259
260
261
  	void menuInfo(void);
  	QString debug_info(struct symbol *sym);
  	static QString print_filter(const QString &str);
ab45d190f   Roman Zippel   kconfig: create l...
262
  	static void expr_print_help(void *data, struct symbol *sym, const char *str);
133c5f7c1   Alexander Stein   kconfig qconf: po...
263
  	Q3PopupMenu* createPopupMenu(const QPoint& pos);
7fc925fd6   Roman Zippel   kconfig: finer cu...
264
  	void contentsContextMenuEvent(QContextMenuEvent *e);
43bf612af   Roman Zippel   kconfig: Add sear...
265

ab45d190f   Roman Zippel   kconfig: create l...
266
  	struct symbol *sym;
133c5f7c1   Alexander Stein   kconfig qconf: po...
267
  	struct menu *_menu;
43bf612af   Roman Zippel   kconfig: Add sear...
268
269
270
271
272
273
274
  	bool _showDebug;
  };
  
  class ConfigSearchWindow : public QDialog {
  	Q_OBJECT
  	typedef class QDialog Parent;
  public:
63431e756   Marco Costalba   kconfig/xconfig: ...
275
  	ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
7fc925fd6   Roman Zippel   kconfig: finer cu...
276

43bf612af   Roman Zippel   kconfig: Add sear...
277
  public slots:
7fc925fd6   Roman Zippel   kconfig: finer cu...
278
  	void saveSettings(void);
43bf612af   Roman Zippel   kconfig: Add sear...
279
  	void search(void);
7fc925fd6   Roman Zippel   kconfig: finer cu...
280

43bf612af   Roman Zippel   kconfig: Add sear...
281
282
283
  protected:
  	QLineEdit* editField;
  	QPushButton* searchButton;
7fc925fd6   Roman Zippel   kconfig: finer cu...
284
  	QSplitter* split;
43bf612af   Roman Zippel   kconfig: Add sear...
285
286
287
288
289
  	ConfigView* list;
  	ConfigInfoView* info;
  
  	struct symbol **result;
  };
133c5f7c1   Alexander Stein   kconfig qconf: po...
290
  class ConfigMainWindow : public Q3MainWindow {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
291
  	Q_OBJECT
3b354c557   Karsten Wiese   [PATCH] kconfig: ...
292

133c5f7c1   Alexander Stein   kconfig qconf: po...
293
  	static Q3Action *saveAction;
3b354c557   Karsten Wiese   [PATCH] kconfig: ...
294
  	static void conf_changed(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
295
296
297
  public:
  	ConfigMainWindow(void);
  public slots:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
298
  	void changeMenu(struct menu *);
b65a47e1a   Roman Zippel   kconfig: jump to ...
299
  	void setMenuLink(struct menu *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
300
301
302
  	void listFocusChanged(void);
  	void goBack(void);
  	void loadConfig(void);
bac6aa865   Michal Marek   xconfig: Abort cl...
303
  	bool saveConfig(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
304
  	void saveConfigAs(void);
43bf612af   Roman Zippel   kconfig: Add sear...
305
  	void searchConfig(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
306
307
308
  	void showSingleView(void);
  	void showSplitView(void);
  	void showFullView(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
309
310
311
312
313
314
  	void showIntro(void);
  	void showAbout(void);
  	void saveSettings(void);
  
  protected:
  	void closeEvent(QCloseEvent *e);
43bf612af   Roman Zippel   kconfig: Add sear...
315
  	ConfigSearchWindow *searchWindow;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
316
317
318
319
  	ConfigView *menuView;
  	ConfigList *menuList;
  	ConfigView *configView;
  	ConfigList *configList;
43bf612af   Roman Zippel   kconfig: Add sear...
320
  	ConfigInfoView *helpText;
133c5f7c1   Alexander Stein   kconfig qconf: po...
321
322
  	Q3ToolBar *toolBar;
  	Q3Action *backAction;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
323
324
  	QSplitter* split1;
  	QSplitter* split2;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
325
  };