bus: mhi: core: Fix some error return code
[linux/fpc-iii.git] / scripts / kconfig / qconf.h
blobc879d79ce8170b625f7e1ba7d9d12b18f7f3ccd9
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 */
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>
15 #include <QCheckBox>
16 #include <QDialog>
17 #include "expr.h"
19 class ConfigView;
20 class ConfigList;
21 class ConfigItem;
22 class ConfigLineEdit;
23 class ConfigMainWindow;
25 class ConfigSettings : public QSettings {
26 public:
27 ConfigSettings();
28 QList<int> readSizes(const QString& key, bool *ok);
29 bool writeSizes(const QString& key, const QList<int>& value);
32 enum colIdx {
33 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
35 enum listMode {
36 singleMode, menuMode, symbolMode, fullMode, listMode
38 enum optionMode {
39 normalOpt = 0, allOpt, promptOpt
42 class ConfigList : public QTreeWidget {
43 Q_OBJECT
44 typedef class QTreeWidget Parent;
45 public:
46 ConfigList(ConfigView* p, const char *name = 0);
47 void reinit(void);
48 ConfigView* parent(void) const
50 return (ConfigView*)Parent::parent();
52 ConfigItem* findConfigItem(struct menu *);
54 protected:
55 void keyPressEvent(QKeyEvent *e);
56 void mousePressEvent(QMouseEvent *e);
57 void mouseReleaseEvent(QMouseEvent *e);
58 void mouseMoveEvent(QMouseEvent *e);
59 void mouseDoubleClickEvent(QMouseEvent *e);
60 void focusInEvent(QFocusEvent *e);
61 void contextMenuEvent(QContextMenuEvent *e);
63 public slots:
64 void setRootMenu(struct menu *menu);
66 void updateList(ConfigItem *item);
67 void setValue(ConfigItem* item, tristate val);
68 void changeValue(ConfigItem* item);
69 void updateSelection(void);
70 void saveSettings(void);
71 signals:
72 void menuChanged(struct menu *menu);
73 void menuSelected(struct menu *menu);
74 void itemSelected(struct menu *menu);
75 void parentSelected(void);
76 void gotFocus(struct menu *);
78 public:
79 void updateListAll(void)
81 updateAll = true;
82 updateList(NULL);
83 updateAll = false;
85 ConfigList* listView()
87 return this;
89 ConfigItem* firstChild() const
91 return (ConfigItem *)children().first();
93 void addColumn(colIdx idx)
95 showColumn(idx);
97 void removeColumn(colIdx idx)
99 hideColumn(idx);
101 void setAllOpen(bool open);
102 void setParentMenu(void);
104 bool menuSkip(struct menu *);
106 void updateMenuList(ConfigItem *parent, struct menu*);
107 void updateMenuList(ConfigList *parent, struct menu*);
109 bool updateAll;
111 QPixmap symbolYesPix, symbolModPix, symbolNoPix;
112 QPixmap choiceYesPix, choiceNoPix;
113 QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
115 bool showName, showRange, showData;
116 enum listMode mode;
117 enum optionMode optMode;
118 struct menu *rootEntry;
119 QPalette disabledColorGroup;
120 QPalette inactivedColorGroup;
121 QMenu* headerPopup;
124 class ConfigItem : public QTreeWidgetItem {
125 typedef class QTreeWidgetItem Parent;
126 public:
127 ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v)
128 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
130 init();
132 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
133 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
135 init();
137 ConfigItem(ConfigList *parent, ConfigItem *after, bool v)
138 : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true)
140 init();
142 ~ConfigItem(void);
143 void init(void);
144 void okRename(int col);
145 void updateMenu(void);
146 void testUpdateMenu(bool v);
147 ConfigList* listView() const
149 return (ConfigList*)Parent::treeWidget();
151 ConfigItem* firstChild() const
153 return (ConfigItem *)Parent::child(0);
155 ConfigItem* nextSibling()
157 ConfigItem *ret = NULL;
158 ConfigItem *_parent = (ConfigItem *)parent();
160 if(_parent) {
161 ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1);
162 } else {
163 QTreeWidget *_treeWidget = treeWidget();
164 ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1);
167 return ret;
169 void setText(colIdx idx, const QString& text)
171 Parent::setText(idx, text);
173 QString text(colIdx idx) const
175 return Parent::text(idx);
177 void setPixmap(colIdx idx, const QIcon &icon)
179 Parent::setIcon(idx, icon);
181 const QIcon pixmap(colIdx idx) const
183 return icon(idx);
185 // TODO: Implement paintCell
187 ConfigItem* nextItem;
188 struct menu *menu;
189 bool visible;
190 bool goParent;
193 class ConfigLineEdit : public QLineEdit {
194 Q_OBJECT
195 typedef class QLineEdit Parent;
196 public:
197 ConfigLineEdit(ConfigView* parent);
198 ConfigView* parent(void) const
200 return (ConfigView*)Parent::parent();
202 void show(ConfigItem *i);
203 void keyPressEvent(QKeyEvent *e);
205 public:
206 ConfigItem *item;
209 class ConfigView : public QWidget {
210 Q_OBJECT
211 typedef class QWidget Parent;
212 public:
213 ConfigView(QWidget* parent, const char *name = 0);
214 ~ConfigView(void);
215 static void updateList(ConfigItem* item);
216 static void updateListAll(void);
218 bool showName(void) const { return list->showName; }
219 bool showRange(void) const { return list->showRange; }
220 bool showData(void) const { return list->showData; }
221 public slots:
222 void setShowName(bool);
223 void setShowRange(bool);
224 void setShowData(bool);
225 void setOptionMode(QAction *);
226 signals:
227 void showNameChanged(bool);
228 void showRangeChanged(bool);
229 void showDataChanged(bool);
230 public:
231 ConfigList* list;
232 ConfigLineEdit* lineEdit;
234 static ConfigView* viewList;
235 ConfigView* nextView;
237 static QAction *showNormalAction;
238 static QAction *showAllAction;
239 static QAction *showPromptAction;
242 class ConfigInfoView : public QTextBrowser {
243 Q_OBJECT
244 typedef class QTextBrowser Parent;
245 public:
246 ConfigInfoView(QWidget* parent, const char *name = 0);
247 bool showDebug(void) const { return _showDebug; }
249 public slots:
250 void setInfo(struct menu *menu);
251 void saveSettings(void);
252 void setShowDebug(bool);
254 signals:
255 void showDebugChanged(bool);
256 void menuSelected(struct menu *);
258 protected:
259 void symbolInfo(void);
260 void menuInfo(void);
261 QString debug_info(struct symbol *sym);
262 static QString print_filter(const QString &str);
263 static void expr_print_help(void *data, struct symbol *sym, const char *str);
264 QMenu *createStandardContextMenu(const QPoint & pos);
265 void contextMenuEvent(QContextMenuEvent *e);
267 struct symbol *sym;
268 struct menu *_menu;
269 bool _showDebug;
272 class ConfigSearchWindow : public QDialog {
273 Q_OBJECT
274 typedef class QDialog Parent;
275 public:
276 ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
278 public slots:
279 void saveSettings(void);
280 void search(void);
282 protected:
283 QLineEdit* editField;
284 QPushButton* searchButton;
285 QSplitter* split;
286 ConfigView* list;
287 ConfigInfoView* info;
289 struct symbol **result;
292 class ConfigMainWindow : public QMainWindow {
293 Q_OBJECT
295 char *configname;
296 static QAction *saveAction;
297 static void conf_changed(void);
298 public:
299 ConfigMainWindow(void);
300 public slots:
301 void changeMenu(struct menu *);
302 void changeItens(struct menu *);
303 void setMenuLink(struct menu *);
304 void listFocusChanged(void);
305 void goBack(void);
306 void loadConfig(void);
307 bool saveConfig(void);
308 void saveConfigAs(void);
309 void searchConfig(void);
310 void showSingleView(void);
311 void showSplitView(void);
312 void showFullView(void);
313 void showIntro(void);
314 void showAbout(void);
315 void saveSettings(void);
317 protected:
318 void closeEvent(QCloseEvent *e);
320 ConfigSearchWindow *searchWindow;
321 ConfigView *menuView;
322 ConfigList *menuList;
323 ConfigView *configView;
324 ConfigList *configList;
325 ConfigInfoView *helpText;
326 QToolBar *toolBar;
327 QAction *backAction;
328 QAction *singleViewAction;
329 QAction *splitViewAction;
330 QAction *fullViewAction;
331 QSplitter *split1;
332 QSplitter *split2;