- remove '---help---' keyword support
 
  - fix mouse events for 'menuconfig' symbols in search view of qconf
 
  - code cleanups of qconf
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl82GPgVHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGb7wP/1FP152f3jbxUqS08UMWxgxcV6qX
 Bon75HJxLhH6GF3bDh7SNt4dfoq5SAbOnQaRu68r97XQnCbanOjddh3yeSAS1FNX
 XQlHdy+gfWQQR+cxEXT6pFfw2AE2HFxb9srsV9QKtOqUVaCvSpxV1ch+YvqaJ+ZM
 yu1AMB4uHOdoUMVdgMHnx8d2nn7TFstFzzbvi7mK0S0uUBKEswv6PK6KbkZdIbJZ
 8gZqt6GE5H7FG934J8PQt2JA2/cAMJ2mbsISH40rfNgagpRJuk7GEbMZETckKALR
 2XHJqnY++CHyQT7OZUv+kqYrGMX+1Oi1UlvXxr+fScfHVEAcKg2nFYAtiHVUvhEi
 rpT/DjmvbIp1onL6wDpgMZzRS++lutdOJ2+02KnAb4/XZjFwTCHgydXcv299MAxE
 6R3KKmkCG6OT/OZleC9f1GTiUcFVc7SRRJwQaH4RFE2weWJZmVQoYLwEw846ke89
 cZTUCG0QXdTHgLYGpdK9V9GrTMr16ClTvXjZANgErlHwTWNc1Zh/Gl+1CI1fqTN4
 v9jxLRJY9Pt1fJvgrKYUz3QQsuMM/GLdwRCAxQ6DxQjK7tZYr/qhdtf8agICwxQp
 haEKWakt8pnIGy10DXYoF5ZVDUP0Kif8n0BOZjJeaBZZMB4CICBgrVe+G7s9/2QP
 Dxz6KUwbygDvs6KH
 =IAh/
 -----END PGP SIGNATURE-----

Merge tag 'kconfig-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kconfig updates from Masahiro Yamada:

 - remove '---help---' keyword support

 - fix mouse events for 'menuconfig' symbols in search view of qconf

 - code cleanups of qconf

* tag 'kconfig-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (24 commits)
  kconfig: qconf: move setOptionMode() to ConfigList from ConfigView
  kconfig: qconf: do not limit the pop-up menu to the first row
  kconfig: qconf: refactor icon setups
  kconfig: qconf: remove unused voidPix, menuInvPix
  kconfig: qconf: remove ConfigItem::text/setText
  kconfig: qconf: remove ConfigList::addColumn/removeColumn
  kconfig: qconf: remove ConfigItem::pixmap/setPixmap
  kconfig: qconf: drop more localization code
  kconfig: qconf: remove 'parent' from ConfigList::updateMenuList()
  kconfig: qconf: remove unused argument from ConfigView::updateList()
  kconfig: qconf: remove unused argument from ConfigList::updateList()
  kconfig: qconf: omit parent to QHBoxLayout()
  kconfig: qconf: remove name from ConfigSearchWindow constructor
  kconfig: qconf: remove unused ConfigList::listView()
  kconfig: qconf: overload addToolBar() to create and insert toolbar
  kconfig: qconf: remove toolBar from ConfigMainWindow members
  kconfig: qconf: use 'menu' variable for (QMenu *)
  kconfig: qconf: do not use 'menu' variable for (QMenuBar *)
  kconfig: qconf: remove ->addSeparator() to menuBar
  kconfig: add 'static' to some file-local data
  ...
This commit is contained in:
Linus Torvalds 2020-08-14 11:04:45 -07:00
Родитель a1d21081a6 d4bbe8a1b5
Коммит 32b2ee5cea
8 изменённых файлов: 217 добавлений и 242 удалений

Просмотреть файл

@ -34,7 +34,7 @@ REGEX_SOURCE_SYMBOL = re.compile(SOURCE_SYMBOL)
REGEX_KCONFIG_DEF = re.compile(DEF)
REGEX_KCONFIG_EXPR = re.compile(EXPR)
REGEX_KCONFIG_STMT = re.compile(STMT)
REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$")
REGEX_KCONFIG_HELP = re.compile(r"^\s+help\s*$")
REGEX_FILTER_SYMBOLS = re.compile(r"[A-Za-z0-9]$")
REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+")
REGEX_QUOTES = re.compile("(\"(.*?)\")")

Просмотреть файл

@ -3045,11 +3045,7 @@ sub process {
if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) {
$is_start = 1;
} elsif ($lines[$ln - 1] =~ /^\+\s*(?:help|---help---)\s*$/) {
if ($lines[$ln - 1] =~ "---help---") {
WARN("CONFIG_DESCRIPTION",
"prefer 'help' over '---help---' for new help texts\n" . $herecurr);
}
} elsif ($lines[$ln - 1] =~ /^\+\s*(?:---)?help(?:---)?$/) {
$length = -1;
}

Просмотреть файл

@ -5,7 +5,7 @@
#include "images.h"
const char *xpm_load[] = {
const char * const xpm_load[] = {
"22 22 5 1",
". c None",
"# c #000000",
@ -35,7 +35,7 @@ const char *xpm_load[] = {
"###############.......",
"......................"};
const char *xpm_save[] = {
const char * const xpm_save[] = {
"22 22 5 1",
". c None",
"# c #000000",
@ -65,7 +65,7 @@ const char *xpm_save[] = {
"..##################..",
"......................"};
const char *xpm_back[] = {
const char * const xpm_back[] = {
"22 22 3 1",
". c None",
"# c #000083",
@ -93,7 +93,7 @@ const char *xpm_back[] = {
"......................",
"......................"};
const char *xpm_tree_view[] = {
const char * const xpm_tree_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@ -120,7 +120,7 @@ const char *xpm_tree_view[] = {
"......................",
"......................"};
const char *xpm_single_view[] = {
const char * const xpm_single_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@ -147,7 +147,7 @@ const char *xpm_single_view[] = {
"......................",
"......................"};
const char *xpm_split_view[] = {
const char * const xpm_split_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@ -174,7 +174,7 @@ const char *xpm_split_view[] = {
"......................",
"......................"};
const char *xpm_symbol_no[] = {
const char * const xpm_symbol_no[] = {
"12 12 2 1",
" c white",
". c black",
@ -191,7 +191,7 @@ const char *xpm_symbol_no[] = {
" .......... ",
" "};
const char *xpm_symbol_mod[] = {
const char * const xpm_symbol_mod[] = {
"12 12 2 1",
" c white",
". c black",
@ -208,7 +208,7 @@ const char *xpm_symbol_mod[] = {
" .......... ",
" "};
const char *xpm_symbol_yes[] = {
const char * const xpm_symbol_yes[] = {
"12 12 2 1",
" c white",
". c black",
@ -225,7 +225,7 @@ const char *xpm_symbol_yes[] = {
" .......... ",
" "};
const char *xpm_choice_no[] = {
const char * const xpm_choice_no[] = {
"12 12 2 1",
" c white",
". c black",
@ -242,7 +242,7 @@ const char *xpm_choice_no[] = {
" .... ",
" "};
const char *xpm_choice_yes[] = {
const char * const xpm_choice_yes[] = {
"12 12 2 1",
" c white",
". c black",
@ -259,7 +259,7 @@ const char *xpm_choice_yes[] = {
" .... ",
" "};
const char *xpm_menu[] = {
const char * const xpm_menu[] = {
"12 12 2 1",
" c white",
". c black",
@ -276,7 +276,7 @@ const char *xpm_menu[] = {
" .......... ",
" "};
const char *xpm_menu_inv[] = {
const char * const xpm_menu_inv[] = {
"12 12 2 1",
" c white",
". c black",
@ -293,7 +293,7 @@ const char *xpm_menu_inv[] = {
" .......... ",
" "};
const char *xpm_menuback[] = {
const char * const xpm_menuback[] = {
"12 12 2 1",
" c white",
". c black",
@ -310,7 +310,7 @@ const char *xpm_menuback[] = {
" .......... ",
" "};
const char *xpm_void[] = {
const char * const xpm_void[] = {
"12 12 2 1",
" c white",
". c black",

Просмотреть файл

@ -10,21 +10,21 @@
extern "C" {
#endif
extern const char *xpm_load[];
extern const char *xpm_save[];
extern const char *xpm_back[];
extern const char *xpm_tree_view[];
extern const char *xpm_single_view[];
extern const char *xpm_split_view[];
extern const char *xpm_symbol_no[];
extern const char *xpm_symbol_mod[];
extern const char *xpm_symbol_yes[];
extern const char *xpm_choice_no[];
extern const char *xpm_choice_yes[];
extern const char *xpm_menu[];
extern const char *xpm_menu_inv[];
extern const char *xpm_menuback[];
extern const char *xpm_void[];
extern const char * const xpm_load[];
extern const char * const xpm_save[];
extern const char * const xpm_back[];
extern const char * const xpm_tree_view[];
extern const char * const xpm_single_view[];
extern const char * const xpm_split_view[];
extern const char * const xpm_symbol_no[];
extern const char * const xpm_symbol_mod[];
extern const char * const xpm_symbol_yes[];
extern const char * const xpm_choice_no[];
extern const char * const xpm_choice_yes[];
extern const char * const xpm_menu[];
extern const char * const xpm_menu_inv[];
extern const char * const xpm_menuback[];
extern const char * const xpm_void[];
#ifdef __cplusplus
}

Просмотреть файл

@ -36,7 +36,7 @@ struct buffer {
YY_BUFFER_STATE state;
};
struct buffer *current_buf;
static struct buffer *current_buf;
static int last_ts, first_ts;
@ -105,7 +105,7 @@ n [A-Za-z0-9_-]
"endchoice" return T_ENDCHOICE;
"endif" return T_ENDIF;
"endmenu" return T_ENDMENU;
"help"|"---help---" return T_HELP;
"help" return T_HELP;
"hex" return T_HEX;
"if" return T_IF;
"imply" return T_IMPLY;

Просмотреть файл

@ -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")
{
@ -79,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
@ -102,14 +104,14 @@ void ConfigItem::updateMenu(void)
list = listView();
if (goParent) {
setPixmap(promptColIdx, list->menuBackPix);
setIcon(promptColIdx, menubackIcon);
prompt = "..";
goto set_prompt;
}
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:
@ -119,15 +121,15 @@ void ConfigItem::updateMenu(void)
*/
if (sym && list->rootEntry == menu)
break;
setPixmap(promptColIdx, list->menuPix);
setIcon(promptColIdx, menuIcon);
} 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:
;
@ -135,7 +137,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) {
@ -144,7 +146,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());
@ -154,22 +156,22 @@ void ConfigItem::updateMenu(void)
switch (expr) {
case yes:
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
setPixmap(promptColIdx, list->choiceYesPix);
setIcon(promptColIdx, choiceYesIcon);
else
setPixmap(promptColIdx, list->symbolYesPix);
setIcon(promptColIdx, symbolYesIcon);
setText(yesColIdx, "Y");
ch = 'Y';
break;
case mod:
setPixmap(promptColIdx, list->symbolModPix);
setIcon(promptColIdx, symbolModIcon);
setText(modColIdx, "M");
ch = 'M';
break;
default:
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
setPixmap(promptColIdx, list->choiceNoPix);
setIcon(promptColIdx, choiceNoIcon);
else
setPixmap(promptColIdx, list->symbolNoPix);
setIcon(promptColIdx, symbolNoIcon);
setText(noColIdx, "N");
ch = 'N';
break;
@ -265,7 +267,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();
@ -280,7 +282,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);
@ -294,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), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
rootEntry(0), headerPopup(0)
{
@ -322,7 +321,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
}
addColumn(promptColIdx);
showColumn(promptColIdx);
reinit();
}
@ -340,21 +339,33 @@ 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();
}
void ConfigList::setOptionMode(QAction *action)
{
if (action == showNormalAction)
optMode = normalOpt;
else if (action == showAllAction)
optMode = allOpt;
else
optMode = promptOpt;
updateListAll();
}
@ -404,15 +415,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);
@ -446,7 +457,7 @@ void ConfigList::updateList(ConfigItem* item)
return;
}
update:
updateMenuList(this, rootEntry);
updateMenuList(rootEntry);
update();
resizeColumnToContents(0);
}
@ -471,7 +482,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 +516,7 @@ void ConfigList::changeValue(ConfigItem* item)
item->setExpanded(true);
}
if (oldexpr != newexpr)
parent()->updateList(item);
parent()->updateList();
break;
case S_INT:
case S_HEX:
@ -524,7 +535,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 +639,7 @@ hide:
}
}
void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
void ConfigList::updateMenuList(struct menu *menu)
{
struct menu* child;
ConfigItem* item;
@ -637,19 +648,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 +681,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 +694,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)
@ -774,7 +785,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()) {
@ -785,7 +796,8 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e)
break;
ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
if (ptype == P_MENU && rootEntry != menu &&
mode != fullMode && mode != menuMode)
mode != fullMode && mode != menuMode &&
mode != listMode)
emit menuSelected(menu);
else
changeValue(item);
@ -835,7 +847,7 @@ void ConfigList::mouseDoubleClickEvent(QMouseEvent* e)
if (!menu)
goto skip;
ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
if (ptype == P_MENU) {
if (ptype == P_MENU && mode != listMode) {
if (mode == singleMode)
emit itemSelected(menu);
else if (mode == symbolMode)
@ -864,46 +876,46 @@ void ConfigList::focusInEvent(QFocusEvent *e)
void ConfigList::contextMenuEvent(QContextMenuEvent *e)
{
if (e->y() <= header()->geometry().bottom()) {
if (!headerPopup) {
QAction *action;
if (!headerPopup) {
QAction *action;
headerPopup = new QMenu(this);
action = new QAction("Show Name", this);
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool)));
connect(parent(), SIGNAL(showNameChanged(bool)),
action, SLOT(setOn(bool)));
action->setChecked(showName);
headerPopup->addAction(action);
action = new QAction("Show Range", this);
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowRange(bool)));
connect(parent(), SIGNAL(showRangeChanged(bool)),
action, SLOT(setOn(bool)));
action->setChecked(showRange);
headerPopup->addAction(action);
action = new QAction("Show Data", this);
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowData(bool)));
connect(parent(), SIGNAL(showDataChanged(bool)),
action, SLOT(setOn(bool)));
action->setChecked(showData);
headerPopup->addAction(action);
}
headerPopup->exec(e->globalPos());
e->accept();
} else
e->ignore();
headerPopup = new QMenu(this);
action = new QAction("Show Name", this);
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool)));
connect(parent(), SIGNAL(showNameChanged(bool)),
action, SLOT(setOn(bool)));
action->setChecked(showName);
headerPopup->addAction(action);
action = new QAction("Show Range", this);
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowRange(bool)));
connect(parent(), SIGNAL(showRangeChanged(bool)),
action, SLOT(setOn(bool)));
action->setChecked(showRange);
headerPopup->addAction(action);
action = new QAction("Show Data", this);
action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowData(bool)));
connect(parent(), SIGNAL(showDataChanged(bool)),
action, SLOT(setOn(bool)));
action->setChecked(showData);
headerPopup->addAction(action);
}
headerPopup->exec(e->globalPos());
e->accept();
}
ConfigView*ConfigView::viewList;
QAction *ConfigView::showNormalAction;
QAction *ConfigView::showAllAction;
QAction *ConfigView::showPromptAction;
QAction *ConfigList::showNormalAction;
QAction *ConfigList::showAllAction;
QAction *ConfigList::showPromptAction;
ConfigView::ConfigView(QWidget* parent, const char *name)
: Parent(parent)
@ -934,18 +946,6 @@ ConfigView::~ConfigView(void)
}
}
void ConfigView::setOptionMode(QAction *act)
{
if (act == showNormalAction)
list->optMode = normalOpt;
else if (act == showAllAction)
list->optMode = allOpt;
else
list->optMode = promptOpt;
list->updateListAll();
}
void ConfigView::setShowName(bool b)
{
if (list->showName != b) {
@ -984,12 +984,12 @@ void ConfigList::setAllOpen(bool open)
}
}
void ConfigView::updateList(ConfigItem* item)
void ConfigView::updateList()
{
ConfigView* v;
for (v = viewList; v; v = v->nextView)
v->list->updateList(item);
v->list->updateList();
}
void ConfigView::updateListAll(void)
@ -1287,16 +1287,17 @@ 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);
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));
@ -1311,9 +1312,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 +1322,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)
@ -1381,7 +1380,6 @@ void ConfigSearchWindow::search(void)
ConfigMainWindow::ConfigMainWindow(void)
: searchWindow(0)
{
QMenuBar* menu;
bool ok = true;
QVariant x, y;
int width, height;
@ -1402,6 +1400,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);
@ -1432,10 +1439,6 @@ ConfigMainWindow::ConfigMainWindow(void)
setTabOrder(configList, helpText);
configList->setFocus();
menu = menuBar();
toolBar = new QToolBar("Tools", this);
addToolBar(toolBar);
backAction = new QAction(QPixmap(xpm_back), "Back", this);
connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
@ -1485,17 +1488,17 @@ ConfigMainWindow::ConfigMainWindow(void)
QActionGroup *optGroup = new QActionGroup(this);
optGroup->setExclusive(true);
connect(optGroup, SIGNAL(triggered(QAction*)), configView,
connect(optGroup, SIGNAL(triggered(QAction*)), configList,
SLOT(setOptionMode(QAction *)));
connect(optGroup, SIGNAL(triggered(QAction *)), menuView,
connect(optGroup, SIGNAL(triggered(QAction *)), menuList,
SLOT(setOptionMode(QAction *)));
configView->showNormalAction = new QAction("Show Normal Options", optGroup);
configView->showAllAction = new QAction("Show All Options", optGroup);
configView->showPromptAction = new QAction("Show Prompt Options", optGroup);
configView->showNormalAction->setCheckable(true);
configView->showAllAction->setCheckable(true);
configView->showPromptAction->setCheckable(true);
ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup);
ConfigList::showNormalAction->setCheckable(true);
ConfigList::showAllAction = new QAction("Show All Options", optGroup);
ConfigList::showAllAction->setCheckable(true);
ConfigList::showPromptAction = new QAction("Show Prompt Options", optGroup);
ConfigList::showPromptAction->setCheckable(true);
QAction *showDebugAction = new QAction("Show Debug Info", this);
showDebugAction->setCheckable(true);
@ -1508,6 +1511,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);
@ -1517,33 +1521,32 @@ 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 *menu = menuBar()->addMenu("&File");
menu->addAction(loadAction);
menu->addAction(saveAction);
menu->addAction(saveAsAction);
menu->addSeparator();
menu->addAction(quitAction);
// create edit menu
QMenu* editMenu = menu->addMenu("&Edit");
editMenu->addAction(searchAction);
menu = menuBar()->addMenu("&Edit");
menu->addAction(searchAction);
// create options menu
QMenu* optionMenu = menu->addMenu("&Option");
optionMenu->addAction(showNameAction);
optionMenu->addAction(showRangeAction);
optionMenu->addAction(showDataAction);
optionMenu->addSeparator();
optionMenu->addActions(optGroup->actions());
optionMenu->addSeparator();
optionMenu->addAction(showDebugAction);
menu = menuBar()->addMenu("&Option");
menu->addAction(showNameAction);
menu->addAction(showRangeAction);
menu->addAction(showDataAction);
menu->addSeparator();
menu->addActions(optGroup->actions());
menu->addSeparator();
menu->addAction(showDebugAction);
// create help menu
menu->addSeparator();
QMenu* helpMenu = menu->addMenu("&Help");
helpMenu->addAction(showIntroAction);
helpMenu->addAction(showAboutAction);
menu = menuBar()->addMenu("&Help");
menu->addAction(showIntroAction);
menu->addAction(showAboutAction);
connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
helpText, SLOT (clicked (const QUrl &)) );
@ -1646,7 +1649,7 @@ void ConfigMainWindow::saveConfigAs(void)
void ConfigMainWindow::searchConfig(void)
{
if (!searchWindow)
searchWindow = new ConfigSearchWindow(this, "search");
searchWindow = new ConfigSearchWindow(this);
searchWindow->show();
}

Просмотреть файл

@ -69,11 +69,13 @@ protected:
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);
void saveSettings(void);
void setOptionMode(QAction *action);
signals:
void menuChanged(struct menu *menu);
void menuSelected(struct menu *menu);
@ -85,35 +87,19 @@ public:
void updateListAll(void)
{
updateAll = true;
updateList(NULL);
updateList();
updateAll = false;
}
ConfigList* listView()
{
return this;
}
void addColumn(colIdx idx)
{
showColumn(idx);
}
void removeColumn(colIdx idx)
{
hideColumn(idx);
}
void setAllOpen(bool open);
void setParentMenu(void);
bool menuSkip(struct menu *);
void updateMenuList(ConfigItem *parent, struct menu*);
void updateMenuList(ConfigList *parent, struct menu*);
void updateMenuList(struct menu *menu);
bool updateAll;
QPixmap symbolYesPix, symbolModPix, symbolNoPix;
QPixmap choiceYesPix, choiceNoPix;
QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
bool showName, showRange, showData;
enum listMode mode;
enum optionMode optMode;
@ -121,6 +107,8 @@ public:
QPalette disabledColorGroup;
QPalette inactivedColorGroup;
QMenu* headerPopup;
static QAction *showNormalAction, *showAllAction, *showPromptAction;
};
class ConfigItem : public QTreeWidgetItem {
@ -168,28 +156,16 @@ public:
return ret;
}
void setText(colIdx idx, const QString& text)
{
Parent::setText(idx, text);
}
QString text(colIdx idx) const
{
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;
struct menu *menu;
bool visible;
bool goParent;
static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
static QIcon choiceYesIcon, choiceNoIcon;
static QIcon menuIcon, menubackIcon;
};
class ConfigLineEdit : public QLineEdit {
@ -214,7 +190,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; }
@ -224,7 +200,6 @@ public slots:
void setShowName(bool);
void setShowRange(bool);
void setShowData(bool);
void setOptionMode(QAction *);
signals:
void showNameChanged(bool);
void showRangeChanged(bool);
@ -235,10 +210,6 @@ public:
static ConfigView* viewList;
ConfigView* nextView;
static QAction *showNormalAction;
static QAction *showAllAction;
static QAction *showPromptAction;
};
class ConfigInfoView : public QTextBrowser {
@ -276,7 +247,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);
@ -326,7 +297,6 @@ protected:
ConfigView *configView;
ConfigList *configList;
ConfigInfoView *helpText;
QToolBar *toolBar;
QAction *backAction;
QAction *singleViewAction;
QAction *splitViewAction;

Просмотреть файл

@ -15,15 +15,21 @@ struct symbol symbol_yes = {
.name = "y",
.curr = { "y", yes },
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_mod = {
};
struct symbol symbol_mod = {
.name = "m",
.curr = { "m", mod },
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_no = {
};
struct symbol symbol_no = {
.name = "n",
.curr = { "n", no },
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_empty = {
};
static struct symbol symbol_empty = {
.name = "",
.curr = { "", no },
.flags = SYMBOL_VALID,
@ -31,7 +37,7 @@ struct symbol symbol_yes = {
struct symbol *sym_defconfig_list;
struct symbol *modules_sym;
tristate modules_val;
static tristate modules_val;
enum symbol_type sym_get_type(struct symbol *sym)
{