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>
13 class ConfigMainWindow
;
15 class ConfigSettings
: public QSettings
{
18 Q3ValueList
<int> readSizes(const QString
& key
, bool *ok
);
19 bool writeSizes(const QString
& key
, const Q3ValueList
<int>& value
);
23 promptColIdx
, nameColIdx
, noColIdx
, modColIdx
, yesColIdx
, dataColIdx
, colNr
26 singleMode
, menuMode
, symbolMode
, fullMode
, listMode
29 normalOpt
= 0, allOpt
, promptOpt
32 class ConfigList
: public Q3ListView
{
34 typedef class Q3ListView Parent
;
36 ConfigList(ConfigView
* p
, const char *name
= 0);
38 ConfigView
* parent(void) const
40 return (ConfigView
*)Parent::parent();
42 ConfigItem
* findConfigItem(struct menu
*);
45 void keyPressEvent(QKeyEvent
*e
);
46 void contentsMousePressEvent(QMouseEvent
*e
);
47 void contentsMouseReleaseEvent(QMouseEvent
*e
);
48 void contentsMouseMoveEvent(QMouseEvent
*e
);
49 void contentsMouseDoubleClickEvent(QMouseEvent
*e
);
50 void focusInEvent(QFocusEvent
*e
);
51 void contextMenuEvent(QContextMenuEvent
*e
);
54 void setRootMenu(struct menu
*menu
);
56 void updateList(ConfigItem
*item
);
57 void setValue(ConfigItem
* item
, tristate val
);
58 void changeValue(ConfigItem
* item
);
59 void updateSelection(void);
60 void saveSettings(void);
62 void menuChanged(struct menu
*menu
);
63 void menuSelected(struct menu
*menu
);
64 void parentSelected(void);
65 void gotFocus(struct menu
*);
68 void updateListAll(void)
74 ConfigList
* listView()
78 ConfigItem
* firstChild() const
80 return (ConfigItem
*)Parent::firstChild();
82 int mapIdx(colIdx idx
)
86 void addColumn(colIdx idx
, const QString
& label
)
88 colMap
[idx
] = Parent::addColumn(label
);
89 colRevMap
[colMap
[idx
]] = idx
;
91 void removeColumn(colIdx idx
)
93 int col
= colMap
[idx
];
95 Parent::removeColumn(col
);
96 colRevMap
[col
] = colMap
[idx
] = -1;
99 void setAllOpen(bool open
);
100 void setParentMenu(void);
102 bool menuSkip(struct menu
*);
105 void updateMenuList(P
*, struct menu
*);
109 QPixmap symbolYesPix
, symbolModPix
, symbolNoPix
;
110 QPixmap choiceYesPix
, choiceNoPix
;
111 QPixmap menuPix
, menuInvPix
, menuBackPix
, voidPix
;
113 bool showName
, showRange
, showData
;
115 enum optionMode optMode
;
116 struct menu
*rootEntry
;
117 QColorGroup disabledColorGroup
;
118 QColorGroup inactivedColorGroup
;
119 Q3PopupMenu
* headerPopup
;
123 int colRevMap
[colNr
];
126 class ConfigItem
: public Q3ListViewItem
{
127 typedef class Q3ListViewItem Parent
;
129 ConfigItem(Q3ListView
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
130 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
134 ConfigItem(ConfigItem
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
135 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
139 ConfigItem(Q3ListView
*parent
, ConfigItem
*after
, bool v
)
140 : Parent(parent
, after
), menu(0), visible(v
), goParent(true)
146 void okRename(int col
);
147 void updateMenu(void);
148 void testUpdateMenu(bool v
);
149 ConfigList
* listView() const
151 return (ConfigList
*)Parent::listView();
153 ConfigItem
* firstChild() const
155 return (ConfigItem
*)Parent::firstChild();
157 ConfigItem
* nextSibling() const
159 return (ConfigItem
*)Parent::nextSibling();
161 void setText(colIdx idx
, const QString
& text
)
163 Parent::setText(listView()->mapIdx(idx
), text
);
165 QString
text(colIdx idx
) const
167 return Parent::text(listView()->mapIdx(idx
));
169 void setPixmap(colIdx idx
, const QPixmap
& pm
)
171 Parent::setPixmap(listView()->mapIdx(idx
), pm
);
173 const QPixmap
* pixmap(colIdx idx
) const
175 return Parent::pixmap(listView()->mapIdx(idx
));
177 void paintCell(QPainter
* p
, const QColorGroup
& cg
, int column
, int width
, int align
);
179 ConfigItem
* nextItem
;
185 class ConfigLineEdit
: public QLineEdit
{
187 typedef class QLineEdit Parent
;
189 ConfigLineEdit(ConfigView
* parent
);
190 ConfigView
* parent(void) const
192 return (ConfigView
*)Parent::parent();
194 void show(ConfigItem
*i
);
195 void keyPressEvent(QKeyEvent
*e
);
201 class ConfigView
: public Q3VBox
{
203 typedef class Q3VBox Parent
;
205 ConfigView(QWidget
* parent
, const char *name
= 0);
207 static void updateList(ConfigItem
* item
);
208 static void updateListAll(void);
210 bool showName(void) const { return list
->showName
; }
211 bool showRange(void) const { return list
->showRange
; }
212 bool showData(void) const { return list
->showData
; }
214 void setShowName(bool);
215 void setShowRange(bool);
216 void setShowData(bool);
217 void setOptionMode(QAction
*);
219 void showNameChanged(bool);
220 void showRangeChanged(bool);
221 void showDataChanged(bool);
224 ConfigLineEdit
* lineEdit
;
226 static ConfigView
* viewList
;
227 ConfigView
* nextView
;
229 static QAction
*showNormalAction
;
230 static QAction
*showAllAction
;
231 static QAction
*showPromptAction
;
234 class ConfigInfoView
: public Q3TextBrowser
{
236 typedef class Q3TextBrowser Parent
;
238 ConfigInfoView(QWidget
* parent
, const char *name
= 0);
239 bool showDebug(void) const { return _showDebug
; }
242 void setInfo(struct menu
*menu
);
243 void saveSettings(void);
244 void setShowDebug(bool);
247 void showDebugChanged(bool);
248 void menuSelected(struct menu
*);
251 void symbolInfo(void);
253 QString
debug_info(struct symbol
*sym
);
254 static QString
print_filter(const QString
&str
);
255 static void expr_print_help(void *data
, struct symbol
*sym
, const char *str
);
256 Q3PopupMenu
* createPopupMenu(const QPoint
& pos
);
257 void contentsContextMenuEvent(QContextMenuEvent
*e
);
264 class ConfigSearchWindow
: public QDialog
{
266 typedef class QDialog Parent
;
268 ConfigSearchWindow(ConfigMainWindow
* parent
, const char *name
= 0);
271 void saveSettings(void);
275 QLineEdit
* editField
;
276 QPushButton
* searchButton
;
279 ConfigInfoView
* info
;
281 struct symbol
**result
;
284 class ConfigMainWindow
: public Q3MainWindow
{
287 static Q3Action
*saveAction
;
288 static void conf_changed(void);
290 ConfigMainWindow(void);
292 void changeMenu(struct menu
*);
293 void setMenuLink(struct menu
*);
294 void listFocusChanged(void);
296 void loadConfig(void);
297 bool saveConfig(void);
298 void saveConfigAs(void);
299 void searchConfig(void);
300 void showSingleView(void);
301 void showSplitView(void);
302 void showFullView(void);
303 void showIntro(void);
304 void showAbout(void);
305 void saveSettings(void);
308 void closeEvent(QCloseEvent
*e
);
310 ConfigSearchWindow
*searchWindow
;
311 ConfigView
*menuView
;
312 ConfigList
*menuList
;
313 ConfigView
*configView
;
314 ConfigList
*configList
;
315 ConfigInfoView
*helpText
;
317 Q3Action
*backAction
;