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