Skip to contentSkip to conversation

Fix split view search and debug info navigation

PATCH In review Mauro Carvalho Chehab 3 participants 14 messages Jun 30, 2020 – Jul 18, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Fix split view search and debug info navigation

This series fixes some issues with search while on split view and fix the broken hyperlink navigation.

The first patches restore the pre-Qt5 conversion behavior. The last one implements navigation on a different way. I opted to keep this one in separate, as this one is a new feature.

-

v3:

- dropped a patch that it is not needed anymore;
- hyperlinks should now work for non-visible items;
- fixed a description at patch 3.

Mauro Carvalho Chehab (7):
kconfig: qconf: cleanup includes
kconfig: qconf: make search fully work again on split mode
kconfig: qconf: make debug links work again
kconfig: qconf: re-implement setSelected()
kconfig: qconf: simplify the goBack() logic
kconfig: qconf: don't show goback button on splitMode
kconfig: qconf: navigate menus on hyperlinks

 scripts/kconfig/qconf.cc | 169 +++++++++++++++++++++++----------------
 scripts/kconfig/qconf.h  |  29 ++++---
 2 files changed, 119 insertions(+), 79 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v3 1/7 kconfig: qconf: cleanup includes

The usage of c-like include is deprecated on modern Qt versions. Use the c++ style includes.

While here, remove uneeded and redundant ones, sorting them on alphabetic order.

---
 scripts/kconfig/qconf.cc | 27 +++++++++------------------
 scripts/kconfig/qconf.h  | 14 +++++++-------
 2 files changed, 16 insertions(+), 25 deletions(-)
scripts/kconfig/qconf.cc +9 -18
index c0ac8f7b5f1a..0e06afa08908 100644
@@ -4,27 +4,18 @@
  * Copyright (C) 2015 Boris Barbulovski <[email protected]>
  */
 
-#include <qglobal.h>
-
-#include <QMainWindow>
-#include <QList>
-#include <qtextbrowser.h>
 #include <QAction>
+#include <QApplication>
+#include <QCloseEvent>
+#include <QDesktopWidget>
 #include <QFileDialog>
+#include <QLabel>
+#include <QLayout>
+#include <QList>
 #include <QMenu>
-
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-#include <qtoolbar.h>
-#include <qlayout.h>
-#include <qsplitter.h>
-#include <qlineedit.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qmenubar.h>
-#include <qmessagebox.h>
-#include <qregexp.h>
-#include <qevent.h>
+#include <QMenuBar>
+#include <QMessageBox>
+#include <QToolBar>
 
 #include <stdlib.h>
 
scripts/kconfig/qconf.h +7 -7
index c879d79ce817..d913a02967ae 100644
@@ -3,17 +3,17 @@
  * Copyright (C) 2002 Roman Zippel <[email protected]>
  */
 
-#include <QTextBrowser>
-#include <QTreeWidget>
-#include <QMainWindow>
+#include <QCheckBox>
+#include <QDialog>
 #include <QHeaderView>
-#include <qsettings.h>
+#include <QLineEdit>
+#include <QMainWindow>
 #include <QPushButton>
 #include <QSettings>
-#include <QLineEdit>
 #include <QSplitter>
-#include <QCheckBox>
-#include <QDialog>
+#include <QTextBrowser>
+#include <QTreeWidget>
+
 #include "expr.h"
 
 class ConfigView;
Signature · 1 line
2.26.2
#2 lore raw

PATCH v3 2/7 kconfig: qconf: make search fully work again on split mode

In reply to Mauro Carvalho Chehab

When the search dialog box finds symbols/menus that match the search criteria, it presents all results at the window.

Clicking on a search result should make qconf to navigate to the selected item. This works on singleMode and on fullMode, but on splitMode, the navigation is broken.

This was partially caused by an incomplete Qt5 conversion and by the followup patches that restored the original behavior.

When qconf is on split mode, it has to update both the config and the menu views. Right now, such logic is broken, as it is not seeking using the right structures.

On qconf, the screen is split into 3 parts:

	+------------+-------+
	|            |       |
	|   Config   | Menu  |
	|            |       |
	+------------+-------+
	|                    |
	|     ConfigInfo     |
	|                    |
	+--------------------+

On singleMode and on fullMode, the menuView is hidden, and search updates only the configList (which controls the ConfigView).

On SplitMode, the search logic should detect if the variable is a leaf or not. If it is a leaf, it should be presented at the menuView, and both configList and menuList should be updated. Otherwise, just the configList should be updated.

---
 scripts/kconfig/qconf.cc | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
scripts/kconfig/qconf.cc +18 -7
index 0e06afa08908..9def59423743 100644
@@ -1636,22 +1636,33 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
 			return;
 		list->setRootMenu(parent);
 		break;
-	case symbolMode:
+	case menuMode:
 		if (menu->flags & MENU_ROOT) {
-			configList->setRootMenu(menu);
+			menuList->setRootMenu(menu);
 			configList->clearSelection();
-			list = menuList;
-		} else {
 			list = configList;
+		} else {
 			parent = menu_get_parent_menu(menu->parent);
 			if (!parent)
 				return;
-			item = menuList->findConfigItem(parent);
+
+			/* Clear an already-selected item */
+			if (!configList->selectedItems().isEmpty()) {
+				item = (ConfigItem*)configList->selectedItems().first();
+				if (item)
+					item->setSelected(false);
+			}
+
+			/* Select the config view */
+			item = configList->findConfigItem(parent);
 			if (item) {
 				item->setSelected(true);
-				menuList->scrollToItem(item);
+				configList->scrollToItem(item);
 			}
-			list->setRootMenu(parent);
+
+			menuList->setRootMenu(parent);
+			menuList->clearSelection();
+			list = menuList;
 		}
 		break;
 	case fullMode:
Signature · 1 line
2.26.2
#3 lore raw

PATCH v3 3/7 kconfig: qconf: make debug links work again

In reply to Mauro Carvalho Chehab

The Qt5 conversion broke support for debug info links.

Restore the behaviour added by changeset ab45d190fd4a ("kconfig: create links in info window").

The original approach was to pass a pointer for a data struct via an <a href>. That doesn't sound a good idea, as, if something gets wrong, the app could crash. So, instead, pass the name of the symbol, and validate such symbol at the hyperlink handling logic.

---
 scripts/kconfig/qconf.cc | 75 +++++++++++++++++++++++++++++++++++++---
 scripts/kconfig/qconf.h  |  1 +
 2 files changed, 71 insertions(+), 5 deletions(-)
scripts/kconfig/qconf.cc +70 -5
index 9def59423743..1fddbdfa58b4 100644
@@ -7,6 +7,7 @@
 #include <QAction>
 #include <QApplication>
 #include <QCloseEvent>
+#include <QDebug>
 #include <QDesktopWidget>
 #include <QFileDialog>
 #include <QLabel>
@@ -1012,7 +1013,7 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
 	: Parent(parent), sym(0), _menu(0)
 {
 	setObjectName(name);
-
+	setOpenLinks(false);
 
 	if (!objectName().isEmpty()) {
 		configSettings->beginGroup(objectName());
@@ -1085,7 +1086,7 @@ void ConfigInfoView::menuInfo(void)
 			if (sym->name) {
 				head += " (";
 				if (showDebug())
-					head += QString().sprintf("<a href=\"s%p\">", sym);
+					head += QString().sprintf("<a href=\"s%s\">", sym->name);
 				head += print_filter(sym->name);
 				if (showDebug())
 					head += "</a>";
@@ -1094,7 +1095,7 @@ void ConfigInfoView::menuInfo(void)
 		} else if (sym->name) {
 			head += "<big><b>";
 			if (showDebug())
-				head += QString().sprintf("<a href=\"s%p\">", sym);
+				head += QString().sprintf("<a href=\"s%s\">", sym->name);
 			head += print_filter(sym->name);
 			if (showDebug())
 				head += "</a>";
@@ -1145,7 +1146,7 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
 		switch (prop->type) {
 		case P_PROMPT:
 		case P_MENU:
-			debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu);
+			debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
 			debug += print_filter(prop->text);
 			debug += "</a><br>";
 			break;
@@ -1217,13 +1218,74 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 	QString str2 = print_filter(str);
 
 	if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
-		*text += QString().sprintf("<a href=\"s%p\">", sym);
+		*text += QString().sprintf("<a href=\"s%s\">", sym->name);
 		*text += str2;
 		*text += "</a>";
 	} else
 		*text += str2;
 }
 
+void ConfigInfoView::clicked(const QUrl &url)
+{
+	QByteArray str = url.toEncoded();
+	const std::size_t count = str.size();
+	char *data = new char[count + 1];
+	struct symbol **result;
+	struct menu *m = NULL;
+	char type;
+
+	if (count < 1) {
+		qInfo() << "Clicked link is empty";
+		delete data;
+		return;
+	}
+
+	memcpy(data, str.constData(), count);
+	data[count] = '\0';
+	type = data[0];
+
+	/* Seek for exact match */
+	data[0] = '^';
+	strcat(data, "$");
+	result = sym_re_search(data);
+	if (!result) {
+		qInfo() << "Clicked symbol is invalid:" << data;
+		delete data;
+		return;
+	}
+
+	sym = *result;
+	if (type == 's') {
+		symbolInfo();
+		emit showDebugChanged(true);
+		free(result);
+		delete data;
+		return;
+	}
+
+	/* URL is a menu */
+	for (struct property *prop = sym->prop; prop; prop = prop->next) {
+		    if (prop->type != P_PROMPT && prop->type != P_MENU)
+			    continue;
+		    m = prop->menu;
+		    break;
+	}
+
+	if (!m) {
+		qInfo() << "Clicked menu is invalid:" << data;
+		free(result);
+		delete data;
+		return;
+	}
+
+	_menu = m;
+	menuInfo();
+
+	emit showDebugChanged(true);
+	free(result);
+	delete data;
+}
+
 QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
 {
 	QMenu* popup = Parent::createStandardContextMenu(pos);
@@ -1497,6 +1559,9 @@ ConfigMainWindow::ConfigMainWindow(void)
 	helpMenu->addAction(showIntroAction);
 	helpMenu->addAction(showAboutAction);
 
+	connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
+		 helpText, SLOT (clicked (const QUrl &)) );
+
 	connect(configList, SIGNAL(menuChanged(struct menu *)),
 		helpText, SLOT(setInfo(struct menu *)));
 	connect(configList, SIGNAL(menuSelected(struct menu *)),
scripts/kconfig/qconf.h +1 -0
index d913a02967ae..a193137f2314 100644
@@ -250,6 +250,7 @@ public slots:
 	void setInfo(struct menu *menu);
 	void saveSettings(void);
 	void setShowDebug(bool);
+	void clicked (const QUrl &url);
 
 signals:
 	void showDebugChanged(bool);
Signature · 1 line
2.26.2
#4 lore raw

PATCH v3 4/7 kconfig: qconf: re-implement setSelected()

In reply to Mauro Carvalho Chehab

The default implementation for setSelected() at QTreeWidgetItem allows multiple items to be selected.

Well, this should never be possible for the configItem lists.

So, implement a function that will automatically clean any previous selection. This simplifies the logic somewhat, while making the selection logic to be applied atomically, avoiding future issues on that.

---
 scripts/kconfig/qconf.cc | 15 ++++-----------
 scripts/kconfig/qconf.h  | 14 ++++++++++----
 2 files changed, 14 insertions(+), 15 deletions(-)
scripts/kconfig/qconf.cc +4 -11
index 1fddbdfa58b4..29ca4823cfb9 100644
@@ -537,7 +537,7 @@ void ConfigList::setRootMenu(struct menu *menu)
 	rootEntry = menu;
 	updateListAll();
 	if (currentItem()) {
-		currentItem()->setSelected(hasFocus());
+		setSelected(currentItem(), hasFocus());
 		scrollToItem(currentItem());
 	}
 }
@@ -865,7 +865,7 @@ void ConfigList::focusInEvent(QFocusEvent *e)
 
 	ConfigItem* item = (ConfigItem *)currentItem();
 	if (item) {
-		item->setSelected(true);
+		setSelected(item, true);
 		menu = item->menu;
 	}
 	emit gotFocus(menu);
@@ -1711,17 +1711,10 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
 			if (!parent)
 				return;
 
-			/* Clear an already-selected item */
-			if (!configList->selectedItems().isEmpty()) {
-				item = (ConfigItem*)configList->selectedItems().first();
-				if (item)
-					item->setSelected(false);
-			}
-
 			/* Select the config view */
 			item = configList->findConfigItem(parent);
 			if (item) {
-				item->setSelected(true);
+				configList->setSelected(item, true);
 				configList->scrollToItem(item);
 			}
 
@@ -1740,7 +1733,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
 	if (list) {
 		item = list->findConfigItem(menu);
 		if (item) {
-			item->setSelected(true);
+			list->setSelected(item, true);
 			list->scrollToItem(item);
 			list->setFocus();
 		}
scripts/kconfig/qconf.h +10 -4
index a193137f2314..fb9e9729266f 100644
@@ -45,11 +45,17 @@ class ConfigList : public QTreeWidget {
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
-	ConfigView* parent(void) const
-	{
-		return (ConfigView*)Parent::parent();
-	}
 	ConfigItem* findConfigItem(struct menu *);
+	ConfigView* parent(void) const
+	{
+		return (ConfigView*)Parent::parent();
+	}
+	void setSelected(QTreeWidgetItem *item, bool enable) {
+		for (int i = 0; i < selectedItems().size(); i++)
+			selectedItems().at(i)->setSelected(false);
+
+		item->setSelected(enable);
+	}
 
 protected:
 	void keyPressEvent(QKeyEvent *e);
Signature · 1 line
2.26.2
#6 lore raw

PATCH v3 6/7 kconfig: qconf: don't show goback button on splitMode

In reply to Mauro Carvalho Chehab

the goback button does nothing on splitMode. So, why display it?

---
 scripts/kconfig/qconf.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/kconfig/qconf.cc +3 -2
index e43fe4dcd4e7..6a327b69ff5f 100644
@@ -437,9 +437,10 @@ void ConfigList::updateList(ConfigItem* item)
 	if (rootEntry != &rootmenu && (mode == singleMode ||
 	    (mode == symbolMode && rootEntry->parent != &rootmenu))) {
 		item = (ConfigItem *)topLevelItem(0);
-		if (!item)
+		if (!item && mode != symbolMode) {
 			item = new ConfigItem(this, 0, true);
-		last = item;
+			last = item;
+		}
 	}
 	if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
 	    rootEntry->sym && rootEntry->prompt) {
Signature · 1 line
2.26.2
#5 lore raw

PATCH v3 5/7 kconfig: qconf: simplify the goBack() logic

In reply to Mauro Carvalho Chehab

The goBack() logic is used only for the configList, as it only makes sense on singleMode. So, let's simplify the code.

---
 scripts/kconfig/qconf.cc | 50 +++++++++++++++-------------------------
 1 file changed, 18 insertions(+), 32 deletions(-)
scripts/kconfig/qconf.cc +18 -32
index 29ca4823cfb9..e43fe4dcd4e7 100644
@@ -1455,18 +1455,22 @@ ConfigMainWindow::ConfigMainWindow(void)
 	addToolBar(toolBar);
 
 	backAction = new QAction(QPixmap(xpm_back), "Back", this);
-	  connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
-	  backAction->setEnabled(false);
+	connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
+
 	QAction *quitAction = new QAction("&Quit", this);
 	quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
-	  connect(quitAction, SIGNAL(triggered(bool)), 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(triggered(bool)), 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(triggered(bool)), SLOT(saveConfig()));
+	connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig()));
+
 	conf_set_changed_callback(conf_changed);
+
 	// Set saveAction's initial state
 	conf_changed();
 	configname = xstrdup(conf_get_configname());
@@ -1667,21 +1671,11 @@ void ConfigMainWindow::searchConfig(void)
 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)
@@ -1748,25 +1742,11 @@ void ConfigMainWindow::listFocusChanged(void)
 
 void ConfigMainWindow::goBack(void)
 {
-	ConfigItem* item, *oldSelection;
+qInfo() << __FUNCTION__;
+	if (configList->rootEntry == &rootmenu)
+		return;
 
 	configList->setParentMenu();
-	if (configList->rootEntry == &rootmenu)
-		backAction->setEnabled(false);
-
-	if (menuList->selectedItems().count() == 0)
-		return;
-
-	item = (ConfigItem*)menuList->selectedItems().first();
-	oldSelection = item;
-	while (item) {
-		if (item->menu == configList->rootEntry) {
-			oldSelection->setSelected(false);
-			item->setSelected(true);
-			break;
-		}
-		item = (ConfigItem*)item->parent();
-	}
 }
 
 void ConfigMainWindow::showSingleView(void)
@@ -1778,6 +1758,8 @@ void ConfigMainWindow::showSingleView(void)
 	fullViewAction->setEnabled(true);
 	fullViewAction->setChecked(false);
 
+	backAction->setEnabled(true);
+
 	menuView->hide();
 	menuList->setRootMenu(0);
 	configList->mode = singleMode;
@@ -1797,6 +1779,8 @@ void ConfigMainWindow::showSplitView(void)
 	fullViewAction->setEnabled(true);
 	fullViewAction->setChecked(false);
 
+	backAction->setEnabled(false);
+
 	configList->mode = menuMode;
 	if (configList->rootEntry == &rootmenu)
 		configList->updateListAll();
@@ -1820,6 +1804,8 @@ void ConfigMainWindow::showFullView(void)
 	fullViewAction->setEnabled(false);
 	fullViewAction->setChecked(true);
 
+	backAction->setEnabled(false);
+
 	menuView->hide();
 	menuList->setRootMenu(0);
 	configList->mode = fullMode;
Signature · 1 line
2.26.2
#8 lore raw

PATCH v3 7/7 kconfig: qconf: navigate menus on hyperlinks

In reply to Mauro Carvalho Chehab

Instead of just changing the helper window to show a dependency, also navigate to it at the config and menu widgets.

---
 scripts/kconfig/qconf.cc | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)
scripts/kconfig/qconf.cc +5 -19
index 6a327b69ff5f..f49fbac91995 100644
@@ -1233,7 +1233,6 @@ void ConfigInfoView::clicked(const QUrl &url)
 	char *data = new char[count + 1];
 	struct symbol **result;
 	struct menu *m = NULL;
-	char type;
 
 	if (count < 1) {
 		qInfo() << "Clicked link is empty";
@@ -1243,7 +1242,6 @@ void ConfigInfoView::clicked(const QUrl &url)
 
 	memcpy(data, str.constData(), count);
 	data[count] = '\0';
-	type = data[0];
 
 	/* Seek for exact match */
 	data[0] = '^';
@@ -1256,15 +1254,8 @@ void ConfigInfoView::clicked(const QUrl &url)
 	}
 
 	sym = *result;
-	if (type == 's') {
-		symbolInfo();
-		emit showDebugChanged(true);
-		free(result);
-		delete data;
-		return;
-	}
 
-	/* URL is a menu */
+	/* Seek for the menu which holds the symbol */
 	for (struct property *prop = sym->prop; prop; prop = prop->next) {
 		    if (prop->type != P_PROMPT && prop->type != P_MENU)
 			    continue;
@@ -1272,17 +1263,11 @@ void ConfigInfoView::clicked(const QUrl &url)
 		    break;
 	}
 
-	if (!m) {
+	if (!m)
 		qInfo() << "Clicked menu is invalid:" << data;
-		free(result);
-		delete data;
-		return;
-	}
+	else
+		emit menuSelected(m);
 
-	_menu = m;
-	menuInfo();
-
-	emit showDebugChanged(true);
 	free(result);
 	delete data;
 }
@@ -1731,6 +1716,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
 			list->setSelected(item, true);
 			list->scrollToItem(item);
 			list->setFocus();
+			helpText->setInfo(menu);
 		}
 	}
 }
Signature · 1 line
2.26.2
#9 lore raw

PATCH v3 7/7 kconfig: qconf: navigate menus on hyperlinks

Instead of just changing the helper window to show a dependency, also navigate to it at the config and menu widgets.

---

I ended re-sending the same version as on patch series 2. Please consider this patch instead.

scripts/kconfig/qconf.cc +7 -18
index 6a327b69ff5f..fd721c6c4c94 100644
@@ -1233,7 +1233,6 @@ void ConfigInfoView::clicked(const QUrl &url)
 	char *data = new char[count + 1];
 	struct symbol **result;
 	struct menu *m = NULL;
-	char type;
 
 	if (count < 1) {
 		qInfo() << "Clicked link is empty";
@@ -1243,7 +1242,6 @@ void ConfigInfoView::clicked(const QUrl &url)
 
 	memcpy(data, str.constData(), count);
 	data[count] = '\0';
-	type = data[0];
 
 	/* Seek for exact match */
 	data[0] = '^';
@@ -1256,15 +1254,8 @@ void ConfigInfoView::clicked(const QUrl &url)
 	}
 
 	sym = *result;
-	if (type == 's') {
-		symbolInfo();
-		emit showDebugChanged(true);
-		free(result);
-		delete data;
-		return;
-	}
 
-	/* URL is a menu */
+	/* Seek for the menu which holds the symbol */
 	for (struct property *prop = sym->prop; prop; prop = prop->next) {
 		    if (prop->type != P_PROMPT && prop->type != P_MENU)
 			    continue;
@@ -1273,16 +1264,13 @@ void ConfigInfoView::clicked(const QUrl &url)
 	}
 
 	if (!m) {
-		qInfo() << "Clicked menu is invalid:" << data;
-		free(result);
-		delete data;
-		return;
+		/* Symbol is not visible as a menu */
+		symbolInfo();
+		emit showDebugChanged(true);
+	} else {
+		emit menuSelected(m);
 	}
 
-	_menu = m;
-	menuInfo();
-
-	emit showDebugChanged(true);
 	free(result);
 	delete data;
 }
@@ -1731,6 +1719,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
 			list->setSelected(item, true);
 			list->scrollToItem(item);
 			list->setFocus();
+			helpText->setInfo(menu);
 		}
 	}
 }
#13 lore raw
In reply to Mauro Carvalho Chehab
Quoted 9 lines · Mauro Carvalho Chehab

This series fixes some issues with search while on split view and fix the broken hyperlink navigation.

The first patches restore the pre-Qt5 conversion behavior. The last one implements navigation on a different way. I opted to keep this one in separate, as this one is a new feature.

-

Series, I applied to linux-kbuild/fixes.
(I used v3.1 for 7/7)

If Maxim gives Tested-by or something,
I will append it.

Quoted 23 lines

v3:

- dropped a patch that it is not needed anymore;
- hyperlinks should now work for non-visible items;
- fixed a description at patch 3.

Mauro Carvalho Chehab (7):
kconfig: qconf: cleanup includes
kconfig: qconf: make search fully work again on split mode
kconfig: qconf: make debug links work again
kconfig: qconf: re-implement setSelected()
kconfig: qconf: simplify the goBack() logic
kconfig: qconf: don't show goback button on splitMode
kconfig: qconf: navigate menus on hyperlinks

 scripts/kconfig/qconf.cc | 169 +++++++++++++++++++++++----------------
 scripts/kconfig/qconf.h  |  29 ++++---
 2 files changed, 119 insertions(+), 79 deletions(-)

--
2.26.2

Signature · 2 lines
Best Regards
Masahiro Yamada
#10 lore raw

Re: [PATCH v3.1 7/7] kconfig: qconf: navigate menus on hyperlinks

In reply to Mauro Carvalho Chehab
Quoted 11 lines · Mauro Carvalho Chehab

Instead of just changing the helper window to show a dependency, also navigate to it at the config and menu widgets.

---

I ended re-sending the same version as on patch series 2.

Do you mean this one should substitute 7/7 in v3, right?

Applied to linux-kbuild.

Quoted 70 lines

Please
consider this patch instead.

scripts/kconfig/qconf.cc +7 -18
index 6a327b69ff5f..fd721c6c4c94 100644
@@ -1233,7 +1233,6 @@ void ConfigInfoView::clicked(const QUrl &url)
        char *data = new char[count + 1];
        struct symbol **result;
        struct menu *m = NULL;
-       char type;
 
        if (count < 1) {
                qInfo() << "Clicked link is empty";
@@ -1243,7 +1242,6 @@ void ConfigInfoView::clicked(const QUrl &url)
 
        memcpy(data, str.constData(), count);
        data[count] = '\0';
-       type = data[0];
 
        /* Seek for exact match */
        data[0] = '^';
@@ -1256,15 +1254,8 @@ void ConfigInfoView::clicked(const QUrl &url)
        }
 
        sym = *result;
-       if (type == 's') {
-               symbolInfo();
-               emit showDebugChanged(true);
-               free(result);
-               delete data;
-               return;
-       }
 
-       /* URL is a menu */
+       /* Seek for the menu which holds the symbol */
        for (struct property *prop = sym->prop; prop; prop = prop->next) {
                    if (prop->type != P_PROMPT && prop->type != P_MENU)
                            continue;
@@ -1273,16 +1264,13 @@ void ConfigInfoView::clicked(const QUrl &url)
        }
 
        if (!m) {
-               qInfo() << "Clicked menu is invalid:" << data;
-               free(result);
-               delete data;
-               return;
+               /* Symbol is not visible as a menu */
+               symbolInfo();
+               emit showDebugChanged(true);
+       } else {
+               emit menuSelected(m);
        }
 
-       _menu = m;
-       menuInfo();
-
-       emit showDebugChanged(true);
        free(result);
        delete data;
 }
@@ -1731,6 +1719,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
                        list->setSelected(item, true);
                        list->scrollToItem(item);
                        list->setFocus();
+                       helpText->setInfo(menu);
                }
        }
 }
Signature · 2 lines
Best Regards
Masahiro Yamada
#11 lore raw

Re: [PATCH v3.1 7/7] kconfig: qconf: navigate menus on hyperlinks

Em Thu, 2 Jul 2020 00:21:36 +0900
Masahiro Yamada <[email protected]> escreveu:

Quoted 7 lines
Quoted 5 lines · Mauro Carvalho Chehab

Instead of just changing the helper window to show a dependency, also navigate to it at the config and menu widgets.

Quoted 8 lines
Quoted 6 lines

---

I ended re-sending the same version as on patch series 2.

Do you mean this one should substitute 7/7 in v3, right?

Yes.

Quoted 1 line

Applied to linux-kbuild.

Thank you!

Mauro

#12 lore raw

Re: [PATCH v3.1 7/7] kconfig: qconf: navigate menus on hyperlinks

Quoted 18 lines · Mauro Carvalho Chehab

Em Thu, 2 Jul 2020 00:21:36 +0900
Masahiro Yamada <[email protected]> escreveu:

Quoted 6 lines
Quoted 4 lines · Mauro Carvalho Chehab

Instead of just changing the helper window to show a dependency, also navigate to it at the config and menu widgets.

Quoted 8 lines
Quoted 6 lines

---

I ended re-sending the same version as on patch series 2.

Do you mean this one should substitute 7/7 in v3, right?

Quoted 8 lines

Yes.

Quoted 1 line

Applied to linux-kbuild.

Thank you!

Mauro

I tested these series yestarday, but found a but which I haven't yet had time to debug. Now when I click on a item that goes to a submenu in the right panel, the app segfaults. I'll debug this soon.

Best regards,
Maxim evitsky

#7 lore raw

Re: [PATCH v3 6/7] kconfig: qconf: don't show goback button on splitMode

In reply to Mauro Carvalho Chehab
Quoted 15 lines · Mauro Carvalho Chehab

the goback button does nothing on splitMode. So, why display it?

---
 scripts/kconfig/qconf.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/kconfig/qconf.cc +0 -0
index e43fe4dcd4e7..6a327b69ff5f 100644
@@ -437,9 +437,10 @@ void ConfigList::updateList(ConfigItem* item)
 	if (rootEntry != &rootmenu && (mode == singleMode ||
 	    (mode == symbolMode && rootEntry->parent != &rootmenu))) {

scripts/kconfig/qconf.cc void ConfigList::updateList(ConfigItem* item) · line 446

Quoted 10 lines
scripts/kconfig/qconf.cc +3 -2
 		item = (ConfigItem *)topLevelItem(0);
-		if (!item)
+		if (!item && mode != symbolMode) {
 			item = new ConfigItem(this, 0, true);
-		last = item;
+			last = item;
+		}
 	}
 	if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
 	    rootEntry->sym && rootEntry->prompt) {

I finally found some time to debug this.

This patch make xconfig crash when you try to select a menu that opens a submenu.

This is the backtrace:

#0  0x000000000041d196 in ConfigItem::testUpdateMenu(bool) ()
#1  0x000000000041e2f8 in ConfigList::updateList(ConfigItem*) ()
#2  0x0000000000420e3a in ConfigList::setRootMenu(menu*) ()
#3  0x00007ffff7

0f1fb0 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt5Core.so.5
#4 0x000000000041bd22 in ConfigList::menuSelected(menu*) ()
#5 0x0000000000425eb0 in
ConfigList::mouseDoubleClickEvent(QMouseEvent*) ()
#6 0x00007ffff7a9fcd1 in QWidget::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#7 0x00007ffff7b483b2 in QFrame::event(QEvent*) () at
/lib64/libQt5Widgets.so.5
#8 0x00007ffff70c2d2e in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /lib64/libQt5Core.so.5 #9 0x00007ffff7a5e052 in
QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#10 0x00007ffff7a63891 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#11
0x00007ffff70c2fc0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#12 0x00007ffff7a6278a in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*,
QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) ()

    at /lib64/libQt5Widgets.so.5

#13 0x00007ffff7ab7f82 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () at /lib64/libQt5Widgets.so.5 #14
0x00007ffff7abadde in QWidgetWindow::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#15 0x00007ffff7a5e063 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 #16
0x00007ffff70c2fc0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5 #17 0x00007ffff74a7142 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib64/libQt5Gui.so.5 #18 0x00007ffff748915b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Gui.so.5 #19 0x00007fffe6ecdc9e in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt5XcbQpa.so.5
#20 0x00007ffff605b7af in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#21 0x00007ffff605bb38 in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
#22
0x00007ffff605bc03 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#23 0x00007ffff710eb73 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#24 0x00007ffff70c191b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5 #25 0x00007ffff70c95a6 in QCoreApplication::exec() () at
/lib64/libQt5Core.so.5
#26 0x000000000040e553 in main ()

For example:
'Input device support'->'Keyboards'

Maybe we shoudld just revert it? I tried to understand the code a little bit, but no luck yet to understand how the whole thing works.

Best regards,
Maxim Levitsky