From 1c199f2878f6c1b8c52125ad9805e94fe2dde472 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Wed, 7 Oct 2015 16:16:33 -0700 Subject: kbuild: document recursive dependency limitation / resolution Recursive dependency issues with kconfig are unavoidable due to some limitations with kconfig, since these issues are recurring provide a hint to the user how they can resolve these dependency issues and also document why such limitation exists. While at it also document a bit of future prospects of ways to enhance Kconfig, including providing formal semantics and evaluation of use of a SAT solver. If you're interested in this work or prospects of it check out the kconfig-sat project wiki [0] and mailing list [1]. [0] http://kernelnewbies.org/KernelProjects/kconfig-sat [1] https://groups.google.com/d/forum/kconfig-sat Cc: Geert Uytterhoeven Cc: James Bottomley Cc: Josh Triplett Cc: Paul Bolle Cc: Herbert Xu Cc: Takashi Iwai Cc: "Yann E. MORIN" Cc: Jonathan Corbet Cc: Mate Soos Signed-off-by: Luis R. Rodriguez Signed-off-by: Michal Marek --- scripts/kconfig/symbol.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 50878dc025a5..25cf0c2c0c79 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -1116,6 +1116,8 @@ static void sym_check_print_recursive(struct symbol *last_sym) if (stack->sym == last_sym) fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", prop->file->name, prop->lineno); + fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n"); + fprintf(stderr, "subsection \"Kconfig recursive dependency limitations\"\n"); if (stack->expr) { fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", prop->file->name, prop->lineno, -- cgit v1.2.3 From 8328447af88eaab1db29852cb3e4a71cda5bd887 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:01 -0700 Subject: Remove support for QT3 and older. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 23 ----------------------- scripts/kconfig/qconf.h | 18 ------------------ 2 files changed, 41 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index c3bb7fe8dfa6..0e18a9ccf288 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -5,18 +5,6 @@ #include -#if QT_VERSION < 0x040000 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#else #include #include #include @@ -26,7 +14,6 @@ #include #include #include -#endif #include #include @@ -1282,11 +1269,7 @@ ConfigMainWindow::ConfigMainWindow(void) QDesktopWidget *d = configApp->desktop(); snprintf(title, sizeof(title), "%s%s", rootmenu.prompt->text, -#if QT_VERSION < 0x040000 - " (Qt3)" -#else "" -#endif ); setCaption(title); @@ -1368,15 +1351,9 @@ ConfigMainWindow::ConfigMainWindow(void) connect(optGroup, SIGNAL(selected(QAction *)), menuView, SLOT(setOptionMode(QAction *))); -#if QT_VERSION >= 0x040000 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); configView->showAllAction = new QAction(_("Show All Options"), optGroup); configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); -#else - configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup); - configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup); - configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup); -#endif configView->showNormalAction->setToggleAction(TRUE); configView->showNormalAction->setOn(configList->optMode == normalOpt); configView->showAllAction->setToggleAction(TRUE); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index bde0c6b6f9e8..703285d0faf6 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -3,27 +3,9 @@ * Released under the terms of the GNU GPL v2.0. */ -#if QT_VERSION < 0x040000 -#include -#else #include -#endif #include -#if QT_VERSION < 0x040000 -#define Q3ValueList QValueList -#define Q3PopupMenu QPopupMenu -#define Q3ListView QListView -#define Q3ListViewItem QListViewItem -#define Q3VBox QVBox -#define Q3TextBrowser QTextBrowser -#define Q3MainWindow QMainWindow -#define Q3Action QAction -#define Q3ToolBar QToolBar -#define Q3ListViewItemIterator QListViewItemIterator -#define Q3FileDialog QFileDialog -#endif - class ConfigView; class ConfigList; class ConfigItem; -- cgit v1.2.3 From b1f8a45bfee563f6aa9969c6b01f6c831a85e39a Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:02 -0700 Subject: Port xconfig to Qt5 - Use QMainWindow, QToolBar Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 4 ++-- scripts/kconfig/qconf.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 0e18a9ccf288..199934c5cdbf 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -5,7 +5,7 @@ #include -#include +#include #include #include #include @@ -1303,7 +1303,7 @@ ConfigMainWindow::ConfigMainWindow(void) configList->setFocus(); menu = menuBar(); - toolBar = new Q3ToolBar("Tools", this); + toolBar = new QToolBar("Tools", this); backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); connect(backAction, SIGNAL(activated()), SLOT(goBack())); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 703285d0faf6..db4b41730053 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -4,6 +4,7 @@ */ #include +#include #include class ConfigView; @@ -281,7 +282,7 @@ protected: struct symbol **result; }; -class ConfigMainWindow : public Q3MainWindow { +class ConfigMainWindow : public QMainWindow { Q_OBJECT static Q3Action *saveAction; @@ -313,7 +314,7 @@ protected: ConfigView *configView; ConfigList *configList; ConfigInfoView *helpText; - Q3ToolBar *toolBar; + QToolBar *toolBar; Q3Action *backAction; QSplitter* split1; QSplitter* split2; -- cgit v1.2.3 From 85eaf28a2683b11227fbcd77341339fe3642f795 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:03 -0700 Subject: Port xconfig to Qt5 - Use QAction Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 48 ++++++++++++++++++++++++++---------------------- scripts/kconfig/qconf.h | 4 ++-- 2 files changed, 28 insertions(+), 24 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 199934c5cdbf..601c8689a2cf 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ static QApplication *configApp; static ConfigSettings *configSettings; -Q3Action *ConfigMainWindow::saveAction; +QAction *ConfigMainWindow::saveAction; static inline QString qgettext(const char* str) { @@ -815,10 +815,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) { if (e->y() <= header()->geometry().bottom()) { if (!headerPopup) { - Q3Action *action; + QAction *action; headerPopup = new Q3PopupMenu(this); - action = new Q3Action(NULL, _("Show Name"), 0, this); + action = new QAction(_("Show Name"), this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowName(bool))); @@ -826,7 +826,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) action, SLOT(setOn(bool))); action->setOn(showName); action->addTo(headerPopup); - action = new Q3Action(NULL, _("Show Range"), 0, this); + action = new QAction(_("Show Range"), this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowRange(bool))); @@ -834,7 +834,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) action, SLOT(setOn(bool))); action->setOn(showRange); action->addTo(headerPopup); - action = new Q3Action(NULL, _("Show Data"), 0, this); + action = new QAction( _("Show Data"), this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowData(bool))); @@ -1157,7 +1157,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) { Q3PopupMenu* popup = Parent::createPopupMenu(pos); - Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup); + QAction* action = new QAction(_("Show Debug Info"), popup); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); @@ -1305,40 +1305,44 @@ ConfigMainWindow::ConfigMainWindow(void) menu = menuBar(); toolBar = new QToolBar("Tools", this); - backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); + backAction = new QAction(QPixmap(xpm_back), _("Back"), this); connect(backAction, SIGNAL(activated()), SLOT(goBack())); backAction->setEnabled(FALSE); - Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); + QAction *quitAction = new QAction(_("&Quit"), this); + quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); connect(quitAction, SIGNAL(activated()), SLOT(close())); - Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); + QAction *loadAction = new QAction(QPixmap(xpm_load), _("&Load"), this); + loadAction->setShortcut(Qt::CTRL + Qt::Key_L); connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); - saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); + saveAction = new QAction(QPixmap(xpm_save), _("&Save"), this); + saveAction->setShortcut(Qt::CTRL + Qt::Key_S); connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); conf_set_changed_callback(conf_changed); // Set saveAction's initial state conf_changed(); - Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this); + QAction *saveAsAction = new QAction(_("Save &As..."), this); connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); - Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); + QAction *searchAction = new QAction(_("&Find"), this); + searchAction->setShortcut(Qt::CTRL + Qt::Key_F); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); - Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); + QAction *singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); - Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); + QAction *splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); - Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); + QAction *fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); - Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this); + QAction *showNameAction = new QAction(_("Show Name"), this); showNameAction->setToggleAction(TRUE); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); showNameAction->setOn(configView->showName()); - Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this); + QAction *showRangeAction = new QAction(_("Show Range"), this); showRangeAction->setToggleAction(TRUE); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); showRangeAction->setOn(configList->showRange); - Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this); + QAction *showDataAction = new QAction(_("Show Data"), this); showDataAction->setToggleAction(TRUE); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); @@ -1361,15 +1365,15 @@ ConfigMainWindow::ConfigMainWindow(void) configView->showPromptAction->setToggleAction(TRUE); configView->showPromptAction->setOn(configList->optMode == promptOpt); - Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this); + QAction *showDebugAction = new QAction( _("Show Debug Info"), this); showDebugAction->setToggleAction(TRUE); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); showDebugAction->setOn(helpText->showDebug()); - Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this); + QAction *showIntroAction = new QAction( _("Introduction"), this); connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); - Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this); + QAction *showAboutAction = new QAction( _("About"), this); connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); // init tool bar diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index db4b41730053..4d5218da2110 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -285,7 +285,7 @@ protected: class ConfigMainWindow : public QMainWindow { Q_OBJECT - static Q3Action *saveAction; + static QAction *saveAction; static void conf_changed(void); public: ConfigMainWindow(void); @@ -315,7 +315,7 @@ protected: ConfigList *configList; ConfigInfoView *helpText; QToolBar *toolBar; - Q3Action *backAction; + QAction *backAction; QSplitter* split1; QSplitter* split2; }; -- cgit v1.2.3 From bea00771f7d0964192da89d53adf3faf55b1daa9 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:04 -0700 Subject: Port xconfig to Qt5 - Use QFileDialog Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 601c8689a2cf..9f1a9cf90402 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -1457,7 +1457,7 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this); + QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; if (conf_read(QFile::encodeName(s))) @@ -1476,7 +1476,7 @@ bool ConfigMainWindow::saveConfig(void) void ConfigMainWindow::saveConfigAs(void) { - QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); + QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; saveConfig(); -- cgit v1.2.3 From 041fbdc21fadb7747482bddc22a27a431b678c1c Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:05 -0700 Subject: Port xconfig to Qt5 - Use QList Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 14 +++++++------- scripts/kconfig/qconf.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 9f1a9cf90402..bd62f6039626 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include @@ -64,9 +64,9 @@ ConfigSettings::ConfigSettings() /** * Reads a list of integer values from the application settings. */ -Q3ValueList ConfigSettings::readSizes(const QString& key, bool *ok) +QList ConfigSettings::readSizes(const QString& key, bool *ok) { - Q3ValueList result; + QList result; QStringList entryList = readListEntry(key, ok); QStringList::Iterator it; @@ -79,10 +79,10 @@ Q3ValueList ConfigSettings::readSizes(const QString& key, bool *ok) /** * Writes a list of integer values to the application settings. */ -bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList& value) +bool ConfigSettings::writeSizes(const QString& key, const QList& value) { QStringList stringList; - Q3ValueList::ConstIterator it; + QList::ConstIterator it; for (it = value.begin(); it != value.end(); ++it) stringList.push_back(QString::number(*it)); @@ -1214,7 +1214,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam y = configSettings->readNumEntry("/window y", 0, &ok); if (ok) move(x, y); - Q3ValueList sizes = configSettings->readSizes("/split", &ok); + QList sizes = configSettings->readSizes("/split", &ok); if (ok) split->setSizes(sizes); configSettings->endGroup(); @@ -1446,7 +1446,7 @@ ConfigMainWindow::ConfigMainWindow(void) showSplitView(); // UI setup done, restore splitter positions - Q3ValueList sizes = configSettings->readSizes("/split1", &ok); + QList sizes = configSettings->readSizes("/split1", &ok); if (ok) split1->setSizes(sizes); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 4d5218da2110..0d364c701674 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -16,8 +16,8 @@ class ConfigMainWindow; class ConfigSettings : public QSettings { public: ConfigSettings(); - Q3ValueList readSizes(const QString& key, bool *ok); - bool writeSizes(const QString& key, const Q3ValueList& value); + QList readSizes(const QString& key, bool *ok); + bool writeSizes(const QString& key, const QList& value); }; enum colIdx { -- cgit v1.2.3 From 924bbb53d512688bf9caae10a0d2d8b081aea535 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:06 -0700 Subject: Port xconfig to Qt5 - Use QTextBrowser Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 12 ++++++------ scripts/kconfig/qconf.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index bd62f6039626..f4231d406a66 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -1154,22 +1154,22 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *text += str2; } -Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) +QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) { - Q3PopupMenu* popup = Parent::createPopupMenu(pos); + QMenu* popup = Parent::createStandardContextMenu(pos); QAction* action = new QAction(_("Show Debug Info"), popup); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); action->setOn(showDebug()); - popup->insertSeparator(); + popup->addSeparator(); action->addTo(popup); return popup; } -void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e) +void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e) { - Parent::contentsContextMenuEvent(e); + Parent::contextMenuEvent(e); } ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name) diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 0d364c701674..84b62f5804cc 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -232,9 +232,9 @@ public: static QAction *showPromptAction; }; -class ConfigInfoView : public Q3TextBrowser { +class ConfigInfoView : public QTextBrowser { Q_OBJECT - typedef class Q3TextBrowser Parent; + typedef class QTextBrowser Parent; public: ConfigInfoView(QWidget* parent, const char *name = 0); bool showDebug(void) const { return _showDebug; } @@ -254,8 +254,8 @@ protected: QString debug_info(struct symbol *sym); static QString print_filter(const QString &str); static void expr_print_help(void *data, struct symbol *sym, const char *str); - Q3PopupMenu* createPopupMenu(const QPoint& pos); - void contentsContextMenuEvent(QContextMenuEvent *e); + QMenu *createStandardContextMenu(const QPoint & pos); + void contextMenuEvent(QContextMenuEvent *e); struct symbol *sym; struct menu *_menu; -- cgit v1.2.3 From 76bede87084ac891f8ddc727178efa49dc49a0d5 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:07 -0700 Subject: Port xconfig to Qt5 - Use QMenu Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 20 ++++++++++---------- scripts/kconfig/qconf.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index f4231d406a66..334000aa77ff 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -817,7 +817,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) if (!headerPopup) { QAction *action; - headerPopup = new Q3PopupMenu(this); + headerPopup = new QMenu(this); action = new QAction(_("Show Name"), this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), @@ -1387,32 +1387,32 @@ ConfigMainWindow::ConfigMainWindow(void) fullViewAction->addTo(toolBar); // create config menu - Q3PopupMenu* config = new Q3PopupMenu(this); + QMenu* config = new QMenu(this); menu->insertItem(_("&File"), config); loadAction->addTo(config); saveAction->addTo(config); saveAsAction->addTo(config); - config->insertSeparator(); + config->addSeparator(); quitAction->addTo(config); // create edit menu - Q3PopupMenu* editMenu = new Q3PopupMenu(this); + QMenu* editMenu = new QMenu(this); menu->insertItem(_("&Edit"), editMenu); searchAction->addTo(editMenu); // create options menu - Q3PopupMenu* optionMenu = new Q3PopupMenu(this); + QMenu* optionMenu = new QMenu(this); menu->insertItem(_("&Option"), optionMenu); showNameAction->addTo(optionMenu); showRangeAction->addTo(optionMenu); showDataAction->addTo(optionMenu); - optionMenu->insertSeparator(); + optionMenu->addSeparator(); optGroup->addTo(optionMenu); - optionMenu->insertSeparator(); + optionMenu->addSeparator(); // create help menu - Q3PopupMenu* helpMenu = new Q3PopupMenu(this); - menu->insertSeparator(); + QMenu* helpMenu = new QMenu(this); + menu->addSeparator(); menu->insertItem(_("&Help"), helpMenu); showIntroAction->addTo(helpMenu); showAboutAction->addTo(helpMenu); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 84b62f5804cc..94e57bd8fffe 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -117,7 +117,7 @@ public: struct menu *rootEntry; QColorGroup disabledColorGroup; QColorGroup inactivedColorGroup; - Q3PopupMenu* headerPopup; + QMenu* headerPopup; private: int colMap[colNr]; -- cgit v1.2.3 From 1ce67353a77a260fa917086405e326693c35abf2 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:08 -0700 Subject: Port xconfig to Qt5 - Remove unused #include Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 334000aa77ff..64371976ae2a 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -12,7 +12,6 @@ #include #include #include -#include #include #include -- cgit v1.2.3 From 34d6320b825ec2d261d4cb1af83f0582cd2e7954 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:09 -0700 Subject: Port xconfig to Qt5 - Replace Q3VBox with QWidget Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 1 - scripts/kconfig/qconf.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 64371976ae2a..df1700ec2a68 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 94e57bd8fffe..8c7d95105e3c 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -199,9 +199,9 @@ public: ConfigItem *item; }; -class ConfigView : public Q3VBox { +class ConfigView : public QWidget { Q_OBJECT - typedef class Q3VBox Parent; + typedef class QWidget Parent; public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView(void); -- cgit v1.2.3 From 29a70168e2637385295cc60549c038d3c958f8a8 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:10 -0700 Subject: Port xconfig to Qt5 - Fix layout Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index df1700ec2a68..3a5ff5dcae05 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -855,9 +855,13 @@ QAction *ConfigView::showPromptAction; ConfigView::ConfigView(QWidget* parent, const char *name) : Parent(parent, name) { + QVBoxLayout *verticalLayout = new QVBoxLayout(this); + list = new ConfigList(this, name); + verticalLayout->addWidget(list); lineEdit = new ConfigLineEdit(this); lineEdit->hide(); + verticalLayout->addWidget(lineEdit); this->nextView = viewList; viewList = this; @@ -1302,6 +1306,7 @@ ConfigMainWindow::ConfigMainWindow(void) menu = menuBar(); toolBar = new QToolBar("Tools", this); + addToolBar(toolBar); backAction = new QAction(QPixmap(xpm_back), _("Back"), this); connect(backAction, SIGNAL(activated()), SLOT(goBack())); -- cgit v1.2.3 From 92298b496df10415b03574efee5fbba9ce8f5ca0 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:11 -0700 Subject: Port xconfig to Qt5 - Fix layout margin. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 3a5ff5dcae05..6d32f3996ab6 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -856,6 +856,7 @@ ConfigView::ConfigView(QWidget* parent, const char *name) : Parent(parent, name) { QVBoxLayout *verticalLayout = new QVBoxLayout(this); + verticalLayout->setContentsMargins(0, 0, 0, 0); list = new ConfigList(this, name); verticalLayout->addWidget(list); -- cgit v1.2.3 From 9c86235a19861155cdd81e0cb29f34cd0d07fbe2 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:12 -0700 Subject: Port xconfig to Qt5 - Update QAction checkable Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 6d32f3996ab6..c2f9767514de 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -817,28 +817,28 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) headerPopup = new QMenu(this); action = new QAction(_("Show Name"), this); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowName(bool))); connect(parent(), SIGNAL(showNameChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showName); + action->setChecked(showName); action->addTo(headerPopup); action = new QAction(_("Show Range"), this); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowRange(bool))); connect(parent(), SIGNAL(showRangeChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showRange); + action->setChecked(showRange); action->addTo(headerPopup); action = new QAction( _("Show Data"), this); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowData(bool))); connect(parent(), SIGNAL(showDataChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showData); + action->setChecked(showData); action->addTo(headerPopup); } headerPopup->exec(e->globalPos()); @@ -1161,10 +1161,10 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) { QMenu* popup = Parent::createStandardContextMenu(pos); QAction* action = new QAction(_("Show Debug Info"), popup); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showDebug()); + action->setChecked(showDebug()); popup->addSeparator(); action->addTo(popup); return popup; @@ -1337,20 +1337,20 @@ ConfigMainWindow::ConfigMainWindow(void) connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); QAction *showNameAction = new QAction(_("Show Name"), this); - showNameAction->setToggleAction(TRUE); + showNameAction->setCheckable(TRUE); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); - showNameAction->setOn(configView->showName()); + showNameAction->setChecked(configView->showName()); QAction *showRangeAction = new QAction(_("Show Range"), this); - showRangeAction->setToggleAction(TRUE); + showRangeAction->setCheckable(TRUE); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); - showRangeAction->setOn(configList->showRange); + showRangeAction->setChecked(configList->showRange); QAction *showDataAction = new QAction(_("Show Data"), this); - showDataAction->setToggleAction(TRUE); + showDataAction->setCheckable(TRUE); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); - showDataAction->setOn(configList->showData); + showDataAction->setChecked(configList->showData); QActionGroup *optGroup = new QActionGroup(this); optGroup->setExclusive(TRUE); @@ -1362,18 +1362,18 @@ ConfigMainWindow::ConfigMainWindow(void) configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); configView->showAllAction = new QAction(_("Show All Options"), optGroup); configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); - configView->showNormalAction->setToggleAction(TRUE); - configView->showNormalAction->setOn(configList->optMode == normalOpt); - configView->showAllAction->setToggleAction(TRUE); - configView->showAllAction->setOn(configList->optMode == allOpt); - configView->showPromptAction->setToggleAction(TRUE); - configView->showPromptAction->setOn(configList->optMode == promptOpt); + configView->showNormalAction->setCheckable(TRUE); + configView->showNormalAction->setChecked(configList->optMode == normalOpt); + configView->showAllAction->setCheckable(TRUE); + configView->showAllAction->setChecked(configList->optMode == allOpt); + configView->showPromptAction->setCheckable(TRUE); + configView->showPromptAction->setChecked(configList->optMode == promptOpt); QAction *showDebugAction = new QAction( _("Show Debug Info"), this); - showDebugAction->setToggleAction(TRUE); + showDebugAction->setCheckable(TRUE); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); - showDebugAction->setOn(helpText->showDebug()); + showDebugAction->setChecked(helpText->showDebug()); QAction *showIntroAction = new QAction( _("Introduction"), this); connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); -- cgit v1.2.3 From 780505e33f0af32808257fd8b6ace5c3e3d9666f Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:13 -0700 Subject: Port xconfig to Qt5 - Make single/split/full actions checkable. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 30 +++++++++++++++++++++++++++--- scripts/kconfig/qconf.h | 3 +++ 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index c2f9767514de..f439f355dddc 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1329,11 +1329,14 @@ ConfigMainWindow::ConfigMainWindow(void) QAction *searchAction = new QAction(_("&Find"), this); searchAction->setShortcut(Qt::CTRL + Qt::Key_F); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); - QAction *singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); + singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); + singleViewAction->setCheckable(TRUE); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); - QAction *splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); + splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); + splitViewAction->setCheckable(TRUE); connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); - QAction *fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); + fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); + fullViewAction->setCheckable(TRUE); connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); QAction *showNameAction = new QAction(_("Show Name"), this); @@ -1579,6 +1582,13 @@ void ConfigMainWindow::goBack(void) void ConfigMainWindow::showSingleView(void) { + singleViewAction->setEnabled(false); + singleViewAction->setChecked(true); + splitViewAction->setEnabled(true); + splitViewAction->setChecked(false); + fullViewAction->setEnabled(true); + fullViewAction->setChecked(false); + menuView->hide(); menuList->setRootMenu(0); configList->mode = singleMode; @@ -1592,6 +1602,13 @@ void ConfigMainWindow::showSingleView(void) void ConfigMainWindow::showSplitView(void) { + singleViewAction->setEnabled(true); + singleViewAction->setChecked(false); + splitViewAction->setEnabled(false); + splitViewAction->setChecked(true); + fullViewAction->setEnabled(true); + fullViewAction->setChecked(false); + configList->mode = symbolMode; if (configList->rootEntry == &rootmenu) configList->updateListAll(); @@ -1608,6 +1625,13 @@ void ConfigMainWindow::showSplitView(void) void ConfigMainWindow::showFullView(void) { + singleViewAction->setEnabled(true); + singleViewAction->setChecked(false); + splitViewAction->setEnabled(true); + splitViewAction->setChecked(false); + fullViewAction->setEnabled(false); + fullViewAction->setChecked(true); + menuView->hide(); menuList->setRootMenu(0); configList->mode = fullMode; diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 8c7d95105e3c..213990129e51 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -316,6 +316,9 @@ protected: ConfigInfoView *helpText; QToolBar *toolBar; QAction *backAction; + QAction *singleViewAction; + QAction *splitViewAction; + QAction *fullViewAction; QSplitter* split1; QSplitter* split2; }; -- cgit v1.2.3 From 76538660fb08f2f794d569a594a95fc55eb03932 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:14 -0700 Subject: Port xconfig to Qt5 - Remove custom ListView classes. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 904 +---------------------------------------------- scripts/kconfig/qconf.h | 177 +--------- 2 files changed, 15 insertions(+), 1066 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index f439f355dddc..319559f361ac 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -87,213 +87,15 @@ bool ConfigSettings::writeSizes(const QString& key, const QList& value) return writeEntry(key, stringList); } - -/* - * set the new data - * TODO check the value - */ -void ConfigItem::okRename(int col) -{ - Parent::okRename(col); - sym_set_string_value(menu->sym, text(dataColIdx).latin1()); - listView()->updateList(this); -} - -/* - * update the displayed of a menu entry - */ -void ConfigItem::updateMenu(void) -{ - ConfigList* list; - struct symbol* sym; - struct property *prop; - QString prompt; - int type; - tristate expr; - - list = listView(); - if (goParent) { - setPixmap(promptColIdx, list->menuBackPix); - prompt = ".."; - goto set_prompt; - } - - sym = menu->sym; - prop = menu->prompt; - prompt = _(menu_get_prompt(menu)); - - if (prop) switch (prop->type) { - case P_MENU: - if (list->mode == singleMode || list->mode == symbolMode) { - /* a menuconfig entry is displayed differently - * depending whether it's at the view root or a child. - */ - if (sym && list->rootEntry == menu) - break; - setPixmap(promptColIdx, list->menuPix); - } else { - if (sym) - break; - setPixmap(promptColIdx, 0); - } - goto set_prompt; - case P_COMMENT: - setPixmap(promptColIdx, 0); - goto set_prompt; - default: - ; - } - if (!sym) - goto set_prompt; - - setText(nameColIdx, QString::fromLocal8Bit(sym->name)); - - type = sym_get_type(sym); - switch (type) { - case S_BOOLEAN: - case S_TRISTATE: - char ch; - - if (!sym_is_changable(sym) && list->optMode == normalOpt) { - setPixmap(promptColIdx, 0); - setText(noColIdx, QString::null); - setText(modColIdx, QString::null); - setText(yesColIdx, QString::null); - break; - } - expr = sym_get_tristate_value(sym); - switch (expr) { - case yes: - if (sym_is_choice_value(sym) && type == S_BOOLEAN) - setPixmap(promptColIdx, list->choiceYesPix); - else - setPixmap(promptColIdx, list->symbolYesPix); - setText(yesColIdx, "Y"); - ch = 'Y'; - break; - case mod: - setPixmap(promptColIdx, list->symbolModPix); - setText(modColIdx, "M"); - ch = 'M'; - break; - default: - if (sym_is_choice_value(sym) && type == S_BOOLEAN) - setPixmap(promptColIdx, list->choiceNoPix); - else - setPixmap(promptColIdx, list->symbolNoPix); - setText(noColIdx, "N"); - ch = 'N'; - break; - } - if (expr != no) - setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); - if (expr != mod) - setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); - if (expr != yes) - setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); - - setText(dataColIdx, QChar(ch)); - break; - case S_INT: - case S_HEX: - case S_STRING: - const char* data; - - data = sym_get_string_value(sym); - - int i = list->mapIdx(dataColIdx); - if (i >= 0) - setRenameEnabled(i, TRUE); - setText(dataColIdx, data); - if (type == S_STRING) - prompt = QString("%1: %2").arg(prompt).arg(data); - else - prompt = QString("(%2) %1").arg(prompt).arg(data); - break; - } - if (!sym_has_value(sym) && visible) - prompt += _(" (NEW)"); -set_prompt: - setText(promptColIdx, prompt); -} - -void ConfigItem::testUpdateMenu(bool v) -{ - ConfigItem* i; - - visible = v; - if (!menu) - return; - - sym_calc_value(menu->sym); - if (menu->flags & MENU_CHANGED) { - /* the menu entry changed, so update all list items */ - menu->flags &= ~MENU_CHANGED; - for (i = (ConfigItem*)menu->data; i; i = i->nextItem) - i->updateMenu(); - } else if (listView()->updateAll) - updateMenu(); -} - -void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) -{ - ConfigList* list = listView(); - - if (visible) { - if (isSelected() && !list->hasFocus() && list->mode == menuMode) - Parent::paintCell(p, list->inactivedColorGroup, column, width, align); - else - Parent::paintCell(p, cg, column, width, align); - } else - Parent::paintCell(p, list->disabledColorGroup, column, width, align); -} - -/* - * construct a menu entry - */ -void ConfigItem::init(void) -{ - if (menu) { - ConfigList* list = listView(); - nextItem = (ConfigItem*)menu->data; - menu->data = this; - - if (list->mode != fullMode) - setOpen(TRUE); - sym_calc_value(menu->sym); - } - updateMenu(); -} - -/* - * destruct a menu entry - */ -ConfigItem::~ConfigItem(void) -{ - if (menu) { - ConfigItem** ip = (ConfigItem**)&menu->data; - for (; *ip; ip = &(*ip)->nextItem) { - if (*ip == this) { - *ip = nextItem; - break; - } - } - } -} - ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { connect(this, SIGNAL(lostFocus()), SLOT(hide())); } -void ConfigLineEdit::show(ConfigItem* i) +void ConfigLineEdit::show(Q3ListViewItem *i) { item = i; - if (sym_get_string_value(item->menu->sym)) - setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym))); - else - setText(QString::null); Parent::show(); setFocus(); } @@ -305,7 +107,6 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) break; case Qt::Key_Return: case Qt::Key_Enter: - sym_set_string_value(item->menu->sym, text().latin1()); parent()->updateList(item); break; default: @@ -317,536 +118,6 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) hide(); } -ConfigList::ConfigList(ConfigView* p, const char *name) - : Parent(p, name), - updateAll(false), - symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), - choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), - menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), - showName(false), showRange(false), showData(false), optMode(normalOpt), - rootEntry(0), headerPopup(0) -{ - int i; - - setSorting(-1); - setRootIsDecorated(TRUE); - disabledColorGroup = palette().active(); - disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text()); - inactivedColorGroup = palette().active(); - inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight()); - - connect(this, SIGNAL(selectionChanged(void)), - SLOT(updateSelection(void))); - - if (name) { - configSettings->beginGroup(name); - showName = configSettings->readBoolEntry("/showName", false); - showRange = configSettings->readBoolEntry("/showRange", false); - showData = configSettings->readBoolEntry("/showData", false); - optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); - configSettings->endGroup(); - connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); - } - - for (i = 0; i < colNr; i++) - colMap[i] = colRevMap[i] = -1; - addColumn(promptColIdx, _("Option")); - - reinit(); -} - -bool ConfigList::menuSkip(struct menu *menu) -{ - if (optMode == normalOpt && menu_is_visible(menu)) - return false; - if (optMode == promptOpt && menu_has_prompt(menu)) - return false; - if (optMode == allOpt) - return false; - return true; -} - -void ConfigList::reinit(void) -{ - removeColumn(dataColIdx); - removeColumn(yesColIdx); - removeColumn(modColIdx); - removeColumn(noColIdx); - removeColumn(nameColIdx); - - if (showName) - addColumn(nameColIdx, _("Name")); - if (showRange) { - addColumn(noColIdx, "N"); - addColumn(modColIdx, "M"); - addColumn(yesColIdx, "Y"); - } - if (showData) - addColumn(dataColIdx, _("Value")); - - updateListAll(); -} - -void ConfigList::saveSettings(void) -{ - if (name()) { - configSettings->beginGroup(name()); - configSettings->writeEntry("/showName", showName); - configSettings->writeEntry("/showRange", showRange); - configSettings->writeEntry("/showData", showData); - configSettings->writeEntry("/optionMode", (int)optMode); - configSettings->endGroup(); - } -} - -ConfigItem* ConfigList::findConfigItem(struct menu *menu) -{ - ConfigItem* item = (ConfigItem*)menu->data; - - for (; item; item = item->nextItem) { - if (this == item->listView()) - break; - } - - return item; -} - -void ConfigList::updateSelection(void) -{ - struct menu *menu; - enum prop_type type; - - ConfigItem* item = (ConfigItem*)selectedItem(); - if (!item) - return; - - menu = item->menu; - emit menuChanged(menu); - if (!menu) - return; - type = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (mode == menuMode && type == P_MENU) - emit menuSelected(menu); -} - -void ConfigList::updateList(ConfigItem* item) -{ - ConfigItem* last = 0; - - if (!rootEntry) { - if (mode != listMode) - goto update; - Q3ListViewItemIterator it(this); - ConfigItem* item; - - for (; it.current(); ++it) { - item = (ConfigItem*)it.current(); - if (!item->menu) - continue; - item->testUpdateMenu(menu_is_visible(item->menu)); - } - return; - } - - if (rootEntry != &rootmenu && (mode == singleMode || - (mode == symbolMode && rootEntry->parent != &rootmenu))) { - item = firstChild(); - if (!item) - item = new ConfigItem(this, 0, true); - last = item; - } - if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) && - rootEntry->sym && rootEntry->prompt) { - item = last ? last->nextSibling() : firstChild(); - if (!item) - item = new ConfigItem(this, last, rootEntry, true); - else - item->testUpdateMenu(true); - - updateMenuList(item, rootEntry); - triggerUpdate(); - return; - } -update: - updateMenuList(this, rootEntry); - triggerUpdate(); -} - -void ConfigList::setValue(ConfigItem* item, tristate val) -{ - struct symbol* sym; - int type; - tristate oldval; - - sym = item->menu ? item->menu->sym : 0; - if (!sym) - return; - - type = sym_get_type(sym); - switch (type) { - case S_BOOLEAN: - case S_TRISTATE: - oldval = sym_get_tristate_value(sym); - - if (!sym_set_tristate_value(sym, val)) - return; - if (oldval == no && item->menu->list) - item->setOpen(TRUE); - parent()->updateList(item); - break; - } -} - -void ConfigList::changeValue(ConfigItem* item) -{ - struct symbol* sym; - struct menu* menu; - int type, oldexpr, newexpr; - - menu = item->menu; - if (!menu) - return; - sym = menu->sym; - if (!sym) { - if (item->menu->list) - item->setOpen(!item->isOpen()); - return; - } - - type = sym_get_type(sym); - switch (type) { - case S_BOOLEAN: - case S_TRISTATE: - oldexpr = sym_get_tristate_value(sym); - newexpr = sym_toggle_tristate_value(sym); - if (item->menu->list) { - if (oldexpr == newexpr) - item->setOpen(!item->isOpen()); - else if (oldexpr == no) - item->setOpen(TRUE); - } - if (oldexpr != newexpr) - parent()->updateList(item); - break; - case S_INT: - case S_HEX: - case S_STRING: - if (colMap[dataColIdx] >= 0) - item->startRename(colMap[dataColIdx]); - else - parent()->lineEdit->show(item); - break; - } -} - -void ConfigList::setRootMenu(struct menu *menu) -{ - enum prop_type type; - - if (rootEntry == menu) - return; - type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (type != P_MENU) - return; - updateMenuList(this, 0); - rootEntry = menu; - updateListAll(); - setSelected(currentItem(), hasFocus()); - ensureItemVisible(currentItem()); -} - -void ConfigList::setParentMenu(void) -{ - ConfigItem* item; - struct menu *oldroot; - - oldroot = rootEntry; - if (rootEntry == &rootmenu) - return; - setRootMenu(menu_get_parent_menu(rootEntry->parent)); - - Q3ListViewItemIterator it(this); - for (; (item = (ConfigItem*)it.current()); it++) { - if (item->menu == oldroot) { - setCurrentItem(item); - ensureItemVisible(item); - break; - } - } -} - -/* - * update all the children of a menu entry - * removes/adds the entries from the parent widget as necessary - * - * parent: either the menu list widget or a menu entry widget - * menu: entry to be updated - */ -template -void ConfigList::updateMenuList(P* parent, struct menu* menu) -{ - struct menu* child; - ConfigItem* item; - ConfigItem* last; - bool visible; - enum prop_type type; - - if (!menu) { - while ((item = parent->firstChild())) - delete item; - return; - } - - last = parent->firstChild(); - if (last && !last->goParent) - last = 0; - for (child = menu->list; child; child = child->next) { - item = last ? last->nextSibling() : parent->firstChild(); - type = child->prompt ? child->prompt->type : P_UNKNOWN; - - switch (mode) { - case menuMode: - if (!(child->flags & MENU_ROOT)) - goto hide; - break; - case symbolMode: - if (child->flags & MENU_ROOT) - goto hide; - break; - default: - break; - } - - visible = menu_is_visible(child); - if (!menuSkip(child)) { - if (!child->sym && !child->list && !child->prompt) - continue; - if (!item || item->menu != child) - item = new ConfigItem(parent, last, child, visible); - else - item->testUpdateMenu(visible); - - if (mode == fullMode || mode == menuMode || type != P_MENU) - updateMenuList(item, child); - else - updateMenuList(item, 0); - last = item; - continue; - } - hide: - if (item && item->menu == child) { - last = parent->firstChild(); - if (last == item) - last = 0; - else while (last->nextSibling() != item) - last = last->nextSibling(); - delete item; - } - } -} - -void ConfigList::keyPressEvent(QKeyEvent* ev) -{ - Q3ListViewItem* i = currentItem(); - ConfigItem* item; - struct menu *menu; - enum prop_type type; - - if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { - emit parentSelected(); - ev->accept(); - return; - } - - if (!i) { - Parent::keyPressEvent(ev); - return; - } - item = (ConfigItem*)i; - - switch (ev->key()) { - case Qt::Key_Return: - case Qt::Key_Enter: - if (item->goParent) { - emit parentSelected(); - break; - } - menu = item->menu; - if (!menu) - break; - type = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (type == P_MENU && rootEntry != menu && - mode != fullMode && mode != menuMode) { - emit menuSelected(menu); - break; - } - case Qt::Key_Space: - changeValue(item); - break; - case Qt::Key_N: - setValue(item, no); - break; - case Qt::Key_M: - setValue(item, mod); - break; - case Qt::Key_Y: - setValue(item, yes); - break; - default: - Parent::keyPressEvent(ev); - return; - } - ev->accept(); -} - -void ConfigList::contentsMousePressEvent(QMouseEvent* e) -{ - //QPoint p(contentsToViewport(e->pos())); - //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); - Parent::contentsMousePressEvent(e); -} - -void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) -{ - QPoint p(contentsToViewport(e->pos())); - ConfigItem* item = (ConfigItem*)itemAt(p); - struct menu *menu; - enum prop_type ptype; - const QPixmap* pm; - int idx, x; - - if (!item) - goto skip; - - menu = item->menu; - x = header()->offset() + p.x(); - idx = colRevMap[header()->sectionAt(x)]; - switch (idx) { - case promptColIdx: - pm = item->pixmap(promptColIdx); - if (pm) { - int off = header()->sectionPos(0) + itemMargin() + - treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); - if (x >= off && x < off + pm->width()) { - if (item->goParent) { - emit parentSelected(); - break; - } else if (!menu) - break; - ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (ptype == P_MENU && rootEntry != menu && - mode != fullMode && mode != menuMode) - emit menuSelected(menu); - else - changeValue(item); - } - } - break; - case noColIdx: - setValue(item, no); - break; - case modColIdx: - setValue(item, mod); - break; - case yesColIdx: - setValue(item, yes); - break; - case dataColIdx: - changeValue(item); - break; - } - -skip: - //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); - Parent::contentsMouseReleaseEvent(e); -} - -void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) -{ - //QPoint p(contentsToViewport(e->pos())); - //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); - Parent::contentsMouseMoveEvent(e); -} - -void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) -{ - QPoint p(contentsToViewport(e->pos())); - ConfigItem* item = (ConfigItem*)itemAt(p); - struct menu *menu; - enum prop_type ptype; - - if (!item) - goto skip; - if (item->goParent) { - emit parentSelected(); - goto skip; - } - menu = item->menu; - if (!menu) - goto skip; - ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (ptype == P_MENU && (mode == singleMode || mode == symbolMode)) - emit menuSelected(menu); - else if (menu->sym) - changeValue(item); - -skip: - //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); - Parent::contentsMouseDoubleClickEvent(e); -} - -void ConfigList::focusInEvent(QFocusEvent *e) -{ - struct menu *menu = NULL; - - Parent::focusInEvent(e); - - ConfigItem* item = (ConfigItem *)currentItem(); - if (item) { - setSelected(item, TRUE); - menu = item->menu; - } - emit gotFocus(menu); -} - -void ConfigList::contextMenuEvent(QContextMenuEvent *e) -{ - if (e->y() <= header()->geometry().bottom()) { - if (!headerPopup) { - QAction *action; - - headerPopup = new QMenu(this); - action = new QAction(_("Show Name"), this); - action->setCheckable(TRUE); - connect(action, SIGNAL(toggled(bool)), - parent(), SLOT(setShowName(bool))); - connect(parent(), SIGNAL(showNameChanged(bool)), - action, SLOT(setOn(bool))); - action->setChecked(showName); - action->addTo(headerPopup); - action = new QAction(_("Show Range"), this); - action->setCheckable(TRUE); - connect(action, SIGNAL(toggled(bool)), - parent(), SLOT(setShowRange(bool))); - connect(parent(), SIGNAL(showRangeChanged(bool)), - action, SLOT(setOn(bool))); - action->setChecked(showRange); - action->addTo(headerPopup); - action = new QAction( _("Show Data"), this); - action->setCheckable(TRUE); - connect(action, SIGNAL(toggled(bool)), - parent(), SLOT(setShowData(bool))); - connect(parent(), SIGNAL(showDataChanged(bool)), - action, SLOT(setOn(bool))); - action->setChecked(showData); - action->addTo(headerPopup); - } - headerPopup->exec(e->globalPos()); - e->accept(); - } else - e->ignore(); -} - ConfigView*ConfigView::viewList; QAction *ConfigView::showNormalAction; QAction *ConfigView::showAllAction; @@ -858,7 +129,7 @@ ConfigView::ConfigView(QWidget* parent, const char *name) QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setContentsMargins(0, 0, 0, 0); - list = new ConfigList(this, name); + list = new Q3ListView(this, name); verticalLayout->addWidget(list); lineEdit = new ConfigLineEdit(this); lineEdit->hide(); @@ -882,65 +153,26 @@ ConfigView::~ConfigView(void) void ConfigView::setOptionMode(QAction *act) { - if (act == showNormalAction) - list->optMode = normalOpt; - else if (act == showAllAction) - list->optMode = allOpt; - else - list->optMode = promptOpt; - - list->updateListAll(); } void ConfigView::setShowName(bool b) { - if (list->showName != b) { - list->showName = b; - list->reinit(); - emit showNameChanged(b); - } } void ConfigView::setShowRange(bool b) { - if (list->showRange != b) { - list->showRange = b; - list->reinit(); - emit showRangeChanged(b); - } } void ConfigView::setShowData(bool b) { - if (list->showData != b) { - list->showData = b; - list->reinit(); - emit showDataChanged(b); - } -} - -void ConfigList::setAllOpen(bool open) -{ - Q3ListViewItemIterator it(this); - - for (; it.current(); it++) - it.current()->setOpen(open); } -void ConfigView::updateList(ConfigItem* item) +void ConfigView::updateList(Q3ListViewItem* item) { - ConfigView* v; - - for (v = viewList; v; v = v->nextView) - v->list->updateList(item); } void ConfigView::updateListAll(void) { - ConfigView* v; - - for (v = viewList; v; v = v->nextView) - v->list->updateListAll(); } ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) @@ -1195,7 +427,6 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam split = new QSplitter(this); split->setOrientation(Qt::Vertical); list = new ConfigView(split, name); - list->list->mode = listMode; info = new ConfigInfoView(split, name); connect(list->list, SIGNAL(menuChanged(struct menu *)), info, SLOT(setInfo(struct menu *))); @@ -1240,22 +471,6 @@ void ConfigSearchWindow::saveSettings(void) void ConfigSearchWindow::search(void) { - struct symbol **p; - struct property *prop; - ConfigItem *lastItem = NULL; - - free(result); - list->list->clear(); - info->clear(); - - result = sym_re_search(editField->text().latin1()); - if (!result) - return; - for (p = result; *p; p++) { - for_all_prompts((*p), prop) - lastItem = new ConfigItem(list->list, lastItem, prop->menu, - menu_is_visible(prop->menu)); - } } /* @@ -1348,12 +563,10 @@ ConfigMainWindow::ConfigMainWindow(void) showRangeAction->setCheckable(TRUE); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); - showRangeAction->setChecked(configList->showRange); QAction *showDataAction = new QAction(_("Show Data"), this); showDataAction->setCheckable(TRUE); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); - showDataAction->setChecked(configList->showData); QActionGroup *optGroup = new QActionGroup(this); optGroup->setExclusive(TRUE); @@ -1366,11 +579,8 @@ ConfigMainWindow::ConfigMainWindow(void) configView->showAllAction = new QAction(_("Show All Options"), optGroup); configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); configView->showNormalAction->setCheckable(TRUE); - configView->showNormalAction->setChecked(configList->optMode == normalOpt); configView->showAllAction->setCheckable(TRUE); - configView->showAllAction->setChecked(configList->optMode == allOpt); configView->showPromptAction->setCheckable(TRUE); - configView->showPromptAction->setChecked(configList->optMode == promptOpt); QAction *showDebugAction = new QAction( _("Show Debug Info"), this); showDebugAction->setCheckable(TRUE); @@ -1498,86 +708,19 @@ void ConfigMainWindow::searchConfig(void) void ConfigMainWindow::changeMenu(struct menu *menu) { - configList->setRootMenu(menu); - if (configList->rootEntry->parent == &rootmenu) - backAction->setEnabled(FALSE); - else - backAction->setEnabled(TRUE); + } void ConfigMainWindow::setMenuLink(struct menu *menu) { - struct menu *parent; - ConfigList* list = NULL; - ConfigItem* item; - - if (configList->menuSkip(menu)) - return; - - switch (configList->mode) { - case singleMode: - list = configList; - parent = menu_get_parent_menu(menu); - if (!parent) - return; - list->setRootMenu(parent); - break; - case symbolMode: - if (menu->flags & MENU_ROOT) { - configList->setRootMenu(menu); - configList->clearSelection(); - list = menuList; - } else { - list = configList; - parent = menu_get_parent_menu(menu->parent); - if (!parent) - return; - item = menuList->findConfigItem(parent); - if (item) { - menuList->setSelected(item, TRUE); - menuList->ensureItemVisible(item); - } - list->setRootMenu(parent); - } - break; - case fullMode: - list = configList; - break; - default: - break; - } - - if (list) { - item = list->findConfigItem(menu); - if (item) { - list->setSelected(item, TRUE); - list->ensureItemVisible(item); - list->setFocus(); - } - } } void ConfigMainWindow::listFocusChanged(void) { - if (menuList->mode == menuMode) - configList->clearSelection(); } void ConfigMainWindow::goBack(void) { - ConfigItem* item; - - configList->setParentMenu(); - if (configList->rootEntry == &rootmenu) - backAction->setEnabled(FALSE); - item = (ConfigItem*)menuList->selectedItem(); - while (item) { - if (item->menu == configList->rootEntry) { - menuList->setSelected(item, TRUE); - break; - } - item = (ConfigItem*)item->parent(); - } } void ConfigMainWindow::showSingleView(void) @@ -1590,13 +733,6 @@ void ConfigMainWindow::showSingleView(void) fullViewAction->setChecked(false); menuView->hide(); - menuList->setRootMenu(0); - configList->mode = singleMode; - if (configList->rootEntry == &rootmenu) - configList->updateListAll(); - else - configList->setRootMenu(&rootmenu); - configList->setAllOpen(TRUE); configList->setFocus(); } @@ -1609,16 +745,6 @@ void ConfigMainWindow::showSplitView(void) fullViewAction->setEnabled(true); fullViewAction->setChecked(false); - configList->mode = symbolMode; - if (configList->rootEntry == &rootmenu) - configList->updateListAll(); - else - configList->setRootMenu(&rootmenu); - configList->setAllOpen(TRUE); - configApp->processEvents(); - menuList->mode = menuMode; - menuList->setRootMenu(&rootmenu); - menuList->setAllOpen(TRUE); menuView->show(); menuList->setFocus(); } @@ -1633,13 +759,6 @@ void ConfigMainWindow::showFullView(void) fullViewAction->setChecked(true); menuView->hide(); - menuList->setRootMenu(0); - configList->mode = fullMode; - if (configList->rootEntry == &rootmenu) - configList->updateListAll(); - else - configList->setRootMenu(&rootmenu); - configList->setAllOpen(FALSE); configList->setFocus(); } @@ -1707,22 +826,7 @@ void ConfigMainWindow::saveSettings(void) configSettings->writeEntry("/window height", size().height()); QString entry; - switch(configList->mode) { - case singleMode : - entry = "single"; - break; - - case symbolMode : - entry = "split"; - break; - - case fullMode : - entry = "full"; - break; - default: - break; - } configSettings->writeEntry("/listMode", entry); configSettings->writeSizes("/split1", split1->sizes()); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 213990129e51..d025f29694c6 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -8,8 +8,6 @@ #include class ConfigView; -class ConfigList; -class ConfigItem; class ConfigLineEdit; class ConfigMainWindow; @@ -30,159 +28,6 @@ enum optionMode { normalOpt = 0, allOpt, promptOpt }; -class ConfigList : public Q3ListView { - Q_OBJECT - typedef class Q3ListView Parent; -public: - ConfigList(ConfigView* p, const char *name = 0); - void reinit(void); - ConfigView* parent(void) const - { - return (ConfigView*)Parent::parent(); - } - ConfigItem* findConfigItem(struct menu *); - -protected: - void keyPressEvent(QKeyEvent *e); - void contentsMousePressEvent(QMouseEvent *e); - void contentsMouseReleaseEvent(QMouseEvent *e); - void contentsMouseMoveEvent(QMouseEvent *e); - void contentsMouseDoubleClickEvent(QMouseEvent *e); - void focusInEvent(QFocusEvent *e); - void contextMenuEvent(QContextMenuEvent *e); - -public slots: - void setRootMenu(struct menu *menu); - - void updateList(ConfigItem *item); - void setValue(ConfigItem* item, tristate val); - void changeValue(ConfigItem* item); - void updateSelection(void); - void saveSettings(void); -signals: - void menuChanged(struct menu *menu); - void menuSelected(struct menu *menu); - void parentSelected(void); - void gotFocus(struct menu *); - -public: - void updateListAll(void) - { - updateAll = true; - updateList(NULL); - updateAll = false; - } - ConfigList* listView() - { - return this; - } - ConfigItem* firstChild() const - { - return (ConfigItem *)Parent::firstChild(); - } - int mapIdx(colIdx idx) - { - return colMap[idx]; - } - void addColumn(colIdx idx, const QString& label) - { - colMap[idx] = Parent::addColumn(label); - colRevMap[colMap[idx]] = idx; - } - void removeColumn(colIdx idx) - { - int col = colMap[idx]; - if (col >= 0) { - Parent::removeColumn(col); - colRevMap[col] = colMap[idx] = -1; - } - } - void setAllOpen(bool open); - void setParentMenu(void); - - bool menuSkip(struct menu *); - - template - void updateMenuList(P*, struct menu*); - - bool updateAll; - - QPixmap symbolYesPix, symbolModPix, symbolNoPix; - QPixmap choiceYesPix, choiceNoPix; - QPixmap menuPix, menuInvPix, menuBackPix, voidPix; - - bool showName, showRange, showData; - enum listMode mode; - enum optionMode optMode; - struct menu *rootEntry; - QColorGroup disabledColorGroup; - QColorGroup inactivedColorGroup; - QMenu* headerPopup; - -private: - int colMap[colNr]; - int colRevMap[colNr]; -}; - -class ConfigItem : public Q3ListViewItem { - typedef class Q3ListViewItem Parent; -public: - ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) - { - init(); - } - ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) - { - init(); - } - ConfigItem(Q3ListView *parent, ConfigItem *after, bool v) - : Parent(parent, after), menu(0), visible(v), goParent(true) - { - init(); - } - ~ConfigItem(void); - void init(void); - void okRename(int col); - void updateMenu(void); - void testUpdateMenu(bool v); - ConfigList* listView() const - { - return (ConfigList*)Parent::listView(); - } - ConfigItem* firstChild() const - { - return (ConfigItem *)Parent::firstChild(); - } - ConfigItem* nextSibling() const - { - return (ConfigItem *)Parent::nextSibling(); - } - void setText(colIdx idx, const QString& text) - { - Parent::setText(listView()->mapIdx(idx), text); - } - QString text(colIdx idx) const - { - return Parent::text(listView()->mapIdx(idx)); - } - void setPixmap(colIdx idx, const QPixmap& pm) - { - Parent::setPixmap(listView()->mapIdx(idx), pm); - } - const QPixmap* pixmap(colIdx idx) const - { - return Parent::pixmap(listView()->mapIdx(idx)); - } - void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align); - - ConfigItem* nextItem; - struct menu *menu; - bool visible; - bool goParent; -}; - class ConfigLineEdit : public QLineEdit { Q_OBJECT typedef class QLineEdit Parent; @@ -192,11 +37,11 @@ public: { return (ConfigView*)Parent::parent(); } - void show(ConfigItem *i); + void show(Q3ListViewItem *i); void keyPressEvent(QKeyEvent *e); public: - ConfigItem *item; + Q3ListViewItem *item; }; class ConfigView : public QWidget { @@ -205,12 +50,12 @@ class ConfigView : public QWidget { public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView(void); - static void updateList(ConfigItem* item); + static void updateList(Q3ListViewItem* item); static void updateListAll(void); - bool showName(void) const { return list->showName; } - bool showRange(void) const { return list->showRange; } - bool showData(void) const { return list->showData; } + bool showName(void) const { return false; } // TODO: Implement me. + bool showRange(void) const { return false; } // TODO: Implement me. + bool showData(void) const { return false; } // TODO: Implement me. public slots: void setShowName(bool); void setShowRange(bool); @@ -221,7 +66,7 @@ signals: void showRangeChanged(bool); void showDataChanged(bool); public: - ConfigList* list; + Q3ListView* list; ConfigLineEdit* lineEdit; static ConfigView* viewList; @@ -310,15 +155,15 @@ protected: ConfigSearchWindow *searchWindow; ConfigView *menuView; - ConfigList *menuList; + Q3ListView *menuList; ConfigView *configView; - ConfigList *configList; + Q3ListView *configList; ConfigInfoView *helpText; QToolBar *toolBar; QAction *backAction; QAction *singleViewAction; QAction *splitViewAction; QAction *fullViewAction; - QSplitter* split1; - QSplitter* split2; + QSplitter *split1; + QSplitter *split2; }; -- cgit v1.2.3 From 68ccb7ef4974bfce0d99a4425324a1c7ef85a82e Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:15 -0700 Subject: Port xconfig to Qt5 - Fix the code so it compiles with Qt5 Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 185 +++++++++++++++++++++++------------------------ scripts/kconfig/qconf.h | 23 ++++-- 2 files changed, 108 insertions(+), 100 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 319559f361ac..d134a89bfdce 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -51,7 +50,7 @@ static inline QString qgettext(const char* str) static inline QString qgettext(const QString& str) { - return QString::fromLocal8Bit(gettext(str.latin1())); + return QString::fromLocal8Bit(gettext(str.toLatin1())); } ConfigSettings::ConfigSettings() @@ -65,7 +64,7 @@ ConfigSettings::ConfigSettings() QList ConfigSettings::readSizes(const QString& key, bool *ok) { QList result; - QStringList entryList = readListEntry(key, ok); + QStringList entryList = value(key).toStringList(); QStringList::Iterator it; for (it = entryList.begin(); it != entryList.end(); ++it) @@ -84,7 +83,8 @@ bool ConfigSettings::writeSizes(const QString& key, const QList& value) for (it = value.begin(); it != value.end(); ++it) stringList.push_back(QString::number(*it)); - return writeEntry(key, stringList); + setValue(key, stringList); + return true; } ConfigLineEdit::ConfigLineEdit(ConfigView* parent) @@ -93,7 +93,7 @@ ConfigLineEdit::ConfigLineEdit(ConfigView* parent) connect(this, SIGNAL(lostFocus()), SLOT(hide())); } -void ConfigLineEdit::show(Q3ListViewItem *i) +void ConfigLineEdit::show(QTreeWidgetItem *i) { item = i; Parent::show(); @@ -124,12 +124,12 @@ QAction *ConfigView::showAllAction; QAction *ConfigView::showPromptAction; ConfigView::ConfigView(QWidget* parent, const char *name) - : Parent(parent, name) + : Parent(parent) { QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setContentsMargins(0, 0, 0, 0); - list = new Q3ListView(this, name); + list = new QTreeWidget(this); verticalLayout->addWidget(list); lineEdit = new ConfigLineEdit(this); lineEdit->hide(); @@ -167,7 +167,7 @@ void ConfigView::setShowData(bool b) { } -void ConfigView::updateList(Q3ListViewItem* item) +void ConfigView::updateList(QTreeWidgetItem* item) { } @@ -176,11 +176,11 @@ void ConfigView::updateListAll(void) } ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) - : Parent(parent, name), sym(0), _menu(0) + : Parent(parent), sym(0), _menu(0) { if (name) { configSettings->beginGroup(name); - _showDebug = configSettings->readBoolEntry("/showDebug", false); + _showDebug = configSettings->value("/showDebug", false).toBool(); configSettings->endGroup(); connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); } @@ -188,11 +188,11 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) void ConfigInfoView::saveSettings(void) { - if (name()) { + /*if (name()) { configSettings->beginGroup(name()); - configSettings->writeEntry("/showDebug", showDebug()); + configSettings->setValue("/showDebug", showDebug()); configSettings->endGroup(); - } + }*/ } void ConfigInfoView::setShowDebug(bool b) @@ -349,8 +349,8 @@ QString ConfigInfoView::print_filter(const QString &str) { QRegExp re("[<>&\"\\n]"); QString res = str; - for (int i = 0; (i = res.find(re, i)) >= 0;) { - switch (res[i].latin1()) { + for (int i = 0; (i = res.indexOf(re, i)) >= 0;) { + switch (res[i].toLatin1()) { case '<': res.replace(i, 1, "<"); i += 4; @@ -393,12 +393,12 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) { QMenu* popup = Parent::createStandardContextMenu(pos); QAction* action = new QAction(_("Show Debug Info"), popup); - action->setCheckable(TRUE); + action->setCheckable(true); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); action->setChecked(showDebug()); popup->addSeparator(); - action->addTo(popup); + popup->addAction(action); return popup; } @@ -408,18 +408,22 @@ void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e) } ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name) - : Parent(parent, name), result(NULL) + : Parent(parent), result(NULL) { - setCaption("Search Config"); + setWindowTitle("Search Config"); - QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6); - QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6); + QVBoxLayout* layout1 = new QVBoxLayout(this); + layout1->setContentsMargins(11, 11, 11, 11); + layout1->setSpacing(6); + QHBoxLayout* layout2 = new QHBoxLayout(0); + layout2->setContentsMargins(0, 0, 0, 0); + layout2->setSpacing(6); layout2->addWidget(new QLabel(_("Find:"), this)); editField = new QLineEdit(this); connect(editField, SIGNAL(returnPressed()), SLOT(search())); layout2->addWidget(editField); searchButton = new QPushButton(_("Search"), this); - searchButton->setAutoDefault(FALSE); + searchButton->setAutoDefault(false); connect(searchButton, SIGNAL(clicked()), SLOT(search())); layout2->addWidget(searchButton); layout1->addLayout(layout2); @@ -436,18 +440,18 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam layout1->addWidget(split); if (name) { - int x, y, width, height; + QVariant x, y; + int width, height; bool ok; configSettings->beginGroup(name); - width = configSettings->readNumEntry("/window width", parent->width() / 2); - height = configSettings->readNumEntry("/window height", parent->height() / 2); + width = configSettings->value("/window width", parent->width() / 2).toInt(); + height = configSettings->value("/window height", parent->height() / 2).toInt(); resize(width, height); - x = configSettings->readNumEntry("/window x", 0, &ok); - if (ok) - y = configSettings->readNumEntry("/window y", 0, &ok); - if (ok) - move(x, y); + x = configSettings->value("/window x"); + y = configSettings->value("/window y"); + if ((x.isValid())&&(y.isValid())) + move(x.toInt(), y.toInt()); QList sizes = configSettings->readSizes("/split", &ok); if (ok) split->setSizes(sizes); @@ -458,15 +462,15 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam void ConfigSearchWindow::saveSettings(void) { - if (name()) { + /*if (name()) { configSettings->beginGroup(name()); - configSettings->writeEntry("/window x", pos().x()); - configSettings->writeEntry("/window y", pos().y()); - configSettings->writeEntry("/window width", size().width()); - configSettings->writeEntry("/window height", size().height()); + configSettings->setValue("/window x", pos().x()); + configSettings->setValue("/window y", pos().y()); + configSettings->setValue("/window width", size().width()); + configSettings->setValue("/window height", size().height()); configSettings->writeSizes("/split", split->sizes()); configSettings->endGroup(); - } + }*/ } void ConfigSearchWindow::search(void) @@ -481,7 +485,8 @@ ConfigMainWindow::ConfigMainWindow(void) { QMenuBar* menu; bool ok; - int x, y, width, height; + QVariant x, y; + int width, height; char title[256]; QDesktopWidget *d = configApp->desktop(); @@ -489,16 +494,15 @@ ConfigMainWindow::ConfigMainWindow(void) rootmenu.prompt->text, "" ); - setCaption(title); + setWindowTitle(title); - width = configSettings->readNumEntry("/window width", d->width() - 64); - height = configSettings->readNumEntry("/window height", d->height() - 64); + width = configSettings->value("/window width", d->width() - 64).toInt(); + height = configSettings->value("/window height", d->height() - 64).toInt(); resize(width, height); - x = configSettings->readNumEntry("/window x", 0, &ok); - if (ok) - y = configSettings->readNumEntry("/window y", 0, &ok); - if (ok) - move(x, y); + x = configSettings->value("/window x"); + y = configSettings->value("/window y"); + if ((x.isValid())&&(y.isValid())) + move(x.toInt(), y.toInt()); split1 = new QSplitter(this); split1->setOrientation(Qt::Horizontal); @@ -515,7 +519,7 @@ ConfigMainWindow::ConfigMainWindow(void) configList = configView->list; helpText = new ConfigInfoView(split2, "help"); - helpText->setTextFormat(Qt::RichText); + //helpText->setTextFormat(Qt::RichText); setTabOrder(configList, helpText); configList->setFocus(); @@ -526,7 +530,7 @@ ConfigMainWindow::ConfigMainWindow(void) backAction = new QAction(QPixmap(xpm_back), _("Back"), this); connect(backAction, SIGNAL(activated()), SLOT(goBack())); - backAction->setEnabled(FALSE); + backAction->setEnabled(false); QAction *quitAction = new QAction(_("&Quit"), this); quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); connect(quitAction, SIGNAL(activated()), SLOT(close())); @@ -545,31 +549,31 @@ ConfigMainWindow::ConfigMainWindow(void) searchAction->setShortcut(Qt::CTRL + Qt::Key_F); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); - singleViewAction->setCheckable(TRUE); + singleViewAction->setCheckable(true); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); - splitViewAction->setCheckable(TRUE); + splitViewAction->setCheckable(true); connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); - fullViewAction->setCheckable(TRUE); + fullViewAction->setCheckable(true); connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); QAction *showNameAction = new QAction(_("Show Name"), this); - showNameAction->setCheckable(TRUE); + showNameAction->setCheckable(true); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); showNameAction->setChecked(configView->showName()); QAction *showRangeAction = new QAction(_("Show Range"), this); - showRangeAction->setCheckable(TRUE); + showRangeAction->setCheckable(true); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); QAction *showDataAction = new QAction(_("Show Data"), this); - showDataAction->setCheckable(TRUE); + showDataAction->setCheckable(true); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); QActionGroup *optGroup = new QActionGroup(this); - optGroup->setExclusive(TRUE); + optGroup->setExclusive(true); connect(optGroup, SIGNAL(selected(QAction *)), configView, SLOT(setOptionMode(QAction *))); connect(optGroup, SIGNAL(selected(QAction *)), menuView, @@ -578,12 +582,12 @@ ConfigMainWindow::ConfigMainWindow(void) configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); configView->showAllAction = new QAction(_("Show All Options"), optGroup); configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); - configView->showNormalAction->setCheckable(TRUE); - configView->showAllAction->setCheckable(TRUE); - configView->showPromptAction->setCheckable(TRUE); + configView->showNormalAction->setCheckable(true); + configView->showAllAction->setCheckable(true); + configView->showPromptAction->setCheckable(true); QAction *showDebugAction = new QAction( _("Show Debug Info"), this); - showDebugAction->setCheckable(TRUE); + showDebugAction->setCheckable(true); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); showDebugAction->setChecked(helpText->showDebug()); @@ -594,45 +598,41 @@ ConfigMainWindow::ConfigMainWindow(void) connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); // init tool bar - backAction->addTo(toolBar); + toolBar->addAction(backAction); toolBar->addSeparator(); - loadAction->addTo(toolBar); - saveAction->addTo(toolBar); + toolBar->addAction(loadAction); + toolBar->addAction(saveAction); toolBar->addSeparator(); - singleViewAction->addTo(toolBar); - splitViewAction->addTo(toolBar); - fullViewAction->addTo(toolBar); + toolBar->addAction(singleViewAction); + toolBar->addAction(splitViewAction); + toolBar->addAction(fullViewAction); // create config menu - QMenu* config = new QMenu(this); - menu->insertItem(_("&File"), config); - loadAction->addTo(config); - saveAction->addTo(config); - saveAsAction->addTo(config); + QMenu* config = menu->addMenu(_("&File")); + config->addAction(loadAction); + config->addAction(saveAction); + config->addAction(saveAsAction); config->addSeparator(); - quitAction->addTo(config); + config->addAction(quitAction); // create edit menu - QMenu* editMenu = new QMenu(this); - menu->insertItem(_("&Edit"), editMenu); - searchAction->addTo(editMenu); + QMenu* editMenu = menu->addMenu(_("&Edit")); + editMenu->addAction(searchAction); // create options menu - QMenu* optionMenu = new QMenu(this); - menu->insertItem(_("&Option"), optionMenu); - showNameAction->addTo(optionMenu); - showRangeAction->addTo(optionMenu); - showDataAction->addTo(optionMenu); + QMenu* optionMenu = menu->addMenu(_("&Option")); + optionMenu->addAction(showNameAction); + optionMenu->addAction(showRangeAction); + optionMenu->addAction(showDataAction); optionMenu->addSeparator(); - optGroup->addTo(optionMenu); + optionMenu->addActions(optGroup->actions()); optionMenu->addSeparator(); // create help menu - QMenu* helpMenu = new QMenu(this); menu->addSeparator(); - menu->insertItem(_("&Help"), helpMenu); - showIntroAction->addTo(helpMenu); - showAboutAction->addTo(helpMenu); + QMenu* helpMenu = menu->addMenu(_("&Help")); + helpMenu->addAction(showIntroAction); + helpMenu->addAction(showAboutAction); connect(configList, SIGNAL(menuChanged(struct menu *)), helpText, SLOT(setInfo(struct menu *))); @@ -654,7 +654,7 @@ ConfigMainWindow::ConfigMainWindow(void) connect(helpText, SIGNAL(menuSelected(struct menu *)), SLOT(setMenuLink(struct menu *))); - QString listMode = configSettings->readEntry("/listMode", "symbol"); + QString listMode = configSettings->value("/listMode", "symbol").toString(); if (listMode == "single") showSingleView(); else if (listMode == "full") @@ -674,7 +674,7 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); + QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname()); if (s.isNull()) return; if (conf_read(QFile::encodeName(s))) @@ -693,7 +693,7 @@ bool ConfigMainWindow::saveConfig(void) void ConfigMainWindow::saveConfigAs(void) { - QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); + QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname()); if (s.isNull()) return; saveConfig(); @@ -820,14 +820,14 @@ void ConfigMainWindow::showAbout(void) void ConfigMainWindow::saveSettings(void) { - configSettings->writeEntry("/window x", pos().x()); - configSettings->writeEntry("/window y", pos().y()); - configSettings->writeEntry("/window width", size().width()); - configSettings->writeEntry("/window height", size().height()); + configSettings->setValue("/window x", pos().x()); + configSettings->setValue("/window y", pos().y()); + configSettings->setValue("/window width", size().width()); + configSettings->setValue("/window height", size().height()); QString entry; - configSettings->writeEntry("/listMode", entry); + configSettings->setValue("/listMode", entry); configSettings->writeSizes("/split1", split1->sizes()); configSettings->writeSizes("/split2", split2->sizes()); @@ -859,7 +859,7 @@ static const char *progname; static void usage(void) { - printf(_("%s [-s] \n"), progname); + printf(_("%s [-s] \n").toLatin1().constData(), progname); exit(0); } @@ -898,7 +898,6 @@ int main(int ac, char** av) v = new ConfigMainWindow(); //zconfdump(stdout); - configApp->setMainWidget(v); configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); v->show(); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index d025f29694c6..1cd02192f172 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -3,9 +3,18 @@ * Released under the terms of the GNU GPL v2.0. */ -#include +#include +#include #include +#include #include +#include +#include +#include +#include +#include +#include +#include "expr.h" class ConfigView; class ConfigLineEdit; @@ -37,11 +46,11 @@ public: { return (ConfigView*)Parent::parent(); } - void show(Q3ListViewItem *i); + void show(QTreeWidgetItem *i); void keyPressEvent(QKeyEvent *e); public: - Q3ListViewItem *item; + QTreeWidgetItem *item; }; class ConfigView : public QWidget { @@ -50,7 +59,7 @@ class ConfigView : public QWidget { public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView(void); - static void updateList(Q3ListViewItem* item); + static void updateList(QTreeWidgetItem* item); static void updateListAll(void); bool showName(void) const { return false; } // TODO: Implement me. @@ -66,7 +75,7 @@ signals: void showRangeChanged(bool); void showDataChanged(bool); public: - Q3ListView* list; + QTreeWidget* list; ConfigLineEdit* lineEdit; static ConfigView* viewList; @@ -155,9 +164,9 @@ protected: ConfigSearchWindow *searchWindow; ConfigView *menuView; - Q3ListView *menuList; + QTreeWidget *menuList; ConfigView *configView; - Q3ListView *configList; + QTreeWidget *configList; ConfigInfoView *helpText; QToolBar *toolBar; QAction *backAction; -- cgit v1.2.3 From 92119937e844ef60693411062045d3c63ca8edd9 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:16 -0700 Subject: Port xconfig to Qt5 - update signals Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 51 ++++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index d134a89bfdce..c6b732092eda 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -90,7 +90,7 @@ bool ConfigSettings::writeSizes(const QString& key, const QList& value) ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { - connect(this, SIGNAL(lostFocus()), SLOT(hide())); + connect(this, SIGNAL(editingFinished()), SLOT(hide())); } void ConfigLineEdit::show(QTreeWidgetItem *i) @@ -484,7 +484,7 @@ ConfigMainWindow::ConfigMainWindow(void) : searchWindow(0) { QMenuBar* menu; - bool ok; + bool ok = true; QVariant x, y; int width, height; char title[256]; @@ -529,54 +529,51 @@ ConfigMainWindow::ConfigMainWindow(void) addToolBar(toolBar); backAction = new QAction(QPixmap(xpm_back), _("Back"), this); - connect(backAction, SIGNAL(activated()), SLOT(goBack())); + connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack())); backAction->setEnabled(false); QAction *quitAction = new QAction(_("&Quit"), this); quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); - connect(quitAction, SIGNAL(activated()), SLOT(close())); + connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); QAction *loadAction = new QAction(QPixmap(xpm_load), _("&Load"), this); loadAction->setShortcut(Qt::CTRL + Qt::Key_L); - connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); + connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig())); saveAction = new QAction(QPixmap(xpm_save), _("&Save"), this); saveAction->setShortcut(Qt::CTRL + Qt::Key_S); - connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); + connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); conf_set_changed_callback(conf_changed); // Set saveAction's initial state conf_changed(); QAction *saveAsAction = new QAction(_("Save &As..."), this); - connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); + connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); QAction *searchAction = new QAction(_("&Find"), this); searchAction->setShortcut(Qt::CTRL + Qt::Key_F); - connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); + connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); singleViewAction->setCheckable(true); - connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); + connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView())); splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); splitViewAction->setCheckable(true); - connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); + connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView())); fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); fullViewAction->setCheckable(true); - connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); + connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView())); QAction *showNameAction = new QAction(_("Show Name"), this); showNameAction->setCheckable(true); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); - connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); showNameAction->setChecked(configView->showName()); QAction *showRangeAction = new QAction(_("Show Range"), this); showRangeAction->setCheckable(true); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); - connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); QAction *showDataAction = new QAction(_("Show Data"), this); showDataAction->setCheckable(true); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); - connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); QActionGroup *optGroup = new QActionGroup(this); optGroup->setExclusive(true); - connect(optGroup, SIGNAL(selected(QAction *)), configView, + connect(optGroup, SIGNAL(triggered(QAction*)), configView, SLOT(setOptionMode(QAction *))); - connect(optGroup, SIGNAL(selected(QAction *)), menuView, + connect(optGroup, SIGNAL(triggered(QAction *)), menuView, SLOT(setOptionMode(QAction *))); configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); @@ -589,13 +586,12 @@ ConfigMainWindow::ConfigMainWindow(void) QAction *showDebugAction = new QAction( _("Show Debug Info"), this); showDebugAction->setCheckable(true); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); - connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); showDebugAction->setChecked(helpText->showDebug()); QAction *showIntroAction = new QAction( _("Introduction"), this); - connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); + connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro())); QAction *showAboutAction = new QAction( _("About"), this); - connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); + connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); // init tool bar toolBar->addAction(backAction); @@ -634,23 +630,6 @@ ConfigMainWindow::ConfigMainWindow(void) helpMenu->addAction(showIntroAction); helpMenu->addAction(showAboutAction); - connect(configList, SIGNAL(menuChanged(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(configList, SIGNAL(menuSelected(struct menu *)), - SLOT(changeMenu(struct menu *))); - connect(configList, SIGNAL(parentSelected()), - SLOT(goBack())); - connect(menuList, SIGNAL(menuChanged(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(menuSelected(struct menu *)), - SLOT(changeMenu(struct menu *))); - - connect(configList, SIGNAL(gotFocus(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(gotFocus(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(gotFocus(struct menu *)), - SLOT(listFocusChanged(void))); connect(helpText, SIGNAL(menuSelected(struct menu *)), SLOT(setMenuLink(struct menu *))); -- cgit v1.2.3 From 1019f1a586afe835bf1c6e4e8acfcddd2b7465f6 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:17 -0700 Subject: Port xconfig to Qt5 - Introduce Qt4/5 version of ConfigList and ConfigItem Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 24 +++++++++++++++++++++--- scripts/kconfig/qconf.h | 48 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 63 insertions(+), 9 deletions(-) (limited to 'scripts') 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& value) return true; } +/* + * construct a menu entry + */ +void ConfigItem::init(void) +{ +} + +/* + * destruct a menu entry + */ +ConfigItem::~ConfigItem(void) +{ +} + ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { connect(this, SIGNAL(editingFinished()), SLOT(hide())); } -void ConfigLineEdit::show(QTreeWidgetItem *i) +void ConfigLineEdit::show(ConfigItem* i) { item = i; Parent::show(); @@ -118,6 +132,10 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) hide(); } +ConfigList::ConfigList(ConfigView* p, const char *name) + : Parent(p) +{ +} ConfigView*ConfigView::viewList; QAction *ConfigView::showNormalAction; QAction *ConfigView::showAllAction; @@ -129,7 +147,7 @@ ConfigView::ConfigView(QWidget* parent, const char *name) QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setContentsMargins(0, 0, 0, 0); - list = new QTreeWidget(this); + list = new ConfigList(this); verticalLayout->addWidget(list); lineEdit = new ConfigLineEdit(this); lineEdit->hide(); @@ -167,7 +185,7 @@ void ConfigView::setShowData(bool b) { } -void ConfigView::updateList(QTreeWidgetItem* item) +void ConfigView::updateList(ConfigItem* item) { } 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 @@ #include "expr.h" class ConfigView; +class ConfigList; +class ConfigItem; class ConfigLineEdit; class ConfigMainWindow; @@ -37,6 +39,40 @@ enum optionMode { normalOpt = 0, allOpt, promptOpt }; +class ConfigList : public QTreeWidget { + Q_OBJECT + typedef class QTreeWidget Parent; +public: + ConfigList(ConfigView* p, const char *name = 0); +}; + +class ConfigItem : public QTreeWidgetItem { + typedef class QTreeWidgetItem Parent; +public: + ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, struct menu *m, bool v) + : Parent(parent, after), menu(m), visible(v), goParent(false) + { + init(); + } + ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) + : Parent(parent, after), menu(m), visible(v), goParent(false) + { + init(); + } + ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, bool v) + : Parent(parent, after), menu(0), visible(v), goParent(true) + { + init(); + } + ~ConfigItem(void); + void init(void); + + ConfigItem* nextItem; + struct menu *menu; + bool visible; + bool goParent; +}; + class ConfigLineEdit : public QLineEdit { Q_OBJECT typedef class QLineEdit Parent; @@ -46,11 +82,11 @@ public: { return (ConfigView*)Parent::parent(); } - void show(QTreeWidgetItem *i); + void show(ConfigItem *i); void keyPressEvent(QKeyEvent *e); public: - QTreeWidgetItem *item; + ConfigItem *item; }; class ConfigView : public QWidget { @@ -59,7 +95,7 @@ class ConfigView : public QWidget { public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView(void); - static void updateList(QTreeWidgetItem* item); + static void updateList(ConfigItem* item); static void updateListAll(void); bool showName(void) const { return false; } // TODO: Implement me. @@ -75,7 +111,7 @@ signals: void showRangeChanged(bool); void showDataChanged(bool); public: - QTreeWidget* list; + ConfigList* list; ConfigLineEdit* lineEdit; static ConfigView* viewList; @@ -164,9 +200,9 @@ protected: ConfigSearchWindow *searchWindow; ConfigView *menuView; - QTreeWidget *menuList; + ConfigList *menuList; ConfigView *configView; - QTreeWidget *configList; + ConfigList *configList; ConfigInfoView *helpText; QToolBar *toolBar; QAction *backAction; -- cgit v1.2.3 From 59e564408f88ee14395dd96f713eae2474edb591 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:18 -0700 Subject: Port xconfig to Qt5 - Put back some of the old implementation. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 121 +++++++++++++++++++++++++++++++++++++++++------ scripts/kconfig/qconf.h | 113 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 216 insertions(+), 18 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index a86409d6f6a6..0987a751d740 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -84,9 +84,31 @@ bool ConfigSettings::writeSizes(const QString& key, const QList& value) for (it = value.begin(); it != value.end(); ++it) stringList.push_back(QString::number(*it)); setValue(key, stringList); + return true; } + +/* + * set the new data + * TODO check the value + */ +void ConfigItem::okRename(int col) +{ +} + +/* + * update the displayed of a menu entry + */ +void ConfigItem::updateMenu(void) +{ +} + +void ConfigItem::testUpdateMenu(bool v) +{ +} + + /* * construct a menu entry */ @@ -133,9 +155,92 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) } ConfigList::ConfigList(ConfigView* p, const char *name) - : Parent(p) + : Parent(p), + updateAll(false), + symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), + choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), + menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), + showName(false), showRange(false), showData(false), optMode(normalOpt), + rootEntry(0), headerPopup(0) +{ +} + +void ConfigList::reinit(void) +{ +} + +void ConfigList::saveSettings(void) +{ +} + +ConfigItem* ConfigList::findConfigItem(struct menu *menu) +{ +} + +void ConfigList::updateSelection(void) +{ +} + +void ConfigList::updateList(ConfigItem* item) +{ +} + +void ConfigList::setValue(ConfigItem* item, tristate val) +{ +} + +void ConfigList::changeValue(ConfigItem* item) +{ +} + +void ConfigList::setRootMenu(struct menu *menu) +{ +} + +void ConfigList::setParentMenu(void) +{ +} + +/* + * update all the children of a menu entry + * removes/adds the entries from the parent widget as necessary + * + * parent: either the menu list widget or a menu entry widget + * menu: entry to be updated + */ +template +void ConfigList::updateMenuList(P* parent, struct menu* menu) +{ +} + +void ConfigList::keyPressEvent(QKeyEvent* ev) +{ +} + +void ConfigList::contentsMousePressEvent(QMouseEvent* e) { } + +void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) +{ +} + +void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) +{ +} + +void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) +{ +} + +void ConfigList::focusInEvent(QFocusEvent *e) +{ +} + +void ConfigList::contextMenuEvent(QContextMenuEvent *e) +{ +} + ConfigView*ConfigView::viewList; QAction *ConfigView::showNormalAction; QAction *ConfigView::showAllAction; @@ -206,11 +311,6 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) void ConfigInfoView::saveSettings(void) { - /*if (name()) { - configSettings->beginGroup(name()); - configSettings->setValue("/showDebug", showDebug()); - configSettings->endGroup(); - }*/ } void ConfigInfoView::setShowDebug(bool b) @@ -480,15 +580,6 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam void ConfigSearchWindow::saveSettings(void) { - /*if (name()) { - configSettings->beginGroup(name()); - configSettings->setValue("/window x", pos().x()); - configSettings->setValue("/window y", pos().y()); - configSettings->setValue("/window width", size().width()); - configSettings->setValue("/window height", size().height()); - configSettings->writeSizes("/split", split->sizes()); - configSettings->endGroup(); - }*/ } void ConfigSearchWindow::search(void) diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 54b3b925139a..7c55b1d97a1a 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -44,6 +44,81 @@ class ConfigList : public QTreeWidget { typedef class QTreeWidget Parent; public: ConfigList(ConfigView* p, const char *name = 0); + void reinit(void); + ConfigView* parent(void) const + { + return (ConfigView*)Parent::parent(); + } + ConfigItem* findConfigItem(struct menu *); + +protected: + void keyPressEvent(QKeyEvent *e); + void contentsMousePressEvent(QMouseEvent *e); + void contentsMouseReleaseEvent(QMouseEvent *e); + void contentsMouseMoveEvent(QMouseEvent *e); + void contentsMouseDoubleClickEvent(QMouseEvent *e); + void focusInEvent(QFocusEvent *e); + void contextMenuEvent(QContextMenuEvent *e); + +public slots: + void setRootMenu(struct menu *menu); + + void updateList(ConfigItem *item); + void setValue(ConfigItem* item, tristate val); + void changeValue(ConfigItem* item); + void updateSelection(void); + void saveSettings(void); +signals: + void menuChanged(struct menu *menu); + void menuSelected(struct menu *menu); + void parentSelected(void); + void gotFocus(struct menu *); + +public: + void updateListAll(void) + { + updateAll = true; + updateList(NULL); + updateAll = false; + } + ConfigList* listView() + { + return this; + } + ConfigItem* firstChild() const + { + // TODO: Implement me. + return NULL; + } + void addColumn(colIdx idx, const QString& label) + { + // TODO: Implement me. + } + void removeColumn(colIdx idx) + { + // TODO: Implement me. + } + void setAllOpen(bool open); + void setParentMenu(void); + + bool menuSkip(struct menu *); + + template + void updateMenuList(P*, struct menu*); + + bool updateAll; + + QPixmap symbolYesPix, symbolModPix, symbolNoPix; + QPixmap choiceYesPix, choiceNoPix; + QPixmap menuPix, menuInvPix, menuBackPix, voidPix; + + bool showName, showRange, showData; + enum listMode mode; + enum optionMode optMode; + struct menu *rootEntry; + QPalette disabledColorGroup; + QPalette inactivedColorGroup; + QMenu* headerPopup; }; class ConfigItem : public QTreeWidgetItem { @@ -66,6 +141,38 @@ public: } ~ConfigItem(void); void init(void); + void okRename(int col); + void updateMenu(void); + void testUpdateMenu(bool v); + ConfigList* listView() const + { + return (ConfigList*)Parent::treeWidget(); + } + ConfigItem* firstChild() const + { + return (ConfigItem *)Parent::child(0); + } + ConfigItem* nextSibling() const + { + return NULL; // TODO: Implement me + } + void setText(colIdx idx, const QString& text) + { + Parent::setText(idx, text); + } + QString text(colIdx idx) const + { + return Parent::text(idx); + } + void setPixmap(colIdx idx, const QPixmap& pm) + { + // TODO: Implement me + } + const QPixmap* pixmap(colIdx idx) const + { + return NULL; // TODO: Implement me + } + // Implement paintCell ConfigItem* nextItem; struct menu *menu; @@ -98,9 +205,9 @@ public: static void updateList(ConfigItem* item); static void updateListAll(void); - bool showName(void) const { return false; } // TODO: Implement me. - bool showRange(void) const { return false; } // TODO: Implement me. - bool showData(void) const { return false; } // TODO: Implement me. + bool showName(void) const { return list->showName; } + bool showRange(void) const { return list->showRange; } + bool showData(void) const { return list->showData; } public slots: void setShowName(bool); void setShowRange(bool); -- cgit v1.2.3 From d5d973c3f8a956411fafc997738ff03f213200b6 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:19 -0700 Subject: Port xconfig to Qt5 - Put back some of the old implementation(part 2). Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 788 ++++++++++++++++++++++++++++++++++++++++++++++- scripts/kconfig/qconf.h | 45 +-- 2 files changed, 807 insertions(+), 26 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 0987a751d740..e0518cab500e 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -102,10 +102,135 @@ void ConfigItem::okRename(int col) */ void ConfigItem::updateMenu(void) { + ConfigList* list; + struct symbol* sym; + struct property *prop; + QString prompt; + int type; + tristate expr; + + list = listView(); + if (goParent) { + setPixmap(promptColIdx, list->menuBackPix); + prompt = ".."; + goto set_prompt; + } + + sym = menu->sym; + prop = menu->prompt; + prompt = _(menu_get_prompt(menu)); + + if (prop) switch (prop->type) { + case P_MENU: + if (list->mode == singleMode || list->mode == symbolMode) { + /* a menuconfig entry is displayed differently + * depending whether it's at the view root or a child. + */ + if (sym && list->rootEntry == menu) + break; + setPixmap(promptColIdx, list->menuPix); + } else { + if (sym) + break; + setPixmap(promptColIdx, QIcon()); + } + goto set_prompt; + case P_COMMENT: + setPixmap(promptColIdx, QIcon()); + goto set_prompt; + default: + ; + } + if (!sym) + goto set_prompt; + + setText(nameColIdx, QString::fromLocal8Bit(sym->name)); + + type = sym_get_type(sym); + switch (type) { + case S_BOOLEAN: + case S_TRISTATE: + char ch; + + if (!sym_is_changable(sym) && list->optMode == normalOpt) { + setPixmap(promptColIdx, QIcon()); + setText(noColIdx, QString::null); + setText(modColIdx, QString::null); + setText(yesColIdx, QString::null); + break; + } + expr = sym_get_tristate_value(sym); + switch (expr) { + case yes: + if (sym_is_choice_value(sym) && type == S_BOOLEAN) + setPixmap(promptColIdx, list->choiceYesPix); + else + setPixmap(promptColIdx, list->symbolYesPix); + setText(yesColIdx, "Y"); + ch = 'Y'; + break; + case mod: + setPixmap(promptColIdx, list->symbolModPix); + setText(modColIdx, "M"); + ch = 'M'; + break; + default: + if (sym_is_choice_value(sym) && type == S_BOOLEAN) + setPixmap(promptColIdx, list->choiceNoPix); + else + setPixmap(promptColIdx, list->symbolNoPix); + setText(noColIdx, "N"); + ch = 'N'; + break; + } + if (expr != no) + setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); + if (expr != mod) + setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); + if (expr != yes) + setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); + + setText(dataColIdx, QChar(ch)); + break; + case S_INT: + case S_HEX: + case S_STRING: + const char* data; + + data = sym_get_string_value(sym); + + //int i = list->mapIdx(dataColIdx); + //if (i >= 0) + // setRenameEnabled(i, true); + setText(dataColIdx, data); + if (type == S_STRING) + prompt = QString("%1: %2").arg(prompt).arg(data); + else + prompt = QString("(%2) %1").arg(prompt).arg(data); + break; + } + if (!sym_has_value(sym) && visible) + prompt += _(" (NEW)"); +set_prompt: + setText(promptColIdx, prompt); } void ConfigItem::testUpdateMenu(bool v) { + ConfigItem* i; + + visible = v; + if (!menu) + return; + + sym_calc_value(menu->sym); + if (menu->flags & MENU_CHANGED) { + /* the menu entry changed, so update all list items */ + menu->flags &= ~MENU_CHANGED; + for (i = (ConfigItem*)menu->data; i; i = i->nextItem) + i->updateMenu(); + } else if (listView()->updateAll) + updateMenu(); } @@ -114,6 +239,16 @@ void ConfigItem::testUpdateMenu(bool v) */ void ConfigItem::init(void) { + if (menu) { + ConfigList* list = listView(); + nextItem = (ConfigItem*)menu->data; + menu->data = this; + + if (list->mode != fullMode) + setExpanded(true); + sym_calc_value(menu->sym); + } + updateMenu(); } /* @@ -121,17 +256,30 @@ void ConfigItem::init(void) */ ConfigItem::~ConfigItem(void) { + if (menu) { + ConfigItem** ip = (ConfigItem**)&menu->data; + for (; *ip; ip = &(*ip)->nextItem) { + if (*ip == this) { + *ip = nextItem; + break; + } + } + } } ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { - connect(this, SIGNAL(editingFinished()), SLOT(hide())); + connect(this, SIGNAL(lostFocus()), SLOT(hide())); } void ConfigLineEdit::show(ConfigItem* i) { item = i; + if (sym_get_string_value(item->menu->sym)) + setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym))); + else + setText(QString::null); Parent::show(); setFocus(); } @@ -143,6 +291,7 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) break; case Qt::Key_Return: case Qt::Key_Enter: + sym_set_string_value(item->menu->sym, text().toLatin1()); parent()->updateList(item); break; default: @@ -163,42 +312,251 @@ ConfigList::ConfigList(ConfigView* p, const char *name) showName(false), showRange(false), showData(false), optMode(normalOpt), rootEntry(0), headerPopup(0) { + int i; + + setObjectName(name); + setSortingEnabled(-1); + setRootIsDecorated(true); + + connect(this, SIGNAL(selectionChanged(void)), + SLOT(updateSelection(void))); + + if (name) { + configSettings->beginGroup(name); + showName = configSettings->value("/showName", false).toBool(); + showRange = configSettings->value("/showRange", false).toBool(); + showData = configSettings->value("/showData", false).toBool(); + optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt(); + configSettings->endGroup(); + connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); + } + + addColumn(promptColIdx); + + reinit(); +} + +bool ConfigList::menuSkip(struct menu *menu) +{ + if (optMode == normalOpt && menu_is_visible(menu)) + return false; + if (optMode == promptOpt && menu_has_prompt(menu)) + return false; + if (optMode == allOpt) + return false; + return true; } void ConfigList::reinit(void) { + removeColumn(dataColIdx); + removeColumn(yesColIdx); + removeColumn(modColIdx); + removeColumn(noColIdx); + removeColumn(nameColIdx); + + if (showName) + addColumn(nameColIdx); + if (showRange) { + addColumn(noColIdx); + addColumn(modColIdx); + addColumn(yesColIdx); + } + if (showData) + addColumn(dataColIdx); + + updateListAll(); } void ConfigList::saveSettings(void) { + if (!objectName().isEmpty()) { + configSettings->beginGroup(objectName()); + configSettings->setValue("/showName", showName); + configSettings->setValue("/showRange", showRange); + configSettings->setValue("/showData", showData); + configSettings->setValue("/optionMode", (int)optMode); + configSettings->endGroup(); + } } ConfigItem* ConfigList::findConfigItem(struct menu *menu) { + ConfigItem* item = (ConfigItem*)menu->data; + + for (; item; item = item->nextItem) { + if (this == item->listView()) + break; + } + + return item; } void ConfigList::updateSelection(void) { + struct menu *menu; + enum prop_type type; + + ConfigItem* item = (ConfigItem*)selectedItems().first(); + if (!item) + return; + + menu = item->menu; + emit menuChanged(menu); + if (!menu) + return; + type = menu->prompt ? menu->prompt->type : P_UNKNOWN; + if (mode == menuMode && type == P_MENU) + emit menuSelected(menu); } void ConfigList::updateList(ConfigItem* item) { + ConfigItem* last = 0; + + if (!rootEntry) { + if (mode != listMode) + goto update; + QTreeWidgetItemIterator it(this); + ConfigItem* item; + + while (*it) { + item = (ConfigItem*)(*it); + if (!item->menu) + continue; + item->testUpdateMenu(menu_is_visible(item->menu)); + + ++it; + } + return; + } + + if (rootEntry != &rootmenu && (mode == singleMode || + (mode == symbolMode && rootEntry->parent != &rootmenu))) { + item = firstChild(); + if (!item) + item = new ConfigItem(this, 0, true); + last = item; + } + if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) && + rootEntry->sym && rootEntry->prompt) { + item = last ? last->nextSibling() : firstChild(); + if (!item) + item = new ConfigItem(this, last, rootEntry, true); + else + item->testUpdateMenu(true); + + updateMenuList(item, rootEntry); + update(); + return; + } +update: + updateMenuList(this, rootEntry); + update(); } void ConfigList::setValue(ConfigItem* item, tristate val) { + struct symbol* sym; + int type; + tristate oldval; + + sym = item->menu ? item->menu->sym : 0; + if (!sym) + return; + + type = sym_get_type(sym); + switch (type) { + case S_BOOLEAN: + case S_TRISTATE: + oldval = sym_get_tristate_value(sym); + + if (!sym_set_tristate_value(sym, val)) + return; + if (oldval == no && item->menu->list) + item->setExpanded(true); + parent()->updateList(item); + break; + } } void ConfigList::changeValue(ConfigItem* item) { + struct symbol* sym; + struct menu* menu; + int type, oldexpr, newexpr; + + menu = item->menu; + if (!menu) + return; + sym = menu->sym; + if (!sym) { + if (item->menu->list) + item->setExpanded(!item->isExpanded()); + return; + } + + type = sym_get_type(sym); + switch (type) { + case S_BOOLEAN: + case S_TRISTATE: + oldexpr = sym_get_tristate_value(sym); + newexpr = sym_toggle_tristate_value(sym); + if (item->menu->list) { + if (oldexpr == newexpr) + item->setExpanded(!item->isExpanded()); + else if (oldexpr == no) + item->setExpanded(true); + } + if (oldexpr != newexpr) + parent()->updateList(item); + break; + case S_INT: + case S_HEX: + case S_STRING: + break; + } } void ConfigList::setRootMenu(struct menu *menu) { + enum prop_type type; + + if (rootEntry == menu) + return; + type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; + if (type != P_MENU) + return; + updateMenuList(this, 0); + rootEntry = menu; + updateListAll(); + if (currentItem()) { + currentItem()->setSelected(hasFocus()); + scrollToItem(currentItem()); + } } void ConfigList::setParentMenu(void) { + ConfigItem* item; + struct menu *oldroot; + + oldroot = rootEntry; + if (rootEntry == &rootmenu) + return; + setRootMenu(menu_get_parent_menu(rootEntry->parent)); + + QTreeWidgetItemIterator it(this); + while (*it) { + item = (ConfigItem *)(*it); + if (item->menu == oldroot) { + setCurrentItem(item); + scrollToItem(item); + break; + } + + ++it; + } } /* @@ -211,34 +569,250 @@ void ConfigList::setParentMenu(void) template void ConfigList::updateMenuList(P* parent, struct menu* menu) { + struct menu* child; + ConfigItem* item; + ConfigItem* last; + bool visible; + enum prop_type type; + + if (!menu) { + while ((item = parent->firstChild())) + item->parent()->removeChild(item); + delete item; + return; + } + + last = parent->firstChild(); + if (last && !last->goParent) + last = 0; + for (child = menu->list; child; child = child->next) { + item = last ? last->nextSibling() : parent->firstChild(); + type = child->prompt ? child->prompt->type : P_UNKNOWN; + + switch (mode) { + case menuMode: + if (!(child->flags & MENU_ROOT)) + goto hide; + break; + case symbolMode: + if (child->flags & MENU_ROOT) + goto hide; + break; + default: + break; + } + + visible = menu_is_visible(child); + if (!menuSkip(child)) { + if (!child->sym && !child->list && !child->prompt) + continue; + if (!item || item->menu != child) + item = new ConfigItem(parent, last, child, visible); + else + item->testUpdateMenu(visible); + + if (mode == fullMode || mode == menuMode || type != P_MENU) + updateMenuList(item, child); + else + updateMenuList(item, 0); + last = item; + continue; + } + hide: + if (item && item->menu == child) { + last = parent->firstChild(); + if (last == item) + last = 0; + else while (last->nextSibling() != item) + last = last->nextSibling(); + delete item; + } + } } void ConfigList::keyPressEvent(QKeyEvent* ev) { + QTreeWidgetItem* i = currentItem(); + ConfigItem* item; + struct menu *menu; + enum prop_type type; + + if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { + emit parentSelected(); + ev->accept(); + return; + } + + if (!i) { + Parent::keyPressEvent(ev); + return; + } + item = (ConfigItem*)i; + + switch (ev->key()) { + case Qt::Key_Return: + case Qt::Key_Enter: + if (item->goParent) { + emit parentSelected(); + break; + } + menu = item->menu; + if (!menu) + break; + type = menu->prompt ? menu->prompt->type : P_UNKNOWN; + if (type == P_MENU && rootEntry != menu && + mode != fullMode && mode != menuMode) { + emit menuSelected(menu); + break; + } + case Qt::Key_Space: + changeValue(item); + break; + case Qt::Key_N: + setValue(item, no); + break; + case Qt::Key_M: + setValue(item, mod); + break; + case Qt::Key_Y: + setValue(item, yes); + break; + default: + Parent::keyPressEvent(ev); + return; + } + ev->accept(); } -void ConfigList::contentsMousePressEvent(QMouseEvent* e) +void ConfigList::mousePressEvent(QMouseEvent* e) { + //QPoint p(contentsToViewport(e->pos())); + //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); + Parent::mousePressEvent(e); } -void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) +void ConfigList::mouseReleaseEvent(QMouseEvent* e) { + QPoint p = e->pos(); + ConfigItem* item = (ConfigItem*)itemAt(p); + struct menu *menu; + enum prop_type ptype; + QIcon icon; + int idx, x; + + if (!item) + goto skip; + + menu = item->menu; + x = header()->offset() + p.x(); + idx = header()->sectionPosition(x); + switch (idx) { + case promptColIdx: + icon = item->pixmap(promptColIdx); + break; + case noColIdx: + setValue(item, no); + break; + case modColIdx: + setValue(item, mod); + break; + case yesColIdx: + setValue(item, yes); + break; + case dataColIdx: + changeValue(item); + break; + } + +skip: + //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); + Parent::mouseReleaseEvent(e); } -void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) +void ConfigList::mouseMoveEvent(QMouseEvent* e) { + //QPoint p(contentsToViewport(e->pos())); + //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); + Parent::mouseMoveEvent(e); } -void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) +void ConfigList::mouseDoubleClickEvent(QMouseEvent* e) { + QPoint p = e->pos(); // TODO: Check if this works(was contentsToViewport). + ConfigItem* item = (ConfigItem*)itemAt(p); + struct menu *menu; + enum prop_type ptype; + + if (!item) + goto skip; + if (item->goParent) { + emit parentSelected(); + goto skip; + } + menu = item->menu; + if (!menu) + goto skip; + ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; + if (ptype == P_MENU && (mode == singleMode || mode == symbolMode)) + emit menuSelected(menu); + else if (menu->sym) + changeValue(item); + +skip: + //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); + Parent::mouseDoubleClickEvent(e); } void ConfigList::focusInEvent(QFocusEvent *e) { + struct menu *menu = NULL; + + Parent::focusInEvent(e); + + ConfigItem* item = (ConfigItem *)currentItem(); + if (item) { + item->setSelected(true); + menu = item->menu; + } + emit gotFocus(menu); } void ConfigList::contextMenuEvent(QContextMenuEvent *e) { + if (e->y() <= header()->geometry().bottom()) { + if (!headerPopup) { + QAction *action; + + headerPopup = new QMenu(this); + action = new QAction(_("Show Name"), this); + action->setCheckable(true); + connect(action, SIGNAL(toggled(bool)), + parent(), SLOT(setShowName(bool))); + connect(parent(), SIGNAL(showNameChanged(bool)), + action, SLOT(setOn(bool))); + action->setChecked(showName); + headerPopup->addAction(action); + action = new QAction(_("Show Range"), this); + action->setCheckable(true); + connect(action, SIGNAL(toggled(bool)), + parent(), SLOT(setShowRange(bool))); + connect(parent(), SIGNAL(showRangeChanged(bool)), + action, SLOT(setOn(bool))); + action->setChecked(showRange); + headerPopup->addAction(action); + action = new QAction(_("Show Data"), this); + action->setCheckable(true); + connect(action, SIGNAL(toggled(bool)), + parent(), SLOT(setShowData(bool))); + connect(parent(), SIGNAL(showDataChanged(bool)), + action, SLOT(setOn(bool))); + action->setChecked(showData); + headerPopup->addAction(action); + } + headerPopup->exec(e->globalPos()); + e->accept(); + } else + e->ignore(); } ConfigView*ConfigView::viewList; @@ -276,33 +850,78 @@ ConfigView::~ConfigView(void) void ConfigView::setOptionMode(QAction *act) { + if (act == showNormalAction) + list->optMode = normalOpt; + else if (act == showAllAction) + list->optMode = allOpt; + else + list->optMode = promptOpt; + + list->updateListAll(); } void ConfigView::setShowName(bool b) { + if (list->showName != b) { + list->showName = b; + list->reinit(); + emit showNameChanged(b); + } } void ConfigView::setShowRange(bool b) { + if (list->showRange != b) { + list->showRange = b; + list->reinit(); + emit showRangeChanged(b); + } } void ConfigView::setShowData(bool b) { + if (list->showData != b) { + list->showData = b; + list->reinit(); + emit showDataChanged(b); + } +} + +void ConfigList::setAllOpen(bool open) +{ + QTreeWidgetItemIterator it(this); + + while (*it) { + (*it)->setExpanded(open); + + ++it; + } } void ConfigView::updateList(ConfigItem* item) { + ConfigView* v; + + for (v = viewList; v; v = v->nextView) + v->list->updateList(item); } void ConfigView::updateListAll(void) { + ConfigView* v; + + for (v = viewList; v; v = v->nextView) + v->list->updateListAll(); } ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) : Parent(parent), sym(0), _menu(0) { - if (name) { - configSettings->beginGroup(name); + setObjectName(name); + + + if (!objectName().isEmpty()) { + configSettings->beginGroup(objectName()); _showDebug = configSettings->value("/showDebug", false).toBool(); configSettings->endGroup(); connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); @@ -311,6 +930,11 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) void ConfigInfoView::saveSettings(void) { + if (!objectName().isEmpty()) { + configSettings->beginGroup(objectName()); + configSettings->setValue("/showDebug", showDebug()); + configSettings->endGroup(); + } } void ConfigInfoView::setShowDebug(bool b) @@ -528,6 +1152,7 @@ void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e) ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name) : Parent(parent), result(NULL) { + setObjectName(name); setWindowTitle("Search Config"); QVBoxLayout* layout1 = new QVBoxLayout(this); @@ -549,6 +1174,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam split = new QSplitter(this); split->setOrientation(Qt::Vertical); list = new ConfigView(split, name); + list->list->mode = listMode; info = new ConfigInfoView(split, name); connect(list->list, SIGNAL(menuChanged(struct menu *)), info, SLOT(setInfo(struct menu *))); @@ -580,10 +1206,35 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam void ConfigSearchWindow::saveSettings(void) { + if (!objectName().isEmpty()) { + configSettings->beginGroup(objectName()); + configSettings->setValue("/window x", pos().x()); + configSettings->setValue("/window y", pos().y()); + configSettings->setValue("/window width", size().width()); + configSettings->setValue("/window height", size().height()); + configSettings->writeSizes("/split", split->sizes()); + configSettings->endGroup(); + } } void ConfigSearchWindow::search(void) { + struct symbol **p; + struct property *prop; + ConfigItem *lastItem = NULL; + + free(result); + list->list->clear(); + info->clear(); + + result = sym_re_search(editField->text().toLatin1()); + if (!result) + return; + for (p = result; *p; p++) { + for_all_prompts((*p), prop) + lastItem = new ConfigItem(list->list, lastItem, prop->menu, + menu_is_visible(prop->menu)); + } } /* @@ -739,6 +1390,23 @@ ConfigMainWindow::ConfigMainWindow(void) helpMenu->addAction(showIntroAction); helpMenu->addAction(showAboutAction); + connect(configList, SIGNAL(menuChanged(struct menu *)), + helpText, SLOT(setInfo(struct menu *))); + connect(configList, SIGNAL(menuSelected(struct menu *)), + SLOT(changeMenu(struct menu *))); + connect(configList, SIGNAL(parentSelected()), + SLOT(goBack())); + connect(menuList, SIGNAL(menuChanged(struct menu *)), + helpText, SLOT(setInfo(struct menu *))); + connect(menuList, SIGNAL(menuSelected(struct menu *)), + SLOT(changeMenu(struct menu *))); + + connect(configList, SIGNAL(gotFocus(struct menu *)), + helpText, SLOT(setInfo(struct menu *))); + connect(menuList, SIGNAL(gotFocus(struct menu *)), + helpText, SLOT(setInfo(struct menu *))); + connect(menuList, SIGNAL(gotFocus(struct menu *)), + SLOT(listFocusChanged(void))); connect(helpText, SIGNAL(menuSelected(struct menu *)), SLOT(setMenuLink(struct menu *))); @@ -796,19 +1464,86 @@ void ConfigMainWindow::searchConfig(void) void ConfigMainWindow::changeMenu(struct menu *menu) { - + configList->setRootMenu(menu); + if (configList->rootEntry->parent == &rootmenu) + backAction->setEnabled(false); + else + backAction->setEnabled(true); } void ConfigMainWindow::setMenuLink(struct menu *menu) { + struct menu *parent; + ConfigList* list = NULL; + ConfigItem* item; + + if (configList->menuSkip(menu)) + return; + + switch (configList->mode) { + case singleMode: + list = configList; + parent = menu_get_parent_menu(menu); + if (!parent) + return; + list->setRootMenu(parent); + break; + case symbolMode: + if (menu->flags & MENU_ROOT) { + configList->setRootMenu(menu); + configList->clearSelection(); + list = menuList; + } else { + list = configList; + parent = menu_get_parent_menu(menu->parent); + if (!parent) + return; + item = menuList->findConfigItem(parent); + if (item) { + item->setSelected(true); + menuList->scrollToItem(item); + } + list->setRootMenu(parent); + } + break; + case fullMode: + list = configList; + break; + default: + break; + } + + if (list) { + item = list->findConfigItem(menu); + if (item) { + item->setSelected(true); + list->scrollToItem(item); + list->setFocus(); + } + } } void ConfigMainWindow::listFocusChanged(void) { + if (menuList->mode == menuMode) + configList->clearSelection(); } void ConfigMainWindow::goBack(void) { + ConfigItem* item; + + configList->setParentMenu(); + if (configList->rootEntry == &rootmenu) + backAction->setEnabled(false); + item = (ConfigItem*)menuList->selectedItems().first(); + while (item) { + if (item->menu == configList->rootEntry) { + item->setSelected(true); + break; + } + item = (ConfigItem*)item->parent(); + } } void ConfigMainWindow::showSingleView(void) @@ -821,6 +1556,12 @@ void ConfigMainWindow::showSingleView(void) fullViewAction->setChecked(false); menuView->hide(); + menuList->setRootMenu(0); + configList->mode = singleMode; + if (configList->rootEntry == &rootmenu) + configList->updateListAll(); + else + configList->setRootMenu(&rootmenu); configList->setFocus(); } @@ -833,6 +1574,16 @@ void ConfigMainWindow::showSplitView(void) fullViewAction->setEnabled(true); fullViewAction->setChecked(false); + configList->mode = symbolMode; + if (configList->rootEntry == &rootmenu) + configList->updateListAll(); + else + configList->setRootMenu(&rootmenu); + configList->setAllOpen(true); + configApp->processEvents(); + menuList->mode = menuMode; + menuList->setRootMenu(&rootmenu); + menuList->setAllOpen(true); menuView->show(); menuList->setFocus(); } @@ -847,6 +1598,12 @@ void ConfigMainWindow::showFullView(void) fullViewAction->setChecked(true); menuView->hide(); + menuList->setRootMenu(0); + configList->mode = fullMode; + if (configList->rootEntry == &rootmenu) + configList->updateListAll(); + else + configList->setRootMenu(&rootmenu); configList->setFocus(); } @@ -914,7 +1671,22 @@ void ConfigMainWindow::saveSettings(void) configSettings->setValue("/window height", size().height()); QString entry; + switch(configList->mode) { + case singleMode : + entry = "single"; + break; + + case symbolMode : + entry = "split"; + break; + + case fullMode : + entry = "full"; + break; + default: + break; + } configSettings->setValue("/listMode", entry); configSettings->writeSizes("/split1", split1->sizes()); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 7c55b1d97a1a..819e0292aaba 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -53,10 +53,10 @@ public: protected: void keyPressEvent(QKeyEvent *e); - void contentsMousePressEvent(QMouseEvent *e); - void contentsMouseReleaseEvent(QMouseEvent *e); - void contentsMouseMoveEvent(QMouseEvent *e); - void contentsMouseDoubleClickEvent(QMouseEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); void focusInEvent(QFocusEvent *e); void contextMenuEvent(QContextMenuEvent *e); @@ -87,16 +87,15 @@ public: } ConfigItem* firstChild() const { - // TODO: Implement me. - return NULL; + return (ConfigItem *)children().first(); } - void addColumn(colIdx idx, const QString& label) + void addColumn(colIdx idx) { - // TODO: Implement me. + showColumn(idx); } void removeColumn(colIdx idx) { - // TODO: Implement me. + hideColumn(idx); } void setAllOpen(bool open); void setParentMenu(void); @@ -124,7 +123,7 @@ public: class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: - ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, struct menu *m, bool v) + ConfigItem(QTreeWidget *parent, ConfigItem *after, struct menu *m, bool v) : Parent(parent, after), menu(m), visible(v), goParent(false) { init(); @@ -134,7 +133,7 @@ public: { init(); } - ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, bool v) + ConfigItem(QTreeWidget *parent, ConfigItem *after, bool v) : Parent(parent, after), menu(0), visible(v), goParent(true) { init(); @@ -152,9 +151,19 @@ public: { return (ConfigItem *)Parent::child(0); } - ConfigItem* nextSibling() const + ConfigItem* nextSibling() { - return NULL; // TODO: Implement me + ConfigItem *ret = NULL; + ConfigItem *_parent = (ConfigItem *)parent(); + + if(_parent) { + ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1); + } else { + QTreeWidget *_treeWidget = treeWidget(); + ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1); + } + + return ret; } void setText(colIdx idx, const QString& text) { @@ -164,15 +173,15 @@ public: { return Parent::text(idx); } - void setPixmap(colIdx idx, const QPixmap& pm) + void setPixmap(colIdx idx, const QIcon &icon) { - // TODO: Implement me + Parent::setIcon(idx, icon); } - const QPixmap* pixmap(colIdx idx) const + const QIcon pixmap(colIdx idx) const { - return NULL; // TODO: Implement me + return icon(idx); } - // Implement paintCell + // TODO: Implement paintCell ConfigItem* nextItem; struct menu *menu; -- cgit v1.2.3 From 9bfda0ab03877855d9018712a046de0c9e147d34 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:20 -0700 Subject: Port xconfig to Qt5 - Remove Qt3Support from Makefile. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index aceaaed09811..9b5b8c6796b9 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -265,8 +265,8 @@ $(obj)/.tmp_qtcheck: moc="/usr/bin/moc"; \ fi; \ else \ - cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ - libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ + cflags="\$$(shell pkg-config QtCore QtGui --cflags)"; \ + libs="\$$(shell pkg-config QtCore QtGui --libs)"; \ moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ fi; \ -- cgit v1.2.3 From c14fa5e123cea969b0aca4b6a4e13ce6937e4ed2 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:21 -0700 Subject: Port xconfig to Qt5 - Use correct signal names. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index e0518cab500e..a8b54521f754 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -270,7 +270,7 @@ ConfigItem::~ConfigItem(void) ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { - connect(this, SIGNAL(lostFocus()), SLOT(hide())); + connect(this, SIGNAL(editingFinished()), SLOT(hide())); } void ConfigLineEdit::show(ConfigItem* i) @@ -318,7 +318,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setSortingEnabled(-1); setRootIsDecorated(true); - connect(this, SIGNAL(selectionChanged(void)), + connect(this, SIGNAL(itemSelectionChanged(void)), SLOT(updateSelection(void))); if (name) { -- cgit v1.2.3 From 9bd36ed363c9dfec4e47e4ed489aadf3da987314 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:22 -0700 Subject: Port xconfig to Qt5 - Set ConfigView object name. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index a8b54521f754..3454c4361c8e 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -823,6 +823,7 @@ QAction *ConfigView::showPromptAction; ConfigView::ConfigView(QWidget* parent, const char *name) : Parent(parent) { + setObjectName(name); QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setContentsMargins(0, 0, 0, 0); -- cgit v1.2.3 From e484fe3a9be894f97a7f982f606ac318648f8db5 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:23 -0700 Subject: Port xconfig to Qt5 - Quick workaround to bypass app crash at startup. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 3 --- 1 file changed, 3 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 3454c4361c8e..8d72e4ae6291 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -576,9 +576,6 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) enum prop_type type; if (!menu) { - while ((item = parent->firstChild())) - item->parent()->removeChild(item); - delete item; return; } -- cgit v1.2.3 From a52cb321de597542eeab63e1033156e05d9f075b Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:24 -0700 Subject: Port xconfig to Qt5 - Tree widget set column titles. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 8d72e4ae6291..c64b90517bdb 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -318,6 +318,8 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setSortingEnabled(-1); setRootIsDecorated(true); + setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); + connect(this, SIGNAL(itemSelectionChanged(void)), SLOT(updateSelection(void))); -- cgit v1.2.3 From 86c052827b68db49a70597980d0f85c8546a09be Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:25 -0700 Subject: Port xconfig to Qt5 - Add ConfigItem::nextItem to initializer list. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 819e0292aaba..d1383c6692d9 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -124,17 +124,17 @@ class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: ConfigItem(QTreeWidget *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) + : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) { init(); } ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) + : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) { init(); } ConfigItem(QTreeWidget *parent, ConfigItem *after, bool v) - : Parent(parent, after), menu(0), visible(v), goParent(true) + : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true) { init(); } -- cgit v1.2.3 From dbf629331ac8e9458bb5fb1ccd5b850f3f2f94b6 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:26 -0700 Subject: Port xconfig to Qt5 - Add ConfigList::mode to initializer list. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index c64b90517bdb..168f0cccc076 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -309,7 +309,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), - showName(false), showRange(false), showData(false), optMode(normalOpt), + showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt), rootEntry(0), headerPopup(0) { int i; -- cgit v1.2.3 From 5c6f1554ba7f79fedebd3500741027dbb9b6dc79 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:27 -0700 Subject: Port xconfig to Qt5 - Remove ConfigList::updateMenuList template. ConfigItem executes parent->takeChild(0) while ConfigList executes parent->takeTopLevelItem(0) Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 73 ++++++++++++++++++++++++++++++++++++++++++++++-- scripts/kconfig/qconf.h | 4 +-- 2 files changed, 73 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 168f0cccc076..f54f19f55bdb 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -568,8 +568,7 @@ void ConfigList::setParentMenu(void) * parent: either the menu list widget or a menu entry widget * menu: entry to be updated */ -template -void ConfigList::updateMenuList(P* parent, struct menu* menu) +void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) { struct menu* child; ConfigItem* item; @@ -578,6 +577,11 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) enum prop_type type; if (!menu) { + while (parent->childCount() > 0) + { + delete parent->takeChild(0); + } + return; } @@ -629,6 +633,71 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) } } +void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) +{ + struct menu* child; + ConfigItem* item; + ConfigItem* last; + bool visible; + enum prop_type type; + + if (!menu) { + while (parent->topLevelItemCount() > 0) + { + delete parent->takeTopLevelItem(0); + } + + return; + } + + last = (ConfigItem*)parent->topLevelItem(0); + if (last && !last->goParent) + last = 0; + for (child = menu->list; child; child = child->next) { + item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0); + type = child->prompt ? child->prompt->type : P_UNKNOWN; + + switch (mode) { + case menuMode: + if (!(child->flags & MENU_ROOT)) + goto hide; + break; + case symbolMode: + if (child->flags & MENU_ROOT) + goto hide; + break; + default: + break; + } + + visible = menu_is_visible(child); + if (!menuSkip(child)) { + if (!child->sym && !child->list && !child->prompt) + continue; + if (!item || item->menu != child) + item = new ConfigItem(parent, last, child, visible); + else + item->testUpdateMenu(visible); + + if (mode == fullMode || mode == menuMode || type != P_MENU) + updateMenuList(item, child); + else + updateMenuList(item, 0); + last = item; + continue; + } + hide: + if (item && item->menu == child) { + last = (ConfigItem*)parent->topLevelItem(0); + if (last == item) + last = 0; + else while (last->nextSibling() != item) + last = last->nextSibling(); + delete item; + } + } +} + void ConfigList::keyPressEvent(QKeyEvent* ev) { QTreeWidgetItem* i = currentItem(); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index d1383c6692d9..d86ae3c26979 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -102,8 +102,8 @@ public: bool menuSkip(struct menu *); - template - void updateMenuList(P*, struct menu*); + void updateMenuList(ConfigItem *parent, struct menu*); + void updateMenuList(ConfigList *parent, struct menu*); bool updateAll; -- cgit v1.2.3 From a5225e9bc915e9010f31b0ff420a8ce3df669bc6 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:29 -0700 Subject: Port xconfig to Qt5 - Disable ConfigList soring Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index f54f19f55bdb..9edb9c541664 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -315,7 +315,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) int i; setObjectName(name); - setSortingEnabled(-1); + setSortingEnabled(false); setRootIsDecorated(true); setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); -- cgit v1.2.3 From d960b9889984d29182c17d55b3cd95c3d8d9d598 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:30 -0700 Subject: Port xconfig to Qt5 - Change ConfigItem constructor parent type. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index d86ae3c26979..000403de5df0 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -123,7 +123,7 @@ public: class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: - ConfigItem(QTreeWidget *parent, ConfigItem *after, struct menu *m, bool v) + ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v) : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) { init(); @@ -133,7 +133,7 @@ public: { init(); } - ConfigItem(QTreeWidget *parent, ConfigItem *after, bool v) + ConfigItem(ConfigList *parent, ConfigItem *after, bool v) : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true) { init(); -- cgit v1.2.3 From f999cc06f97e0e75b21a114d38e7477c18a5a673 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:31 -0700 Subject: Port xconfig to Qt5 - Add horizontal scrollbar, and scroll per pixel. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 9edb9c541664..10fe15d9aca6 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -318,6 +318,9 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setSortingEnabled(false); setRootIsDecorated(true); + setVerticalScrollMode(ScrollPerPixel); + setHorizontalScrollMode(ScrollPerPixel); + setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); connect(this, SIGNAL(itemSelectionChanged(void)), @@ -450,11 +453,13 @@ void ConfigList::updateList(ConfigItem* item) updateMenuList(item, rootEntry); update(); + resizeColumnToContents(0); return; } update: updateMenuList(this, rootEntry); update(); + resizeColumnToContents(0); } void ConfigList::setValue(ConfigItem* item, tristate val) -- cgit v1.2.3 From b3c48f964cda9311030416d1ee17bd5bdc4729f2 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:32 -0700 Subject: Port xconfig to Qt5 - Source format. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 000403de5df0..a40036d1b059 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -157,10 +157,10 @@ public: ConfigItem *_parent = (ConfigItem *)parent(); if(_parent) { - ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1); + ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1); } else { - QTreeWidget *_treeWidget = treeWidget(); - ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1); + QTreeWidget *_treeWidget = treeWidget(); + ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1); } return ret; -- cgit v1.2.3 From 5c60014b4ee8dd02f0d10a8995cd1859a479c0dc Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:33 -0700 Subject: Port xconfig to Qt5 - Remove some commented code. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 4 ---- 1 file changed, 4 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 10fe15d9aca6..6b3442cd07f2 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -199,9 +199,6 @@ void ConfigItem::updateMenu(void) data = sym_get_string_value(sym); - //int i = list->mapIdx(dataColIdx); - //if (i >= 0) - // setRenameEnabled(i, true); setText(dataColIdx, data); if (type == S_STRING) prompt = QString("%1: %2").arg(prompt).arg(data); @@ -1353,7 +1350,6 @@ ConfigMainWindow::ConfigMainWindow(void) configList = configView->list; helpText = new ConfigInfoView(split2, "help"); - //helpText->setTextFormat(Qt::RichText); setTabOrder(configList, helpText); configList->setFocus(); -- cgit v1.2.3 From e336b9f1325acb65121c6911f6f0bd057073db6a Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:34 -0700 Subject: Port xconfig to Qt5 - Add(back) lineedit editing. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 6b3442cd07f2..b03cfadbd9ef 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -518,6 +518,7 @@ void ConfigList::changeValue(ConfigItem* item) case S_INT: case S_HEX: case S_STRING: + parent()->lineEdit->show(item); break; } } -- cgit v1.2.3 From 76d53cbbae3fe29bfa92177e4bf3377fab176ec6 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:35 -0700 Subject: Port xconfig to Qt5 - Add(back) one click checkbox toggle. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index b03cfadbd9ef..ca22676da4a9 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -776,10 +776,26 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e) menu = item->menu; x = header()->offset() + p.x(); - idx = header()->sectionPosition(x); + idx = header()->logicalIndexAt(x); switch (idx) { case promptColIdx: icon = item->pixmap(promptColIdx); + if (!icon.isNull()) { + int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly. + if (x >= off && x < off + icon.availableSizes().first().width()) { + if (item->goParent) { + emit parentSelected(); + break; + } else if (!menu) + break; + ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; + if (ptype == P_MENU && rootEntry != menu && + mode != fullMode && mode != menuMode) + emit menuSelected(menu); + else + changeValue(item); + } + } break; case noColIdx: setValue(item, no); -- cgit v1.2.3 From 5df9da9df2071c7c18245b4462e7d65d28df4281 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:36 -0700 Subject: Port xconfig to Qt5 - on Back clicked, deselect old item. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index ca22676da4a9..97631e9a61d8 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1618,14 +1618,16 @@ void ConfigMainWindow::listFocusChanged(void) void ConfigMainWindow::goBack(void) { - ConfigItem* item; + ConfigItem* item, *oldSelection; configList->setParentMenu(); if (configList->rootEntry == &rootmenu) backAction->setEnabled(false); item = (ConfigItem*)menuList->selectedItems().first(); + oldSelection = item; while (item) { if (item->menu == configList->rootEntry) { + oldSelection->setSelected(false); item->setSelected(true); break; } -- cgit v1.2.3 From ee7298fbc01e252157a314da7a8a0eaef46ad2a2 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:37 -0700 Subject: Port xconfig to Qt5 - Fix goParent issue. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 97631e9a61d8..6c3f883c6692 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -435,7 +435,7 @@ void ConfigList::updateList(ConfigItem* item) if (rootEntry != &rootmenu && (mode == singleMode || (mode == symbolMode && rootEntry->parent != &rootmenu))) { - item = firstChild(); + item = (ConfigItem *)topLevelItem(0); if (!item) item = new ConfigItem(this, 0, true); last = item; -- cgit v1.2.3 From b4ff1de3b8381a471d1b1320be0daa3f8fc2ed85 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:38 -0700 Subject: Port xconfig to Qt5 - Update copyright. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 6c3f883c6692..73ce56a76271 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1,5 +1,6 @@ /* * Copyright (C) 2002 Roman Zippel + * Copyright (C) 2015 Boris Barbulovski * Released under the terms of the GNU GPL v2.0. */ @@ -1746,7 +1747,8 @@ void ConfigMainWindow::showIntro(void) void ConfigMainWindow::showAbout(void) { - static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel .\n\n" + static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel .\n" + "Copyright (C) 2015 Boris Barbulovski .\n\n" "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); QMessageBox::information(this, "qconf", str); -- cgit v1.2.3 From d1b0dc90abdb3487a8b60ac7c843708f98ff409a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 Sep 2015 11:36:39 -0700 Subject: Update the buildsystem for KConfig finding Qt The buildsystem will now only search for Qt 4 and Qt 5. Support for Qt 2 and 3 was dropped in the previous commits (Qt 3 was EOL'ed in 2010 or so...). For Qt 5, to be future-proof with the future direction notice appearing in the 5.5 release, C++11 support is automatically enabled. Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/Makefile | 73 +++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 45 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 9b5b8c6796b9..33c49944e1a7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -226,53 +226,36 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile # Qt needs some extra effort... $(obj)/.tmp_qtcheck: - @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \ - if ! pkg-config --exists QtCore 2> /dev/null; then \ - echo "* Unable to find the Qt4 tool qmake. Trying to use Qt3"; \ - pkg-config --exists qt 2> /dev/null && pkg=qt; \ - pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ - if [ -n "$$pkg" ]; then \ - cflags="\$$(shell pkg-config $$pkg --cflags)"; \ - libs="\$$(shell pkg-config $$pkg --libs)"; \ - moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ - dir="$$(pkg-config $$pkg --variable=prefix)"; \ - else \ - for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ - if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ - done; \ - if [ -z "$$dir" ]; then \ - echo >&2 "*"; \ - echo >&2 "* Unable to find any Qt installation. Please make sure that"; \ - echo >&2 "* the Qt4 or Qt3 development package is correctly installed and"; \ - echo >&2 "* either qmake can be found or install pkg-config or set"; \ - echo >&2 "* the QTDIR environment variable to the correct location."; \ - echo >&2 "*"; \ - false; \ - fi; \ - libpath=$$dir/lib; lib=qt; osdir=""; \ - $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ - osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ - test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ - test -f $$libpath/libqt-mt.so && lib=qt-mt; \ - cflags="-I$$dir/include"; \ - libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ - moc="$$dir/bin/moc"; \ - fi; \ - if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ - echo "*"; \ - echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ - echo "*"; \ - moc="/usr/bin/moc"; \ - fi; \ - else \ - cflags="\$$(shell pkg-config QtCore QtGui --cflags)"; \ - libs="\$$(shell pkg-config QtCore QtGui --libs)"; \ - moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ - [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ - fi; \ + @set -e; $(kecho) " CHECK qt"; \ + qtver=`qmake -query QT_VERSION` || { \ + echo >&2 "*"; \ + echo >&2 "* qmake failed."; \ + echo >&2 "*"; \ + exit 1; \ + }; \ + qtlibdir=`qmake -query QT_INSTALL_LIBS`; \ + qthdrdir=`qmake -query QT_INSTALL_HEADERS`; \ + qtbindir=`qmake -query QT_INSTALL_BINS`; \ + cflags="-I$$qthdrdir -I$$qthdrdir/QtCore -I$$qthdrdir/QtGui"; \ + case "$$qtver" in \ + 5.*) \ + cflags="$$cflags -I$$qthdrdir/QtWidgets -std=c++11 -fPIC"; \ + libs="-L$$qtlibdir -lQt5Widgets -lQt5Gui -lQt5Core "; \ + ;; \ + 4.*) \ + libs="-L$$qtlibdir -lQtGui -lQtCore"; \ + ;; \ + *) \ + echo >&2 "*"; \ + echo >&2 "* Found qmake but it is for Qt version $$qtver, which is not supported."; \ + echo >&2 "* Please install either Qt 4.8 or 5.x."; \ + echo >&2 "*"; \ + exit 1; \ + ;; \ + esac; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \ - echo "KC_QT_MOC=$$moc" >> $@ + echo "KC_QT_MOC=$$qtbindir/moc" >> $@ endif $(obj)/gconf.o: $(obj)/.tmp_gtkcheck -- cgit v1.2.3 From ed94fea5ba78d03808576f14745d8e59126489bd Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis Date: Wed, 14 Oct 2015 16:04:20 +0200 Subject: kconfig/merge_config.sh: Support KCONFIG_CONFIG All make targets support $KCONFIG_CONFIG because they run scripts/kconf. Make sure merge_config.sh accesses the correct file in all cases. Previously this script broke in two different code paths, one for targets like kvmconfig (which use merge_config.sh -m then call a target that respects KCONFIG_CONFIG) and one for direct use of the script without -m, which called make rules that edit KCONFIG_CONFIG but verified a different file. Signed-off-by: Gabriel de Perthuis Signed-off-by: Michal Marek --- scripts/kconfig/merge_config.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 0d883b37882a..67653538e322 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -32,7 +32,7 @@ usage() { echo " -m only merge the fragments, do not execute the make command" echo " -n use allnoconfig instead of alldefconfig" echo " -r list redundant entries when merging fragments" - echo " -O dir to put generated output files" + echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." } RUNMAKE=true @@ -82,6 +82,14 @@ if [ "$#" -lt 2 ] ; then exit fi +if [ -z "$KCONFIG_CONFIG" ]; then + if [ "$OUTPUT" != . ]; then + KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config") + else + KCONFIG_CONFIG=.config + fi +fi + INITFILE=$1 shift; @@ -124,9 +132,9 @@ for MERGE_FILE in $MERGE_LIST ; do done if [ "$RUNMAKE" = "false" ]; then - cp $TMP_FILE $OUTPUT/.config + cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG" echo "#" - echo "# merged configuration written to $OUTPUT/.config (needs make)" + echo "# merged configuration written to $KCONFIG_CONFIG (needs make)" echo "#" clean_up exit @@ -150,7 +158,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) - ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config) + ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG") if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then echo "Value requested for $CFG not in final .config" echo "Requested value: $REQUESTED_VAL" -- cgit v1.2.3 From 2163e7b38fd56c058e664c8a09ccc14733dbc1b1 Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis Date: Wed, 14 Oct 2015 16:04:21 +0200 Subject: kconfig/merge_config.sh: Accept a single file merge_config.sh can usefully be applied to a single file. It implicitly merges with the default configuration. Signed-off-by: Gabriel de Perthuis Signed-off-by: Michal Marek --- scripts/kconfig/merge_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 67653538e322..67d131447631 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -77,7 +77,7 @@ while true; do esac done -if [ "$#" -lt 2 ] ; then +if [ "$#" -lt 1 ] ; then usage exit fi -- cgit v1.2.3 From f6aad2615c8c4ed806e70693adacb6c93f13564a Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 19 Oct 2015 16:51:02 +0200 Subject: kconfig: Fix copy&paste error Fixes: 31847b67bec0 ("kconfig: allow use of relations other than (in)equality") Signed-off-by: Michal Sojka Reviewed-by: Jan Beulich Signed-off-by: Michal Marek --- scripts/kconfig/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 667d1aa23711..cbf4996dd9c1 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -1113,7 +1113,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * fn(data, e->left.sym, e->left.sym->name); else fn(data, NULL, ""); - fn(data, NULL, e->type == E_LEQ ? ">=" : ">"); + fn(data, NULL, e->type == E_GEQ ? ">=" : ">"); fn(data, e->right.sym, e->right.sym->name); break; case E_UNEQUAL: -- cgit v1.2.3 From 588446a84776cfb3ebbc1677c3407d6884878bd6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 1 Nov 2015 21:12:53 -0600 Subject: Use pkg-config to find Qt 4 and 5 instead of direct qmake The Qt Project recommendation is that there should always be a "qmake" binary and it should never be renamed. If it's necessary to handle multiple Qt versions, the Qt Project recommends using qtchooser. Unfortunately, some distros do not follow the recommendation, so we would need to check qmake-qt4, qmake-qt5, etc. So, instead, let's try pkg-config. Signed-off-by: Thiago Macieira Reported-by: Alexey Brodkin Acked-by: Alexey Brodkin Signed-off-by: Michal Marek --- scripts/kconfig/Makefile | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 33c49944e1a7..8d0b1ba77242 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -227,35 +227,24 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile # Qt needs some extra effort... $(obj)/.tmp_qtcheck: @set -e; $(kecho) " CHECK qt"; \ - qtver=`qmake -query QT_VERSION` || { \ + if pkg-config --exists Qt5Core; then \ + cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ + libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \ + moc=`pkg-config --variable=host_bins Qt5Core`/moc; \ + elif pkg-config --exists QtCore; then \ + cflags=`pkg-config --cflags QtCore QtGui`; \ + libs=`pkg-config --libs QtCore QtGui`; \ + moc=`pkg-config --variable=moc_location QtCore`; \ + else \ echo >&2 "*"; \ - echo >&2 "* qmake failed."; \ + echo >&2 "* Could not find Qt via pkg-config."; \ + echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \ echo >&2 "*"; \ exit 1; \ - }; \ - qtlibdir=`qmake -query QT_INSTALL_LIBS`; \ - qthdrdir=`qmake -query QT_INSTALL_HEADERS`; \ - qtbindir=`qmake -query QT_INSTALL_BINS`; \ - cflags="-I$$qthdrdir -I$$qthdrdir/QtCore -I$$qthdrdir/QtGui"; \ - case "$$qtver" in \ - 5.*) \ - cflags="$$cflags -I$$qthdrdir/QtWidgets -std=c++11 -fPIC"; \ - libs="-L$$qtlibdir -lQt5Widgets -lQt5Gui -lQt5Core "; \ - ;; \ - 4.*) \ - libs="-L$$qtlibdir -lQtGui -lQtCore"; \ - ;; \ - *) \ - echo >&2 "*"; \ - echo >&2 "* Found qmake but it is for Qt version $$qtver, which is not supported."; \ - echo >&2 "* Please install either Qt 4.8 or 5.x."; \ - echo >&2 "*"; \ - exit 1; \ - ;; \ - esac; \ + fi; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \ - echo "KC_QT_MOC=$$qtbindir/moc" >> $@ + echo "KC_QT_MOC=$$moc" >> $@ endif $(obj)/gconf.o: $(obj)/.tmp_gtkcheck -- cgit v1.2.3 From be596aaa74090f553c61505ad03bb7a7460e5d23 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:28 -0700 Subject: Add current selection check. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira [mmarek: I missed it in the original Qt5 patch set, which caused a crash] Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 73ce56a76271..91b7e6fbc364 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -400,6 +400,9 @@ void ConfigList::updateSelection(void) struct menu *menu; enum prop_type type; + if (selectedItems().count() == 0) + return; + ConfigItem* item = (ConfigItem*)selectedItems().first(); if (!item) return; @@ -1624,6 +1627,10 @@ void ConfigMainWindow::goBack(void) configList->setParentMenu(); if (configList->rootEntry == &rootmenu) backAction->setEnabled(false); + + if (menuList->selectedItems().count() == 0) + return; + item = (ConfigItem*)menuList->selectedItems().first(); oldSelection = item; while (item) { -- cgit v1.2.3