From cf497b922386c5e00925cb4d909c319ed27bca18 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Apr 2020 11:27:58 +0200 Subject: kconfig: qconf: clean deprecated warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Masahiro Yamada --- scripts/kconfig/qconf.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 50a5245d87bb..3ea255a66c55 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -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(); } -- cgit From 5752ff07fd90d764d96e3c586cc95c09598abfdd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Apr 2020 11:27:59 +0200 Subject: kconfig: qconf: Change title for the item window Both 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. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Masahiro Yamada --- scripts/kconfig/qconf.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 3ea255a66c55..0e66dc73e177 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -316,7 +316,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))); @@ -397,6 +400,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; -- cgit From cce1faba82645fee899ccef5b7d3050fed3a3d10 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Apr 2020 11:28:00 +0200 Subject: kconfig: qconf: fix the content of the main widget The 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. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Masahiro Yamada --- scripts/kconfig/qconf.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 0e66dc73e177..3f7bee7051e0 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1360,21 +1360,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(); -- cgit From b311142fcfd37b58dfec72e040ed04949eb1ac86 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Apr 2020 11:28:01 +0200 Subject: kconfig: qconf: fix support for the split view mode At 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. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Masahiro Yamada --- scripts/kconfig/qconf.cc | 33 ++++++++++++++++++++++++++------- scripts/kconfig/qconf.h | 2 ++ 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 3f7bee7051e0..4f9c695c1af8 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -742,7 +742,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: @@ -849,9 +852,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: @@ -1503,6 +1509,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 *)), @@ -1599,15 +1607,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; @@ -1717,14 +1736,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(); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 45bfe9b2b966..c879d79ce817 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -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 @@ public: ConfigMainWindow(void); public slots: void changeMenu(struct menu *); + void changeItens(struct menu *); void setMenuLink(struct menu *); void listFocusChanged(void); void goBack(void); -- cgit From e1f7769f6094fb714a63af6be7e8f2d4c86ddcd5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Apr 2020 11:28:02 +0200 Subject: kconfig: qconf: remove some old bogus TODOs The items described on those TODOs are already solved. So, remove the comments. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Masahiro Yamada --- scripts/kconfig/qconf.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 4f9c695c1af8..486b16ddba59 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -837,7 +837,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; @@ -1771,7 +1771,6 @@ void ConfigMainWindow::showFullView(void) /* * ask for saving configuration before quitting - * TODO ask only when something changed */ void ConfigMainWindow::closeEvent(QCloseEvent* e) { -- cgit From 60969f02f07ae1445730c7b293c421d179da729c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Apr 2020 11:28:03 +0200 Subject: kconfig: qconf: Fix a few alignment issues There are a few items with wrong alignments. Solve them. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Masahiro Yamada --- scripts/kconfig/qconf.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 486b16ddba59..c0ac8f7b5f1a 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -633,7 +633,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) @@ -698,7 +698,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) @@ -1237,10 +1237,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; -- cgit