2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
11 class ConfigMainWindow
;
13 class ConfigView
: public QVBox
{
15 typedef class QVBox Parent
;
17 ConfigView(QWidget
* parent
, ConfigMainWindow
* cview
);
19 static void updateList(ConfigItem
* item
);
20 static void updateListAll(void);
24 ConfigLineEdit
* lineEdit
;
26 static ConfigView
* viewList
;
31 promptColIdx
, nameColIdx
, noColIdx
, modColIdx
, yesColIdx
, dataColIdx
, colNr
34 singleMode
, menuMode
, symbolMode
, fullMode
37 class ConfigList
: public QListView
{
39 typedef class QListView Parent
;
41 ConfigList(ConfigView
* p
, ConfigMainWindow
* cview
);
43 ConfigView
* parent(void) const
45 return (ConfigView
*)Parent::parent();
49 ConfigMainWindow
* cview
;
51 void keyPressEvent(QKeyEvent
*e
);
52 void contentsMousePressEvent(QMouseEvent
*e
);
53 void contentsMouseReleaseEvent(QMouseEvent
*e
);
54 void contentsMouseMoveEvent(QMouseEvent
*e
);
55 void contentsMouseDoubleClickEvent(QMouseEvent
*e
);
56 void focusInEvent(QFocusEvent
*e
);
58 void setRootMenu(struct menu
*menu
);
60 void updateList(ConfigItem
*item
);
61 void setValue(ConfigItem
* item
, tristate val
);
62 void changeValue(ConfigItem
* item
);
63 void updateSelection(void);
65 void menuSelected(struct menu
*menu
);
66 void parentSelected(void);
70 void updateListAll(void)
76 ConfigList
* listView()
80 ConfigItem
* firstChild() const
82 return (ConfigItem
*)Parent::firstChild();
84 int mapIdx(colIdx idx
)
88 void addColumn(colIdx idx
, const QString
& label
)
90 colMap
[idx
] = Parent::addColumn(label
);
91 colRevMap
[colMap
[idx
]] = idx
;
93 void removeColumn(colIdx idx
)
95 int col
= colMap
[idx
];
97 Parent::removeColumn(col
);
98 colRevMap
[col
] = colMap
[idx
] = -1;
101 void setAllOpen(bool open
);
102 void setParentMenu(void);
105 void ConfigList::updateMenuList(P
*, struct menu
*);
109 QPixmap symbolYesPix
, symbolModPix
, symbolNoPix
;
110 QPixmap choiceYesPix
, choiceNoPix
;
111 QPixmap menuPix
, menuInvPix
, menuBackPix
, voidPix
;
113 bool showAll
, showName
, showRange
, showData
;
115 struct menu
*rootEntry
;
116 QColorGroup disabledColorGroup
;
117 QColorGroup inactivedColorGroup
;
121 int colRevMap
[colNr
];
124 class ConfigItem
: public QListViewItem
{
125 typedef class QListViewItem Parent
;
127 ConfigItem(QListView
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
128 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
132 ConfigItem(ConfigItem
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
133 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
137 ConfigItem(QListView
*parent
, ConfigItem
*after
, bool v
)
138 : Parent(parent
, after
), menu(0), visible(v
), goParent(true)
144 #if QT_VERSION >= 300
145 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
)
192 ConfigView
* parent(void) const
194 return (ConfigView
*)Parent::parent();
196 void show(ConfigItem
*i
);
197 void keyPressEvent(QKeyEvent
*e
);
203 class ConfigMainWindow
: public QMainWindow
{
206 ConfigMainWindow(void);
208 void setHelp(QListViewItem
* item
);
209 void changeMenu(struct menu
*);
210 void listFocusChanged(void);
212 void loadConfig(void);
213 void saveConfig(void);
214 void saveConfigAs(void);
215 void showSingleView(void);
216 void showSplitView(void);
217 void showFullView(void);
218 void setShowAll(bool);
219 void setShowDebug(bool);
220 void setShowRange(bool);
221 void setShowName(bool);
222 void setShowData(bool);
223 void showIntro(void);
224 void showAbout(void);
227 void closeEvent(QCloseEvent
*e
);
229 ConfigView
*menuView
;
230 ConfigList
*menuList
;
231 ConfigView
*configView
;
232 ConfigList
*configList
;