2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
6 #include <q3listview.h>
14 class ConfigMainWindow
;
16 class ConfigSettings
: public QSettings
{
19 Q3ValueList
<int> readSizes(const QString
& key
, bool *ok
);
20 bool writeSizes(const QString
& key
, const Q3ValueList
<int>& value
);
24 promptColIdx
, nameColIdx
, noColIdx
, modColIdx
, yesColIdx
, dataColIdx
, colNr
27 singleMode
, menuMode
, symbolMode
, fullMode
, listMode
30 normalOpt
= 0, allOpt
, promptOpt
33 class ConfigList
: public Q3ListView
{
35 typedef class Q3ListView Parent
;
37 ConfigList(ConfigView
* p
, const char *name
= 0);
39 ConfigView
* parent(void) const
41 return (ConfigView
*)Parent::parent();
43 ConfigItem
* findConfigItem(struct menu
*);
46 void keyPressEvent(QKeyEvent
*e
);
47 void contentsMousePressEvent(QMouseEvent
*e
);
48 void contentsMouseReleaseEvent(QMouseEvent
*e
);
49 void contentsMouseMoveEvent(QMouseEvent
*e
);
50 void contentsMouseDoubleClickEvent(QMouseEvent
*e
);
51 void focusInEvent(QFocusEvent
*e
);
52 void contextMenuEvent(QContextMenuEvent
*e
);
55 void setRootMenu(struct menu
*menu
);
57 void updateList(ConfigItem
*item
);
58 void setValue(ConfigItem
* item
, tristate val
);
59 void changeValue(ConfigItem
* item
);
60 void updateSelection(void);
61 void saveSettings(void);
63 void menuChanged(struct menu
*menu
);
64 void menuSelected(struct menu
*menu
);
65 void parentSelected(void);
66 void gotFocus(struct menu
*);
69 void updateListAll(void)
75 ConfigList
* listView()
79 ConfigItem
* firstChild() const
81 return (ConfigItem
*)Parent::firstChild();
83 int mapIdx(colIdx idx
)
87 void addColumn(colIdx idx
, const QString
& label
)
89 colMap
[idx
] = Parent::addColumn(label
);
90 colRevMap
[colMap
[idx
]] = idx
;
92 void removeColumn(colIdx idx
)
94 int col
= colMap
[idx
];
96 Parent::removeColumn(col
);
97 colRevMap
[col
] = colMap
[idx
] = -1;
100 void setAllOpen(bool open
);
101 void setParentMenu(void);
103 bool menuSkip(struct menu
*);
106 void updateMenuList(P
*, struct menu
*);
110 QPixmap symbolYesPix
, symbolModPix
, symbolNoPix
;
111 QPixmap choiceYesPix
, choiceNoPix
;
112 QPixmap menuPix
, menuInvPix
, menuBackPix
, voidPix
;
114 bool showName
, showRange
, showData
;
116 enum optionMode optMode
;
117 struct menu
*rootEntry
;
118 QColorGroup disabledColorGroup
;
119 QColorGroup inactivedColorGroup
;
120 Q3PopupMenu
* headerPopup
;
124 int colRevMap
[colNr
];
127 class ConfigItem
: public Q3ListViewItem
{
128 typedef class Q3ListViewItem Parent
;
130 ConfigItem(Q3ListView
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
131 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
135 ConfigItem(ConfigItem
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
136 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
140 ConfigItem(Q3ListView
*parent
, ConfigItem
*after
, bool v
)
141 : Parent(parent
, after
), menu(0), visible(v
), goParent(true)
147 void okRename(int col
);
148 void updateMenu(void);
149 void testUpdateMenu(bool v
);
150 ConfigList
* listView() const
152 return (ConfigList
*)Parent::listView();
154 ConfigItem
* firstChild() const
156 return (ConfigItem
*)Parent::firstChild();
158 ConfigItem
* nextSibling() const
160 return (ConfigItem
*)Parent::nextSibling();
162 void setText(colIdx idx
, const QString
& text
)
164 Parent::setText(listView()->mapIdx(idx
), text
);
166 QString
text(colIdx idx
) const
168 return Parent::text(listView()->mapIdx(idx
));
170 void setPixmap(colIdx idx
, const QPixmap
& pm
)
172 Parent::setPixmap(listView()->mapIdx(idx
), pm
);
174 const QPixmap
* pixmap(colIdx idx
) const
176 return Parent::pixmap(listView()->mapIdx(idx
));
178 void paintCell(QPainter
* p
, const QColorGroup
& cg
, int column
, int width
, int align
);
180 ConfigItem
* nextItem
;
186 class ConfigLineEdit
: public QLineEdit
{
188 typedef class QLineEdit Parent
;
190 ConfigLineEdit(ConfigView
* parent
);
191 ConfigView
* parent(void) const
193 return (ConfigView
*)Parent::parent();
195 void show(ConfigItem
*i
);
196 void keyPressEvent(QKeyEvent
*e
);
202 class ConfigView
: public Q3VBox
{
204 typedef class Q3VBox Parent
;
206 ConfigView(QWidget
* parent
, const char *name
= 0);
208 static void updateList(ConfigItem
* item
);
209 static void updateListAll(void);
211 bool showName(void) const { return list
->showName
; }
212 bool showRange(void) const { return list
->showRange
; }
213 bool showData(void) const { return list
->showData
; }
215 void setShowName(bool);
216 void setShowRange(bool);
217 void setShowData(bool);
218 void setOptionMode(QAction
*);
220 void showNameChanged(bool);
221 void showRangeChanged(bool);
222 void showDataChanged(bool);
225 ConfigLineEdit
* lineEdit
;
227 static ConfigView
* viewList
;
228 ConfigView
* nextView
;
230 static QAction
*showNormalAction
;
231 static QAction
*showAllAction
;
232 static QAction
*showPromptAction
;
235 class ConfigInfoView
: public Q3TextBrowser
{
237 typedef class Q3TextBrowser Parent
;
239 ConfigInfoView(QWidget
* parent
, const char *name
= 0);
240 bool showDebug(void) const { return _showDebug
; }
243 void setInfo(struct menu
*menu
);
244 void saveSettings(void);
245 void setShowDebug(bool);
248 void showDebugChanged(bool);
249 void menuSelected(struct menu
*);
252 void symbolInfo(void);
254 QString
debug_info(struct symbol
*sym
);
255 static QString
print_filter(const QString
&str
);
256 static void expr_print_help(void *data
, struct symbol
*sym
, const char *str
);
257 Q3PopupMenu
* createPopupMenu(const QPoint
& pos
);
258 void contentsContextMenuEvent(QContextMenuEvent
*e
);
265 class ConfigSearchWindow
: public QDialog
{
267 typedef class QDialog Parent
;
269 ConfigSearchWindow(ConfigMainWindow
* parent
, const char *name
= 0);
272 void saveSettings(void);
276 QLineEdit
* editField
;
277 QPushButton
* searchButton
;
280 ConfigInfoView
* info
;
282 struct symbol
**result
;
285 class ConfigMainWindow
: public QMainWindow
{
288 static Q3Action
*saveAction
;
289 static void conf_changed(void);
291 ConfigMainWindow(void);
293 void changeMenu(struct menu
*);
294 void setMenuLink(struct menu
*);
295 void listFocusChanged(void);
297 void loadConfig(void);
298 bool saveConfig(void);
299 void saveConfigAs(void);
300 void searchConfig(void);
301 void showSingleView(void);
302 void showSplitView(void);
303 void showFullView(void);
304 void showIntro(void);
305 void showAbout(void);
306 void saveSettings(void);
309 void closeEvent(QCloseEvent
*e
);
311 ConfigSearchWindow
*searchWindow
;
312 ConfigView
*menuView
;
313 ConfigList
*menuList
;
314 ConfigView
*configView
;
315 ConfigList
*configList
;
316 ConfigInfoView
*helpText
;
318 Q3Action
*backAction
;