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();
60 void keyPressEvent(QKeyEvent
*e
);
61 void contentsMousePressEvent(QMouseEvent
*e
);
62 void contentsMouseReleaseEvent(QMouseEvent
*e
);
63 void contentsMouseMoveEvent(QMouseEvent
*e
);
64 void contentsMouseDoubleClickEvent(QMouseEvent
*e
);
65 void focusInEvent(QFocusEvent
*e
);
66 void contextMenuEvent(QContextMenuEvent
*e
);
69 void setRootMenu(struct menu
*menu
);
71 void updateList(ConfigItem
*item
);
72 void setValue(ConfigItem
* item
, tristate val
);
73 void changeValue(ConfigItem
* item
);
74 void updateSelection(void);
75 void saveSettings(void);
77 void menuChanged(struct menu
*menu
);
78 void menuSelected(struct menu
*menu
);
79 void parentSelected(void);
83 void updateListAll(void)
89 ConfigList
* listView()
93 ConfigItem
* firstChild() const
95 return (ConfigItem
*)Parent::firstChild();
97 int mapIdx(colIdx idx
)
101 void addColumn(colIdx idx
, const QString
& label
)
103 colMap
[idx
] = Parent::addColumn(label
);
104 colRevMap
[colMap
[idx
]] = idx
;
106 void removeColumn(colIdx idx
)
108 int col
= colMap
[idx
];
110 Parent::removeColumn(col
);
111 colRevMap
[col
] = colMap
[idx
] = -1;
114 void setAllOpen(bool open
);
115 void setParentMenu(void);
118 void updateMenuList(P
*, struct menu
*);
122 QPixmap symbolYesPix
, symbolModPix
, symbolNoPix
;
123 QPixmap choiceYesPix
, choiceNoPix
;
124 QPixmap menuPix
, menuInvPix
, menuBackPix
, voidPix
;
126 bool showAll
, showName
, showRange
, showData
;
128 struct menu
*rootEntry
;
129 QColorGroup disabledColorGroup
;
130 QColorGroup inactivedColorGroup
;
131 QPopupMenu
* headerPopup
;
135 int colRevMap
[colNr
];
138 class ConfigItem
: public QListViewItem
{
139 typedef class QListViewItem Parent
;
141 ConfigItem(QListView
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
142 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
146 ConfigItem(ConfigItem
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
147 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
151 ConfigItem(QListView
*parent
, ConfigItem
*after
, bool v
)
152 : Parent(parent
, after
), menu(0), visible(v
), goParent(true)
158 #if QT_VERSION >= 300
159 void okRename(int col
);
161 void updateMenu(void);
162 void testUpdateMenu(bool v
);
163 ConfigList
* listView() const
165 return (ConfigList
*)Parent::listView();
167 ConfigItem
* firstChild() const
169 return (ConfigItem
*)Parent::firstChild();
171 ConfigItem
* nextSibling() const
173 return (ConfigItem
*)Parent::nextSibling();
175 void setText(colIdx idx
, const QString
& text
)
177 Parent::setText(listView()->mapIdx(idx
), text
);
179 QString
text(colIdx idx
) const
181 return Parent::text(listView()->mapIdx(idx
));
183 void setPixmap(colIdx idx
, const QPixmap
& pm
)
185 Parent::setPixmap(listView()->mapIdx(idx
), pm
);
187 const QPixmap
* pixmap(colIdx idx
) const
189 return Parent::pixmap(listView()->mapIdx(idx
));
191 void paintCell(QPainter
* p
, const QColorGroup
& cg
, int column
, int width
, int align
);
193 ConfigItem
* nextItem
;
199 class ConfigLineEdit
: public QLineEdit
{
201 typedef class QLineEdit Parent
;
203 ConfigLineEdit(ConfigView
* parent
);
204 ConfigView
* parent(void) const
206 return (ConfigView
*)Parent::parent();
208 void show(ConfigItem
*i
);
209 void keyPressEvent(QKeyEvent
*e
);
215 class ConfigView
: public QVBox
{
217 typedef class QVBox Parent
;
219 ConfigView(QWidget
* parent
, const char *name
= 0);
221 static void updateList(ConfigItem
* item
);
222 static void updateListAll(void);
224 bool showAll(void) const { return list
->showAll
; }
225 bool showName(void) const { return list
->showName
; }
226 bool showRange(void) const { return list
->showRange
; }
227 bool showData(void) const { return list
->showData
; }
229 void setShowAll(bool);
230 void setShowName(bool);
231 void setShowRange(bool);
232 void setShowData(bool);
234 void showAllChanged(bool);
235 void showNameChanged(bool);
236 void showRangeChanged(bool);
237 void showDataChanged(bool);
240 ConfigLineEdit
* lineEdit
;
242 static ConfigView
* viewList
;
243 ConfigView
* nextView
;
246 class ConfigInfoView
: public QTextBrowser
{
248 typedef class QTextBrowser Parent
;
250 ConfigInfoView(QWidget
* parent
, const char *name
= 0);
251 bool showDebug(void) const { return _showDebug
; }
254 void setInfo(struct menu
*menu
);
255 void saveSettings(void);
256 void setSource(const QString
& name
);
257 void setShowDebug(bool);
260 void showDebugChanged(bool);
264 QString
debug_info(struct symbol
*sym
);
265 static QString
print_filter(const QString
&str
);
266 static void expr_print_help(void *data
, const char *str
);
267 QPopupMenu
* createPopupMenu(const QPoint
& pos
);
268 void contentsContextMenuEvent(QContextMenuEvent
*e
);
274 class ConfigSearchWindow
: public QDialog
{
276 typedef class QDialog Parent
;
278 ConfigSearchWindow(QWidget
* parent
, const char *name
= 0);
281 void saveSettings(void);
285 QLineEdit
* editField
;
286 QPushButton
* searchButton
;
289 ConfigInfoView
* info
;
291 struct symbol
**result
;
294 class ConfigMainWindow
: public QMainWindow
{
297 ConfigMainWindow(void);
299 void setHelp(QListViewItem
* item
);
300 void changeMenu(struct menu
*);
301 void listFocusChanged(void);
303 void loadConfig(void);
304 void saveConfig(void);
305 void saveConfigAs(void);
306 void searchConfig(void);
307 void showSingleView(void);
308 void showSplitView(void);
309 void showFullView(void);
310 void showIntro(void);
311 void showAbout(void);
312 void saveSettings(void);
315 void closeEvent(QCloseEvent
*e
);
317 ConfigSearchWindow
*searchWindow
;
318 ConfigView
*menuView
;
319 ConfigList
*menuList
;
320 ConfigView
*configView
;
321 ConfigList
*configList
;
322 ConfigInfoView
*helpText
;