public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions
@ 2024-10-23 18:17 Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 02/13] kconfig: qconf: remove redundant type check for choice members Masahiro Yamada
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

These functions simply passes the event to the parent.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 14 --------------
 scripts/kconfig/qconf.h  |  2 --
 2 files changed, 16 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 90f139480eda..18cc5c184f56 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -781,13 +781,6 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
 	ev->accept();
 }
 
-void ConfigList::mousePressEvent(QMouseEvent* e)
-{
-	//QPoint p(contentsToViewport(e->pos()));
-	//printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
-	Parent::mousePressEvent(e);
-}
-
 void ConfigList::mouseReleaseEvent(QMouseEvent* e)
 {
 	QPoint p = e->pos();
@@ -834,13 +827,6 @@ skip:
 	Parent::mouseReleaseEvent(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::mouseDoubleClickEvent(QMouseEvent* e)
 {
 	QPoint p = e->pos();
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index aab25ece95c6..0b62fb26821a 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -55,9 +55,7 @@ class ConfigList : public QTreeWidget {
 
 protected:
 	void keyPressEvent(QKeyEvent *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);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 02/13] kconfig: qconf: remove redundant type check for choice members
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 03/13] kconfig: qconf: remove unnecessary setRootIsDecorated() call Masahiro Yamada
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Since commit fde192511bdb ("kconfig: remove tristate choice support"),
choice members are always boolean. The type check is redundant.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 18cc5c184f56..58c57c908149 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -159,7 +159,7 @@ void ConfigItem::updateMenu(void)
 			ch = 'M';
 			break;
 		default:
-			if (sym_is_choice_value(sym) && type == S_BOOLEAN)
+			if (sym_is_choice_value(sym))
 				setIcon(promptColIdx, choiceNoIcon);
 			else
 				setIcon(promptColIdx, symbolNoIcon);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 03/13] kconfig: qconf: remove unnecessary setRootIsDecorated() call
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 02/13] kconfig: qconf: remove redundant type check for choice members Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 04/13] kconfig: qconf: remove unnecessary lastWindowClosed() signal connection Masahiro Yamada
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The default value of the rootIsDecorated property is true.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 58c57c908149..120090fa4ac9 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -307,7 +307,6 @@ ConfigList::ConfigList(QWidget *parent, const char *name)
 {
 	setObjectName(name);
 	setSortingEnabled(false);
-	setRootIsDecorated(true);
 
 	setVerticalScrollMode(ScrollPerPixel);
 	setHorizontalScrollMode(ScrollPerPixel);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 04/13] kconfig: qconf: remove unnecessary lastWindowClosed() signal connection
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 02/13] kconfig: qconf: remove redundant type check for choice members Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 03/13] kconfig: qconf: remove unnecessary setRootIsDecorated() call Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 05/13] kconfig: qconf: convert the last old connection syntax to Qt5 style Masahiro Yamada
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The default value of the quitOnLastWindowClosed property is true.

Hence, the application implicitly quits when the last window is closed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 120090fa4ac9..49a3d0365c39 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1863,7 +1863,6 @@ int main(int ac, char** av)
 	v = new ConfigMainWindow();
 
 	//zconfdump(stdout);
-	configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
 	configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings()));
 
 	v->show();
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 05/13] kconfig: qconf: convert the last old connection syntax to Qt5 style
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (2 preceding siblings ...)
  2024-10-23 18:17 ` [PATCH 04/13] kconfig: qconf: remove unnecessary lastWindowClosed() signal connection Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 06/13] kconfig: qconf: do not show goParent button in split view Masahiro Yamada
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Commit a2574c12df0d ("kconfig: qconf: convert to Qt5 new signal/slot
connection syntax") converted most of the old string-based connections,
but one more instance still remains. Convert it to the new style.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 49a3d0365c39..c922c34621a4 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1475,6 +1475,9 @@ ConfigMainWindow::ConfigMainWindow(void)
 	connect(helpText, &ConfigInfoView::menuSelected,
 		this, &ConfigMainWindow::setMenuLink);
 
+	connect(configApp, &QApplication::aboutToQuit,
+		this, &ConfigMainWindow::saveSettings);
+
 	conf_read(NULL);
 
 	QString listMode = configSettings->value("/listMode", "symbol").toString();
@@ -1863,7 +1866,6 @@ int main(int ac, char** av)
 	v = new ConfigMainWindow();
 
 	//zconfdump(stdout);
-	configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings()));
 
 	v->show();
 	configApp->exec();
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 06/13] kconfig: qconf: do not show goParent button in split view
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (3 preceding siblings ...)
  2024-10-23 18:17 ` [PATCH 05/13] kconfig: qconf: convert the last old connection syntax to Qt5 style Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 07/13] kconfig: qconf: remove ConfigItem::visible member Masahiro Yamada
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

When a menu is selected in the split view, the right pane displays the
goParent button, but it is never functional.

This is unnecessary, as you can select a menu from the menu tree in the
left pane.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c922c34621a4..7c844c4a119e 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -436,8 +436,7 @@ void ConfigList::updateList()
 		return;
 	}
 
-	if (rootEntry != &rootmenu && (mode == singleMode ||
-	    (mode == symbolMode && rootEntry->parent != &rootmenu))) {
+	if (rootEntry != &rootmenu && mode == singleMode) {
 		item = (ConfigItem *)topLevelItem(0);
 		if (!item)
 			item = new ConfigItem(this, 0, true);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 07/13] kconfig: qconf: remove ConfigItem::visible member
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (4 preceding siblings ...)
  2024-10-23 18:17 ` [PATCH 06/13] kconfig: qconf: do not show goParent button in split view Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 08/13] kconfig: qconf: avoid unnecessary parentSelected() when ESC is pressed Masahiro Yamada
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The " (NEW)" string should be displayed regardless of the visibility
of the associated menu.

The ConfigItem::visible member is not used for any other purpose.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 28 +++++++++++-----------------
 scripts/kconfig/qconf.h  | 15 +++++++--------
 2 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 7c844c4a119e..5b1237bf085a 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -175,17 +175,16 @@ void ConfigItem::updateMenu(void)
 		setText(dataColIdx, sym_get_string_value(sym));
 		break;
 	}
-	if (!sym_has_value(sym) && visible)
+	if (!sym_has_value(sym))
 		prompt += " (NEW)";
 set_prompt:
 	setText(promptColIdx, prompt);
 }
 
-void ConfigItem::testUpdateMenu(bool v)
+void ConfigItem::testUpdateMenu(void)
 {
 	ConfigItem* i;
 
-	visible = v;
 	if (!menu)
 		return;
 
@@ -429,7 +428,7 @@ void ConfigList::updateList()
 			item = (ConfigItem*)(*it);
 			if (!item->menu)
 				continue;
-			item->testUpdateMenu(menu_is_visible(item->menu));
+			item->testUpdateMenu();
 
 			++it;
 		}
@@ -439,16 +438,16 @@ void ConfigList::updateList()
 	if (rootEntry != &rootmenu && mode == singleMode) {
 		item = (ConfigItem *)topLevelItem(0);
 		if (!item)
-			item = new ConfigItem(this, 0, true);
+			item = new ConfigItem(this, 0);
 		last = item;
 	}
 	if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
 	    rootEntry->sym && rootEntry->prompt) {
 		item = last ? last->nextSibling() : nullptr;
 		if (!item)
-			item = new ConfigItem(this, last, rootEntry, true);
+			item = new ConfigItem(this, last, rootEntry);
 		else
-			item->testUpdateMenu(true);
+			item->testUpdateMenu();
 
 		updateMenuList(item, rootEntry);
 		update();
@@ -597,7 +596,6 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
 	struct menu* child;
 	ConfigItem* item;
 	ConfigItem* last;
-	bool visible;
 	enum prop_type type;
 
 	if (!menu) {
@@ -629,14 +627,13 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
 			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);
+				item = new ConfigItem(parent, last, child);
 			else
-				item->testUpdateMenu(visible);
+				item->testUpdateMenu();
 
 			if (mode == fullMode || mode == menuMode || type != P_MENU)
 				updateMenuList(item, child);
@@ -662,7 +659,6 @@ void ConfigList::updateMenuList(struct menu *menu)
 	struct menu* child;
 	ConfigItem* item;
 	ConfigItem* last;
-	bool visible;
 	enum prop_type type;
 
 	if (!menu) {
@@ -694,14 +690,13 @@ void ConfigList::updateMenuList(struct menu *menu)
 			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(this, last, child, visible);
+				item = new ConfigItem(this, last, child);
 			else
-				item->testUpdateMenu(visible);
+				item->testUpdateMenu();
 
 			if (mode == fullMode || mode == menuMode || type != P_MENU)
 				updateMenuList(item, child);
@@ -1274,8 +1269,7 @@ void ConfigSearchWindow::search(void)
 		return;
 	for (p = result; *p; p++) {
 		for_all_prompts((*p), prop)
-			lastItem = new ConfigItem(list, lastItem, prop->menu,
-						  menu_is_visible(prop->menu));
+			lastItem = new ConfigItem(list, lastItem, prop->menu);
 	}
 }
 
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 0b62fb26821a..62ab3286d04f 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -114,25 +114,25 @@ public slots:
 class ConfigItem : public QTreeWidgetItem {
 	typedef class QTreeWidgetItem Parent;
 public:
-	ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v)
-	: Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
+	ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m)
+	: Parent(parent, after), nextItem(0), menu(m), goParent(false)
 	{
 		init();
 	}
-	ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
-	: Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
+	ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m)
+	: Parent(parent, after), nextItem(0), menu(m), goParent(false)
 	{
 		init();
 	}
-	ConfigItem(ConfigList *parent, ConfigItem *after, bool v)
-	: Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true)
+	ConfigItem(ConfigList *parent, ConfigItem *after)
+	: Parent(parent, after), nextItem(0), menu(0), goParent(true)
 	{
 		init();
 	}
 	~ConfigItem(void);
 	void init(void);
 	void updateMenu(void);
-	void testUpdateMenu(bool v);
+	void testUpdateMenu(void);
 	ConfigList* listView() const
 	{
 		return (ConfigList*)Parent::treeWidget();
@@ -159,7 +159,6 @@ class ConfigItem : public QTreeWidgetItem {
 
 	ConfigItem* nextItem;
 	struct menu *menu;
-	bool visible;
 	bool goParent;
 
 	static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 08/13] kconfig: qconf: avoid unnecessary parentSelected() when ESC is pressed
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (5 preceding siblings ...)
  2024-10-23 18:17 ` [PATCH 07/13] kconfig: qconf: remove ConfigItem::visible member Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:17 ` [PATCH 09/13] kconfig: qconf: remove redundant check in goBack() Masahiro Yamada
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

When the ESC key is pressed, the parentSelected() signal is currently
emitted for singleMode, menuMode, and symbolMode.

However, parentSelected() signal is functional only for singleMode.

In menuMode, the signal is connected to the goBack() slot, but nothing
occurs because configList->rootEntry is always &rootmenu.

In symbolMode (in the right pane), the parentSelected() signal is not
connected to any slot.

This commit prevents the unnecessary emission of the parentSelected()
signal.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 5b1237bf085a..1948cda048d2 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -724,7 +724,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
 	struct menu *menu;
 	enum prop_type type;
 
-	if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) {
+	if (ev->key() == Qt::Key_Escape && mode == singleMode) {
 		emit parentSelected();
 		ev->accept();
 		return;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 09/13] kconfig: qconf: remove redundant check in goBack()
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (6 preceding siblings ...)
  2024-10-23 18:17 ` [PATCH 08/13] kconfig: qconf: avoid unnecessary parentSelected() when ESC is pressed Masahiro Yamada
@ 2024-10-23 18:17 ` Masahiro Yamada
  2024-10-23 18:18 ` [PATCH 10/13] kconfig: qconf: remove non-functional href="m..." tag Masahiro Yamada
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:17 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The same check is performed in the configList->setParentMenu() call.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 1948cda048d2..acbc4331ebc5 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1616,9 +1616,6 @@ void ConfigMainWindow::listFocusChanged(void)
 
 void ConfigMainWindow::goBack(void)
 {
-	if (configList->rootEntry == &rootmenu)
-		return;
-
 	configList->setParentMenu();
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 10/13] kconfig: qconf: remove non-functional href="m..." tag
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (7 preceding siblings ...)
  2024-10-23 18:17 ` [PATCH 09/13] kconfig: qconf: remove redundant check in goBack() Masahiro Yamada
@ 2024-10-23 18:18 ` Masahiro Yamada
  2024-10-23 18:18 ` [PATCH 11/13] kconfig: add sym_get_prompt_menu() helper function Masahiro Yamada
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The only functional tag is href="s<symbol_name>".

Commit c4f7398bee9c ("kconfig: qconf: make debug links work again")
changed prop->name to sym->name for this reference, but it missed to
change the tag "m" to "s".

This tag is not functional at all.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index acbc4331ebc5..a208ef33128f 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1065,9 +1065,9 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
 		switch (prop->type) {
 		case P_PROMPT:
 		case P_MENU:
-			stream << "prompt: <a href=\"m" << sym->name << "\">";
+			stream << "prompt: ";
 			stream << print_filter(prop->text);
-			stream << "</a><br>";
+			stream << "<br>";
 			break;
 		case P_DEFAULT:
 		case P_SELECT:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 11/13] kconfig: add sym_get_prompt_menu() helper function
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (8 preceding siblings ...)
  2024-10-23 18:18 ` [PATCH 10/13] kconfig: qconf: remove non-functional href="m..." tag Masahiro Yamada
@ 2024-10-23 18:18 ` Masahiro Yamada
  2024-10-23 18:18 ` [PATCH 12/13] kconfig: qconf: refactor ConfigInfoView::clicked() Masahiro Yamada
  2024-10-23 18:18 ` [PATCH 13/13] kconfig: qconf: remove unnecessary mode check in ConfigItem::updateMenu() Masahiro Yamada
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Split out the code that retrieves the menu entry with a prompt, so it
can be reused in other functions.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/lkc_proto.h |  1 +
 scripts/kconfig/symbol.c    | 26 +++++++++++++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 63519cd24bc7..8914b4e8f2a8 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -34,6 +34,7 @@ bool sym_string_valid(struct symbol *sym, const char *newval);
 bool sym_string_within_range(struct symbol *sym, const char *str);
 bool sym_set_string_value(struct symbol *sym, const char *newval);
 bool sym_is_changeable(const struct symbol *sym);
+struct menu *sym_get_prompt_menu(const struct symbol *sym);
 struct menu *sym_get_choice_menu(const struct symbol *sym);
 const char * sym_get_string_value(struct symbol *sym);
 
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index a3af93aaaf32..89b84bf8e21f 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -70,6 +70,24 @@ const char *sym_type_name(enum symbol_type type)
 	return "???";
 }
 
+/**
+ * sym_get_prompt_menu - get the menu entry with a prompt
+ *
+ * @sym: a symbol pointer
+ *
+ * Return: the menu entry with a prompt.
+ */
+struct menu *sym_get_prompt_menu(const struct symbol *sym)
+{
+	struct menu *m;
+
+	list_for_each_entry(m, &sym->menus, link)
+		if (m->prompt)
+			return m;
+
+	return NULL;
+}
+
 /**
  * sym_get_choice_menu - get the parent choice menu if present
  *
@@ -80,18 +98,12 @@ const char *sym_type_name(enum symbol_type type)
 struct menu *sym_get_choice_menu(const struct symbol *sym)
 {
 	struct menu *menu = NULL;
-	struct menu *m;
 
 	/*
 	 * Choice members must have a prompt. Find a menu entry with a prompt,
 	 * and assume it resides inside a choice block.
 	 */
-	list_for_each_entry(m, &sym->menus, link)
-		if (m->prompt) {
-			menu = m;
-			break;
-		}
-
+	menu = sym_get_prompt_menu(sym);
 	if (!menu)
 		return NULL;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 12/13] kconfig: qconf: refactor ConfigInfoView::clicked()
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (9 preceding siblings ...)
  2024-10-23 18:18 ` [PATCH 11/13] kconfig: add sym_get_prompt_menu() helper function Masahiro Yamada
@ 2024-10-23 18:18 ` Masahiro Yamada
  2024-10-23 18:18 ` [PATCH 13/13] kconfig: qconf: remove unnecessary mode check in ConfigItem::updateMenu() Masahiro Yamada
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Most of the code in ConfigInfoView::clicked() is unnecessary.
There is no need to use the regular expression to search for a symbol.
Calling sym_find() is simpler and faster.

The hyperlink always begins with the "s" tag, and there is no other
tag used. Remove it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 43 ++++++----------------------------------
 1 file changed, 6 insertions(+), 37 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index a208ef33128f..f59a9597f09b 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1001,7 +1001,7 @@ void ConfigInfoView::menuInfo(void)
 			if (sym->name) {
 				stream << " (";
 				if (showDebug())
-					stream << "<a href=\"s" << sym->name << "\">";
+					stream << "<a href=\"" << sym->name << "\">";
 				stream << print_filter(sym->name);
 				if (showDebug())
 					stream << "</a>";
@@ -1010,7 +1010,7 @@ void ConfigInfoView::menuInfo(void)
 		} else if (sym->name) {
 			stream << "<big><b>";
 			if (showDebug())
-				stream << "<a href=\"s" << sym->name << "\">";
+				stream << "<a href=\"" << sym->name << "\">";
 			stream << print_filter(sym->name);
 			if (showDebug())
 				stream << "</a>";
@@ -1124,7 +1124,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 	QTextStream *stream = reinterpret_cast<QTextStream *>(data);
 
 	if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
-		*stream << "<a href=\"s" << sym->name << "\">";
+		*stream << "<a href=\"" << sym->name << "\">";
 		*stream << print_filter(str);
 		*stream << "</a>";
 	} else {
@@ -1134,39 +1134,11 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 
 void ConfigInfoView::clicked(const QUrl &url)
 {
-	QByteArray str = url.toEncoded();
-	const std::size_t count = str.size();
-	char *data = new char[count + 2];  // '$' + '\0'
-	struct symbol **result;
-	struct menu *m = NULL;
+	struct menu *m;
 
-	if (count < 1) {
-		delete[] data;
-		return;
-	}
-
-	memcpy(data, str.constData(), count);
-	data[count] = '\0';
-
-	/* Seek for exact match */
-	data[0] = '^';
-	strcat(data, "$");
-	result = sym_re_search(data);
-	if (!result) {
-		delete[] data;
-		return;
-	}
-
-	sym = *result;
-
-	/* 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;
-		    m = prop->menu;
-		    break;
-	}
+	sym = sym_find(url.toEncoded().constData());
 
+	m = sym_get_prompt_menu(sym);
 	if (!m) {
 		/* Symbol is not visible as a menu */
 		symbolInfo();
@@ -1174,9 +1146,6 @@ void ConfigInfoView::clicked(const QUrl &url)
 	} else {
 		emit menuSelected(m);
 	}
-
-	free(result);
-	delete[] data;
 }
 
 void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 13/13] kconfig: qconf: remove unnecessary mode check in ConfigItem::updateMenu()
  2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
                   ` (10 preceding siblings ...)
  2024-10-23 18:18 ` [PATCH 12/13] kconfig: qconf: refactor ConfigInfoView::clicked() Masahiro Yamada
@ 2024-10-23 18:18 ` Masahiro Yamada
  11 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2024-10-23 18:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The P_MENU entries ("menu" and "menuconfig") are never displayed in
symbolMode.

The condition, list->mode == symbolMode, is never met here.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index f59a9597f09b..6c92ef1e16ef 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -110,7 +110,7 @@ void ConfigItem::updateMenu(void)
 
 	if (prop) switch (prop->type) {
 	case P_MENU:
-		if (list->mode == singleMode || list->mode == symbolMode) {
+		if (list->mode == singleMode) {
 			/* a menuconfig entry is displayed differently
 			 * depending whether it's at the view root or a child.
 			 */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-10-23 18:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 18:17 [PATCH 01/13] kconfig: qconf: remove mouse{Press,Move}Event() functions Masahiro Yamada
2024-10-23 18:17 ` [PATCH 02/13] kconfig: qconf: remove redundant type check for choice members Masahiro Yamada
2024-10-23 18:17 ` [PATCH 03/13] kconfig: qconf: remove unnecessary setRootIsDecorated() call Masahiro Yamada
2024-10-23 18:17 ` [PATCH 04/13] kconfig: qconf: remove unnecessary lastWindowClosed() signal connection Masahiro Yamada
2024-10-23 18:17 ` [PATCH 05/13] kconfig: qconf: convert the last old connection syntax to Qt5 style Masahiro Yamada
2024-10-23 18:17 ` [PATCH 06/13] kconfig: qconf: do not show goParent button in split view Masahiro Yamada
2024-10-23 18:17 ` [PATCH 07/13] kconfig: qconf: remove ConfigItem::visible member Masahiro Yamada
2024-10-23 18:17 ` [PATCH 08/13] kconfig: qconf: avoid unnecessary parentSelected() when ESC is pressed Masahiro Yamada
2024-10-23 18:17 ` [PATCH 09/13] kconfig: qconf: remove redundant check in goBack() Masahiro Yamada
2024-10-23 18:18 ` [PATCH 10/13] kconfig: qconf: remove non-functional href="m..." tag Masahiro Yamada
2024-10-23 18:18 ` [PATCH 11/13] kconfig: add sym_get_prompt_menu() helper function Masahiro Yamada
2024-10-23 18:18 ` [PATCH 12/13] kconfig: qconf: refactor ConfigInfoView::clicked() Masahiro Yamada
2024-10-23 18:18 ` [PATCH 13/13] kconfig: qconf: remove unnecessary mode check in ConfigItem::updateMenu() Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox