hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/scripts/kconfig/qconf.h
....@@ -1,25 +1,24 @@
1
+/* SPDX-License-Identifier: GPL-2.0 */
12 /*
23 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3
- * Released under the terms of the GNU GPL v2.0.
44 */
55
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>
156 #include <QCheckBox>
167 #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
+
1718 #include "expr.h"
1819
19
-class ConfigView;
2020 class ConfigList;
2121 class ConfigItem;
22
-class ConfigLineEdit;
2322 class ConfigMainWindow;
2423
2524 class ConfigSettings : public QSettings {
....@@ -30,7 +29,7 @@
3029 };
3130
3231 enum colIdx {
33
- promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
32
+ promptColIdx, nameColIdx, dataColIdx
3433 };
3534 enum listMode {
3635 singleMode, menuMode, symbolMode, fullMode, listMode
....@@ -43,13 +42,16 @@
4342 Q_OBJECT
4443 typedef class QTreeWidget Parent;
4544 public:
46
- ConfigList(ConfigView* p, const char *name = 0);
45
+ ConfigList(QWidget *parent, const char *name = 0);
46
+ ~ConfigList();
4747 void reinit(void);
48
- ConfigView* parent(void) const
49
- {
50
- return (ConfigView*)Parent::parent();
51
- }
5248 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
+ }
5355
5456 protected:
5557 void keyPressEvent(QKeyEvent *e);
....@@ -63,39 +65,28 @@
6365 public slots:
6466 void setRootMenu(struct menu *menu);
6567
66
- void updateList(ConfigItem *item);
68
+ void updateList();
6769 void setValue(ConfigItem* item, tristate val);
6870 void changeValue(ConfigItem* item);
6971 void updateSelection(void);
7072 void saveSettings(void);
73
+ void setOptionMode(QAction *action);
74
+ void setShowName(bool on);
75
+
7176 signals:
7277 void menuChanged(struct menu *menu);
7378 void menuSelected(struct menu *menu);
79
+ void itemSelected(struct menu *menu);
7480 void parentSelected(void);
7581 void gotFocus(struct menu *);
82
+ void showNameChanged(bool on);
7683
7784 public:
7885 void updateListAll(void)
7986 {
8087 updateAll = true;
81
- updateList(NULL);
88
+ updateList();
8289 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);
9990 }
10091 void setAllOpen(bool open);
10192 void setParentMenu(void);
....@@ -103,21 +94,23 @@
10394 bool menuSkip(struct menu *);
10495
10596 void updateMenuList(ConfigItem *parent, struct menu*);
106
- void updateMenuList(ConfigList *parent, struct menu*);
97
+ void updateMenuList(struct menu *menu);
10798
10899 bool updateAll;
109100
110
- QPixmap symbolYesPix, symbolModPix, symbolNoPix;
111
- QPixmap choiceYesPix, choiceNoPix;
112
- QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
113
-
114
- bool showName, showRange, showData;
101
+ bool showName;
115102 enum listMode mode;
116103 enum optionMode optMode;
117104 struct menu *rootEntry;
118105 QPalette disabledColorGroup;
119106 QPalette inactivedColorGroup;
120107 QMenu* headerPopup;
108
+
109
+ static QList<ConfigList *> allLists;
110
+ static void updateListForAll();
111
+ static void updateListAllForAll();
112
+
113
+ static QAction *showNormalAction, *showAllAction, *showPromptAction;
121114 };
122115
123116 class ConfigItem : public QTreeWidgetItem {
....@@ -140,7 +133,6 @@
140133 }
141134 ~ConfigItem(void);
142135 void init(void);
143
- void okRename(int col);
144136 void updateMenu(void);
145137 void testUpdateMenu(bool v);
146138 ConfigList* listView() const
....@@ -165,82 +157,36 @@
165157
166158 return ret;
167159 }
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
- }
184160 // TODO: Implement paintCell
185161
186162 ConfigItem* nextItem;
187163 struct menu *menu;
188164 bool visible;
189165 bool goParent;
166
+
167
+ static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
168
+ static QIcon choiceYesIcon, choiceNoIcon;
169
+ static QIcon menuIcon, menubackIcon;
190170 };
191171
192
-class ConfigLineEdit : public QLineEdit {
193
- Q_OBJECT
194
- typedef class QLineEdit Parent;
172
+class ConfigItemDelegate : public QStyledItemDelegate
173
+{
174
+private:
175
+ struct menu *menu;
195176 public:
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
-
204
-public:
205
- ConfigItem *item;
206
-};
207
-
208
-class ConfigView : public QWidget {
209
- Q_OBJECT
210
- typedef class QWidget Parent;
211
-public:
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; }
220
-public slots:
221
- void setShowName(bool);
222
- void setShowRange(bool);
223
- void setShowData(bool);
224
- void setOptionMode(QAction *);
225
-signals:
226
- void showNameChanged(bool);
227
- void showRangeChanged(bool);
228
- void showDataChanged(bool);
229
-public:
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;
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;
239184 };
240185
241186 class ConfigInfoView : public QTextBrowser {
242187 Q_OBJECT
243188 typedef class QTextBrowser Parent;
189
+ QMenu *contextMenu;
244190 public:
245191 ConfigInfoView(QWidget* parent, const char *name = 0);
246192 bool showDebug(void) const { return _showDebug; }
....@@ -249,6 +195,7 @@
249195 void setInfo(struct menu *menu);
250196 void saveSettings(void);
251197 void setShowDebug(bool);
198
+ void clicked (const QUrl &url);
252199
253200 signals:
254201 void showDebugChanged(bool);
....@@ -260,8 +207,7 @@
260207 QString debug_info(struct symbol *sym);
261208 static QString print_filter(const QString &str);
262209 static void expr_print_help(void *data, struct symbol *sym, const char *str);
263
- QMenu *createStandardContextMenu(const QPoint & pos);
264
- void contextMenuEvent(QContextMenuEvent *e);
210
+ void contextMenuEvent(QContextMenuEvent *event);
265211
266212 struct symbol *sym;
267213 struct menu *_menu;
....@@ -272,7 +218,7 @@
272218 Q_OBJECT
273219 typedef class QDialog Parent;
274220 public:
275
- ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
221
+ ConfigSearchWindow(ConfigMainWindow *parent);
276222
277223 public slots:
278224 void saveSettings(void);
....@@ -282,7 +228,7 @@
282228 QLineEdit* editField;
283229 QPushButton* searchButton;
284230 QSplitter* split;
285
- ConfigView* list;
231
+ ConfigList *list;
286232 ConfigInfoView* info;
287233
288234 struct symbol **result;
....@@ -291,12 +237,14 @@
291237 class ConfigMainWindow : public QMainWindow {
292238 Q_OBJECT
293239
240
+ char *configname;
294241 static QAction *saveAction;
295242 static void conf_changed(void);
296243 public:
297244 ConfigMainWindow(void);
298245 public slots:
299246 void changeMenu(struct menu *);
247
+ void changeItens(struct menu *);
300248 void setMenuLink(struct menu *);
301249 void listFocusChanged(void);
302250 void goBack(void);
....@@ -315,12 +263,9 @@
315263 void closeEvent(QCloseEvent *e);
316264
317265 ConfigSearchWindow *searchWindow;
318
- ConfigView *menuView;
319266 ConfigList *menuList;
320
- ConfigView *configView;
321267 ConfigList *configList;
322268 ConfigInfoView *helpText;
323
- QToolBar *toolBar;
324269 QAction *backAction;
325270 QAction *singleViewAction;
326271 QAction *splitViewAction;