* [PATCH 0/2] Clean up goback logic @ 2020-06-29 15:30 Mauro Carvalho Chehab 2020-06-29 15:30 ` [PATCH 1/2] kconfig: qconf: simplify the goBack() logic Mauro Carvalho Chehab 2020-06-29 15:30 ` [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode Mauro Carvalho Chehab 0 siblings, 2 replies; 6+ messages in thread From: Mauro Carvalho Chehab @ 2020-06-29 15:30 UTC (permalink / raw) To: Masahiro Yamada; +Cc: Mauro Carvalho Chehab, linux-kernel, linux-kbuild Those patches cleanup the goBack logic. The first patch removes some unused stuff and makes the goBack to work only on singleMode. The second patch ensures that the goback button won't be shown on split mode. While not clear at the logic, it won't show either on full mode. So, the button will only show on single mode, with is compatible with the current goBack() implementation. Mauro Carvalho Chehab (2): kconfig: qconf: simplify the goBack() logic kconfig: qconf: don't show goback button on splitMode scripts/kconfig/qconf.cc | 55 +++++++++++++++------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) -- 2.26.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] kconfig: qconf: simplify the goBack() logic 2020-06-29 15:30 [PATCH 0/2] Clean up goback logic Mauro Carvalho Chehab @ 2020-06-29 15:30 ` Mauro Carvalho Chehab 2020-06-29 15:30 ` [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode Mauro Carvalho Chehab 1 sibling, 0 replies; 6+ messages in thread From: Mauro Carvalho Chehab @ 2020-06-29 15:30 UTC (permalink / raw) Cc: Mauro Carvalho Chehab, Masahiro Yamada, linux-kbuild, linux-kernel The goBack() logic is used only for the configList, as it only makes sense on singleMode. So, let's simplify the code. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> --- scripts/kconfig/qconf.cc | 50 +++++++++++++++------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 0ba373a3cdd4..d0bcc0b717f0 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1440,18 +1440,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()); @@ -1652,21 +1656,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) @@ -1734,25 +1728,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) @@ -1764,6 +1744,8 @@ void ConfigMainWindow::showSingleView(void) fullViewAction->setEnabled(true); fullViewAction->setChecked(false); + backAction->setEnabled(true); + menuView->hide(); menuList->setRootMenu(0); configList->mode = singleMode; @@ -1783,6 +1765,8 @@ void ConfigMainWindow::showSplitView(void) fullViewAction->setEnabled(true); fullViewAction->setChecked(false); + backAction->setEnabled(false); + configList->mode = menuMode; if (configList->rootEntry == &rootmenu) configList->updateListAll(); @@ -1806,6 +1790,8 @@ void ConfigMainWindow::showFullView(void) fullViewAction->setEnabled(false); fullViewAction->setChecked(true); + backAction->setEnabled(false); + menuView->hide(); menuList->setRootMenu(0); configList->mode = fullMode; -- 2.26.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode 2020-06-29 15:30 [PATCH 0/2] Clean up goback logic Mauro Carvalho Chehab 2020-06-29 15:30 ` [PATCH 1/2] kconfig: qconf: simplify the goBack() logic Mauro Carvalho Chehab @ 2020-06-29 15:30 ` Mauro Carvalho Chehab 2020-06-30 3:55 ` Masahiro Yamada 1 sibling, 1 reply; 6+ messages in thread From: Mauro Carvalho Chehab @ 2020-06-29 15:30 UTC (permalink / raw) Cc: Mauro Carvalho Chehab, Masahiro Yamada, linux-kbuild, linux-kernel the goback button does nothing on splitMode. So, why display it? Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> --- scripts/kconfig/qconf.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index d0bcc0b717f0..f49fbac91995 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -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) { -- 2.26.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode 2020-06-29 15:30 ` [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode Mauro Carvalho Chehab @ 2020-06-30 3:55 ` Masahiro Yamada 2020-06-30 6:09 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 6+ messages in thread From: Masahiro Yamada @ 2020-06-30 3:55 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Linux Kbuild mailing list, Linux Kernel Mailing List On Tue, Jun 30, 2020 at 12:30 AM Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > the goback button does nothing on splitMode. So, why display > it? Hmm, I still see the goback button on all of the three modes... > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> > --- > scripts/kconfig/qconf.cc | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc > index d0bcc0b717f0..f49fbac91995 100644 > --- a/scripts/kconfig/qconf.cc > +++ b/scripts/kconfig/qconf.cc > @@ -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) { > -- > 2.26.2 > -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode 2020-06-30 3:55 ` Masahiro Yamada @ 2020-06-30 6:09 ` Mauro Carvalho Chehab 2020-07-01 15:17 ` Masahiro Yamada 0 siblings, 1 reply; 6+ messages in thread From: Mauro Carvalho Chehab @ 2020-06-30 6:09 UTC (permalink / raw) To: Masahiro Yamada; +Cc: Linux Kbuild mailing list, Linux Kernel Mailing List Em Tue, 30 Jun 2020 12:55:05 +0900 Masahiro Yamada <masahiroy@kernel.org> escreveu: > On Tue, Jun 30, 2020 at 12:30 AM Mauro Carvalho Chehab > <mchehab+huawei@kernel.org> wrote: > > > > the goback button does nothing on splitMode. So, why display > > it? > > > Hmm, I still see the goback button > on all of the three modes... Huh? Perhaps we're talking about a different thing here... What I meant by goback button is this: ◀ .. Which is displayed as the first item is not the root config item. This is implemented on this logic, within ConfigItem::updateMenu(): if (goParent) { setPixmap(promptColIdx, list->menuBackPix); prompt = ".."; goto set_prompt; } and it displays this image: const char *xpm_menuback[] = { "12 12 2 1", " c white", ". c black", " ", " .......... ", " . . ", " . .. . ", " . .... . ", " . ...... . ", " . ...... . ", " . .... . ", " . .. . ", " . . ", " .......... ", " "}; This item is should never be shown on fullMode, because it never changes the root item. Looking within the code logic, the only place that passes goParent = true to "new ConfigItem" (thus creating it) is here: if (rootEntry != &rootmenu && (mode == singleMode || (mode == symbolMode && rootEntry->parent != &rootmenu))) { item = (ConfigItem *)topLevelItem(0); if (!item && mode != symbolMode) { item = new ConfigItem(this, 0, true); last = item; } } (Btw, I almost sent a patch making the "goParent" parameter explict when creating ConfigItem) So, even before this patch, the goback button is only displayed on singleMode and symbolMode (with is one of the internal representations for the split mode). This patch should solve the split mode case. > > > > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> > > --- > > scripts/kconfig/qconf.cc | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc > > index d0bcc0b717f0..f49fbac91995 100644 > > --- a/scripts/kconfig/qconf.cc > > +++ b/scripts/kconfig/qconf.cc > > @@ -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) { > > -- > > 2.26.2 > > > > Thanks, Mauro ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode 2020-06-30 6:09 ` Mauro Carvalho Chehab @ 2020-07-01 15:17 ` Masahiro Yamada 0 siblings, 0 replies; 6+ messages in thread From: Masahiro Yamada @ 2020-07-01 15:17 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Linux Kbuild mailing list, Linux Kernel Mailing List On Tue, Jun 30, 2020 at 3:09 PM Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > Em Tue, 30 Jun 2020 12:55:05 +0900 > Masahiro Yamada <masahiroy@kernel.org> escreveu: > > > On Tue, Jun 30, 2020 at 12:30 AM Mauro Carvalho Chehab > > <mchehab+huawei@kernel.org> wrote: > > > > > > the goback button does nothing on splitMode. So, why display > > > it? > > > > > > Hmm, I still see the goback button > > on all of the three modes... > > Huh? > > Perhaps we're talking about a different thing here... > > What I meant by goback button is this: > > ◀ .. Sorry, I misunderstood the goback button. This improvement is neat. Thank you. > Which is displayed as the first item is not the root config item. > > This is implemented on this logic, within ConfigItem::updateMenu(): > > if (goParent) { > setPixmap(promptColIdx, list->menuBackPix); > prompt = ".."; > goto set_prompt; > } > > and it displays this image: > > const char *xpm_menuback[] = { > "12 12 2 1", > " c white", > ". c black", > " ", > " .......... ", > " . . ", > " . .. . ", > " . .... . ", > " . ...... . ", > " . ...... . ", > " . .... . ", > " . .. . ", > " . . ", > " .......... ", > " "}; > > This item is should never be shown on fullMode, because it never > changes the root item. > > Looking within the code logic, the only place that passes > goParent = true to "new ConfigItem" (thus creating it) is here: > > if (rootEntry != &rootmenu && (mode == singleMode || > (mode == symbolMode && rootEntry->parent != &rootmenu))) { > item = (ConfigItem *)topLevelItem(0); > if (!item && mode != symbolMode) { > item = new ConfigItem(this, 0, true); > last = item; > } > } > > (Btw, I almost sent a patch making the "goParent" parameter explict > when creating ConfigItem) > > So, even before this patch, the goback button is only displayed on > singleMode and symbolMode (with is one of the internal representations > for the split mode). > > This patch should solve the split mode case. > > > > > > > > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> > > > --- > > > scripts/kconfig/qconf.cc | 5 +++-- > > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc > > > index d0bcc0b717f0..f49fbac91995 100644 > > > --- a/scripts/kconfig/qconf.cc > > > +++ b/scripts/kconfig/qconf.cc > > > @@ -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) { > > > -- > > > 2.26.2 > > > > > > > > > > > Thanks, > Mauro -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-01 15:18 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-29 15:30 [PATCH 0/2] Clean up goback logic Mauro Carvalho Chehab 2020-06-29 15:30 ` [PATCH 1/2] kconfig: qconf: simplify the goBack() logic Mauro Carvalho Chehab 2020-06-29 15:30 ` [PATCH 2/2] kconfig: qconf: don't show goback button on splitMode Mauro Carvalho Chehab 2020-06-30 3:55 ` Masahiro Yamada 2020-06-30 6:09 ` Mauro Carvalho Chehab 2020-07-01 15:17 ` Masahiro Yamada
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox