diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2006-06-09 01:12:46 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-06-09 01:31:31 -0400 |
commit | 7fc925fd6a4c24e1db879d227fc0a0f65a335aa1 (patch) | |
tree | 35ff433ba285d150a3347bee23afcd79a3d2aa31 /scripts/kconfig/qconf.h | |
parent | 43bf612af2d4f2615dcbf86af8206e2f40231237 (diff) |
kconfig: finer customization via popup menus
This allows to configure every symbol list and info window separately via a
popup menu, these settings are also separately saved and restored. Cleanup
the ConfigSettings class a bit to reduce the number of #ifdef.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/qconf.h')
-rw-r--r-- | scripts/kconfig/qconf.h | 95 |
1 files changed, 61 insertions, 34 deletions
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index a548d13149b3..fb50e1c6029f 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,35 +34,8 @@ 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, 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 { |
@@ -60,7 +49,7 @@ 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, 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 | { |
@@ -74,6 +63,8 @@ protected: | |||
74 | void contentsMouseMoveEvent(QMouseEvent *e); | 63 | void contentsMouseMoveEvent(QMouseEvent *e); |
75 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 64 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
76 | void focusInEvent(QFocusEvent *e); | 65 | void focusInEvent(QFocusEvent *e); |
66 | void contextMenuEvent(QContextMenuEvent *e); | ||
67 | |||
77 | public slots: | 68 | public slots: |
78 | void setRootMenu(struct menu *menu); | 69 | void setRootMenu(struct menu *menu); |
79 | 70 | ||
@@ -81,6 +72,7 @@ public slots: | |||
81 | void setValue(ConfigItem* item, tristate val); | 72 | void setValue(ConfigItem* item, tristate val); |
82 | void changeValue(ConfigItem* item); | 73 | void changeValue(ConfigItem* item); |
83 | void updateSelection(void); | 74 | void updateSelection(void); |
75 | void saveSettings(void); | ||
84 | signals: | 76 | signals: |
85 | void menuChanged(struct menu *menu); | 77 | void menuChanged(struct menu *menu); |
86 | void menuSelected(struct menu *menu); | 78 | void menuSelected(struct menu *menu); |
@@ -136,6 +128,7 @@ public: | |||
136 | struct menu *rootEntry; | 128 | struct menu *rootEntry; |
137 | QColorGroup disabledColorGroup; | 129 | QColorGroup disabledColorGroup; |
138 | QColorGroup inactivedColorGroup; | 130 | QColorGroup inactivedColorGroup; |
131 | QPopupMenu* headerPopup; | ||
139 | 132 | ||
140 | private: | 133 | private: |
141 | int colMap[colNr]; | 134 | int colMap[colNr]; |
@@ -219,6 +212,37 @@ public: | |||
219 | ConfigItem *item; | 212 | ConfigItem *item; |
220 | }; | 213 | }; |
221 | 214 | ||
215 | class ConfigView : public QVBox { | ||
216 | Q_OBJECT | ||
217 | typedef class QVBox Parent; | ||
218 | public: | ||
219 | ConfigView(QWidget* parent, const char *name = 0); | ||
220 | ~ConfigView(void); | ||
221 | static void updateList(ConfigItem* item); | ||
222 | static void updateListAll(void); | ||
223 | |||
224 | bool showAll(void) const { return list->showAll; } | ||
225 | bool showName(void) const { return list->showName; } | ||
226 | bool showRange(void) const { return list->showRange; } | ||
227 | bool showData(void) const { return list->showData; } | ||
228 | public slots: | ||
229 | void setShowAll(bool); | ||
230 | void setShowName(bool); | ||
231 | void setShowRange(bool); | ||
232 | void setShowData(bool); | ||
233 | signals: | ||
234 | void showAllChanged(bool); | ||
235 | void showNameChanged(bool); | ||
236 | void showRangeChanged(bool); | ||
237 | void showDataChanged(bool); | ||
238 | public: | ||
239 | ConfigList* list; | ||
240 | ConfigLineEdit* lineEdit; | ||
241 | |||
242 | static ConfigView* viewList; | ||
243 | ConfigView* nextView; | ||
244 | }; | ||
245 | |||
222 | class ConfigInfoView : public QTextBrowser { | 246 | class ConfigInfoView : public QTextBrowser { |
223 | Q_OBJECT | 247 | Q_OBJECT |
224 | typedef class QTextBrowser Parent; | 248 | typedef class QTextBrowser Parent; |
@@ -228,6 +252,7 @@ public: | |||
228 | 252 | ||
229 | public slots: | 253 | public slots: |
230 | void setInfo(struct menu *menu); | 254 | void setInfo(struct menu *menu); |
255 | void saveSettings(void); | ||
231 | void setSource(const QString& name); | 256 | void setSource(const QString& name); |
232 | void setShowDebug(bool); | 257 | void setShowDebug(bool); |
233 | 258 | ||
@@ -239,6 +264,8 @@ protected: | |||
239 | QString debug_info(struct symbol *sym); | 264 | QString debug_info(struct symbol *sym); |
240 | static QString print_filter(const QString &str); | 265 | static QString print_filter(const QString &str); |
241 | static void expr_print_help(void *data, const char *str); | 266 | static void expr_print_help(void *data, const char *str); |
267 | QPopupMenu* createPopupMenu(const QPoint& pos); | ||
268 | void contentsContextMenuEvent(QContextMenuEvent *e); | ||
242 | 269 | ||
243 | struct menu *menu; | 270 | struct menu *menu; |
244 | bool _showDebug; | 271 | bool _showDebug; |
@@ -248,12 +275,16 @@ class ConfigSearchWindow : public QDialog { | |||
248 | Q_OBJECT | 275 | Q_OBJECT |
249 | typedef class QDialog Parent; | 276 | typedef class QDialog Parent; |
250 | public: | 277 | public: |
251 | ConfigSearchWindow(QWidget* parent); | 278 | ConfigSearchWindow(QWidget* parent, const char *name = 0); |
279 | |||
252 | public slots: | 280 | public slots: |
281 | void saveSettings(void); | ||
253 | void search(void); | 282 | void search(void); |
283 | |||
254 | protected: | 284 | protected: |
255 | QLineEdit* editField; | 285 | QLineEdit* editField; |
256 | QPushButton* searchButton; | 286 | QPushButton* searchButton; |
287 | QSplitter* split; | ||
257 | ConfigView* list; | 288 | ConfigView* list; |
258 | ConfigInfoView* info; | 289 | ConfigInfoView* info; |
259 | 290 | ||
@@ -276,10 +307,6 @@ public slots: | |||
276 | void showSingleView(void); | 307 | void showSingleView(void); |
277 | void showSplitView(void); | 308 | void showSplitView(void); |
278 | void showFullView(void); | 309 | void showFullView(void); |
279 | void setShowAll(bool); | ||
280 | void setShowRange(bool); | ||
281 | void setShowName(bool); | ||
282 | void setShowData(bool); | ||
283 | void showIntro(void); | 310 | void showIntro(void); |
284 | void showAbout(void); | 311 | void showAbout(void); |
285 | void saveSettings(void); | 312 | void saveSettings(void); |