diff options
Diffstat (limited to 'scripts/kconfig/qconf.h')
-rw-r--r-- | scripts/kconfig/qconf.h | 158 |
1 files changed, 113 insertions, 45 deletions
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index e52f3e90bf0c..6a9e3b14c227 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -7,9 +7,25 @@ | |||
7 | #if QT_VERSION >= 300 | 7 | #if QT_VERSION >= 300 |
8 | #include <qsettings.h> | 8 | #include <qsettings.h> |
9 | #else | 9 | #else |
10 | class QSettings { }; | 10 | class QSettings { |
11 | public: | ||
12 | void beginGroup(const QString& group) { } | ||
13 | void endGroup(void) { } | ||
14 | bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const | ||
15 | { if (ok) *ok = FALSE; return def; } | ||
16 | int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const | ||
17 | { if (ok) *ok = FALSE; return def; } | ||
18 | QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const | ||
19 | { if (ok) *ok = FALSE; return def; } | ||
20 | QStringList readListEntry(const QString& key, bool* ok = 0) const | ||
21 | { if (ok) *ok = FALSE; return QStringList(); } | ||
22 | template <class t> | ||
23 | bool writeEntry(const QString& key, t value) | ||
24 | { return TRUE; } | ||
25 | }; | ||
11 | #endif | 26 | #endif |
12 | 27 | ||
28 | class ConfigView; | ||
13 | class ConfigList; | 29 | class ConfigList; |
14 | class ConfigItem; | 30 | class ConfigItem; |
15 | class ConfigLineEdit; | 31 | class ConfigLineEdit; |
@@ -18,64 +34,38 @@ class ConfigMainWindow; | |||
18 | 34 | ||
19 | class ConfigSettings : public QSettings { | 35 | class ConfigSettings : public QSettings { |
20 | public: | 36 | public: |
21 | ConfigSettings(); | ||
22 | |||
23 | #if QT_VERSION >= 300 | ||
24 | void readListSettings(); | ||
25 | QValueList<int> readSizes(const QString& key, bool *ok); | 37 | QValueList<int> readSizes(const QString& key, bool *ok); |
26 | bool writeSizes(const QString& key, const QValueList<int>& value); | 38 | bool writeSizes(const QString& key, const QValueList<int>& value); |
27 | #endif | ||
28 | |||
29 | bool showAll; | ||
30 | bool showName; | ||
31 | bool showRange; | ||
32 | bool showData; | ||
33 | }; | ||
34 | |||
35 | class ConfigView : public QVBox { | ||
36 | Q_OBJECT | ||
37 | typedef class QVBox Parent; | ||
38 | public: | ||
39 | ConfigView(QWidget* parent, ConfigMainWindow* cview, ConfigSettings* configSettings); | ||
40 | ~ConfigView(void); | ||
41 | static void updateList(ConfigItem* item); | ||
42 | static void updateListAll(void); | ||
43 | |||
44 | public: | ||
45 | ConfigList* list; | ||
46 | ConfigLineEdit* lineEdit; | ||
47 | |||
48 | static ConfigView* viewList; | ||
49 | ConfigView* nextView; | ||
50 | }; | 39 | }; |
51 | 40 | ||
52 | enum colIdx { | 41 | enum colIdx { |
53 | promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr | 42 | promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr |
54 | }; | 43 | }; |
55 | enum listMode { | 44 | enum listMode { |
56 | singleMode, menuMode, symbolMode, fullMode | 45 | singleMode, menuMode, symbolMode, fullMode, listMode |
57 | }; | 46 | }; |
58 | 47 | ||
59 | class ConfigList : public QListView { | 48 | class ConfigList : public QListView { |
60 | Q_OBJECT | 49 | Q_OBJECT |
61 | typedef class QListView Parent; | 50 | typedef class QListView Parent; |
62 | public: | 51 | public: |
63 | ConfigList(ConfigView* p, ConfigMainWindow* cview, ConfigSettings *configSettings); | 52 | ConfigList(ConfigView* p, const char *name = 0); |
64 | void reinit(void); | 53 | void reinit(void); |
65 | ConfigView* parent(void) const | 54 | ConfigView* parent(void) const |
66 | { | 55 | { |
67 | return (ConfigView*)Parent::parent(); | 56 | return (ConfigView*)Parent::parent(); |
68 | } | 57 | } |
58 | ConfigItem* findConfigItem(struct menu *); | ||
69 | 59 | ||
70 | protected: | 60 | protected: |
71 | ConfigMainWindow* cview; | ||
72 | |||
73 | void keyPressEvent(QKeyEvent *e); | 61 | void keyPressEvent(QKeyEvent *e); |
74 | void contentsMousePressEvent(QMouseEvent *e); | 62 | void contentsMousePressEvent(QMouseEvent *e); |
75 | void contentsMouseReleaseEvent(QMouseEvent *e); | 63 | void contentsMouseReleaseEvent(QMouseEvent *e); |
76 | void contentsMouseMoveEvent(QMouseEvent *e); | 64 | void contentsMouseMoveEvent(QMouseEvent *e); |
77 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 65 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
78 | void focusInEvent(QFocusEvent *e); | 66 | void focusInEvent(QFocusEvent *e); |
67 | void contextMenuEvent(QContextMenuEvent *e); | ||
68 | |||
79 | public slots: | 69 | public slots: |
80 | void setRootMenu(struct menu *menu); | 70 | void setRootMenu(struct menu *menu); |
81 | 71 | ||
@@ -83,10 +73,12 @@ public slots: | |||
83 | void setValue(ConfigItem* item, tristate val); | 73 | void setValue(ConfigItem* item, tristate val); |
84 | void changeValue(ConfigItem* item); | 74 | void changeValue(ConfigItem* item); |
85 | void updateSelection(void); | 75 | void updateSelection(void); |
76 | void saveSettings(void); | ||
86 | signals: | 77 | signals: |
78 | void menuChanged(struct menu *menu); | ||
87 | void menuSelected(struct menu *menu); | 79 | void menuSelected(struct menu *menu); |
88 | void parentSelected(void); | 80 | void parentSelected(void); |
89 | void gotFocus(void); | 81 | void gotFocus(struct menu *); |
90 | 82 | ||
91 | public: | 83 | public: |
92 | void updateListAll(void) | 84 | void updateListAll(void) |
@@ -137,6 +129,7 @@ public: | |||
137 | struct menu *rootEntry; | 129 | struct menu *rootEntry; |
138 | QColorGroup disabledColorGroup; | 130 | QColorGroup disabledColorGroup; |
139 | QColorGroup inactivedColorGroup; | 131 | QColorGroup inactivedColorGroup; |
132 | QPopupMenu* headerPopup; | ||
140 | 133 | ||
141 | private: | 134 | private: |
142 | int colMap[colNr]; | 135 | int colMap[colNr]; |
@@ -208,9 +201,7 @@ class ConfigLineEdit : public QLineEdit { | |||
208 | Q_OBJECT | 201 | Q_OBJECT |
209 | typedef class QLineEdit Parent; | 202 | typedef class QLineEdit Parent; |
210 | public: | 203 | public: |
211 | ConfigLineEdit(ConfigView* parent) | 204 | ConfigLineEdit(ConfigView* parent); |
212 | : Parent(parent) | ||
213 | { } | ||
214 | ConfigView* parent(void) const | 205 | ConfigView* parent(void) const |
215 | { | 206 | { |
216 | return (ConfigView*)Parent::parent(); | 207 | return (ConfigView*)Parent::parent(); |
@@ -222,26 +213,104 @@ public: | |||
222 | ConfigItem *item; | 213 | ConfigItem *item; |
223 | }; | 214 | }; |
224 | 215 | ||
216 | class ConfigView : public QVBox { | ||
217 | Q_OBJECT | ||
218 | typedef class QVBox Parent; | ||
219 | public: | ||
220 | ConfigView(QWidget* parent, const char *name = 0); | ||
221 | ~ConfigView(void); | ||
222 | static void updateList(ConfigItem* item); | ||
223 | static void updateListAll(void); | ||
224 | |||
225 | bool showAll(void) const { return list->showAll; } | ||
226 | bool showName(void) const { return list->showName; } | ||
227 | bool showRange(void) const { return list->showRange; } | ||
228 | bool showData(void) const { return list->showData; } | ||
229 | public slots: | ||
230 | void setShowAll(bool); | ||
231 | void setShowName(bool); | ||
232 | void setShowRange(bool); | ||
233 | void setShowData(bool); | ||
234 | signals: | ||
235 | void showAllChanged(bool); | ||
236 | void showNameChanged(bool); | ||
237 | void showRangeChanged(bool); | ||
238 | void showDataChanged(bool); | ||
239 | public: | ||
240 | ConfigList* list; | ||
241 | ConfigLineEdit* lineEdit; | ||
242 | |||
243 | static ConfigView* viewList; | ||
244 | ConfigView* nextView; | ||
245 | }; | ||
246 | |||
247 | class ConfigInfoView : public QTextBrowser { | ||
248 | Q_OBJECT | ||
249 | typedef class QTextBrowser Parent; | ||
250 | public: | ||
251 | ConfigInfoView(QWidget* parent, const char *name = 0); | ||
252 | bool showDebug(void) const { return _showDebug; } | ||
253 | |||
254 | public slots: | ||
255 | void setInfo(struct menu *menu); | ||
256 | void saveSettings(void); | ||
257 | void setSource(const QString& name); | ||
258 | void setShowDebug(bool); | ||
259 | |||
260 | signals: | ||
261 | void showDebugChanged(bool); | ||
262 | void menuSelected(struct menu *); | ||
263 | |||
264 | protected: | ||
265 | void symbolInfo(void); | ||
266 | void menuInfo(void); | ||
267 | QString debug_info(struct symbol *sym); | ||
268 | static QString print_filter(const QString &str); | ||
269 | static void expr_print_help(void *data, struct symbol *sym, const char *str); | ||
270 | QPopupMenu* createPopupMenu(const QPoint& pos); | ||
271 | void contentsContextMenuEvent(QContextMenuEvent *e); | ||
272 | |||
273 | struct symbol *sym; | ||
274 | struct menu *menu; | ||
275 | bool _showDebug; | ||
276 | }; | ||
277 | |||
278 | class ConfigSearchWindow : public QDialog { | ||
279 | Q_OBJECT | ||
280 | typedef class QDialog Parent; | ||
281 | public: | ||
282 | ConfigSearchWindow(QWidget* parent, const char *name = 0); | ||
283 | |||
284 | public slots: | ||
285 | void saveSettings(void); | ||
286 | void search(void); | ||
287 | |||
288 | protected: | ||
289 | QLineEdit* editField; | ||
290 | QPushButton* searchButton; | ||
291 | QSplitter* split; | ||
292 | ConfigView* list; | ||
293 | ConfigInfoView* info; | ||
294 | |||
295 | struct symbol **result; | ||
296 | }; | ||
297 | |||
225 | class ConfigMainWindow : public QMainWindow { | 298 | class ConfigMainWindow : public QMainWindow { |
226 | Q_OBJECT | 299 | Q_OBJECT |
227 | public: | 300 | public: |
228 | ConfigMainWindow(void); | 301 | ConfigMainWindow(void); |
229 | public slots: | 302 | public slots: |
230 | void setHelp(QListViewItem* item); | ||
231 | void changeMenu(struct menu *); | 303 | void changeMenu(struct menu *); |
304 | void setMenuLink(struct menu *); | ||
232 | void listFocusChanged(void); | 305 | void listFocusChanged(void); |
233 | void goBack(void); | 306 | void goBack(void); |
234 | void loadConfig(void); | 307 | void loadConfig(void); |
235 | void saveConfig(void); | 308 | void saveConfig(void); |
236 | void saveConfigAs(void); | 309 | void saveConfigAs(void); |
310 | void searchConfig(void); | ||
237 | void showSingleView(void); | 311 | void showSingleView(void); |
238 | void showSplitView(void); | 312 | void showSplitView(void); |
239 | void showFullView(void); | 313 | void showFullView(void); |
240 | void setShowAll(bool); | ||
241 | void setShowDebug(bool); | ||
242 | void setShowRange(bool); | ||
243 | void setShowName(bool); | ||
244 | void setShowData(bool); | ||
245 | void showIntro(void); | 314 | void showIntro(void); |
246 | void showAbout(void); | 315 | void showAbout(void); |
247 | void saveSettings(void); | 316 | void saveSettings(void); |
@@ -249,15 +318,14 @@ public slots: | |||
249 | protected: | 318 | protected: |
250 | void closeEvent(QCloseEvent *e); | 319 | void closeEvent(QCloseEvent *e); |
251 | 320 | ||
321 | ConfigSearchWindow *searchWindow; | ||
252 | ConfigView *menuView; | 322 | ConfigView *menuView; |
253 | ConfigList *menuList; | 323 | ConfigList *menuList; |
254 | ConfigView *configView; | 324 | ConfigView *configView; |
255 | ConfigList *configList; | 325 | ConfigList *configList; |
256 | QTextView *helpText; | 326 | ConfigInfoView *helpText; |
257 | QToolBar *toolBar; | 327 | QToolBar *toolBar; |
258 | QAction *backAction; | 328 | QAction *backAction; |
259 | QSplitter* split1; | 329 | QSplitter* split1; |
260 | QSplitter* split2; | 330 | QSplitter* split2; |
261 | |||
262 | bool showDebug; | ||
263 | }; | 331 | }; |