From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>, linux-kernel@vger.kernel.org
Subject: [PATCH v2 17/19] kconfig: qconf: refactor icon setups
Date: Fri, 7 Aug 2020 18:19:07 +0900 [thread overview]
Message-ID: <20200807091909.2985787-17-masahiroy@kernel.org> (raw)
In-Reply-To: <20200807091909.2985787-1-masahiroy@kernel.org>
These icon data are used by ConfigItem, but stored in each instance
of ConfigView. There is no point to keep the same data in each of 3
instances, "menu", "config", and "search".
Move the icon data to the more relevant ConfigItem class, and make
them static members.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
(no changes since v1)
scripts/kconfig/qconf.cc | 33 +++++++++++++++++++++++----------
scripts/kconfig/qconf.h | 8 ++++----
2 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 90b618785239..19f7764c1d68 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -74,6 +74,13 @@ bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
return true;
}
+QIcon ConfigItem::symbolYesIcon;
+QIcon ConfigItem::symbolModIcon;
+QIcon ConfigItem::symbolNoIcon;
+QIcon ConfigItem::choiceYesIcon;
+QIcon ConfigItem::choiceNoIcon;
+QIcon ConfigItem::menuIcon;
+QIcon ConfigItem::menubackIcon;
/*
* set the new data
@@ -97,7 +104,7 @@ void ConfigItem::updateMenu(void)
list = listView();
if (goParent) {
- setIcon(promptColIdx, list->menuBackPix);
+ setIcon(promptColIdx, menubackIcon);
prompt = "..";
goto set_prompt;
}
@@ -114,7 +121,7 @@ void ConfigItem::updateMenu(void)
*/
if (sym && list->rootEntry == menu)
break;
- setIcon(promptColIdx, list->menuPix);
+ setIcon(promptColIdx, menuIcon);
} else {
if (sym)
break;
@@ -149,22 +156,22 @@ void ConfigItem::updateMenu(void)
switch (expr) {
case yes:
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
- setIcon(promptColIdx, list->choiceYesPix);
+ setIcon(promptColIdx, choiceYesIcon);
else
- setIcon(promptColIdx, list->symbolYesPix);
+ setIcon(promptColIdx, symbolYesIcon);
setText(yesColIdx, "Y");
ch = 'Y';
break;
case mod:
- setIcon(promptColIdx, list->symbolModPix);
+ setIcon(promptColIdx, symbolModIcon);
setText(modColIdx, "M");
ch = 'M';
break;
default:
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
- setIcon(promptColIdx, list->choiceNoPix);
+ setIcon(promptColIdx, choiceNoIcon);
else
- setIcon(promptColIdx, list->symbolNoPix);
+ setIcon(promptColIdx, symbolNoIcon);
setText(noColIdx, "N");
ch = 'N';
break;
@@ -289,9 +296,6 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
ConfigList::ConfigList(ConfigView* p, const char *name)
: Parent(p),
updateAll(false),
- symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
- choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
- menuPix(xpm_menu), menuBackPix(xpm_menuback),
showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
rootEntry(0), headerPopup(0)
{
@@ -1395,6 +1399,15 @@ ConfigMainWindow::ConfigMainWindow(void)
if ((x.isValid())&&(y.isValid()))
move(x.toInt(), y.toInt());
+ // set up icons
+ ConfigItem::symbolYesIcon = QIcon(QPixmap(xpm_symbol_yes));
+ ConfigItem::symbolModIcon = QIcon(QPixmap(xpm_symbol_mod));
+ ConfigItem::symbolNoIcon = QIcon(QPixmap(xpm_symbol_no));
+ ConfigItem::choiceYesIcon = QIcon(QPixmap(xpm_choice_yes));
+ ConfigItem::choiceNoIcon = QIcon(QPixmap(xpm_choice_no));
+ ConfigItem::menuIcon = QIcon(QPixmap(xpm_menu));
+ ConfigItem::menubackIcon = QIcon(QPixmap(xpm_menuback));
+
QWidget *widget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(widget);
setCentralWidget(widget);
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index c46a79a69001..460b858b0faa 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -98,10 +98,6 @@ public slots:
bool updateAll;
- QPixmap symbolYesPix, symbolModPix, symbolNoPix;
- QPixmap choiceYesPix, choiceNoPix;
- QPixmap menuPix, menuBackPix;
-
bool showName, showRange, showData;
enum listMode mode;
enum optionMode optMode;
@@ -162,6 +158,10 @@ class ConfigItem : public QTreeWidgetItem {
struct menu *menu;
bool visible;
bool goParent;
+
+ static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
+ static QIcon choiceYesIcon, choiceNoIcon;
+ static QIcon menuIcon, menubackIcon;
};
class ConfigLineEdit : public QLineEdit {
--
2.25.1
next prev parent reply other threads:[~2020-08-07 9:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-07 9:18 [PATCH v2 01/19] kconfig: qconf: remove ->addSeparator() to menuBar Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 02/19] kconfig: qconf: do not use 'menu' variable for (QMenuBar *) Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 03/19] kconfig: qconf: use 'menu' variable for (QMenu *) Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 04/19] kconfig: qconf: remove toolBar from ConfigMainWindow members Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 05/19] kconfig: qconf: overload addToolBar() to create and insert toolbar Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 06/19] kconfig: qconf: remove unused ConfigList::listView() Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 07/19] kconfig: qconf: remove name from ConfigSearchWindow constructor Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 08/19] kconfig: qconf: omit parent to QHBoxLayout() Masahiro Yamada
2020-08-07 9:18 ` [PATCH v2 09/19] kconfig: qconf: remove unused argument from ConfigList::updateList() Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 10/19] kconfig: qconf: remove unused argument from ConfigView::updateList() Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 11/19] kconfig: qconf: remove 'parent' from ConfigList::updateMenuList() Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 12/19] kconfig: qconf: drop more localization code Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 13/19] kconfig: qconf: remove ConfigItem::pixmap/setPixmap Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 14/19] kconfig: qconf: remove ConfigList::addColumn/removeColumn Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 15/19] kconfig: qconf: remove ConfigItem::text/setText Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 16/19] kconfig: qconf: remove unused voidPix, menuInvPix Masahiro Yamada
2020-08-07 9:19 ` Masahiro Yamada [this message]
2020-08-07 9:19 ` [PATCH v2 18/19] kconfig: qconf: do not limit the pop-up menu to the first row Masahiro Yamada
2020-08-07 9:19 ` [PATCH v2 19/19] kconfig: qconf: move setOptionMode() to ConfigList from ConfigView Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200807091909.2985787-17-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).