Port xconfig to Qt5 - Fix the code so it compiles with Qt5
[firefly-linux-kernel-4.4.55.git] / scripts / kconfig / qconf.h
1 /*
2  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3  * Released under the terms of the GNU GPL v2.0.
4  */
5
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"
18
19 class ConfigView;
20 class ConfigLineEdit;
21 class ConfigMainWindow;
22
23 class ConfigSettings : public QSettings {
24 public:
25         ConfigSettings();
26         QList<int> readSizes(const QString& key, bool *ok);
27         bool writeSizes(const QString& key, const QList<int>& value);
28 };
29
30 enum colIdx {
31         promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
32 };
33 enum listMode {
34         singleMode, menuMode, symbolMode, fullMode, listMode
35 };
36 enum optionMode {
37         normalOpt = 0, allOpt, promptOpt
38 };
39
40 class ConfigLineEdit : public QLineEdit {
41         Q_OBJECT
42         typedef class QLineEdit Parent;
43 public:
44         ConfigLineEdit(ConfigView* parent);
45         ConfigView* parent(void) const
46         {
47                 return (ConfigView*)Parent::parent();
48         }
49         void show(QTreeWidgetItem *i);
50         void keyPressEvent(QKeyEvent *e);
51
52 public:
53         QTreeWidgetItem *item;
54 };
55
56 class ConfigView : public QWidget {
57         Q_OBJECT
58         typedef class QWidget Parent;
59 public:
60         ConfigView(QWidget* parent, const char *name = 0);
61         ~ConfigView(void);
62         static void updateList(QTreeWidgetItem* item);
63         static void updateListAll(void);
64
65         bool showName(void) const { return false; } // TODO: Implement me.
66         bool showRange(void) const { return false; } // TODO: Implement me.
67         bool showData(void) const { return false; } // TODO: Implement me.
68 public slots:
69         void setShowName(bool);
70         void setShowRange(bool);
71         void setShowData(bool);
72         void setOptionMode(QAction *);
73 signals:
74         void showNameChanged(bool);
75         void showRangeChanged(bool);
76         void showDataChanged(bool);
77 public:
78         QTreeWidget* list;
79         ConfigLineEdit* lineEdit;
80
81         static ConfigView* viewList;
82         ConfigView* nextView;
83
84         static QAction *showNormalAction;
85         static QAction *showAllAction;
86         static QAction *showPromptAction;
87 };
88
89 class ConfigInfoView : public QTextBrowser {
90         Q_OBJECT
91         typedef class QTextBrowser Parent;
92 public:
93         ConfigInfoView(QWidget* parent, const char *name = 0);
94         bool showDebug(void) const { return _showDebug; }
95
96 public slots:
97         void setInfo(struct menu *menu);
98         void saveSettings(void);
99         void setShowDebug(bool);
100
101 signals:
102         void showDebugChanged(bool);
103         void menuSelected(struct menu *);
104
105 protected:
106         void symbolInfo(void);
107         void menuInfo(void);
108         QString debug_info(struct symbol *sym);
109         static QString print_filter(const QString &str);
110         static void expr_print_help(void *data, struct symbol *sym, const char *str);
111         QMenu *createStandardContextMenu(const QPoint & pos);
112         void contextMenuEvent(QContextMenuEvent *e);
113
114         struct symbol *sym;
115         struct menu *_menu;
116         bool _showDebug;
117 };
118
119 class ConfigSearchWindow : public QDialog {
120         Q_OBJECT
121         typedef class QDialog Parent;
122 public:
123         ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
124
125 public slots:
126         void saveSettings(void);
127         void search(void);
128
129 protected:
130         QLineEdit* editField;
131         QPushButton* searchButton;
132         QSplitter* split;
133         ConfigView* list;
134         ConfigInfoView* info;
135
136         struct symbol **result;
137 };
138
139 class ConfigMainWindow : public QMainWindow {
140         Q_OBJECT
141
142         static QAction *saveAction;
143         static void conf_changed(void);
144 public:
145         ConfigMainWindow(void);
146 public slots:
147         void changeMenu(struct menu *);
148         void setMenuLink(struct menu *);
149         void listFocusChanged(void);
150         void goBack(void);
151         void loadConfig(void);
152         bool saveConfig(void);
153         void saveConfigAs(void);
154         void searchConfig(void);
155         void showSingleView(void);
156         void showSplitView(void);
157         void showFullView(void);
158         void showIntro(void);
159         void showAbout(void);
160         void saveSettings(void);
161
162 protected:
163         void closeEvent(QCloseEvent *e);
164
165         ConfigSearchWindow *searchWindow;
166         ConfigView *menuView;
167         QTreeWidget *menuList;
168         ConfigView *configView;
169         QTreeWidget *configList;
170         ConfigInfoView *helpText;
171         QToolBar *toolBar;
172         QAction *backAction;
173         QAction *singleViewAction;
174         QAction *splitViewAction;
175         QAction *fullViewAction;
176         QSplitter *split1;
177         QSplitter *split2;
178 };