Fix several issues at qconf.cc
cover Fix several issues at qconf.cc
Since its conversion to support Qt5, back on Kernel 3.14, the qconf.cc tool has been having some issues. With Kernel 5.6 (and Qt 5.13) it doesn't work at all, on any of its modes.
This patch series restore its functionality to what it had before Kernel 3.14.
Now, all three modes should work as expected, and the layout will be shown with a vertical split, with the help messages at the botton, for both Single and Full modes.
The Split mode should also work properly, with its horizontal split showing the main config items at the left and a per-items view at the right.
Mauro Carvalho Chehab (6):
kconfig: qconf: clean deprecated warnings
kconfig: qconf: Change title for the item window
kconfig: qconf: fix the content of the main widget
kconfig: qconf: fix support for the split view mode
kconfig: qconf: remove some old bogus TODOs
kconfig: qconf: Fix a few alignment issues
scripts/kconfig/qconf.cc | 90 ++++++++++++++++++++++++++++------------ scripts/kconfig/qconf.h | 2 + 2 files changed, 66 insertions(+), 26 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/6 kconfig: qconf: clean deprecated warnings
The recommended way to initialize a null string is with QString(). This is there at least since Qt5.5, with is when qconf was ported to Qt5.
Fix those warnings:
scripts/kconfig/qconf.cc: In member function ‘void ConfigItem::updateMenu()’:
scripts/kconfig/qconf.cc:158:31: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
158 | setText(noColIdx, QString::null);
| ^~~~
In file included from /usr/include/qt5/QtCore/qobject.h:47,
from /usr/include/qt5/QtWidgets/qwidget.h:45,
from /usr/include/qt5/QtWidgets/qmainwindow.h:44,
from /usr/include/qt5/QtWidgets/QMainWindow:1,
from scripts/kconfig/qconf.cc:9:
--- scripts/kconfig/qconf.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/kconfig/qconf.cc +4 -4
@@ -154,9 +154,9 @@ void ConfigItem::updateMenu(void) if (!sym_is_changeable(sym) && list->optMode == normalOpt) { setPixmap(promptColIdx, QIcon()); - setText(noColIdx, QString::null); - setText(modColIdx, QString::null); - setText(yesColIdx, QString::null); + setText(noColIdx, QString()); + setText(modColIdx, QString()); + setText(yesColIdx, QString()); break; } expr = sym_get_tristate_value(sym);
@@ -276,7 +276,7 @@ void ConfigLineEdit::show(ConfigItem* i) if (sym_get_string_value(item->menu->sym)) setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym))); else - setText(QString::null); + setText(QString()); Parent::show(); setFocus(); }
Signature · 1 line
2.25.1
PATCH 2/6 kconfig: qconf: Change title for the item window
In reply to Mauro Carvalho ChehabBoth main config window and the item window have "Option" name. That sounds weird, and makes harder to debug issues of a window appearing at the wrong place.
So, change the title to reflect the contents of each window.
--- scripts/kconfig/qconf.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/kconfig/qconf.cc +9 -1
@@ -318,7 +318,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setVerticalScrollMode(ScrollPerPixel); setHorizontalScrollMode(ScrollPerPixel); - setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value"); + if (mode == symbolMode) + setHeaderLabels(QStringList() << "Item" << "Name" << "N" << "M" << "Y" << "Value"); + else + setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value"); connect(this, SIGNAL(itemSelectionChanged(void)), SLOT(updateSelection(void)));
@@ -399,6 +402,11 @@ void ConfigList::updateSelection(void) struct menu *menu; enum prop_type type; + if (mode == symbolMode) + setHeaderLabels(QStringList() << "Item" << "Name" << "N" << "M" << "Y" << "Value"); + else + setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value"); + if (selectedItems().count() == 0) return;
Signature · 1 line
2.25.1
PATCH 3/6 kconfig: qconf: fix the content of the main widget
In reply to Mauro Carvalho ChehabThe port to Qt5 tried to preserve the same way as it used to work with Qt3 and Qt4. However, at least with newer versions of Qt5 (5.13), this doesn't work properly.
Change the schema by adding a vertical layout, in order for it to start working properly again.
--- scripts/kconfig/qconf.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
scripts/kconfig/qconf.cc +17 -6
@@ -1362,21 +1362,32 @@ ConfigMainWindow::ConfigMainWindow(void) if ((x.isValid())&&(y.isValid())) move(x.toInt(), y.toInt()); - split1 = new QSplitter(this); + QWidget *widget = new QWidget(this); + QVBoxLayout *layout = new QVBoxLayout(widget); + setCentralWidget(widget); + + split1 = new QSplitter(widget); split1->setOrientation(Qt::Horizontal); - setCentralWidget(split1); + split1->setChildrenCollapsible(false); - menuView = new ConfigView(split1, "menu"); + menuView = new ConfigView(widget, "menu"); menuList = menuView->list; - split2 = new QSplitter(split1); + split2 = new QSplitter(widget); + split2->setChildrenCollapsible(false); split2->setOrientation(Qt::Vertical); // create config tree - configView = new ConfigView(split2, "config"); + configView = new ConfigView(widget, "config"); configList = configView->list; - helpText = new ConfigInfoView(split2, "help"); + helpText = new ConfigInfoView(widget, "help"); + + layout->addWidget(split2); + split2->addWidget(split1); + split1->addWidget(configView); + split1->addWidget(menuView); + split2->addWidget(helpText); setTabOrder(configList, helpText); configList->setFocus();
Signature · 1 line
2.25.1
PATCH 4/6 kconfig: qconf: fix support for the split view mode
In reply to Mauro Carvalho ChehabAt least on my tests (building against Qt5.13), it seems to me that, since Kernel 3.14, the split view mode is broken.
Maybe it was not a top priority during the conversion time.
Anyway, this patch changes the logic in order to properly support the split view mode and the single view mode.
--- scripts/kconfig/qconf.cc | 33 ++++++++++++++++++++++++++------- scripts/kconfig/qconf.h | 2 ++ 2 files changed, 28 insertions(+), 7 deletions(-)
scripts/kconfig/qconf.cc +26 -7
@@ -744,7 +744,10 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) type = menu->prompt ? menu->prompt->type : P_UNKNOWN; if (type == P_MENU && rootEntry != menu && mode != fullMode && mode != menuMode) { - emit menuSelected(menu); + if (mode == menuMode) + emit menuSelected(menu); + else + emit itemSelected(menu); break; } case Qt::Key_Space:
@@ -851,9 +854,12 @@ void ConfigList::mouseDoubleClickEvent(QMouseEvent* e) 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) + if (ptype == P_MENU) { + if (mode == singleMode) + emit itemSelected(menu); + else if (mode == symbolMode) + emit menuSelected(menu); + } else if (menu->sym) changeValue(item); skip:
@@ -1505,6 +1511,8 @@ ConfigMainWindow::ConfigMainWindow(void) helpText, SLOT(setInfo(struct menu *))); connect(configList, SIGNAL(menuSelected(struct menu *)), SLOT(changeMenu(struct menu *))); + connect(configList, SIGNAL(itemSelected(struct menu *)), + SLOT(changeItens(struct menu *))); connect(configList, SIGNAL(parentSelected()), SLOT(goBack())); connect(menuList, SIGNAL(menuChanged(struct menu *)),
@@ -1601,15 +1609,26 @@ void ConfigMainWindow::searchConfig(void) searchWindow->show(); } -void ConfigMainWindow::changeMenu(struct menu *menu) +void ConfigMainWindow::changeItens(struct menu *menu) { configList->setRootMenu(menu); + if (configList->rootEntry->parent == &rootmenu) backAction->setEnabled(false); else backAction->setEnabled(true); } +void ConfigMainWindow::changeMenu(struct menu *menu) +{ + menuList->setRootMenu(menu); + + if (menuList->rootEntry->parent == &rootmenu) + backAction->setEnabled(false); + else + backAction->setEnabled(true); +} + void ConfigMainWindow::setMenuLink(struct menu *menu) { struct menu *parent;
@@ -1719,14 +1738,14 @@ void ConfigMainWindow::showSplitView(void) fullViewAction->setEnabled(true); fullViewAction->setChecked(false); - configList->mode = symbolMode; + configList->mode = menuMode; if (configList->rootEntry == &rootmenu) configList->updateListAll(); else configList->setRootMenu(&rootmenu); configList->setAllOpen(true); configApp->processEvents(); - menuList->mode = menuMode; + menuList->mode = symbolMode; menuList->setRootMenu(&rootmenu); menuList->setAllOpen(true); menuView->show();
scripts/kconfig/qconf.h +2 -0
@@ -71,6 +71,7 @@ public slots: signals:void menuChanged (struct menu *menu);void menuSelected (struct menu *menu); +void itemSelected (struct menu *menu);void parentSelected (void );void gotFocus (struct menu *);
@@ -298,6 +299,7 @@ class ConfigMainWindow : public QMainWindow {ConfigMainWindow (void); public slots:void changeMenu (struct menu *); +void changeItens (struct menu *);void setMenuLink (struct menu *);void listFocusChanged (void );void goBack (void );
Signature · 1 line
2.25.1
PATCH 5/6 kconfig: qconf: remove some old bogus TODOs
In reply to Mauro Carvalho ChehabThe items described on those TODOs are already solved. So, remove the comments.
--- scripts/kconfig/qconf.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/kconfig/qconf.cc +1 -2
@@ -839,7 +839,7 @@ void ConfigList::mouseMoveEvent(QMouseEvent* e) void ConfigList::mouseDoubleClickEvent(QMouseEvent* e) { - QPoint p = e->pos(); // TODO: Check if this works(was contentsToViewport). + QPoint p = e->pos(); ConfigItem* item = (ConfigItem*)itemAt(p); struct menu *menu; enum prop_type ptype;
@@ -1773,7 +1773,6 @@ void ConfigMainWindow::showFullView(void) /* * ask for saving configuration before quitting - * TODO ask only when something changed */ void ConfigMainWindow::closeEvent(QCloseEvent* e) {
Signature · 1 line
2.25.1
PATCH 6/6 kconfig: qconf: Fix a few alignment issues
In reply to Mauro Carvalho ChehabThere are a few items with wrong alignments. Solve them.
--- scripts/kconfig/qconf.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
scripts/kconfig/qconf.cc +7 -6
@@ -635,7 +635,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) last = item; continue; } - hide: +hide: if (item && item->menu == child) { last = parent->firstChild(); if (last == item)
@@ -700,7 +700,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) last = item; continue; } - hide: +hide: if (item && item->menu == child) { last = (ConfigItem*)parent->topLevelItem(0); if (last == item)
@@ -1239,10 +1239,11 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) { QMenu* popup = Parent::createStandardContextMenu(pos); QAction* action = new QAction("Show Debug Info", popup); - action->setCheckable(true); - connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); - connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); - action->setChecked(showDebug()); + + 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(); popup->addAction(action); return popup;
Signature · 1 line
2.25.1
Quoted 14 lines · Mauro Carvalho Chehab
Since its conversion to support Qt5, back on Kernel 3.14, the qconf.cc tool has been having some issues. With Kernel 5.6 (and Qt 5.13) it doesn't work at all, on any of its modes.
This patch series restore its functionality to what it had before Kernel 3.14.
Now, all three modes should work as expected, and the layout will be shown with a vertical split, with the help messages at the botton, for both Single and Full modes.
The Split mode should also work properly, with its horizontal split showing the main config items at the left and a per-items view at the right.
Quoted 7 lines
Mauro Carvalho Chehab (6):
kconfig: qconf: clean deprecated warnings
kconfig: qconf: Change title for the item window
kconfig: qconf: fix the content of the main widget
kconfig: qconf: fix support for the split view mode
kconfig: qconf: remove some old bogus TODOs
kconfig: qconf: Fix a few alignment issues
Thank you for fixing several issues!
I will pick this series for v5.7-rc1 soon.
Quoted 9 lines
scripts/kconfig/qconf.cc | 90 ++++++++++++++++++++++++++++------------ scripts/kconfig/qconf.h | 2 + 2 files changed, 66 insertions(+), 26 deletions(-)--
2.25.1
Signature · 2 lines
Best Regards Masahiro Yamada