kconfig: qconf: rename 'config' to 'fileMenu'
PATCH 1/16 kconfig: qconf: rename 'config' to 'fileMenu'
Rename for clarification and consistency.
---
scripts/kconfig/qconf.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
scripts/kconfig/qconf.cc +7 -7
@@ -1517,13 +1517,13 @@ ConfigMainWindow::ConfigMainWindow(void) toolBar->addAction(splitViewAction); toolBar->addAction(fullViewAction); - // create config menu - QMenu* config = menu->addMenu("&File"); - config->addAction(loadAction); - config->addAction(saveAction); - config->addAction(saveAsAction); - config->addSeparator(); - config->addAction(quitAction); + // create file menu + QMenu *fileMenu = menu->addMenu("&File"); + fileMenu->addAction(loadAction); + fileMenu->addAction(saveAction); + fileMenu->addAction(saveAsAction); + fileMenu->addSeparator(); + fileMenu->addAction(quitAction); // create edit menu QMenu* editMenu = menu->addMenu("&Edit");
Signature · 1 line
2.25.1
PATCH 2/16 kconfig: qconf: remove 'menu' variable
I think it is a bit confusing to use 'menu' to hold a QMenuBar pointer because it looks like a QMenu pointer.
You do not need to use a local variable here. Use QMenuBar() directly.
---
scripts/kconfig/qconf.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
scripts/kconfig/qconf.cc +6 -7
@@ -1381,7 +1381,6 @@ void ConfigSearchWindow::search(void) ConfigMainWindow::ConfigMainWindow(void) : searchWindow(0) { - QMenuBar* menu; bool ok = true; QVariant x, y; int width, height;
@@ -1432,7 +1431,6 @@ ConfigMainWindow::ConfigMainWindow(void) setTabOrder(configList, helpText); configList->setFocus(); - menu = menuBar(); toolBar = new QToolBar("Tools", this); addToolBar(toolBar);
@@ -1518,7 +1516,7 @@ ConfigMainWindow::ConfigMainWindow(void) toolBar->addAction(fullViewAction); // create file menu - QMenu *fileMenu = menu->addMenu("&File"); + QMenu *fileMenu = menuBar()->addMenu("&File"); fileMenu->addAction(loadAction); fileMenu->addAction(saveAction); fileMenu->addAction(saveAsAction);
@@ -1526,12 +1524,13 @@ ConfigMainWindow::ConfigMainWindow(void) fileMenu->addAction(quitAction); // create edit menu - QMenu* editMenu = menu->addMenu("&Edit"); + QMenu *editMenu = menuBar()->addMenu("&Edit"); editMenu->addAction(searchAction); // create options menu - QMenu* optionMenu = menu->addMenu("&Option"); + QMenu *optionMenu = menuBar()->addMenu("&Option"); optionMenu->addAction(showNameAction); + optionMenu->addAction(showRangeAction); optionMenu->addAction(showDataAction); optionMenu->addSeparator();
@@ -1540,8 +1539,8 @@ ConfigMainWindow::ConfigMainWindow(void) optionMenu->addAction(showDebugAction); // create help menu - menu->addSeparator(); - QMenu* helpMenu = menu->addMenu("&Help"); + menuBar()->addSeparator(); + QMenu *helpMenu = menuBar()->addMenu("&Help"); helpMenu->addAction(showIntroAction); helpMenu->addAction(showAboutAction);
Signature · 1 line
2.25.1
PATCH 3/16 kconfig: qconf: remove toolBar from ConfigMainWindow members
In reply to Masahiro YamadaThis pointer is only used in the ConfigMainWindow constructor.
Drop it from the private members.
---
scripts/kconfig/qconf.cc | 2 +- scripts/kconfig/qconf.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
scripts/kconfig/qconf.cc +1 -1
@@ -1431,7 +1431,7 @@ ConfigMainWindow::ConfigMainWindow(void) setTabOrder(configList, helpText); configList->setFocus(); - toolBar = new QToolBar("Tools", this); + QToolBar *toolBar = new QToolBar("Tools", this); addToolBar(toolBar); backAction = new QAction(QPixmap(xpm_back), "Back", this);
scripts/kconfig/qconf.h +0 -1
@@ -326,7 +326,6 @@ public slots:ConfigView *configView;ConfigList *configList;ConfigInfoView *helpText; -QToolBar *toolBar;QAction *backAction;QAction *singleViewAction;QAction *splitViewAction;
Signature · 1 line
2.25.1
PATCH 4/16 kconfig: qconf: overload addToolBar() to create and insert toolbar
In reply to Masahiro YamadaUse the overloaded function, addToolBar(const QString &title) to create a QToolBar object, setting its window title, and inserts it into the toolbar area.
---
scripts/kconfig/qconf.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
scripts/kconfig/qconf.cc +1 -3
@@ -1431,9 +1431,6 @@ ConfigMainWindow::ConfigMainWindow(void) setTabOrder(configList, helpText); configList->setFocus(); - QToolBar *toolBar = new QToolBar("Tools", this); - addToolBar(toolBar); - backAction = new QAction(QPixmap(xpm_back), "Back", this); connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
@@ -1506,6 +1503,7 @@ ConfigMainWindow::ConfigMainWindow(void) connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); // init tool bar + QToolBar *toolBar = addToolBar("Tools"); toolBar->addAction(backAction); toolBar->addSeparator(); toolBar->addAction(loadAction);
Signature · 1 line
2.25.1
PATCH 5/16 kconfig: qconf: remove unused ConfigList::listView()
In reply to Masahiro YamadaI do not know how this function can be useful. In fact, it is unsed.
---
scripts/kconfig/qconf.h | 4 ---- 1 file changed, 4 deletions(-)
scripts/kconfig/qconf.h +0 -4
@@ -88,10 +88,6 @@ public slots:updateList (NULL ); updateAll = false; } -ConfigList *listView () - { -return this; - }void addColumn (colIdx idx) {showColumn (idx);
Signature · 1 line
2.25.1
PATCH 6/16 kconfig: qconf: remove name from ConfigSearchWindow constructor
In reply to Masahiro YamadaThis constructor is only called with "search" as the second argument.
Hard-code the name in the constructor, and drop it from the function argument.
---
scripts/kconfig/qconf.cc | 44 +++++++++++++++++++--------------------- scripts/kconfig/qconf.h | 2 +- 2 files changed, 22 insertions(+), 24 deletions(-)
scripts/kconfig/qconf.cc +21 -23
@@ -1287,10 +1287,10 @@ void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e) Parent::contextMenuEvent(e); } -ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name) +ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) : Parent(parent), result(NULL) { - setObjectName(name); + setObjectName("search"); setWindowTitle("Search Config"); QVBoxLayout* layout1 = new QVBoxLayout(this);
@@ -1311,9 +1311,9 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam split = new QSplitter(this); split->setOrientation(Qt::Vertical); - list = new ConfigView(split, name); + list = new ConfigView(split, "search"); list->list->mode = listMode; - info = new ConfigInfoView(split, name); + info = new ConfigInfoView(split, "search"); connect(list->list, SIGNAL(menuChanged(struct menu *)), info, SLOT(setInfo(struct menu *))); connect(list->list, SIGNAL(menuChanged(struct menu *)),
@@ -1321,25 +1321,23 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam layout1->addWidget(split); - if (name) { - QVariant x, y; - int width, height; - bool ok; + QVariant x, y; + int width, height; + bool ok; - configSettings->beginGroup(name); - width = configSettings->value("/window width", parent->width() / 2).toInt(); - height = configSettings->value("/window height", parent->height() / 2).toInt(); - resize(width, height); - x = configSettings->value("/window x"); - y = configSettings->value("/window y"); - if ((x.isValid())&&(y.isValid())) - move(x.toInt(), y.toInt()); - QList<int> sizes = configSettings->readSizes("/split", &ok); - if (ok) - split->setSizes(sizes); - configSettings->endGroup(); - connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); - } + configSettings->beginGroup("search"); + width = configSettings->value("/window width", parent->width() / 2).toInt(); + height = configSettings->value("/window height", parent->height() / 2).toInt(); + resize(width, height); + x = configSettings->value("/window x"); + y = configSettings->value("/window y"); + if (x.isValid() && y.isValid()) + move(x.toInt(), y.toInt()); + QList<int> sizes = configSettings->readSizes("/split", &ok); + if (ok) + split->setSizes(sizes); + configSettings->endGroup(); + connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); } void ConfigSearchWindow::saveSettings(void)
@@ -1643,7 +1641,7 @@ void ConfigMainWindow::saveConfigAs(void) void ConfigMainWindow::searchConfig(void) { if (!searchWindow) - searchWindow = new ConfigSearchWindow(this, "search"); + searchWindow = new ConfigSearchWindow(this); searchWindow->show(); }
scripts/kconfig/qconf.h +1 -1
@@ -272,7 +272,7 @@ class ConfigSearchWindow : public QDialog {Q_OBJECT typedef class QDialog Parent; public: - ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0); +ConfigSearchWindow (ConfigMainWindow *parent); public slots:void saveSettings (void );
Signature · 1 line
2.25.1
PATCH 7/16 kconfig: qconf: omit parent to QHBoxLayout()
In reply to Masahiro YamadaInstead of passing 0 (i.e. nullptr), leave it empty.
---
scripts/kconfig/qconf.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/qconf.cc +2 -1
@@ -1296,7 +1296,8 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) QVBoxLayout* layout1 = new QVBoxLayout(this); layout1->setContentsMargins(11, 11, 11, 11); layout1->setSpacing(6); - QHBoxLayout* layout2 = new QHBoxLayout(0); + + QHBoxLayout* layout2 = new QHBoxLayout(); layout2->setContentsMargins(0, 0, 0, 0); layout2->setSpacing(6); layout2->addWidget(new QLabel("Find:", this));
Signature · 1 line
2.25.1
PATCH 8/16 kconfig: qconf: remove unused argument from ConfigList::updateList()
In reply to Masahiro YamadaThis function allocates 'item' before using it, so the argument 'item' is always shadowed.
Remove the meaningless argument.
---
scripts/kconfig/qconf.cc | 6 +++--- scripts/kconfig/qconf.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
scripts/kconfig/qconf.cc +3 -3
@@ -404,15 +404,15 @@ void ConfigList::updateSelection(void) emit menuSelected(menu); } -void ConfigList::updateList(ConfigItem* item) +void ConfigList::updateList() { ConfigItem* last = 0; + ConfigItem *item; if (!rootEntry) { if (mode != listMode) goto update; QTreeWidgetItemIterator it(this); - ConfigItem* item; while (*it) { item = (ConfigItem*)(*it);
@@ -989,7 +989,7 @@ void ConfigView::updateList(ConfigItem* item) ConfigView* v; for (v = viewList; v; v = v->nextView) - v->list->updateList(item); + v->list->updateList(); } void ConfigView::updateListAll(void)
scripts/kconfig/qconf.h +2 -2
@@ -69,7 +69,7 @@ class ConfigList : public QTreeWidget { public slots:void setRootMenu (struct menu *menu); -void updateList (ConfigItem *item); +void updateList ();void setValue (ConfigItem * item,tristate val);void changeValue (ConfigItem * item);void updateSelection (void );
@@ -85,7 +85,7 @@ public slots:void updateListAll (void ) { updateAll = true; -updateList (NULL ); +updateList (); updateAll = false; }void addColumn (colIdx idx)
Signature · 1 line
2.25.1
PATCH 9/16 kconfig: qconf: remove unused argument from ConfigView::updateList()
In reply to Masahiro YamadaNow that ConfigList::updateList() takes no argument, the 'item' argument ConfigView::updateList() is no longer used.
---
scripts/kconfig/qconf.cc | 8 ++++---- scripts/kconfig/qconf.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
scripts/kconfig/qconf.cc +4 -4
@@ -280,7 +280,7 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) case Qt::Key_Return: case Qt::Key_Enter: sym_set_string_value(item->menu->sym, text().toLatin1()); - parent()->updateList(item); + parent()->updateList(); break; default: Parent::keyPressEvent(e);
@@ -471,7 +471,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val) return; if (oldval == no && item->menu->list) item->setExpanded(true); - parent()->updateList(item); + parent()->updateList(); break; } }
@@ -505,7 +505,7 @@ void ConfigList::changeValue(ConfigItem* item) item->setExpanded(true); } if (oldexpr != newexpr) - parent()->updateList(item); + parent()->updateList(); break; case S_INT: case S_HEX:
@@ -984,7 +984,7 @@ void ConfigList::setAllOpen(bool open) } } -void ConfigView::updateList(ConfigItem* item) +void ConfigView::updateList() { ConfigView* v;
scripts/kconfig/qconf.h +1 -1
@@ -210,7 +210,7 @@ class ConfigView : public QWidget { public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView (void); -static void updateList (ConfigItem * item); +static void updateList ();static void updateListAll (void );bool showName (void ) const {return list->showName; }
Signature · 1 line
2.25.1
PATCH 10/16 kconfig: qconf: remove 'parent' from ConfigList::updateMenuList()
In reply to Masahiro YamadaAll the callers of this function passes 'this' to the first argument.
So, 'parent' is always 'this'.
---
scripts/kconfig/qconf.cc | 18 +++++++++--------- scripts/kconfig/qconf.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-)
scripts/kconfig/qconf.cc +9 -9
@@ -446,7 +446,7 @@ void ConfigList::updateList() return; } update: - updateMenuList(this, rootEntry); + updateMenuList(rootEntry); update(); resizeColumnToContents(0); }
@@ -524,7 +524,7 @@ void ConfigList::setRootMenu(struct menu *menu) type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; if (type != P_MENU) return; - updateMenuList(this, 0); + updateMenuList(0); rootEntry = menu; updateListAll(); if (currentItem()) {
@@ -628,7 +628,7 @@ hide: } } -void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) +void ConfigList::updateMenuList(struct menu* menu) { struct menu* child; ConfigItem* item;
@@ -637,19 +637,19 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) enum prop_type type; if (!menu) { - while (parent->topLevelItemCount() > 0) + while (topLevelItemCount() > 0) { - delete parent->takeTopLevelItem(0); + delete takeTopLevelItem(0); } return; } - last = (ConfigItem*)parent->topLevelItem(0); + last = (ConfigItem*)topLevelItem(0); if (last && !last->goParent) last = 0; for (child = menu->list; child; child = child->next) { - item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0); + item = last ? last->nextSibling() : (ConfigItem*)topLevelItem(0); type = child->prompt ? child->prompt->type : P_UNKNOWN; switch (mode) {
@@ -670,7 +670,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) if (!child->sym && !child->list && !child->prompt) continue; if (!item || item->menu != child) - item = new ConfigItem(parent, last, child, visible); + item = new ConfigItem(this, last, child, visible); else item->testUpdateMenu(visible);
@@ -683,7 +683,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) } hide: if (item && item->menu == child) { - last = (ConfigItem*)parent->topLevelItem(0); + last = (ConfigItem*)topLevelItem(0); if (last == item) last = 0; else while (last->nextSibling() != item)
scripts/kconfig/qconf.h +1 -1
@@ -102,7 +102,7 @@ public slots:bool menuSkip (struct menu *);void updateMenuList (ConfigItem *parent,struct menu *); -void updateMenuList (ConfigList *parent,struct menu *); +void updateMenuList (struct menu *menu);bool updateAll;
Signature · 1 line
2.25.1
PATCH 11/16 kconfig: qconf: drop more localization code
In reply to Masahiro YamadaThis is a remnant of commit 694c49a7c01c ("kconfig: drop localization support").
Get it back to the code prior to commit 3b9fa0931dd8 ("[PATCH] Kconfig i18n support").
---
scripts/kconfig/qconf.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
scripts/kconfig/qconf.cc +3 -8
@@ -31,11 +31,6 @@ static ConfigSettings *configSettings; QAction *ConfigMainWindow::saveAction; -static inline QString qgettext(const char* str) -{ - return QString::fromLocal8Bit(str); -} - ConfigSettings::ConfigSettings() : QSettings("kernel.org", "qconf") {
@@ -109,7 +104,7 @@ void ConfigItem::updateMenu(void) sym = menu->sym; prop = menu->prompt; - prompt = qgettext(menu_get_prompt(menu)); + prompt = menu_get_prompt(menu); if (prop) switch (prop->type) { case P_MENU:
@@ -135,7 +130,7 @@ void ConfigItem::updateMenu(void) if (!sym) goto set_prompt; - setText(nameColIdx, QString::fromLocal8Bit(sym->name)); + setText(nameColIdx, sym->name); type = sym_get_type(sym); switch (type) {
@@ -265,7 +260,7 @@ void ConfigLineEdit::show(ConfigItem* i) { item = i; if (sym_get_string_value(item->menu->sym)) - setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym))); + setText(sym_get_string_value(item->menu->sym)); else setText(QString()); Parent::show();
Signature · 1 line
2.25.1
PATCH 12/16 kconfig: qconf: remove ConfigItem::pixmap/setPixmap
In reply to Masahiro YamadaUse QTreeWidgetItem::icon/setIcon directly.
---
scripts/kconfig/qconf.cc | 22 +++++++++++----------- scripts/kconfig/qconf.h | 8 -------- 2 files changed, 11 insertions(+), 19 deletions(-)
scripts/kconfig/qconf.cc +11 -11
@@ -97,7 +97,7 @@ void ConfigItem::updateMenu(void) list = listView(); if (goParent) { - setPixmap(promptColIdx, list->menuBackPix); + setIcon(promptColIdx, list->menuBackPix); prompt = ".."; goto set_prompt; }
@@ -114,15 +114,15 @@ void ConfigItem::updateMenu(void) */ if (sym && list->rootEntry == menu) break; - setPixmap(promptColIdx, list->menuPix); + setIcon(promptColIdx, list->menuPix); } else { if (sym) break; - setPixmap(promptColIdx, QIcon()); + setIcon(promptColIdx, QIcon()); } goto set_prompt; case P_COMMENT: - setPixmap(promptColIdx, QIcon()); + setIcon(promptColIdx, QIcon()); goto set_prompt; default: ;
@@ -139,7 +139,7 @@ void ConfigItem::updateMenu(void) char ch; if (!sym_is_changeable(sym) && list->optMode == normalOpt) { - setPixmap(promptColIdx, QIcon()); + setIcon(promptColIdx, QIcon()); setText(noColIdx, QString()); setText(modColIdx, QString()); setText(yesColIdx, QString());
@@ -149,22 +149,22 @@ void ConfigItem::updateMenu(void) switch (expr) { case yes: if (sym_is_choice_value(sym) && type == S_BOOLEAN) - setPixmap(promptColIdx, list->choiceYesPix); + setIcon(promptColIdx, list->choiceYesPix); else - setPixmap(promptColIdx, list->symbolYesPix); + setIcon(promptColIdx, list->symbolYesPix); setText(yesColIdx, "Y"); ch = 'Y'; break; case mod: - setPixmap(promptColIdx, list->symbolModPix); + setIcon(promptColIdx, list->symbolModPix); setText(modColIdx, "M"); ch = 'M'; break; default: if (sym_is_choice_value(sym) && type == S_BOOLEAN) - setPixmap(promptColIdx, list->choiceNoPix); + setIcon(promptColIdx, list->choiceNoPix); else - setPixmap(promptColIdx, list->symbolNoPix); + setIcon(promptColIdx, list->symbolNoPix); setText(noColIdx, "N"); ch = 'N'; break;
@@ -769,7 +769,7 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e) idx = header()->logicalIndexAt(x); switch (idx) { case promptColIdx: - icon = item->pixmap(promptColIdx); + icon = item->icon(promptColIdx); if (!icon.isNull()) { int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly. if (x >= off && x < off + icon.availableSizes().first().width()) {
scripts/kconfig/qconf.h +0 -8
@@ -172,14 +172,6 @@ class ConfigItem : public QTreeWidgetItem { { return Parent::text(idx); } - void setPixmap(colIdx idx, const QIcon &icon) - { - Parent::setIcon(idx, icon); - } -const QIcon pixmap (colIdx idx) const - { -return icon (idx); - }// TODO: Implement paintCell ConfigItem * nextItem;
Signature · 1 line
2.25.1
PATCH 13/16 kconfig: qconf: remove ConfigList::addColumn/removeColumn
In reply to Masahiro YamadaUse QTreeView::showColumn/hideColumn directly.
---
scripts/kconfig/qconf.cc | 22 +++++++++++----------- scripts/kconfig/qconf.h | 8 -------- 2 files changed, 11 insertions(+), 19 deletions(-)
scripts/kconfig/qconf.cc +11 -11
@@ -317,7 +317,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); } - addColumn(promptColIdx); + showColumn(promptColIdx); reinit(); }
@@ -335,21 +335,21 @@ bool ConfigList::menuSkip(struct menu *menu) void ConfigList::reinit(void) { - removeColumn(dataColIdx); - removeColumn(yesColIdx); - removeColumn(modColIdx); - removeColumn(noColIdx); - removeColumn(nameColIdx); + hideColumn(dataColIdx); + hideColumn(yesColIdx); + hideColumn(modColIdx); + hideColumn(noColIdx); + hideColumn(nameColIdx); if (showName) - addColumn(nameColIdx); + showColumn(nameColIdx); if (showRange) { - addColumn(noColIdx); - addColumn(modColIdx); - addColumn(yesColIdx); + showColumn(noColIdx); + showColumn(modColIdx); + showColumn(yesColIdx); } if (showData) - addColumn(dataColIdx); + showColumn(dataColIdx); updateListAll(); }
scripts/kconfig/qconf.h +0 -8
@@ -88,14 +88,6 @@ public slots:updateList (); updateAll = false; } -void addColumn (colIdx idx) - { -showColumn (idx); - } -void removeColumn (colIdx idx) - { -hideColumn (idx); - }void setAllOpen (bool open);void setParentMenu (void );
Signature · 1 line
2.25.1
PATCH 14/16 kconfig: qconf: remove ConfigItem::text/setText
In reply to Masahiro YamadaUse QTreeWidgetItem::text/setText directly
---
scripts/kconfig/qconf.h | 8 -------- 1 file changed, 8 deletions(-)
scripts/kconfig/qconf.h +0 -8
@@ -156,14 +156,6 @@ class ConfigItem : public QTreeWidgetItem {return ret; } - void setText(colIdx idx, const QString& text) - { - Parent::setText(idx, text); - } -QString text (colIdx idx) const - { - return Parent::text(idx); - }// TODO: Implement paintCell ConfigItem * nextItem;
Signature · 1 line
2.25.1
PATCH 15/16 kconfig: qconf: remove unused voidPix, menuInvPix
In reply to Masahiro YamadaThese are initialized, but not used by anyone.
---
scripts/kconfig/qconf.cc | 2 +- scripts/kconfig/qconf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/qconf.cc +1 -1
@@ -291,7 +291,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) 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), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), + menuPix(xpm_menu), menuBackPix(xpm_menuback), showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt), rootEntry(0), headerPopup(0) {
scripts/kconfig/qconf.h +1 -1
@@ -100,7 +100,7 @@ public slots:QPixmap symbolYesPix, symbolModPix, symbolNoPix;QPixmap choiceYesPix, choiceNoPix; -QPixmap menuPix, menuInvPix, menuBackPix, voidPix; +QPixmap menuPix, menuBackPix;bool showName, showRange, showData;enum listMode mode;
Signature · 1 line
2.25.1
PATCH 16/16 kconfig: qconf: refactor icon setups
In reply to Masahiro YamadaThese 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.
---
scripts/kconfig/qconf.cc | 33 +++++++++++++++++++++++---------- scripts/kconfig/qconf.h | 8 ++++---- 2 files changed, 27 insertions(+), 14 deletions(-)
scripts/kconfig/qconf.cc +23 -10
@@ -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::menubackIcon = QIcon(QPixmap(xpm_menuback)); + ConfigItem::menuIcon = QIcon(QPixmap(xpm_menu)); + QWidget *widget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(widget); setCentralWidget(widget);
scripts/kconfig/qconf.h +4 -4
@@ -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 {
Signature · 1 line
2.25.1