arch/arm64: Support FEAT_CCIDX
[coreboot2.git] / util / kconfig / qconf.h
blobf7e11b398369885adc90d448f94427385f630b07
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 */
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>
18 #include "expr.h"
20 class ConfigList;
21 class ConfigItem;
22 class ConfigMainWindow;
24 class ConfigSettings : public QSettings {
25 public:
26 ConfigSettings();
27 QList<int> readSizes(const QString& key, bool *ok);
28 bool writeSizes(const QString& key, const QList<int>& value);
31 enum colIdx {
32 promptColIdx, nameColIdx, dataColIdx
34 enum listMode {
35 singleMode, menuMode, symbolMode, fullMode, listMode
37 enum optionMode {
38 normalOpt = 0, allOpt, promptOpt
41 class ConfigList : public QTreeWidget {
42 Q_OBJECT
43 typedef class QTreeWidget Parent;
44 public:
45 ConfigList(QWidget *parent, const char *name = NULL);
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);
53 item->setSelected(enable);
56 protected:
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);
65 public slots:
66 void setRootMenu(struct menu *menu);
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);
76 signals:
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);
84 public:
85 void updateListAll(void)
87 updateAll = true;
88 updateList();
89 updateAll = false;
91 void setAllOpen(bool open);
92 void setParentMenu(void);
94 bool menuSkip(struct menu *);
96 void updateMenuList(ConfigItem *parent, struct menu*);
97 void updateMenuList(struct menu *menu);
99 bool updateAll;
101 bool showName;
102 enum listMode mode;
103 enum optionMode optMode;
104 struct menu *rootEntry;
105 QPalette disabledColorGroup;
106 QPalette inactivedColorGroup;
107 QMenu* headerPopup;
109 static QList<ConfigList *> allLists;
110 static void updateListForAll();
111 static void updateListAllForAll();
113 static QAction *showNormalAction, *showAllAction, *showPromptAction;
116 class ConfigItem : public QTreeWidgetItem {
117 typedef class QTreeWidgetItem Parent;
118 public:
119 ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v)
120 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
122 init();
124 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
125 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
127 init();
129 ConfigItem(ConfigList *parent, ConfigItem *after, bool v)
130 : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true)
132 init();
134 ~ConfigItem(void);
135 void init(void);
136 void updateMenu(void);
137 void testUpdateMenu(bool v);
138 ConfigList* listView() const
140 return (ConfigList*)Parent::treeWidget();
142 ConfigItem* firstChild() const
144 return (ConfigItem *)Parent::child(0);
146 ConfigItem* nextSibling()
148 ConfigItem *ret = NULL;
149 ConfigItem *_parent = (ConfigItem *)parent();
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);
158 return ret;
160 // TODO: Implement paintCell
162 ConfigItem* nextItem;
163 struct menu *menu;
164 bool visible;
165 bool goParent;
167 static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
168 static QIcon choiceYesIcon, choiceNoIcon;
169 static QIcon menuIcon, menubackIcon;
172 class ConfigItemDelegate : public QStyledItemDelegate
174 private:
175 struct menu *menu;
176 public:
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;
186 class ConfigInfoView : public QTextBrowser {
187 Q_OBJECT
188 typedef class QTextBrowser Parent;
189 QMenu *contextMenu;
190 public:
191 ConfigInfoView(QWidget* parent, const char *name = NULL);
192 bool showDebug(void) const { return _showDebug; }
194 public slots:
195 void setInfo(struct menu *menu);
196 void saveSettings(void);
197 void setShowDebug(bool);
198 void clicked (const QUrl &url);
200 signals:
201 void showDebugChanged(bool);
202 void menuSelected(struct menu *);
204 protected:
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);
212 struct symbol *sym;
213 struct menu *_menu;
214 bool _showDebug;
217 class ConfigSearchWindow : public QDialog {
218 Q_OBJECT
219 typedef class QDialog Parent;
220 public:
221 ConfigSearchWindow(ConfigMainWindow *parent);
223 public slots:
224 void saveSettings(void);
225 void search(void);
227 protected:
228 QLineEdit* editField;
229 QPushButton* searchButton;
230 QSplitter* split;
231 ConfigList *list;
232 ConfigInfoView* info;
234 struct symbol **result;
237 class ConfigMainWindow : public QMainWindow {
238 Q_OBJECT
240 char *configname;
241 static QAction *saveAction;
242 static void conf_changed(void);
243 public:
244 ConfigMainWindow(void);
245 public 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);
262 protected:
263 void closeEvent(QCloseEvent *e);
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;