From patchwork Tue Jun 30 06:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11633239 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AEE892A for ; Tue, 30 Jun 2020 06:26:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21EBC20672 for ; Tue, 30 Jun 2020 06:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498408; bh=wGa+qBV2V1GP8GCaDKNfsF9c/pokG/wFsofWOOaD/1A=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=0ixrT8wIAK8yiwCEkG4nsW3KBhTdQRSSw9Mcj2k9RV9YGCSopi54Xe9T2+z0li/U9 YNbrwtJ2NdPmQz3514f9UEaU3EBzAl0mra09QJ7cib3Bvz8mKwXIIbrmjSPQTyRFr8 v1czywnysCwSCycMV+Y8FyI2gaEh9TqNtelRE0kY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730094AbgF3G0r (ORCPT ); Tue, 30 Jun 2020 02:26:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:55664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729984AbgF3G0q (ORCPT ); Tue, 30 Jun 2020 02:26:46 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 897BC20759; Tue, 30 Jun 2020 06:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498405; bh=wGa+qBV2V1GP8GCaDKNfsF9c/pokG/wFsofWOOaD/1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bfcupfYZOFR260roxhZ7vOF60m/dlnmaRVEmulDm2P4M+V+wdMpsjH9tjvNIJF8Og PVz5lcHBK/6zWf0UJL2Y82WUE7kpDjyVJlVpJCpm81pLJrRlBIf3UaE3K/Shj2cw+M ZUanRschzU60HYohVs/Cb2O6TO57CFE9oassZEFY= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jq9j9-008Wap-N9; Tue, 30 Jun 2020 08:26:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Maxim Levitsky , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/7] kconfig: qconf: cleanup includes Date: Tue, 30 Jun 2020 08:26:35 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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. Signed-off-by: Mauro Carvalho Chehab --- scripts/kconfig/qconf.cc | 27 +++++++++------------------ scripts/kconfig/qconf.h | 14 +++++++------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index c0ac8f7b5f1a..0e06afa08908 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -4,27 +4,18 @@ * Copyright (C) 2015 Boris Barbulovski */ -#include - -#include -#include -#include #include +#include +#include +#include #include +#include +#include +#include #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index c879d79ce817..d913a02967ae 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -3,17 +3,17 @@ * Copyright (C) 2002 Roman Zippel */ -#include -#include -#include +#include +#include #include -#include +#include +#include #include #include -#include #include -#include -#include +#include +#include + #include "expr.h" class ConfigView; From patchwork Tue Jun 30 06:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11633249 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2A6B92A for ; Tue, 30 Jun 2020 06:27:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B3A020759 for ; Tue, 30 Jun 2020 06:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498437; bh=eCfi2orVb6Q/mnzdtfC6fPJiHcL9lh7S6Q9cS68MP0g=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=Teb/Zvh45yBviQMNFNL7+smmTOefiN2xZ4SU0pUHz7/7YOg6m4RWnAq5/iXq6DVfm bpRyd+knS+7eWwZafpzDjM1zW3e/nvUezK5iTdEx5qrhTxa+ObMW1M7Rk2EaykTjGi F1++gDUrxgYB9qve3B3KDG1bhK3J4kdpffizNRuU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730183AbgF3G1Q (ORCPT ); Tue, 30 Jun 2020 02:27:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:55686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730015AbgF3G0q (ORCPT ); Tue, 30 Jun 2020 02:26:46 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A59D520768; Tue, 30 Jun 2020 06:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498405; bh=eCfi2orVb6Q/mnzdtfC6fPJiHcL9lh7S6Q9cS68MP0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ClcoMkx+mf41VFcHVwzR5QPKHymZZSmowiel3g5fCTakMPJMmg061uo/nilB5epd4 kNlFDAGtN8BZiQ5H2TUJswt6r8NaR3g7a2WECC2kzUTEc0v38zUO36l1xIGj99MN4n gaU9ml5UTRTQsoIk6bzoBDOR7ND518j1W5Yo6fdE= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jq9j9-008Wat-PP; Tue, 30 Jun 2020 08:26:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Maxim Levitsky , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/7] kconfig: qconf: make search fully work again on split mode Date: Tue, 30 Jun 2020 08:26:36 +0200 Message-Id: <7febfd14786f364acb6351ab07f6ce6434475b31.1593498345.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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. Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/ Reported-by: Maxim Levitsky Signed-off-by: Mauro Carvalho Chehab --- scripts/kconfig/qconf.cc | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 0e06afa08908..9def59423743 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -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: From patchwork Tue Jun 30 06:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11633247 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97DC6138C for ; Tue, 30 Jun 2020 06:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F61120672 for ; Tue, 30 Jun 2020 06:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498436; bh=RZ2rkV62ktbBI9GzhHIODbDisO7XQiMGLLLhwLg0o2M=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=d4AqeIdGfJRhnDyCD2/WbKqR6aK8uAQMh8u25kiJwOyZQKDTxhwPXZIswBmHgzb3x aElduPEYO8fInxrtvBqVuVegFG/B38O7fc8iukCL5V41lfs2H/n/384yvKKWNUoAEd QzDaRwDV72X95aYiv8mS0hEsPcpSuExTUbOoKF64= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730159AbgF3G1Q (ORCPT ); Tue, 30 Jun 2020 02:27:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:55696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730040AbgF3G0q (ORCPT ); Tue, 30 Jun 2020 02:26:46 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A7BB420775; Tue, 30 Jun 2020 06:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498405; bh=RZ2rkV62ktbBI9GzhHIODbDisO7XQiMGLLLhwLg0o2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNfJQ5KhY2mWoLkEDg+ZMBmtMOmGK0UwR/gMgv2Uc4zMs4Vh3/E0E3SztRkdu8uv9 sQt25iAdaw/Qay8KX4/ZPFbNspFoG4xY8MDKhKFUX/e3zpErQpL+/WUQikm1nWUT0O WTUAQUN86s46b36d2NP7rp2en7Y0Hm0R+UOY6kGA= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jq9j9-008Wax-Qc; Tue, 30 Jun 2020 08:26:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Maxim Levitsky , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/7] kconfig: qconf: make debug links work again Date: Tue, 30 Jun 2020 08:26:37 +0200 Message-Id: <83a8d9184fa05c8620c6654f8afd34de737ecce3.1593498345.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 . 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. Link: https://lore.kernel.org/lkml/20200628125421.12458086@coco.lan/ Reported-by: Maxim Levitsky Signed-off-by: Mauro Carvalho Chehab --- scripts/kconfig/qconf.cc | 75 +++++++++++++++++++++++++++++++++++++--- scripts/kconfig/qconf.h | 1 + 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 9def59423743..1fddbdfa58b4 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -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("", sym); + head += QString().sprintf("", sym->name); head += print_filter(sym->name); if (showDebug()) head += ""; @@ -1094,7 +1095,7 @@ void ConfigInfoView::menuInfo(void) } else if (sym->name) { head += ""; if (showDebug()) - head += QString().sprintf("", sym); + head += QString().sprintf("", sym->name); head += print_filter(sym->name); if (showDebug()) head += ""; @@ -1145,7 +1146,7 @@ QString ConfigInfoView::debug_info(struct symbol *sym) switch (prop->type) { case P_PROMPT: case P_MENU: - debug += QString().sprintf("prompt: ", prop->menu); + debug += QString().sprintf("prompt: ", sym->name); debug += print_filter(prop->text); debug += "
"; 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("", sym); + *text += QString().sprintf("", sym->name); *text += str2; *text += ""; } 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 *)), diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index d913a02967ae..a193137f2314 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -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); From patchwork Tue Jun 30 06:26:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11633237 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0B0513B4 for ; Tue, 30 Jun 2020 06:26:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 996082081A for ; Tue, 30 Jun 2020 06:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498407; bh=v+fJP3zpnLdDqpCxjw9RsnC9MqdLnPMCDMn2cVHwDew=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=xUeykzGv5vydCoR0tucxSX1ecO3UC0fGEfuxpZu8D32UzTM8LH1pQAG5A8WiAU5q0 abRt3wndQQ4q4zYwY9bhNutOl1P1hZLqCCiWQpulkKgWVtliscwsPDC4TCRoplHKmv ZWiP1514KscNUEr1oxylL/PaNmLBe62MgaGZCuhs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730090AbgF3G0r (ORCPT ); Tue, 30 Jun 2020 02:26:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:55704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730047AbgF3G0q (ORCPT ); Tue, 30 Jun 2020 02:26:46 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA2BB207D0; Tue, 30 Jun 2020 06:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498405; bh=v+fJP3zpnLdDqpCxjw9RsnC9MqdLnPMCDMn2cVHwDew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SZPsWt5gjjvoK9c1Tl4sFnb0CvJbUqtQBuhZnt9YboBXVABfiz8NhcZAg780i/1vG bIt9qmj+jxelZBJQSLa7bPmy7OIpLuoupELcpfbCqy+gjHXXk1rNPY8nPGM7jXPuDL TxvNHMdzmauWtDcBImUaEQmRoF7P+Soy0Ofxsxz4= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jq9j9-008Wb2-Ri; Tue, 30 Jun 2020 08:26:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Maxim Levitsky , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/7] kconfig: qconf: re-implement setSelected() Date: Tue, 30 Jun 2020 08:26:38 +0200 Message-Id: <872efc941f9780bb9e2ee919437be3babbc38da8.1593498345.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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. Signed-off-by: Mauro Carvalho Chehab --- scripts/kconfig/qconf.cc | 15 ++++----------- scripts/kconfig/qconf.h | 14 ++++++++++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 1fddbdfa58b4..29ca4823cfb9 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -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(); } diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index a193137f2314..fb9e9729266f 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -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); From patchwork Tue Jun 30 06:26:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11633245 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDD20138C for ; Tue, 30 Jun 2020 06:27:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6E0120759 for ; Tue, 30 Jun 2020 06:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498435; bh=Z4lp7oXZkaDyzU+Sb4qdG0t7/jfmzRI6xblJHILJBbw=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=haMD3GhIYSo5p7ByIRVG1ns0y/l5NTjz1L4yFzR1BcmaHdJ1cQKxXk0gaZJevWNn4 I1X1kYjOsGP50YfkWikmfrHGB3T0NSG/3Cf9WbMSbzusYSJSQ/hPyvrIK2EV0uaw5u UlPnaDz2s9HMI/Is6f6m3tJxtvoyrUHd30Dcbw7o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730080AbgF3G1B (ORCPT ); Tue, 30 Jun 2020 02:27:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:55720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730052AbgF3G0r (ORCPT ); Tue, 30 Jun 2020 02:26:47 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B0475207E8; Tue, 30 Jun 2020 06:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498405; bh=Z4lp7oXZkaDyzU+Sb4qdG0t7/jfmzRI6xblJHILJBbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQFCOKdmTS9UzNRZnfPRvPJAHjb1lzCaveSNoz+PIAU/JWjFIetBtEtDkfNNFEZoD Xtokq7iRcvx64dq26IpKEmVldK1LwZTPqQA/1LQrpIHQsALyyIn6G7pyikj5nWM+QY kr8gouIqVKlMdL8zkelmGvlK6dEies40qUWf/RlU= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jq9j9-008Wb6-Sf; Tue, 30 Jun 2020 08:26:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Maxim Levitsky , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/7] kconfig: qconf: simplify the goBack() logic Date: Tue, 30 Jun 2020 08:26:39 +0200 Message-Id: <3e99a592ce50886f8748db2565cc80765f66009f.1593498345.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- 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 29ca4823cfb9..e43fe4dcd4e7 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -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; From patchwork Tue Jun 30 06:26:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11633243 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB98B92A for ; Tue, 30 Jun 2020 06:27:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 998FB20759 for ; Tue, 30 Jun 2020 06:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498434; bh=xcriatRX5oAW76hSmZ8ro5YavRMjfjxoExGQJ1O33Ek=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=hPvahnKqDHptjykjBS4boC/wyu48zfTFEivoqyqnppHgS3A7mdhksIEGuVZNod0AY r32gcNjrTBD7PJXpXzozohJh46QTJrT17RKJnAi/c7LD8FSnmMiNpoQB5IQ4edIEWS YmMp2amhlHMYPHE/wStXgZLX9J8zkpEIROphIqIg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730146AbgF3G1C (ORCPT ); Tue, 30 Jun 2020 02:27:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:55722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730048AbgF3G0q (ORCPT ); Tue, 30 Jun 2020 02:26:46 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BADBC207FB; Tue, 30 Jun 2020 06:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498405; bh=xcriatRX5oAW76hSmZ8ro5YavRMjfjxoExGQJ1O33Ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OuZBULVpD4h2IFt14O/+GNMZfJxt0nP53Ofn+fMRawivCx22TtGrRwu5Z5r0ymo/Q UZ24hd1LiWvvN5FWxCurhXI3+mL5N0QvQO50f/d2T/H7zJpfVQ5DBelQHsOrfzGLvg x2ZVb+nUurAENaVgPxiPUH+yCp/wISaIa01M1690= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jq9j9-008WbB-Tc; Tue, 30 Jun 2020 08:26:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Maxim Levitsky , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/7] kconfig: qconf: don't show goback button on splitMode Date: Tue, 30 Jun 2020 08:26:40 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org the goback button does nothing on splitMode. So, why display it? Signed-off-by: Mauro Carvalho Chehab --- 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 e43fe4dcd4e7..6a327b69ff5f 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) { From patchwork Tue Jun 30 06:26:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11633241 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E770B92A for ; Tue, 30 Jun 2020 06:26:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C694620759 for ; Tue, 30 Jun 2020 06:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498408; bh=JuODmNQ54Xlmx3f0CzHGZh/WPPiH3/FVYyWJpfhaPZU=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=JrDkh0yABC6oaDo9yjkkgbqlrifvks/lPCfmsMcnI/onZLIdFpWd/tS/6li75fo69 XUH4PW9IEnw6FXRqqgL93PeGhlEaD2zbeXjcOF9A4KFYjoypeNJnachb2qZJBHeiN4 a3MndaLzPxIc7DvM6ea8aTBJpYfdOJYKdozBn89Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730099AbgF3G0s (ORCPT ); Tue, 30 Jun 2020 02:26:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:55718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730080AbgF3G0r (ORCPT ); Tue, 30 Jun 2020 02:26:47 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BECA1207FF; Tue, 30 Jun 2020 06:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593498405; bh=JuODmNQ54Xlmx3f0CzHGZh/WPPiH3/FVYyWJpfhaPZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVsS0hE2t7LARWIDMce6DWaBiHNe0GREg56hGSlK0NQAD2thEOXRhG6eDAIUx9Fke o+My5d5geODSvZ+b1qPMCOS0bGlg39H58TqnGyZh4H/QLz2fWs5qH2gV75M2PTl6MN VehejzweSjs39nXUjk2WV1fedU8yItXGOZdcVRtQ= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jq9j9-008WbF-UV; Tue, 30 Jun 2020 08:26:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Maxim Levitsky , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/7] kconfig: qconf: navigate menus on hyperlinks Date: Tue, 30 Jun 2020 08:26:41 +0200 Message-Id: <6f7162e40f127e76c7169315d33a14946a85719a.1593498345.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- scripts/kconfig/qconf.cc | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 6a327b69ff5f..f49fbac91995 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; @@ -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); } } }