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
, ConfigMainWindow
* cview
, 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
59 class ConfigList
: public QListView
{
61 typedef class QListView Parent
;
63 ConfigList(ConfigView
* p
, ConfigMainWindow
* cview
, ConfigSettings
*configSettings
);
65 ConfigView
* parent(void) const
67 return (ConfigView
*)Parent::parent();
71 ConfigMainWindow
* cview
;
73 void keyPressEvent(QKeyEvent
*e
);
74 void contentsMousePressEvent(QMouseEvent
*e
);
75 void contentsMouseReleaseEvent(QMouseEvent
*e
);
76 void contentsMouseMoveEvent(QMouseEvent
*e
);
77 void contentsMouseDoubleClickEvent(QMouseEvent
*e
);
78 void focusInEvent(QFocusEvent
*e
);
80 void setRootMenu(struct menu
*menu
);
82 void updateList(ConfigItem
*item
);
83 void setValue(ConfigItem
* item
, tristate val
);
84 void changeValue(ConfigItem
* item
);
85 void updateSelection(void);
87 void menuSelected(struct menu
*menu
);
88 void parentSelected(void);
92 void updateListAll(void)
98 ConfigList
* listView()
102 ConfigItem
* firstChild() const
104 return (ConfigItem
*)Parent::firstChild();
106 int mapIdx(colIdx idx
)
110 void addColumn(colIdx idx
, const QString
& label
)
112 colMap
[idx
] = Parent::addColumn(label
);
113 colRevMap
[colMap
[idx
]] = idx
;
115 void removeColumn(colIdx idx
)
117 int col
= colMap
[idx
];
119 Parent::removeColumn(col
);
120 colRevMap
[col
] = colMap
[idx
] = -1;
123 void setAllOpen(bool open
);
124 void setParentMenu(void);
127 void updateMenuList(P
*, struct menu
*);
131 QPixmap symbolYesPix
, symbolModPix
, symbolNoPix
;
132 QPixmap choiceYesPix
, choiceNoPix
;
133 QPixmap menuPix
, menuInvPix
, menuBackPix
, voidPix
;
135 bool showAll
, showName
, showRange
, showData
;
137 struct menu
*rootEntry
;
138 QColorGroup disabledColorGroup
;
139 QColorGroup inactivedColorGroup
;
143 int colRevMap
[colNr
];
146 class ConfigItem
: public QListViewItem
{
147 typedef class QListViewItem Parent
;
149 ConfigItem(QListView
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
150 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
154 ConfigItem(ConfigItem
*parent
, ConfigItem
*after
, struct menu
*m
, bool v
)
155 : Parent(parent
, after
), menu(m
), visible(v
), goParent(false)
159 ConfigItem(QListView
*parent
, ConfigItem
*after
, bool v
)
160 : Parent(parent
, after
), menu(0), visible(v
), goParent(true)
166 #if QT_VERSION >= 300
167 void okRename(int col
);
169 void updateMenu(void);
170 void testUpdateMenu(bool v
);
171 ConfigList
* listView() const
173 return (ConfigList
*)Parent::listView();
175 ConfigItem
* firstChild() const
177 return (ConfigItem
*)Parent::firstChild();
179 ConfigItem
* nextSibling() const
181 return (ConfigItem
*)Parent::nextSibling();
183 void setText(colIdx idx
, const QString
& text
)
185 Parent::setText(listView()->mapIdx(idx
), text
);
187 QString
text(colIdx idx
) const
189 return Parent::text(listView()->mapIdx(idx
));
191 void setPixmap(colIdx idx
, const QPixmap
& pm
)
193 Parent::setPixmap(listView()->mapIdx(idx
), pm
);
195 const QPixmap
* pixmap(colIdx idx
) const
197 return Parent::pixmap(listView()->mapIdx(idx
));
199 void paintCell(QPainter
* p
, const QColorGroup
& cg
, int column
, int width
, int align
);
201 ConfigItem
* nextItem
;
207 class ConfigLineEdit
: public QLineEdit
{
209 typedef class QLineEdit Parent
;
211 ConfigLineEdit(ConfigView
* parent
)
214 ConfigView
* parent(void) const
216 return (ConfigView
*)Parent::parent();
218 void show(ConfigItem
*i
);
219 void keyPressEvent(QKeyEvent
*e
);
225 class ConfigMainWindow
: public QMainWindow
{
228 ConfigMainWindow(void);
230 void setHelp(QListViewItem
* item
);
231 void changeMenu(struct menu
*);
232 void listFocusChanged(void);
234 void loadConfig(void);
235 void saveConfig(void);
236 void saveConfigAs(void);
237 void showSingleView(void);
238 void showSplitView(void);
239 void showFullView(void);
240 void setShowAll(bool);
241 void setShowDebug(bool);
242 void setShowRange(bool);
243 void setShowName(bool);
244 void setShowData(bool);
245 void showIntro(void);
246 void showAbout(void);
247 void saveSettings(void);
250 void closeEvent(QCloseEvent
*e
);
252 ConfigView
*menuView
;
253 ConfigList
*menuList
;
254 ConfigView
*configView
;
255 ConfigList
*configList
;