Blame view
scripts/kconfig/qconf.h
6.4 KB
0c8741001
|
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c
|
2 3 |
/* * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
1da177e4c
|
4 |
*/ |
cf81dfa47
|
5 6 |
#include <QCheckBox> #include <QDialog> |
68ccb7ef4
|
7 |
#include <QHeaderView> |
cf81dfa47
|
8 9 |
#include <QLineEdit> #include <QMainWindow> |
68ccb7ef4
|
10 11 |
#include <QPushButton> #include <QSettings> |
68ccb7ef4
|
12 |
#include <QSplitter> |
37162a68b
|
13 |
#include <QStyledItemDelegate> |
cf81dfa47
|
14 15 |
#include <QTextBrowser> #include <QTreeWidget> |
68ccb7ef4
|
16 |
#include "expr.h" |
133c5f7c1
|
17 |
|
1019f1a58
|
18 19 |
class ConfigList; class ConfigItem; |
1da177e4c
|
20 |
class ConfigMainWindow; |
1da177e4c
|
21 22 |
class ConfigSettings : public QSettings { public: |
00d4f8fc2
|
23 |
ConfigSettings(); |
041fbdc21
|
24 25 |
QList<int> readSizes(const QString& key, bool *ok); bool writeSizes(const QString& key, const QList<int>& value); |
1da177e4c
|
26 27 28 |
}; enum colIdx { |
a0fce2833
|
29 |
promptColIdx, nameColIdx, dataColIdx |
1da177e4c
|
30 31 |
}; enum listMode { |
43bf612af
|
32 |
singleMode, menuMode, symbolMode, fullMode, listMode |
1da177e4c
|
33 |
}; |
39a4897c1
|
34 35 36 |
enum optionMode { normalOpt = 0, allOpt, promptOpt }; |
1da177e4c
|
37 |
|
1019f1a58
|
38 39 40 41 |
class ConfigList : public QTreeWidget { Q_OBJECT typedef class QTreeWidget Parent; public: |
62ed16565
|
42 |
ConfigList(QWidget *parent, const char *name = 0); |
f9b918fae
|
43 |
~ConfigList(); |
59e564408
|
44 |
void reinit(void); |
b06c3ec3b
|
45 |
ConfigItem* findConfigItem(struct menu *); |
b06c3ec3b
|
46 47 48 49 50 51 |
void setSelected(QTreeWidgetItem *item, bool enable) { for (int i = 0; i < selectedItems().size(); i++) selectedItems().at(i)->setSelected(false); item->setSelected(enable); } |
59e564408
|
52 53 54 |
protected: void keyPressEvent(QKeyEvent *e); |
d5d973c3f
|
55 56 57 58 |
void mousePressEvent(QMouseEvent *e); void mouseReleaseEvent(QMouseEvent *e); void mouseMoveEvent(QMouseEvent *e); void mouseDoubleClickEvent(QMouseEvent *e); |
59e564408
|
59 60 61 62 63 |
void focusInEvent(QFocusEvent *e); void contextMenuEvent(QContextMenuEvent *e); public slots: void setRootMenu(struct menu *menu); |
cb77043f0
|
64 |
void updateList(); |
59e564408
|
65 66 67 68 |
void setValue(ConfigItem* item, tristate val); void changeValue(ConfigItem* item); void updateSelection(void); void saveSettings(void); |
d4bbe8a1b
|
69 |
void setOptionMode(QAction *action); |
7930dd91a
|
70 |
void setShowName(bool on); |
d4bbe8a1b
|
71 |
|
59e564408
|
72 73 74 |
signals: void menuChanged(struct menu *menu); void menuSelected(struct menu *menu); |
b311142fc
|
75 |
void itemSelected(struct menu *menu); |
59e564408
|
76 77 |
void parentSelected(void); void gotFocus(struct menu *); |
7930dd91a
|
78 |
void showNameChanged(bool on); |
59e564408
|
79 80 81 82 83 |
public: void updateListAll(void) { updateAll = true; |
cb77043f0
|
84 |
updateList(); |
59e564408
|
85 86 |
updateAll = false; } |
59e564408
|
87 88 89 90 |
void setAllOpen(bool open); void setParentMenu(void); bool menuSkip(struct menu *); |
5c6f1554b
|
91 |
void updateMenuList(ConfigItem *parent, struct menu*); |
5b75a6c89
|
92 |
void updateMenuList(struct menu *menu); |
59e564408
|
93 94 |
bool updateAll; |
a0fce2833
|
95 |
bool showName; |
59e564408
|
96 97 98 99 100 101 |
enum listMode mode; enum optionMode optMode; struct menu *rootEntry; QPalette disabledColorGroup; QPalette inactivedColorGroup; QMenu* headerPopup; |
d4bbe8a1b
|
102 |
|
f9b918fae
|
103 104 105 |
static QList<ConfigList *> allLists; static void updateListForAll(); static void updateListAllForAll(); |
d4bbe8a1b
|
106 |
static QAction *showNormalAction, *showAllAction, *showPromptAction; |
1019f1a58
|
107 108 109 110 111 |
}; class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: |
d960b9889
|
112 |
ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v) |
86c052827
|
113 |
: Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) |
1019f1a58
|
114 115 116 117 |
{ init(); } ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) |
86c052827
|
118 |
: Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) |
1019f1a58
|
119 120 121 |
{ init(); } |
d960b9889
|
122 |
ConfigItem(ConfigList *parent, ConfigItem *after, bool v) |
86c052827
|
123 |
: Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true) |
1019f1a58
|
124 125 126 127 128 |
{ init(); } ~ConfigItem(void); void init(void); |
59e564408
|
129 130 131 132 133 134 135 136 137 138 |
void updateMenu(void); void testUpdateMenu(bool v); ConfigList* listView() const { return (ConfigList*)Parent::treeWidget(); } ConfigItem* firstChild() const { return (ConfigItem *)Parent::child(0); } |
d5d973c3f
|
139 |
ConfigItem* nextSibling() |
59e564408
|
140 |
{ |
d5d973c3f
|
141 142 143 144 |
ConfigItem *ret = NULL; ConfigItem *_parent = (ConfigItem *)parent(); if(_parent) { |
b3c48f964
|
145 |
ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1); |
d5d973c3f
|
146 |
} else { |
b3c48f964
|
147 148 |
QTreeWidget *_treeWidget = treeWidget(); ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1); |
d5d973c3f
|
149 150 151 |
} return ret; |
59e564408
|
152 |
} |
d5d973c3f
|
153 |
// TODO: Implement paintCell |
1019f1a58
|
154 155 156 157 158 |
ConfigItem* nextItem; struct menu *menu; bool visible; bool goParent; |
5cb255ffa
|
159 160 161 162 |
static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon; static QIcon choiceYesIcon, choiceNoIcon; static QIcon menuIcon, menubackIcon; |
1019f1a58
|
163 |
}; |
37162a68b
|
164 165 166 167 168 169 170 171 172 173 174 175 176 |
class ConfigItemDelegate : public QStyledItemDelegate { private: struct menu *menu; public: ConfigItemDelegate(QObject *parent = nullptr) : QStyledItemDelegate(parent) {} QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; }; |
924bbb53d
|
177 |
class ConfigInfoView : public QTextBrowser { |
43bf612af
|
178 |
Q_OBJECT |
924bbb53d
|
179 |
typedef class QTextBrowser Parent; |
7d1300e63
|
180 |
QMenu *contextMenu; |
43bf612af
|
181 182 183 184 185 186 |
public: ConfigInfoView(QWidget* parent, const char *name = 0); bool showDebug(void) const { return _showDebug; } public slots: void setInfo(struct menu *menu); |
7fc925fd6
|
187 |
void saveSettings(void); |
43bf612af
|
188 |
void setShowDebug(bool); |
c4f7398be
|
189 |
void clicked (const QUrl &url); |
43bf612af
|
190 191 192 |
signals: void showDebugChanged(bool); |
b65a47e1a
|
193 |
void menuSelected(struct menu *); |
43bf612af
|
194 195 |
protected: |
ab45d190f
|
196 |
void symbolInfo(void); |
43bf612af
|
197 198 199 |
void menuInfo(void); QString debug_info(struct symbol *sym); static QString print_filter(const QString &str); |
ab45d190f
|
200 |
static void expr_print_help(void *data, struct symbol *sym, const char *str); |
7d1300e63
|
201 |
void contextMenuEvent(QContextMenuEvent *event); |
43bf612af
|
202 |
|
ab45d190f
|
203 |
struct symbol *sym; |
133c5f7c1
|
204 |
struct menu *_menu; |
43bf612af
|
205 206 207 208 209 210 211 |
bool _showDebug; }; class ConfigSearchWindow : public QDialog { Q_OBJECT typedef class QDialog Parent; public: |
740fdef85
|
212 |
ConfigSearchWindow(ConfigMainWindow *parent); |
7fc925fd6
|
213 |
|
43bf612af
|
214 |
public slots: |
7fc925fd6
|
215 |
void saveSettings(void); |
43bf612af
|
216 |
void search(void); |
7fc925fd6
|
217 |
|
43bf612af
|
218 219 220 |
protected: QLineEdit* editField; QPushButton* searchButton; |
7fc925fd6
|
221 |
QSplitter* split; |
62ed16565
|
222 |
ConfigList *list; |
43bf612af
|
223 224 225 226 |
ConfigInfoView* info; struct symbol **result; }; |
b1f8a45bf
|
227 |
class ConfigMainWindow : public QMainWindow { |
1da177e4c
|
228 |
Q_OBJECT |
3b354c557
|
229 |
|
8741908b3
|
230 |
char *configname; |
85eaf28a2
|
231 |
static QAction *saveAction; |
3b354c557
|
232 |
static void conf_changed(void); |
1da177e4c
|
233 234 235 |
public: ConfigMainWindow(void); public slots: |
1da177e4c
|
236 |
void changeMenu(struct menu *); |
b311142fc
|
237 |
void changeItens(struct menu *); |
b65a47e1a
|
238 |
void setMenuLink(struct menu *); |
1da177e4c
|
239 240 241 |
void listFocusChanged(void); void goBack(void); void loadConfig(void); |
bac6aa865
|
242 |
bool saveConfig(void); |
1da177e4c
|
243 |
void saveConfigAs(void); |
43bf612af
|
244 |
void searchConfig(void); |
1da177e4c
|
245 246 247 |
void showSingleView(void); void showSplitView(void); void showFullView(void); |
1da177e4c
|
248 249 250 251 252 253 |
void showIntro(void); void showAbout(void); void saveSettings(void); protected: void closeEvent(QCloseEvent *e); |
43bf612af
|
254 |
ConfigSearchWindow *searchWindow; |
1019f1a58
|
255 |
ConfigList *menuList; |
1019f1a58
|
256 |
ConfigList *configList; |
43bf612af
|
257 |
ConfigInfoView *helpText; |
85eaf28a2
|
258 |
QAction *backAction; |
780505e33
|
259 260 261 |
QAction *singleViewAction; QAction *splitViewAction; QAction *fullViewAction; |
76538660f
|
262 263 |
QSplitter *split1; QSplitter *split2; |
1da177e4c
|
264 |
}; |