kconfig: qconf: refactor icon setups
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>
This commit is contained in:
parent
4fa91f528f
commit
5cb255ffa1
|
@ -74,6 +74,13 @@ bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
|
||||||
return true;
|
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
|
* set the new data
|
||||||
|
@ -97,7 +104,7 @@ void ConfigItem::updateMenu(void)
|
||||||
|
|
||||||
list = listView();
|
list = listView();
|
||||||
if (goParent) {
|
if (goParent) {
|
||||||
setIcon(promptColIdx, list->menuBackPix);
|
setIcon(promptColIdx, menubackIcon);
|
||||||
prompt = "..";
|
prompt = "..";
|
||||||
goto set_prompt;
|
goto set_prompt;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +121,7 @@ void ConfigItem::updateMenu(void)
|
||||||
*/
|
*/
|
||||||
if (sym && list->rootEntry == menu)
|
if (sym && list->rootEntry == menu)
|
||||||
break;
|
break;
|
||||||
setIcon(promptColIdx, list->menuPix);
|
setIcon(promptColIdx, menuIcon);
|
||||||
} else {
|
} else {
|
||||||
if (sym)
|
if (sym)
|
||||||
break;
|
break;
|
||||||
|
@ -149,22 +156,22 @@ void ConfigItem::updateMenu(void)
|
||||||
switch (expr) {
|
switch (expr) {
|
||||||
case yes:
|
case yes:
|
||||||
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
|
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
|
||||||
setIcon(promptColIdx, list->choiceYesPix);
|
setIcon(promptColIdx, choiceYesIcon);
|
||||||
else
|
else
|
||||||
setIcon(promptColIdx, list->symbolYesPix);
|
setIcon(promptColIdx, symbolYesIcon);
|
||||||
setText(yesColIdx, "Y");
|
setText(yesColIdx, "Y");
|
||||||
ch = 'Y';
|
ch = 'Y';
|
||||||
break;
|
break;
|
||||||
case mod:
|
case mod:
|
||||||
setIcon(promptColIdx, list->symbolModPix);
|
setIcon(promptColIdx, symbolModIcon);
|
||||||
setText(modColIdx, "M");
|
setText(modColIdx, "M");
|
||||||
ch = 'M';
|
ch = 'M';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
|
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
|
||||||
setIcon(promptColIdx, list->choiceNoPix);
|
setIcon(promptColIdx, choiceNoIcon);
|
||||||
else
|
else
|
||||||
setIcon(promptColIdx, list->symbolNoPix);
|
setIcon(promptColIdx, symbolNoIcon);
|
||||||
setText(noColIdx, "N");
|
setText(noColIdx, "N");
|
||||||
ch = 'N';
|
ch = 'N';
|
||||||
break;
|
break;
|
||||||
|
@ -289,9 +296,6 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
|
||||||
ConfigList::ConfigList(ConfigView* p, const char *name)
|
ConfigList::ConfigList(ConfigView* p, const char *name)
|
||||||
: Parent(p),
|
: Parent(p),
|
||||||
updateAll(false),
|
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),
|
showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
|
||||||
rootEntry(0), headerPopup(0)
|
rootEntry(0), headerPopup(0)
|
||||||
{
|
{
|
||||||
|
@ -1396,6 +1400,15 @@ ConfigMainWindow::ConfigMainWindow(void)
|
||||||
if ((x.isValid())&&(y.isValid()))
|
if ((x.isValid())&&(y.isValid()))
|
||||||
move(x.toInt(), y.toInt());
|
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);
|
QWidget *widget = new QWidget(this);
|
||||||
QVBoxLayout *layout = new QVBoxLayout(widget);
|
QVBoxLayout *layout = new QVBoxLayout(widget);
|
||||||
setCentralWidget(widget);
|
setCentralWidget(widget);
|
||||||
|
|
|
@ -98,10 +98,6 @@ public:
|
||||||
|
|
||||||
bool updateAll;
|
bool updateAll;
|
||||||
|
|
||||||
QPixmap symbolYesPix, symbolModPix, symbolNoPix;
|
|
||||||
QPixmap choiceYesPix, choiceNoPix;
|
|
||||||
QPixmap menuPix, menuBackPix;
|
|
||||||
|
|
||||||
bool showName, showRange, showData;
|
bool showName, showRange, showData;
|
||||||
enum listMode mode;
|
enum listMode mode;
|
||||||
enum optionMode optMode;
|
enum optionMode optMode;
|
||||||
|
@ -162,6 +158,10 @@ public:
|
||||||
struct menu *menu;
|
struct menu *menu;
|
||||||
bool visible;
|
bool visible;
|
||||||
bool goParent;
|
bool goParent;
|
||||||
|
|
||||||
|
static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
|
||||||
|
static QIcon choiceYesIcon, choiceNoIcon;
|
||||||
|
static QIcon menuIcon, menubackIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigLineEdit : public QLineEdit {
|
class ConfigLineEdit : public QLineEdit {
|
||||||
|
|
Loading…
Reference in New Issue