summaryrefslogtreecommitdiff
path: root/scripts/kconfig/qconf.h
Unidiff
Diffstat (limited to 'scripts/kconfig/qconf.h') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/kconfig/qconf.h201
1 files changed, 201 insertions, 0 deletions
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
new file mode 100644
index 0000000..f8f3669
--- a/dev/null
+++ b/scripts/kconfig/qconf.h
@@ -0,0 +1,201 @@
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#include <qlistview.h>
7
8class ConfigLineEdit;
9class ConfigItem;
10class ConfigView;
11
12enum colIdx {
13 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
14};
15enum listMode {
16 singleMode, menuMode, symbolMode, fullMode
17};
18
19class ConfigList : public QListView {
20 Q_OBJECT
21 typedef class QListView Parent;
22public:
23 ConfigList(QWidget* p, ConfigView* cview);
24 void reinit(void);
25
26 ConfigLineEdit* lineEdit;
27protected:
28 ConfigView* cview;
29
30 void keyPressEvent(QKeyEvent *e);
31 void contentsMousePressEvent(QMouseEvent *e);
32 void contentsMouseReleaseEvent(QMouseEvent *e);
33 void contentsMouseMoveEvent(QMouseEvent *e);
34 void contentsMouseDoubleClickEvent(QMouseEvent *e);
35 void focusInEvent(QFocusEvent *e);
36public slots:
37 void setRootMenu(struct menu *menu);
38
39 void updateList(ConfigItem *item);
40 void setValue(ConfigItem* item, tristate val);
41 void changeValue(ConfigItem* item);
42 void updateSelection(void);
43signals:
44 void menuSelected(struct menu *menu);
45 void parentSelected(void);
46 void symbolChanged(ConfigItem* item);
47 void gotFocus(void);
48
49public:
50 void updateListAll(void)
51 {
52 updateAll = true;
53 updateList(NULL);
54 updateAll = false;
55 }
56 ConfigList* listView()
57 {
58 return this;
59 }
60 ConfigItem* firstChild() const
61 {
62 return (ConfigItem *)Parent::firstChild();
63 }
64 int mapIdx(colIdx idx)
65 {
66 return colMap[idx];
67 }
68 void addColumn(colIdx idx, const QString& label)
69 {
70 colMap[idx] = Parent::addColumn(label);
71 colRevMap[colMap[idx]] = idx;
72 }
73 void removeColumn(colIdx idx)
74 {
75 int col = colMap[idx];
76 if (col >= 0) {
77 Parent::removeColumn(col);
78 colRevMap[col] = colMap[idx] = -1;
79 }
80 }
81 void setAllOpen(bool open);
82 void setParentMenu(void);
83
84 bool updateAll;
85
86 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
87 QPixmap choiceYesPix, choiceNoPix, menuPix, menuInvPix;
88
89 bool showAll, showName, showRange, showData;
90 enum listMode mode;
91 struct menu *rootEntry;
92 QColorGroup disabledColorGroup;
93 QColorGroup inactivedColorGroup;
94
95private:
96 int colMap[colNr];
97 int colRevMap[colNr];
98};
99
100class ConfigItem : public QListViewItem {
101 typedef class QListViewItem Parent;
102public:
103 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m)
104 : Parent(parent, after), menu(m)
105 {
106 init();
107 }
108 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m)
109 : Parent(parent, after), menu(m)
110 {
111 init();
112 }
113 ~ConfigItem(void);
114 void init(void);
115#if QT_VERSION >= 300
116 void okRename(int col);
117#endif
118 void updateMenu(void);
119 ConfigList* listView() const
120 {
121 return (ConfigList*)Parent::listView();
122 }
123 ConfigItem* firstChild() const
124 {
125 return (ConfigItem *)Parent::firstChild();
126 }
127 ConfigItem* nextSibling() const
128 {
129 return (ConfigItem *)Parent::nextSibling();
130 }
131 void setText(colIdx idx, const QString& text)
132 {
133 Parent::setText(listView()->mapIdx(idx), text);
134 }
135 QString text(colIdx idx) const
136 {
137 return Parent::text(listView()->mapIdx(idx));
138 }
139 void setPixmap(colIdx idx, const QPixmap& pm)
140 {
141 Parent::setPixmap(listView()->mapIdx(idx), pm);
142 }
143 const QPixmap* pixmap(colIdx idx) const
144 {
145 return Parent::pixmap(listView()->mapIdx(idx));
146 }
147 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
148
149 struct menu *menu;
150 bool visible;
151 bool doInit;
152};
153
154class ConfigLineEdit : public QLineEdit {
155 Q_OBJECT
156 typedef class QLineEdit Parent;
157public:
158 ConfigLineEdit(QWidget * parent)
159 : QLineEdit(parent)
160 { }
161 void show(ConfigItem *i);
162 void keyPressEvent(QKeyEvent *e);
163signals:
164 void lineChanged(ConfigItem *item);
165
166public:
167 ConfigItem *item;
168};
169
170class ConfigView : public QMainWindow {
171 Q_OBJECT
172public:
173 ConfigView(void);
174public slots:
175 void setHelp(QListViewItem* item);
176 void changeMenu(struct menu *);
177 void listFocusChanged(void);
178 void goBack(void);
179 void loadConfig(void);
180 void saveConfig(void);
181 void saveConfigAs(void);
182 void showSingleView(void);
183 void showSplitView(void);
184 void showFullView(void);
185 void setShowAll(bool);
186 void setShowDebug(bool);
187 void setShowRange(bool);
188 void setShowName(bool);
189 void setShowData(bool);
190
191protected:
192 void closeEvent(QCloseEvent *e);
193
194 ConfigList *menuList;
195 ConfigList *configList;
196 QTextView *helpText;
197 QToolBar *toolBar;
198 QAction *backAction;
199
200 bool showDebug;
201};