2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
16 class ConfigMainWindow
;
19 class ConfigSettings
: public QSettings
{
24 void readListSettings();
25 QValueList
<int> readSizes(const QString
& key
, bool *ok
);
26 bool writeSizes(const QString
& key
, const QValueList
<int>& value
);
35 class ConfigView
: public QVBox
{
37 typedef class QVBox Parent
;
39 ConfigView(QWidget
* parent
, ConfigSettings
* configSettings
);
41 static void updateList(ConfigItem
* item
);
42 static void updateListAll(void);
46 ConfigLineEdit
* lineEdit
;
48 static ConfigView
* viewList
;
53 promptColIdx
, nameColIdx
, noColIdx
, modColIdx
, yesColIdx
, dataColIdx
, colNr
56 singleMode
, menuMode
, symbolMode
, fullMode
, listMode
59 class ConfigList
: public QListView
{
61 typedef class QListView Parent
;
63 ConfigList(ConfigView
* p
, ConfigSettings
*configSettings
);
65 ConfigView
* parent(void) const
67 return (ConfigView
*)Parent::parent();
71 void keyPressEvent(QKeyEvent
*e
);
72 void contentsMousePressEvent(QMouseEvent
*e
);
73 void contentsMouseReleaseEvent(QMouseEvent
*e
);
74 void contentsMouseMoveEvent(QMouseEvent
*e
);
75 void contentsMouseDoubleClickEvent(QMouseEvent
*e
);
76 void focusInEvent(QFocusEvent
*e
);
78 void setRootMenu(struct menu
*menu
);
80 void updateList(ConfigItem
*item
);
81 void setValue(ConfigItem
* item
, tristate val
);
82 void changeValue(ConfigItem
* item
);
83 void updateSelection(void);
85 void menuChanged(struct menu
*menu
);
86 void menuSelected(struct menu
*menu
);
87 void parentSelected(void);
91 void updateListAll(void)
97 ConfigList
* listView()
101 ConfigItem
* firstChild() const
103 return (ConfigItem
*)Parent::firstChild();
105 int mapIdx(colIdx idx
)
109 void addColumn(colIdx idx
, const QString
& label
)
111 colMap
[idx
] = Parent::addColumn(label
);
112 colRevMap
[colMap
[idx
]] = idx
;
114 void removeColumn(colIdx idx
)
116 int col
= colMap
[idx
];
118 Parent::removeColumn(col
);
119 colRevMap
[col
] = colMap
[idx
] = -1;
122 void setAllOpen(bool open
);
123 void setParentMenu(void);
126 void updateMenuList(P
*, struct menu
*);
130 QPixmap symbolYesPix
, symbolModPix
, symbolNoPix
;
131 QPixmap choiceYesPix
, choiceNoPix
;
132 QPixmap menuPix
, menuInvPix
, menuBackPix
, voidPix
;
134 bool showAll
, showName
, showRange
, showData
;
136 struct menu
*rootEntry
;
137 QColorGroup disabledColorGroup
;
138 QColorGroup inactivedColorGroup
;
142 int colRevMap
[colNr
];
145 class ConfigItem
: public QListViewItem
{
146 typedef class QListViewItem Parent
;
148 ConfigItem(QListView
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
149 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
153 ConfigItem(ConfigItem
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
154 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
158 ConfigItem(QListView
*parent
, ConfigItem
*after
, bool v
)
159 : Parent(parent
, after
), menu(0), visible(v
), goParent(true)
165 #if QT_VERSION >= 300
166 void okRename(int col
);
168 void updateMenu(void);
169 void testUpdateMenu(bool v
);
170 ConfigList
* listView() const
172 return (ConfigList
*)Parent::listView();
174 ConfigItem
* firstChild() const
176 return (ConfigItem
*)Parent::firstChild();
178 ConfigItem
* nextSibling() const
180 return (ConfigItem
*)Parent::nextSibling();
182 void setText(colIdx idx
, const QString
& text
)
184 Parent::setText(listView()->mapIdx(idx
), text
);
186 QString
text(colIdx idx
) const
188 return Parent::text(listView()->mapIdx(idx
));
190 void setPixmap(colIdx idx
, const QPixmap
& pm
)
192 Parent::setPixmap(listView()->mapIdx(idx
), pm
);
194 const QPixmap
* pixmap(colIdx idx
) const
196 return Parent::pixmap(listView()->mapIdx(idx
));
198 void paintCell(QPainter
* p
, const QColorGroup
& cg
, int column
, int width
, int align
);
200 ConfigItem
* nextItem
;
206 class ConfigLineEdit
: public QLineEdit
{
208 typedef class QLineEdit Parent
;
210 ConfigLineEdit(ConfigView
* parent
);
211 ConfigView
* parent(void) const
213 return (ConfigView
*)Parent::parent();
215 void show(ConfigItem
*i
);
216 void keyPressEvent(QKeyEvent
*e
);
222 class ConfigInfoView
: public QTextBrowser
{
224 typedef class QTextBrowser Parent
;
226 ConfigInfoView(QWidget
* parent
, const char *name
= 0);
227 bool showDebug(void) const { return _showDebug
; }
230 void setInfo(struct menu
*menu
);
231 void setSource(const QString
& name
);
232 void setShowDebug(bool);
235 void showDebugChanged(bool);
239 QString
debug_info(struct symbol
*sym
);
240 static QString
print_filter(const QString
&str
);
241 static void expr_print_help(void *data
, const char *str
);
247 class ConfigSearchWindow
: public QDialog
{
249 typedef class QDialog Parent
;
251 ConfigSearchWindow(QWidget
* parent
);
255 QLineEdit
* editField
;
256 QPushButton
* searchButton
;
258 ConfigInfoView
* info
;
260 struct symbol
**result
;
263 class ConfigMainWindow
: public QMainWindow
{
266 ConfigMainWindow(void);
268 void setHelp(QListViewItem
* item
);
269 void changeMenu(struct menu
*);
270 void listFocusChanged(void);
272 void loadConfig(void);
273 void saveConfig(void);
274 void saveConfigAs(void);
275 void searchConfig(void);
276 void showSingleView(void);
277 void showSplitView(void);
278 void showFullView(void);
279 void setShowAll(bool);
280 void setShowRange(bool);
281 void setShowName(bool);
282 void setShowData(bool);
283 void showIntro(void);
284 void showAbout(void);
285 void saveSettings(void);
288 void closeEvent(QCloseEvent
*e
);
290 ConfigSearchWindow
*searchWindow
;
291 ConfigView
*menuView
;
292 ConfigList
*menuList
;
293 ConfigView
*configView
;
294 ConfigList
*configList
;
295 ConfigInfoView
*helpText
;