diff mbox series

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

Message ID 20200630084835.4db1331f@coco.lan
State New
Headers show
Series None | expand

Commit Message

Mauro Carvalho Chehab June 30, 2020, 6:48 a.m. UTC
Instead of just changing the helper window to show a
dependency, also navigate to it at the config and menu
widgets.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


---

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

Comments

Masahiro Yamada July 1, 2020, 3:21 p.m. UTC | #1
On Tue, Jun 30, 2020 at 3:48 PM Mauro Carvalho Chehab
<mchehab+huawei@kernel.org> wrote:
>
> Instead of just changing the helper window to show a
> dependency, also navigate to it at the config and menu
> widgets.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
>
>
> ---
>
> 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.



> Please
> consider this patch instead.
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 6a327b69ff5f..fd721c6c4c94 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -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);
>                 }
>         }
>  }
Mauro Carvalho Chehab July 1, 2020, 3:51 p.m. UTC | #2
Em Thu, 2 Jul 2020 00:21:36 +0900
Masahiro Yamada <masahiroy@kernel.org> escreveu:

> On Tue, Jun 30, 2020 at 3:48 PM Mauro Carvalho Chehab
> <mchehab+huawei@kernel.org> wrote:
> >
> > Instead of just changing the helper window to show a
> > dependency, also navigate to it at the config and menu
> > widgets.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> >
> >
> > ---
> >
> > 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.

> Applied to linux-kbuild.

Thank you!

Mauro
Maxim Levitsky July 1, 2020, 3:55 p.m. UTC | #3
On Wed, 2020-07-01 at 17:51 +0200, Mauro Carvalho Chehab wrote:
> Em Thu, 2 Jul 2020 00:21:36 +0900
> Masahiro Yamada <masahiroy@kernel.org> escreveu:
> 
> > On Tue, Jun 30, 2020 at 3:48 PM Mauro Carvalho Chehab
> > <mchehab+huawei@kernel.org> wrote:
> > > Instead of just changing the helper window to show a
> > > dependency, also navigate to it at the config and menu
> > > widgets.
> > > 
> > > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > > 
> > > 
> > > ---
> > > 
> > > 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.
> 
> > 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
diff mbox series

Patch

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 6a327b69ff5f..fd721c6c4c94 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -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);
 		}
 	}
 }