1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
10 #include <QMainWindow>
11 #include <QPushButton>
14 #include <QTextBrowser>
15 #include <QTreeWidget>
23 class ConfigMainWindow;
25 class ConfigSettings : public QSettings {
28 QList<int> readSizes(const QString& key, bool *ok);
29 bool writeSizes(const QString& key, const QList<int>& value);
33 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
36 singleMode, menuMode, symbolMode, fullMode, listMode
39 normalOpt = 0, allOpt, promptOpt
42 class ConfigList : public QTreeWidget {
44 typedef class QTreeWidget Parent;
46 ConfigList(ConfigView* p, const char *name = 0);
48 ConfigItem* findConfigItem(struct menu *);
49 ConfigView* parent(void) const
51 return (ConfigView*)Parent::parent();
53 void setSelected(QTreeWidgetItem *item, bool enable) {
54 for (int i = 0; i < selectedItems().size(); i++)
55 selectedItems().at(i)->setSelected(false);
57 item->setSelected(enable);
61 void keyPressEvent(QKeyEvent *e);
62 void mousePressEvent(QMouseEvent *e);
63 void mouseReleaseEvent(QMouseEvent *e);
64 void mouseMoveEvent(QMouseEvent *e);
65 void mouseDoubleClickEvent(QMouseEvent *e);
66 void focusInEvent(QFocusEvent *e);
67 void contextMenuEvent(QContextMenuEvent *e);
70 void setRootMenu(struct menu *menu);
73 void setValue(ConfigItem* item, tristate val);
74 void changeValue(ConfigItem* item);
75 void updateSelection(void);
76 void saveSettings(void);
78 void menuChanged(struct menu *menu);
79 void menuSelected(struct menu *menu);
80 void itemSelected(struct menu *menu);
81 void parentSelected(void);
82 void gotFocus(struct menu *);
85 void updateListAll(void)
91 void setAllOpen(bool open);
92 void setParentMenu(void);
94 bool menuSkip(struct menu *);
96 void updateMenuList(ConfigItem *parent, struct menu*);
97 void updateMenuList(struct menu *menu);
101 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
102 QPixmap choiceYesPix, choiceNoPix;
103 QPixmap menuPix, menuBackPix;
105 bool showName, showRange, showData;
107 enum optionMode optMode;
108 struct menu *rootEntry;
109 QPalette disabledColorGroup;
110 QPalette inactivedColorGroup;
114 class ConfigItem : public QTreeWidgetItem {
115 typedef class QTreeWidgetItem Parent;
117 ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v)
118 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
122 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
123 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
127 ConfigItem(ConfigList *parent, ConfigItem *after, bool v)
128 : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true)
134 void okRename(int col);
135 void updateMenu(void);
136 void testUpdateMenu(bool v);
137 ConfigList* listView() const
139 return (ConfigList*)Parent::treeWidget();
141 ConfigItem* firstChild() const
143 return (ConfigItem *)Parent::child(0);
145 ConfigItem* nextSibling()
147 ConfigItem *ret = NULL;
148 ConfigItem *_parent = (ConfigItem *)parent();
151 ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1);
153 QTreeWidget *_treeWidget = treeWidget();
154 ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1);
159 // TODO: Implement paintCell
161 ConfigItem* nextItem;
167 class ConfigLineEdit : public QLineEdit {
169 typedef class QLineEdit Parent;
171 ConfigLineEdit(ConfigView* parent);
172 ConfigView* parent(void) const
174 return (ConfigView*)Parent::parent();
176 void show(ConfigItem *i);
177 void keyPressEvent(QKeyEvent *e);
183 class ConfigView : public QWidget {
185 typedef class QWidget Parent;
187 ConfigView(QWidget* parent, const char *name = 0);
189 static void updateList();
190 static void updateListAll(void);
192 bool showName(void) const { return list->showName; }
193 bool showRange(void) const { return list->showRange; }
194 bool showData(void) const { return list->showData; }
196 void setShowName(bool);
197 void setShowRange(bool);
198 void setShowData(bool);
199 void setOptionMode(QAction *);
201 void showNameChanged(bool);
202 void showRangeChanged(bool);
203 void showDataChanged(bool);
206 ConfigLineEdit* lineEdit;
208 static ConfigView* viewList;
209 ConfigView* nextView;
211 static QAction *showNormalAction;
212 static QAction *showAllAction;
213 static QAction *showPromptAction;
216 class ConfigInfoView : public QTextBrowser {
218 typedef class QTextBrowser Parent;
220 ConfigInfoView(QWidget* parent, const char *name = 0);
221 bool showDebug(void) const { return _showDebug; }
224 void setInfo(struct menu *menu);
225 void saveSettings(void);
226 void setShowDebug(bool);
227 void clicked (const QUrl &url);
230 void showDebugChanged(bool);
231 void menuSelected(struct menu *);
234 void symbolInfo(void);
236 QString debug_info(struct symbol *sym);
237 static QString print_filter(const QString &str);
238 static void expr_print_help(void *data, struct symbol *sym, const char *str);
239 QMenu *createStandardContextMenu(const QPoint & pos);
240 void contextMenuEvent(QContextMenuEvent *e);
247 class ConfigSearchWindow : public QDialog {
249 typedef class QDialog Parent;
251 ConfigSearchWindow(ConfigMainWindow *parent);
254 void saveSettings(void);
258 QLineEdit* editField;
259 QPushButton* searchButton;
262 ConfigInfoView* info;
264 struct symbol **result;
267 class ConfigMainWindow : public QMainWindow {
271 static QAction *saveAction;
272 static void conf_changed(void);
274 ConfigMainWindow(void);
276 void changeMenu(struct menu *);
277 void changeItens(struct menu *);
278 void setMenuLink(struct menu *);
279 void listFocusChanged(void);
281 void loadConfig(void);
282 bool saveConfig(void);
283 void saveConfigAs(void);
284 void searchConfig(void);
285 void showSingleView(void);
286 void showSplitView(void);
287 void showFullView(void);
288 void showIntro(void);
289 void showAbout(void);
290 void saveSettings(void);
293 void closeEvent(QCloseEvent *e);
295 ConfigSearchWindow *searchWindow;
296 ConfigView *menuView;
297 ConfigList *menuList;
298 ConfigView *configView;
299 ConfigList *configList;
300 ConfigInfoView *helpText;
302 QAction *singleViewAction;
303 QAction *splitViewAction;
304 QAction *fullViewAction;