diff options
| author | Boris Barbulovski <bbarbulovski@gmail.com> | 2015-09-22 14:36:17 -0400 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.com> | 2015-10-14 08:59:02 -0400 |
| commit | 1019f1a586afe835bf1c6e4e8acfcddd2b7465f6 (patch) | |
| tree | f4a5629241ca018e221e4f995eff3c66903a076a /scripts/kconfig | |
| parent | 92119937e844ef60693411062045d3c63ca8edd9 (diff) | |
Port xconfig to Qt5 - Introduce Qt4/5 version of ConfigList and ConfigItem
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts/kconfig')
| -rw-r--r-- | scripts/kconfig/qconf.cc | 24 | ||||
| -rw-r--r-- | scripts/kconfig/qconf.h | 48 |
2 files changed, 63 insertions, 9 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index c6b732092eda..a86409d6f6a6 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
| @@ -87,13 +87,27 @@ bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value) | |||
| 87 | return true; | 87 | return true; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | /* | ||
| 91 | * construct a menu entry | ||
| 92 | */ | ||
| 93 | void ConfigItem::init(void) | ||
| 94 | { | ||
| 95 | } | ||
| 96 | |||
| 97 | /* | ||
| 98 | * destruct a menu entry | ||
| 99 | */ | ||
| 100 | ConfigItem::~ConfigItem(void) | ||
| 101 | { | ||
| 102 | } | ||
| 103 | |||
| 90 | ConfigLineEdit::ConfigLineEdit(ConfigView* parent) | 104 | ConfigLineEdit::ConfigLineEdit(ConfigView* parent) |
| 91 | : Parent(parent) | 105 | : Parent(parent) |
| 92 | { | 106 | { |
| 93 | connect(this, SIGNAL(editingFinished()), SLOT(hide())); | 107 | connect(this, SIGNAL(editingFinished()), SLOT(hide())); |
| 94 | } | 108 | } |
| 95 | 109 | ||
| 96 | void ConfigLineEdit::show(QTreeWidgetItem *i) | 110 | void ConfigLineEdit::show(ConfigItem* i) |
| 97 | { | 111 | { |
| 98 | item = i; | 112 | item = i; |
| 99 | Parent::show(); | 113 | Parent::show(); |
| @@ -118,6 +132,10 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) | |||
| 118 | hide(); | 132 | hide(); |
| 119 | } | 133 | } |
| 120 | 134 | ||
| 135 | ConfigList::ConfigList(ConfigView* p, const char *name) | ||
| 136 | : Parent(p) | ||
| 137 | { | ||
| 138 | } | ||
| 121 | ConfigView*ConfigView::viewList; | 139 | ConfigView*ConfigView::viewList; |
| 122 | QAction *ConfigView::showNormalAction; | 140 | QAction *ConfigView::showNormalAction; |
| 123 | QAction *ConfigView::showAllAction; | 141 | QAction *ConfigView::showAllAction; |
| @@ -129,7 +147,7 @@ ConfigView::ConfigView(QWidget* parent, const char *name) | |||
| 129 | QVBoxLayout *verticalLayout = new QVBoxLayout(this); | 147 | QVBoxLayout *verticalLayout = new QVBoxLayout(this); |
| 130 | verticalLayout->setContentsMargins(0, 0, 0, 0); | 148 | verticalLayout->setContentsMargins(0, 0, 0, 0); |
| 131 | 149 | ||
| 132 | list = new QTreeWidget(this); | 150 | list = new ConfigList(this); |
| 133 | verticalLayout->addWidget(list); | 151 | verticalLayout->addWidget(list); |
| 134 | lineEdit = new ConfigLineEdit(this); | 152 | lineEdit = new ConfigLineEdit(this); |
| 135 | lineEdit->hide(); | 153 | lineEdit->hide(); |
| @@ -167,7 +185,7 @@ void ConfigView::setShowData(bool b) | |||
| 167 | { | 185 | { |
| 168 | } | 186 | } |
| 169 | 187 | ||
| 170 | void ConfigView::updateList(QTreeWidgetItem* item) | 188 | void ConfigView::updateList(ConfigItem* item) |
| 171 | { | 189 | { |
| 172 | } | 190 | } |
| 173 | 191 | ||
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 1cd02192f172..54b3b925139a 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | #include "expr.h" | 17 | #include "expr.h" |
| 18 | 18 | ||
| 19 | class ConfigView; | 19 | class ConfigView; |
| 20 | class ConfigList; | ||
| 21 | class ConfigItem; | ||
| 20 | class ConfigLineEdit; | 22 | class ConfigLineEdit; |
| 21 | class ConfigMainWindow; | 23 | class ConfigMainWindow; |
| 22 | 24 | ||
| @@ -37,6 +39,40 @@ enum optionMode { | |||
| 37 | normalOpt = 0, allOpt, promptOpt | 39 | normalOpt = 0, allOpt, promptOpt |
| 38 | }; | 40 | }; |
| 39 | 41 | ||
| 42 | class ConfigList : public QTreeWidget { | ||
| 43 | Q_OBJECT | ||
| 44 | typedef class QTreeWidget Parent; | ||
| 45 | public: | ||
| 46 | ConfigList(ConfigView* p, const char *name = 0); | ||
| 47 | }; | ||
| 48 | |||
| 49 | class ConfigItem : public QTreeWidgetItem { | ||
| 50 | typedef class QTreeWidgetItem Parent; | ||
| 51 | public: | ||
| 52 | ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, struct menu *m, bool v) | ||
| 53 | : Parent(parent, after), menu(m), visible(v), goParent(false) | ||
| 54 | { | ||
| 55 | init(); | ||
| 56 | } | ||
| 57 | ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) | ||
| 58 | : Parent(parent, after), menu(m), visible(v), goParent(false) | ||
| 59 | { | ||
| 60 | init(); | ||
| 61 | } | ||
| 62 | ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, bool v) | ||
| 63 | : Parent(parent, after), menu(0), visible(v), goParent(true) | ||
| 64 | { | ||
| 65 | init(); | ||
| 66 | } | ||
| 67 | ~ConfigItem(void); | ||
| 68 | void init(void); | ||
| 69 | |||
| 70 | ConfigItem* nextItem; | ||
| 71 | struct menu *menu; | ||
| 72 | bool visible; | ||
| 73 | bool goParent; | ||
| 74 | }; | ||
| 75 | |||
| 40 | class ConfigLineEdit : public QLineEdit { | 76 | class ConfigLineEdit : public QLineEdit { |
| 41 | Q_OBJECT | 77 | Q_OBJECT |
| 42 | typedef class QLineEdit Parent; | 78 | typedef class QLineEdit Parent; |
| @@ -46,11 +82,11 @@ public: | |||
| 46 | { | 82 | { |
| 47 | return (ConfigView*)Parent::parent(); | 83 | return (ConfigView*)Parent::parent(); |
| 48 | } | 84 | } |
| 49 | void show(QTreeWidgetItem *i); | 85 | void show(ConfigItem *i); |
| 50 | void keyPressEvent(QKeyEvent *e); | 86 | void keyPressEvent(QKeyEvent *e); |
| 51 | 87 | ||
| 52 | public: | 88 | public: |
| 53 | QTreeWidgetItem *item; | 89 | ConfigItem *item; |
| 54 | }; | 90 | }; |
| 55 | 91 | ||
| 56 | class ConfigView : public QWidget { | 92 | class ConfigView : public QWidget { |
| @@ -59,7 +95,7 @@ class ConfigView : public QWidget { | |||
| 59 | public: | 95 | public: |
| 60 | ConfigView(QWidget* parent, const char *name = 0); | 96 | ConfigView(QWidget* parent, const char *name = 0); |
| 61 | ~ConfigView(void); | 97 | ~ConfigView(void); |
| 62 | static void updateList(QTreeWidgetItem* item); | 98 | static void updateList(ConfigItem* item); |
| 63 | static void updateListAll(void); | 99 | static void updateListAll(void); |
| 64 | 100 | ||
| 65 | bool showName(void) const { return false; } // TODO: Implement me. | 101 | bool showName(void) const { return false; } // TODO: Implement me. |
| @@ -75,7 +111,7 @@ signals: | |||
| 75 | void showRangeChanged(bool); | 111 | void showRangeChanged(bool); |
| 76 | void showDataChanged(bool); | 112 | void showDataChanged(bool); |
| 77 | public: | 113 | public: |
| 78 | QTreeWidget* list; | 114 | ConfigList* list; |
| 79 | ConfigLineEdit* lineEdit; | 115 | ConfigLineEdit* lineEdit; |
| 80 | 116 | ||
| 81 | static ConfigView* viewList; | 117 | static ConfigView* viewList; |
| @@ -164,9 +200,9 @@ protected: | |||
| 164 | 200 | ||
| 165 | ConfigSearchWindow *searchWindow; | 201 | ConfigSearchWindow *searchWindow; |
| 166 | ConfigView *menuView; | 202 | ConfigView *menuView; |
| 167 | QTreeWidget *menuList; | 203 | ConfigList *menuList; |
| 168 | ConfigView *configView; | 204 | ConfigView *configView; |
| 169 | QTreeWidget *configList; | 205 | ConfigList *configList; |
| 170 | ConfigInfoView *helpText; | 206 | ConfigInfoView *helpText; |
| 171 | QToolBar *toolBar; | 207 | QToolBar *toolBar; |
| 172 | QAction *backAction; | 208 | QAction *backAction; |
