2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
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(); }
23 bool writeEntry(const QString& key, t value)
32 class ConfigMainWindow;
35 class ConfigSettings : public QSettings {
37 QValueList<int> readSizes(const QString& key, bool *ok);
38 bool writeSizes(const QString& key, const QValueList<int>& value);
42 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
45 singleMode, menuMode, symbolMode, fullMode, listMode
48 normalOpt = 0, allOpt, promptOpt
51 class ConfigList : public QListView {
53 typedef class QListView Parent;
55 ConfigList(ConfigView* p, const char *name = 0);
57 ConfigView* parent(void) const
59 return (ConfigView*)Parent::parent();
61 ConfigItem* findConfigItem(struct menu *);
64 void keyPressEvent(QKeyEvent *e);
65 void contentsMousePressEvent(QMouseEvent *e);
66 void contentsMouseReleaseEvent(QMouseEvent *e);
67 void contentsMouseMoveEvent(QMouseEvent *e);
68 void contentsMouseDoubleClickEvent(QMouseEvent *e);
69 void focusInEvent(QFocusEvent *e);
70 void contextMenuEvent(QContextMenuEvent *e);
73 void setRootMenu(struct menu *menu);
75 void updateList(ConfigItem *item);
76 void setValue(ConfigItem* item, tristate val);
77 void changeValue(ConfigItem* item);
78 void updateSelection(void);
79 void saveSettings(void);
81 void menuChanged(struct menu *menu);
82 void menuSelected(struct menu *menu);
83 void parentSelected(void);
84 void gotFocus(struct menu *);
87 void updateListAll(void)
93 ConfigList* listView()
97 ConfigItem* firstChild() const
99 return (ConfigItem *)Parent::firstChild();
101 int mapIdx(colIdx idx)
105 void addColumn(colIdx idx, const QString& label)
107 colMap[idx] = Parent::addColumn(label);
108 colRevMap[colMap[idx]] = idx;
110 void removeColumn(colIdx idx)
112 int col = colMap[idx];
114 Parent::removeColumn(col);
115 colRevMap[col] = colMap[idx] = -1;
118 void setAllOpen(bool open);
119 void setParentMenu(void);
121 bool menuSkip(struct menu *);
124 void updateMenuList(P*, struct menu*);
128 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
129 QPixmap choiceYesPix, choiceNoPix;
130 QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
132 bool showName, showRange, showData;
134 enum optionMode optMode;
135 struct menu *rootEntry;
136 QColorGroup disabledColorGroup;
137 QColorGroup inactivedColorGroup;
138 QPopupMenu* headerPopup;
142 int colRevMap[colNr];
145 class ConfigItem : public QListViewItem {
146 typedef class QListViewItem Parent;
148 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v)
149 : Parent(parent, after), menu(m), visible(v), goParent(false)
153 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
154 : Parent(parent, after), menu(m), visible(v), goParent(false)
158 ConfigItem(QListView *parent, ConfigItem *after, bool v)
159 : Parent(parent, after), menu(0), visible(v), goParent(true)
165 #if QT_VERSION >= 300
166 void okRename(int col);
168 void updateMenu(void);
169 void testUpdateMenu(bool v);
170 ConfigList* listView() const
172 return (ConfigList*)Parent::listView();
174 ConfigItem* firstChild() const
176 return (ConfigItem *)Parent::firstChild();
178 ConfigItem* nextSibling() const
180 return (ConfigItem *)Parent::nextSibling();
182 void setText(colIdx idx, const QString& text)
184 Parent::setText(listView()->mapIdx(idx), text);
186 QString text(colIdx idx) const
188 return Parent::text(listView()->mapIdx(idx));
190 void setPixmap(colIdx idx, const QPixmap& pm)
192 Parent::setPixmap(listView()->mapIdx(idx), pm);
194 const QPixmap* pixmap(colIdx idx) const
196 return Parent::pixmap(listView()->mapIdx(idx));
198 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
200 ConfigItem* nextItem;
206 class ConfigLineEdit : public QLineEdit {
208 typedef class QLineEdit Parent;
210 ConfigLineEdit(ConfigView* parent);
211 ConfigView* parent(void) const
213 return (ConfigView*)Parent::parent();
215 void show(ConfigItem *i);
216 void keyPressEvent(QKeyEvent *e);
222 class ConfigView : public QVBox {
224 typedef class QVBox Parent;
226 ConfigView(QWidget* parent, const char *name = 0);
228 static void updateList(ConfigItem* item);
229 static void updateListAll(void);
231 bool showName(void) const { return list->showName; }
232 bool showRange(void) const { return list->showRange; }
233 bool showData(void) const { return list->showData; }
235 void setShowName(bool);
236 void setShowRange(bool);
237 void setShowData(bool);
238 void setOptionMode(QAction *);
240 void showNameChanged(bool);
241 void showRangeChanged(bool);
242 void showDataChanged(bool);
245 ConfigLineEdit* lineEdit;
247 static ConfigView* viewList;
248 ConfigView* nextView;
250 static QAction *showNormalAction;
251 static QAction *showAllAction;
252 static QAction *showPromptAction;
255 class ConfigInfoView : public QTextBrowser {
257 typedef class QTextBrowser Parent;
259 ConfigInfoView(QWidget* parent, const char *name = 0);
260 bool showDebug(void) const { return _showDebug; }
263 void setInfo(struct menu *menu);
264 void saveSettings(void);
265 void setShowDebug(bool);
268 void showDebugChanged(bool);
269 void menuSelected(struct menu *);
272 void symbolInfo(void);
274 QString debug_info(struct symbol *sym);
275 static QString print_filter(const QString &str);
276 static void expr_print_help(void *data, struct symbol *sym, const char *str);
277 QPopupMenu* createPopupMenu(const QPoint& pos);
278 void contentsContextMenuEvent(QContextMenuEvent *e);
285 class ConfigSearchWindow : public QDialog {
287 typedef class QDialog Parent;
289 ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
292 void saveSettings(void);
296 QLineEdit* editField;
297 QPushButton* searchButton;
300 ConfigInfoView* info;
302 struct symbol **result;
305 class ConfigMainWindow : public QMainWindow {
308 static QAction *saveAction;
309 static void conf_changed(void);
311 ConfigMainWindow(void);
313 void changeMenu(struct menu *);
314 void setMenuLink(struct menu *);
315 void listFocusChanged(void);
317 void loadConfig(void);
318 void saveConfig(void);
319 void saveConfigAs(void);
320 void searchConfig(void);
321 void showSingleView(void);
322 void showSplitView(void);
323 void showFullView(void);
324 void showIntro(void);
325 void showAbout(void);
326 void saveSettings(void);
329 void closeEvent(QCloseEvent *e);
331 ConfigSearchWindow *searchWindow;
332 ConfigView *menuView;
333 ConfigList *menuList;
334 ConfigView *configView;
335 ConfigList *configList;
336 ConfigInfoView *helpText;