qconf.h 3.8 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5
/*
 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
 * Released under the terms of the GNU GPL v2.0.
 */

A
Alexander Stein 已提交
6
#include <q3listview.h>
7
#include <QMainWindow>
A
Alexander Stein 已提交
8 9
#include <qsettings.h>

10
class ConfigView;
L
Linus Torvalds 已提交
11 12 13 14 15
class ConfigLineEdit;
class ConfigMainWindow;

class ConfigSettings : public QSettings {
public:
16
	ConfigSettings();
17 18
	QList<int> readSizes(const QString& key, bool *ok);
	bool writeSizes(const QString& key, const QList<int>& value);
L
Linus Torvalds 已提交
19 20 21 22 23 24
};

enum colIdx {
	promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
};
enum listMode {
25
	singleMode, menuMode, symbolMode, fullMode, listMode
L
Linus Torvalds 已提交
26
};
27 28 29
enum optionMode {
	normalOpt = 0, allOpt, promptOpt
};
L
Linus Torvalds 已提交
30 31 32 33 34

class ConfigLineEdit : public QLineEdit {
	Q_OBJECT
	typedef class QLineEdit Parent;
public:
35
	ConfigLineEdit(ConfigView* parent);
L
Linus Torvalds 已提交
36 37 38 39
	ConfigView* parent(void) const
	{
		return (ConfigView*)Parent::parent();
	}
40
	void show(Q3ListViewItem *i);
L
Linus Torvalds 已提交
41 42 43
	void keyPressEvent(QKeyEvent *e);

public:
44
	Q3ListViewItem *item;
L
Linus Torvalds 已提交
45 46
};

47
class ConfigView : public QWidget {
48
	Q_OBJECT
49
	typedef class QWidget Parent;
50 51 52
public:
	ConfigView(QWidget* parent, const char *name = 0);
	~ConfigView(void);
53
	static void updateList(Q3ListViewItem* item);
54 55
	static void updateListAll(void);

56 57 58
	bool showName(void) const { return false; } // TODO: Implement me.
	bool showRange(void) const { return false; } // TODO: Implement me.
	bool showData(void) const { return false; } // TODO: Implement me.
59 60 61 62
public slots:
	void setShowName(bool);
	void setShowRange(bool);
	void setShowData(bool);
63
	void setOptionMode(QAction *);
64 65 66 67 68
signals:
	void showNameChanged(bool);
	void showRangeChanged(bool);
	void showDataChanged(bool);
public:
69
	Q3ListView* list;
70 71 72 73
	ConfigLineEdit* lineEdit;

	static ConfigView* viewList;
	ConfigView* nextView;
74 75 76 77

	static QAction *showNormalAction;
	static QAction *showAllAction;
	static QAction *showPromptAction;
78 79
};

80
class ConfigInfoView : public QTextBrowser {
81
	Q_OBJECT
82
	typedef class QTextBrowser Parent;
83 84 85 86 87 88
public:
	ConfigInfoView(QWidget* parent, const char *name = 0);
	bool showDebug(void) const { return _showDebug; }

public slots:
	void setInfo(struct menu *menu);
89
	void saveSettings(void);
90 91 92 93
	void setShowDebug(bool);

signals:
	void showDebugChanged(bool);
94
	void menuSelected(struct menu *);
95 96

protected:
97
	void symbolInfo(void);
98 99 100
	void menuInfo(void);
	QString debug_info(struct symbol *sym);
	static QString print_filter(const QString &str);
101
	static void expr_print_help(void *data, struct symbol *sym, const char *str);
102 103
	QMenu *createStandardContextMenu(const QPoint & pos);
	void contextMenuEvent(QContextMenuEvent *e);
104

105
	struct symbol *sym;
A
Alexander Stein 已提交
106
	struct menu *_menu;
107 108 109 110 111 112 113
	bool _showDebug;
};

class ConfigSearchWindow : public QDialog {
	Q_OBJECT
	typedef class QDialog Parent;
public:
114
	ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
115

116
public slots:
117
	void saveSettings(void);
118
	void search(void);
119

120 121 122
protected:
	QLineEdit* editField;
	QPushButton* searchButton;
123
	QSplitter* split;
124 125 126 127 128 129
	ConfigView* list;
	ConfigInfoView* info;

	struct symbol **result;
};

130
class ConfigMainWindow : public QMainWindow {
L
Linus Torvalds 已提交
131
	Q_OBJECT
132

133
	static QAction *saveAction;
134
	static void conf_changed(void);
L
Linus Torvalds 已提交
135 136 137 138
public:
	ConfigMainWindow(void);
public slots:
	void changeMenu(struct menu *);
139
	void setMenuLink(struct menu *);
L
Linus Torvalds 已提交
140 141 142
	void listFocusChanged(void);
	void goBack(void);
	void loadConfig(void);
143
	bool saveConfig(void);
L
Linus Torvalds 已提交
144
	void saveConfigAs(void);
145
	void searchConfig(void);
L
Linus Torvalds 已提交
146 147 148 149 150 151 152 153 154 155
	void showSingleView(void);
	void showSplitView(void);
	void showFullView(void);
	void showIntro(void);
	void showAbout(void);
	void saveSettings(void);

protected:
	void closeEvent(QCloseEvent *e);

156
	ConfigSearchWindow *searchWindow;
L
Linus Torvalds 已提交
157
	ConfigView *menuView;
158
	Q3ListView *menuList;
L
Linus Torvalds 已提交
159
	ConfigView *configView;
160
	Q3ListView *configList;
161
	ConfigInfoView *helpText;
162
	QToolBar *toolBar;
163
	QAction *backAction;
164 165 166
	QAction *singleViewAction;
	QAction *splitViewAction;
	QAction *fullViewAction;
167 168
	QSplitter *split1;
	QSplitter *split2;
L
Linus Torvalds 已提交
169
};