Linux Audio

Check our new training course

Loading...
v3.15
 
  1/*
  2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  3 * Released under the terms of the GNU GPL v2.0.
  4 */
  5
  6#if QT_VERSION < 0x040000
  7#include <qlistview.h>
  8#else
  9#include <q3listview.h>
 10#endif
 11#include <qsettings.h>
 12
 13#if QT_VERSION < 0x040000
 14#define Q3ValueList             QValueList
 15#define Q3PopupMenu             QPopupMenu
 16#define Q3ListView              QListView
 17#define Q3ListViewItem          QListViewItem
 18#define Q3VBox                  QVBox
 19#define Q3TextBrowser           QTextBrowser
 20#define Q3MainWindow            QMainWindow
 21#define Q3Action                QAction
 22#define Q3ToolBar               QToolBar
 23#define Q3ListViewItemIterator  QListViewItemIterator
 24#define Q3FileDialog            QFileDialog
 25#endif
 26
 27class ConfigView;
 28class ConfigList;
 29class ConfigItem;
 30class ConfigLineEdit;
 31class ConfigMainWindow;
 32
 33class ConfigSettings : public QSettings {
 34public:
 35	ConfigSettings();
 36	Q3ValueList<int> readSizes(const QString& key, bool *ok);
 37	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 38};
 39
 40enum colIdx {
 41	promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
 42};
 43enum listMode {
 44	singleMode, menuMode, symbolMode, fullMode, listMode
 45};
 46enum optionMode {
 47	normalOpt = 0, allOpt, promptOpt
 48};
 49
 50class ConfigList : public Q3ListView {
 51	Q_OBJECT
 52	typedef class Q3ListView Parent;
 53public:
 54	ConfigList(ConfigView* p, const char *name = 0);
 55	void reinit(void);
 
 56	ConfigView* parent(void) const
 57	{
 58		return (ConfigView*)Parent::parent();
 59	}
 60	ConfigItem* findConfigItem(struct menu *);
 
 
 
 
 
 61
 62protected:
 63	void keyPressEvent(QKeyEvent *e);
 64	void contentsMousePressEvent(QMouseEvent *e);
 65	void contentsMouseReleaseEvent(QMouseEvent *e);
 66	void contentsMouseMoveEvent(QMouseEvent *e);
 67	void contentsMouseDoubleClickEvent(QMouseEvent *e);
 68	void focusInEvent(QFocusEvent *e);
 69	void contextMenuEvent(QContextMenuEvent *e);
 70
 71public slots:
 72	void setRootMenu(struct menu *menu);
 73
 74	void updateList(ConfigItem *item);
 75	void setValue(ConfigItem* item, tristate val);
 76	void changeValue(ConfigItem* item);
 77	void updateSelection(void);
 78	void saveSettings(void);
 
 
 79signals:
 80	void menuChanged(struct menu *menu);
 81	void menuSelected(struct menu *menu);
 
 82	void parentSelected(void);
 83	void gotFocus(struct menu *);
 84
 85public:
 86	void updateListAll(void)
 87	{
 88		updateAll = true;
 89		updateList(NULL);
 90		updateAll = false;
 91	}
 92	ConfigList* listView()
 93	{
 94		return this;
 95	}
 96	ConfigItem* firstChild() const
 97	{
 98		return (ConfigItem *)Parent::firstChild();
 99	}
100	int mapIdx(colIdx idx)
101	{
102		return colMap[idx];
103	}
104	void addColumn(colIdx idx, const QString& label)
105	{
106		colMap[idx] = Parent::addColumn(label);
107		colRevMap[colMap[idx]] = idx;
108	}
109	void removeColumn(colIdx idx)
110	{
111		int col = colMap[idx];
112		if (col >= 0) {
113			Parent::removeColumn(col);
114			colRevMap[col] = colMap[idx] = -1;
115		}
116	}
117	void setAllOpen(bool open);
118	void setParentMenu(void);
119
120	bool menuSkip(struct menu *);
121
122	template <class P>
123	void updateMenuList(P*, struct menu*);
124
125	bool updateAll;
126
127	QPixmap symbolYesPix, symbolModPix, symbolNoPix;
128	QPixmap choiceYesPix, choiceNoPix;
129	QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
130
131	bool showName, showRange, showData;
132	enum listMode mode;
133	enum optionMode optMode;
134	struct menu *rootEntry;
135	QColorGroup disabledColorGroup;
136	QColorGroup inactivedColorGroup;
137	Q3PopupMenu* headerPopup;
138
139private:
140	int colMap[colNr];
141	int colRevMap[colNr];
142};
143
144class ConfigItem : public Q3ListViewItem {
145	typedef class Q3ListViewItem Parent;
146public:
147	ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
148	: Parent(parent, after), menu(m), visible(v), goParent(false)
149	{
150		init();
151	}
152	ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
153	: Parent(parent, after), menu(m), visible(v), goParent(false)
154	{
155		init();
156	}
157	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
158	: Parent(parent, after), menu(0), visible(v), goParent(true)
159	{
160		init();
161	}
162	~ConfigItem(void);
163	void init(void);
164	void okRename(int col);
165	void updateMenu(void);
166	void testUpdateMenu(bool v);
167	ConfigList* listView() const
168	{
169		return (ConfigList*)Parent::listView();
170	}
171	ConfigItem* firstChild() const
172	{
173		return (ConfigItem *)Parent::firstChild();
174	}
175	ConfigItem* nextSibling() const
176	{
177		return (ConfigItem *)Parent::nextSibling();
178	}
179	void setText(colIdx idx, const QString& text)
180	{
181		Parent::setText(listView()->mapIdx(idx), text);
182	}
183	QString text(colIdx idx) const
184	{
185		return Parent::text(listView()->mapIdx(idx));
186	}
187	void setPixmap(colIdx idx, const QPixmap& pm)
188	{
189		Parent::setPixmap(listView()->mapIdx(idx), pm);
190	}
191	const QPixmap* pixmap(colIdx idx) const
192	{
193		return Parent::pixmap(listView()->mapIdx(idx));
 
 
 
 
 
 
 
 
 
 
194	}
195	void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
196
197	ConfigItem* nextItem;
198	struct menu *menu;
199	bool visible;
200	bool goParent;
 
 
 
 
201};
202
203class ConfigLineEdit : public QLineEdit {
204	Q_OBJECT
205	typedef class QLineEdit Parent;
206public:
207	ConfigLineEdit(ConfigView* parent);
208	ConfigView* parent(void) const
209	{
210		return (ConfigView*)Parent::parent();
211	}
212	void show(ConfigItem *i);
213	void keyPressEvent(QKeyEvent *e);
214
215public:
216	ConfigItem *item;
217};
218
219class ConfigView : public Q3VBox {
220	Q_OBJECT
221	typedef class Q3VBox Parent;
222public:
223	ConfigView(QWidget* parent, const char *name = 0);
224	~ConfigView(void);
225	static void updateList(ConfigItem* item);
226	static void updateListAll(void);
227
228	bool showName(void) const { return list->showName; }
229	bool showRange(void) const { return list->showRange; }
230	bool showData(void) const { return list->showData; }
231public slots:
232	void setShowName(bool);
233	void setShowRange(bool);
234	void setShowData(bool);
235	void setOptionMode(QAction *);
236signals:
237	void showNameChanged(bool);
238	void showRangeChanged(bool);
239	void showDataChanged(bool);
240public:
241	ConfigList* list;
242	ConfigLineEdit* lineEdit;
243
244	static ConfigView* viewList;
245	ConfigView* nextView;
246
247	static QAction *showNormalAction;
248	static QAction *showAllAction;
249	static QAction *showPromptAction;
250};
251
252class ConfigInfoView : public Q3TextBrowser {
253	Q_OBJECT
254	typedef class Q3TextBrowser Parent;
 
255public:
256	ConfigInfoView(QWidget* parent, const char *name = 0);
257	bool showDebug(void) const { return _showDebug; }
258
259public slots:
260	void setInfo(struct menu *menu);
261	void saveSettings(void);
262	void setShowDebug(bool);
 
263
264signals:
265	void showDebugChanged(bool);
266	void menuSelected(struct menu *);
267
268protected:
269	void symbolInfo(void);
270	void menuInfo(void);
271	QString debug_info(struct symbol *sym);
272	static QString print_filter(const QString &str);
273	static void expr_print_help(void *data, struct symbol *sym, const char *str);
274	Q3PopupMenu* createPopupMenu(const QPoint& pos);
275	void contentsContextMenuEvent(QContextMenuEvent *e);
276
277	struct symbol *sym;
278	struct menu *_menu;
279	bool _showDebug;
280};
281
282class ConfigSearchWindow : public QDialog {
283	Q_OBJECT
284	typedef class QDialog Parent;
285public:
286	ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
287
288public slots:
289	void saveSettings(void);
290	void search(void);
291
292protected:
293	QLineEdit* editField;
294	QPushButton* searchButton;
295	QSplitter* split;
296	ConfigView* list;
297	ConfigInfoView* info;
298
299	struct symbol **result;
300};
301
302class ConfigMainWindow : public Q3MainWindow {
303	Q_OBJECT
304
305	static Q3Action *saveAction;
 
306	static void conf_changed(void);
307public:
308	ConfigMainWindow(void);
309public slots:
310	void changeMenu(struct menu *);
 
311	void setMenuLink(struct menu *);
312	void listFocusChanged(void);
313	void goBack(void);
314	void loadConfig(void);
315	bool saveConfig(void);
316	void saveConfigAs(void);
317	void searchConfig(void);
318	void showSingleView(void);
319	void showSplitView(void);
320	void showFullView(void);
321	void showIntro(void);
322	void showAbout(void);
323	void saveSettings(void);
324
325protected:
326	void closeEvent(QCloseEvent *e);
327
328	ConfigSearchWindow *searchWindow;
329	ConfigView *menuView;
330	ConfigList *menuList;
331	ConfigView *configView;
332	ConfigList *configList;
333	ConfigInfoView *helpText;
334	Q3ToolBar *toolBar;
335	Q3Action *backAction;
336	QSplitter* split1;
337	QSplitter* split2;
 
 
338};
v5.9
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
 
  4 */
  5
  6#include <QCheckBox>
  7#include <QDialog>
  8#include <QHeaderView>
  9#include <QLineEdit>
 10#include <QMainWindow>
 11#include <QPushButton>
 12#include <QSettings>
 13#include <QSplitter>
 14#include <QTextBrowser>
 15#include <QTreeWidget>
 16
 17#include "expr.h"
 
 
 
 
 
 
 
 
 18
 19class ConfigView;
 20class ConfigList;
 21class ConfigItem;
 22class ConfigLineEdit;
 23class ConfigMainWindow;
 24
 25class ConfigSettings : public QSettings {
 26public:
 27	ConfigSettings();
 28	QList<int> readSizes(const QString& key, bool *ok);
 29	bool writeSizes(const QString& key, const QList<int>& value);
 30};
 31
 32enum colIdx {
 33	promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx
 34};
 35enum listMode {
 36	singleMode, menuMode, symbolMode, fullMode, listMode
 37};
 38enum optionMode {
 39	normalOpt = 0, allOpt, promptOpt
 40};
 41
 42class ConfigList : public QTreeWidget {
 43	Q_OBJECT
 44	typedef class QTreeWidget Parent;
 45public:
 46	ConfigList(ConfigView* p, const char *name = 0);
 47	void reinit(void);
 48	ConfigItem* findConfigItem(struct menu *);
 49	ConfigView* parent(void) const
 50	{
 51		return (ConfigView*)Parent::parent();
 52	}
 53	void setSelected(QTreeWidgetItem *item, bool enable) {
 54		for (int i = 0; i < selectedItems().size(); i++)
 55			selectedItems().at(i)->setSelected(false);
 56
 57		item->setSelected(enable);
 58	}
 59
 60protected:
 61	void keyPressEvent(QKeyEvent *e);
 62	void mousePressEvent(QMouseEvent *e);
 63	void mouseReleaseEvent(QMouseEvent *e);
 64	void mouseMoveEvent(QMouseEvent *e);
 65	void mouseDoubleClickEvent(QMouseEvent *e);
 66	void focusInEvent(QFocusEvent *e);
 67	void contextMenuEvent(QContextMenuEvent *e);
 68
 69public slots:
 70	void setRootMenu(struct menu *menu);
 71
 72	void updateList();
 73	void setValue(ConfigItem* item, tristate val);
 74	void changeValue(ConfigItem* item);
 75	void updateSelection(void);
 76	void saveSettings(void);
 77	void setOptionMode(QAction *action);
 78
 79signals:
 80	void menuChanged(struct menu *menu);
 81	void menuSelected(struct menu *menu);
 82	void itemSelected(struct menu *menu);
 83	void parentSelected(void);
 84	void gotFocus(struct menu *);
 85
 86public:
 87	void updateListAll(void)
 88	{
 89		updateAll = true;
 90		updateList();
 91		updateAll = false;
 92	}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 93	void setAllOpen(bool open);
 94	void setParentMenu(void);
 95
 96	bool menuSkip(struct menu *);
 97
 98	void updateMenuList(ConfigItem *parent, struct menu*);
 99	void updateMenuList(struct menu *menu);
100
101	bool updateAll;
102
 
 
 
 
103	bool showName, showRange, showData;
104	enum listMode mode;
105	enum optionMode optMode;
106	struct menu *rootEntry;
107	QPalette disabledColorGroup;
108	QPalette inactivedColorGroup;
109	QMenu* headerPopup;
110
111	static QAction *showNormalAction, *showAllAction, *showPromptAction;
 
 
112};
113
114class ConfigItem : public QTreeWidgetItem {
115	typedef class QTreeWidgetItem Parent;
116public:
117	ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v)
118	: Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
119	{
120		init();
121	}
122	ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
123	: Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
124	{
125		init();
126	}
127	ConfigItem(ConfigList *parent, ConfigItem *after, bool v)
128	: Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true)
129	{
130		init();
131	}
132	~ConfigItem(void);
133	void init(void);
134	void okRename(int col);
135	void updateMenu(void);
136	void testUpdateMenu(bool v);
137	ConfigList* listView() const
138	{
139		return (ConfigList*)Parent::treeWidget();
140	}
141	ConfigItem* firstChild() const
142	{
143		return (ConfigItem *)Parent::child(0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144	}
145	ConfigItem* nextSibling()
146	{
147		ConfigItem *ret = NULL;
148		ConfigItem *_parent = (ConfigItem *)parent();
149
150		if(_parent) {
151			ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1);
152		} else {
153			QTreeWidget *_treeWidget = treeWidget();
154			ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1);
155		}
156
157		return ret;
158	}
159	// TODO: Implement paintCell
160
161	ConfigItem* nextItem;
162	struct menu *menu;
163	bool visible;
164	bool goParent;
165
166	static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
167	static QIcon choiceYesIcon, choiceNoIcon;
168	static QIcon menuIcon, menubackIcon;
169};
170
171class ConfigLineEdit : public QLineEdit {
172	Q_OBJECT
173	typedef class QLineEdit Parent;
174public:
175	ConfigLineEdit(ConfigView* parent);
176	ConfigView* parent(void) const
177	{
178		return (ConfigView*)Parent::parent();
179	}
180	void show(ConfigItem *i);
181	void keyPressEvent(QKeyEvent *e);
182
183public:
184	ConfigItem *item;
185};
186
187class ConfigView : public QWidget {
188	Q_OBJECT
189	typedef class QWidget Parent;
190public:
191	ConfigView(QWidget* parent, const char *name = 0);
192	~ConfigView(void);
193	static void updateList();
194	static void updateListAll(void);
195
196	bool showName(void) const { return list->showName; }
197	bool showRange(void) const { return list->showRange; }
198	bool showData(void) const { return list->showData; }
199public slots:
200	void setShowName(bool);
201	void setShowRange(bool);
202	void setShowData(bool);
 
203signals:
204	void showNameChanged(bool);
205	void showRangeChanged(bool);
206	void showDataChanged(bool);
207public:
208	ConfigList* list;
209	ConfigLineEdit* lineEdit;
210
211	static ConfigView* viewList;
212	ConfigView* nextView;
 
 
 
 
213};
214
215class ConfigInfoView : public QTextBrowser {
216	Q_OBJECT
217	typedef class QTextBrowser Parent;
218	QMenu *contextMenu;
219public:
220	ConfigInfoView(QWidget* parent, const char *name = 0);
221	bool showDebug(void) const { return _showDebug; }
222
223public slots:
224	void setInfo(struct menu *menu);
225	void saveSettings(void);
226	void setShowDebug(bool);
227	void clicked (const QUrl &url);
228
229signals:
230	void showDebugChanged(bool);
231	void menuSelected(struct menu *);
232
233protected:
234	void symbolInfo(void);
235	void menuInfo(void);
236	QString debug_info(struct symbol *sym);
237	static QString print_filter(const QString &str);
238	static void expr_print_help(void *data, struct symbol *sym, const char *str);
239	void contextMenuEvent(QContextMenuEvent *event);
 
240
241	struct symbol *sym;
242	struct menu *_menu;
243	bool _showDebug;
244};
245
246class ConfigSearchWindow : public QDialog {
247	Q_OBJECT
248	typedef class QDialog Parent;
249public:
250	ConfigSearchWindow(ConfigMainWindow *parent);
251
252public slots:
253	void saveSettings(void);
254	void search(void);
255
256protected:
257	QLineEdit* editField;
258	QPushButton* searchButton;
259	QSplitter* split;
260	ConfigView* list;
261	ConfigInfoView* info;
262
263	struct symbol **result;
264};
265
266class ConfigMainWindow : public QMainWindow {
267	Q_OBJECT
268
269	char *configname;
270	static QAction *saveAction;
271	static void conf_changed(void);
272public:
273	ConfigMainWindow(void);
274public slots:
275	void changeMenu(struct menu *);
276	void changeItens(struct menu *);
277	void setMenuLink(struct menu *);
278	void listFocusChanged(void);
279	void goBack(void);
280	void loadConfig(void);
281	bool saveConfig(void);
282	void saveConfigAs(void);
283	void searchConfig(void);
284	void showSingleView(void);
285	void showSplitView(void);
286	void showFullView(void);
287	void showIntro(void);
288	void showAbout(void);
289	void saveSettings(void);
290
291protected:
292	void closeEvent(QCloseEvent *e);
293
294	ConfigSearchWindow *searchWindow;
295	ConfigView *menuView;
296	ConfigList *menuList;
297	ConfigView *configView;
298	ConfigList *configList;
299	ConfigInfoView *helpText;
300	QAction *backAction;
301	QAction *singleViewAction;
302	QAction *splitViewAction;
303	QAction *fullViewAction;
304	QSplitter *split1;
305	QSplitter *split2;
306};