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 class ConfigList
: public QListView
{
50 typedef class QListView Parent
;
52 ConfigList(ConfigView
* p
, const char *name
= 0);
54 ConfigView
* parent(void) const
56 return (ConfigView
*)Parent::parent();
58 ConfigItem
* findConfigItem(struct menu
*);
61 void keyPressEvent(QKeyEvent
*e
);
62 void contentsMousePressEvent(QMouseEvent
*e
);
63 void contentsMouseReleaseEvent(QMouseEvent
*e
);
64 void contentsMouseMoveEvent(QMouseEvent
*e
);
65 void contentsMouseDoubleClickEvent(QMouseEvent
*e
);
66 void focusInEvent(QFocusEvent
*e
);
67 void contextMenuEvent(QContextMenuEvent
*e
);
70 void setRootMenu(struct menu
*menu
);
72 void updateList(ConfigItem
*item
);
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 parentSelected(void);
81 void gotFocus(struct menu
*);
84 void updateListAll(void)
90 ConfigList
* listView()
94 ConfigItem
* firstChild() const
96 return (ConfigItem
*)Parent::firstChild();
98 int mapIdx(colIdx idx
)
102 void addColumn(colIdx idx
, const QString
& label
)
104 colMap
[idx
] = Parent::addColumn(label
);
105 colRevMap
[colMap
[idx
]] = idx
;
107 void removeColumn(colIdx idx
)
109 int col
= colMap
[idx
];
111 Parent::removeColumn(col
);
112 colRevMap
[col
] = colMap
[idx
] = -1;
115 void setAllOpen(bool open
);
116 void setParentMenu(void);
119 void updateMenuList(P
*, struct menu
*);
123 QPixmap symbolYesPix
, symbolModPix
, symbolNoPix
;
124 QPixmap choiceYesPix
, choiceNoPix
;
125 QPixmap menuPix
, menuInvPix
, menuBackPix
, voidPix
;
127 bool showAll
, showName
, showRange
, showData
;
129 struct menu
*rootEntry
;
130 QColorGroup disabledColorGroup
;
131 QColorGroup inactivedColorGroup
;
132 QPopupMenu
* headerPopup
;
136 int colRevMap
[colNr
];
139 class ConfigItem
: public QListViewItem
{
140 typedef class QListViewItem Parent
;
142 ConfigItem(QListView
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
143 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
147 ConfigItem(ConfigItem
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
148 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
152 ConfigItem(QListView
*parent
, ConfigItem
*after
, bool v
)
153 : Parent(parent
, after
), menu(0), visible(v
), goParent(true)
159 #if QT_VERSION >= 300
160 void okRename(int col
);
162 void updateMenu(void);
163 void testUpdateMenu(bool v
);
164 ConfigList
* listView() const
166 return (ConfigList
*)Parent::listView();
168 ConfigItem
* firstChild() const
170 return (ConfigItem
*)Parent::firstChild();
172 ConfigItem
* nextSibling() const
174 return (ConfigItem
*)Parent::nextSibling();
176 void setText(colIdx idx
, const QString
& text
)
178 Parent::setText(listView()->mapIdx(idx
), text
);
180 QString
text(colIdx idx
) const
182 return Parent::text(listView()->mapIdx(idx
));
184 void setPixmap(colIdx idx
, const QPixmap
& pm
)
186 Parent::setPixmap(listView()->mapIdx(idx
), pm
);
188 const QPixmap
* pixmap(colIdx idx
) const
190 return Parent::pixmap(listView()->mapIdx(idx
));
192 void paintCell(QPainter
* p
, const QColorGroup
& cg
, int column
, int width
, int align
);
194 ConfigItem
* nextItem
;
200 class ConfigLineEdit
: public QLineEdit
{
202 typedef class QLineEdit Parent
;
204 ConfigLineEdit(ConfigView
* parent
);
205 ConfigView
* parent(void) const
207 return (ConfigView
*)Parent::parent();
209 void show(ConfigItem
*i
);
210 void keyPressEvent(QKeyEvent
*e
);
216 class ConfigView
: public QVBox
{
218 typedef class QVBox Parent
;
220 ConfigView(QWidget
* parent
, const char *name
= 0);
222 static void updateList(ConfigItem
* item
);
223 static void updateListAll(void);
225 bool showAll(void) const { return list
->showAll
; }
226 bool showName(void) const { return list
->showName
; }
227 bool showRange(void) const { return list
->showRange
; }
228 bool showData(void) const { return list
->showData
; }
230 void setShowAll(bool);
231 void setShowName(bool);
232 void setShowRange(bool);
233 void setShowData(bool);
235 void showAllChanged(bool);
236 void showNameChanged(bool);
237 void showRangeChanged(bool);
238 void showDataChanged(bool);
241 ConfigLineEdit
* lineEdit
;
243 static ConfigView
* viewList
;
244 ConfigView
* nextView
;
247 class ConfigInfoView
: public QTextBrowser
{
249 typedef class QTextBrowser Parent
;
251 ConfigInfoView(QWidget
* parent
, const char *name
= 0);
252 bool showDebug(void) const { return _showDebug
; }
255 void setInfo(struct menu
*menu
);
256 void saveSettings(void);
257 void setSource(const QString
& name
);
258 void setShowDebug(bool);
261 void showDebugChanged(bool);
262 void menuSelected(struct menu
*);
265 void symbolInfo(void);
267 QString
debug_info(struct symbol
*sym
);
268 static QString
print_filter(const QString
&str
);
269 static void expr_print_help(void *data
, struct symbol
*sym
, const char *str
);
270 QPopupMenu
* createPopupMenu(const QPoint
& pos
);
271 void contentsContextMenuEvent(QContextMenuEvent
*e
);
278 class ConfigSearchWindow
: public QDialog
{
280 typedef class QDialog Parent
;
282 ConfigSearchWindow(QWidget
* parent
, const char *name
= 0);
285 void saveSettings(void);
289 QLineEdit
* editField
;
290 QPushButton
* searchButton
;
293 ConfigInfoView
* info
;
295 struct symbol
**result
;
298 class ConfigMainWindow
: public QMainWindow
{
301 static QAction
*saveAction
;
302 static void conf_changed(void);
304 ConfigMainWindow(void);
306 void changeMenu(struct menu
*);
307 void setMenuLink(struct menu
*);
308 void listFocusChanged(void);
310 void loadConfig(void);
311 void saveConfig(void);
312 void saveConfigAs(void);
313 void searchConfig(void);
314 void showSingleView(void);
315 void showSplitView(void);
316 void showFullView(void);
317 void showIntro(void);
318 void showAbout(void);
319 void saveSettings(void);
322 void closeEvent(QCloseEvent
*e
);
324 ConfigSearchWindow
*searchWindow
;
325 ConfigView
*menuView
;
326 ConfigList
*menuList
;
327 ConfigView
*configView
;
328 ConfigList
*configList
;
329 ConfigInfoView
*helpText
;