Linux Audio

Check our new training course

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