Commit f9893351 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull Kconfig updates from Masahiro Yamada:

 - Remove unused or useless code from qconf

 - Allow to edit "int", "hex", "string" options in place, and remove the
   separate edit box from qconf

* tag 'kconfig-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: qconf: create QApplication after option checks
  kconfig: qconf: remove Y, M, N columns
  kconfig: qconf: remove ConfigView class
  kconfig: qconf: move setShowName/Range() to ConfigList from ConfigView
  kconfig: qconf: remove ConfigLineEdit class
  kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
  kconfig: qconf: show data column all the time
  kconfig: qconf: move ConfigView::updateList(All) to ConfigList class
  kconfig: qconf: remove unused ConfigItem::okRename()
  kconfig: qconf: update the intro message to match to the current code
  kconfig: qconf: reformat the intro message
parents 746b25b1 f9a825a7
...@@ -82,14 +82,6 @@ QIcon ConfigItem::choiceNoIcon; ...@@ -82,14 +82,6 @@ QIcon ConfigItem::choiceNoIcon;
QIcon ConfigItem::menuIcon; QIcon ConfigItem::menuIcon;
QIcon ConfigItem::menubackIcon; QIcon ConfigItem::menubackIcon;
/*
* set the new data
* TODO check the value
*/
void ConfigItem::okRename(int col)
{
}
/* /*
* update the displayed of a menu entry * update the displayed of a menu entry
*/ */
...@@ -147,9 +139,6 @@ void ConfigItem::updateMenu(void) ...@@ -147,9 +139,6 @@ void ConfigItem::updateMenu(void)
if (!sym_is_changeable(sym) && list->optMode == normalOpt) { if (!sym_is_changeable(sym) && list->optMode == normalOpt) {
setIcon(promptColIdx, QIcon()); setIcon(promptColIdx, QIcon());
setText(noColIdx, QString());
setText(modColIdx, QString());
setText(yesColIdx, QString());
break; break;
} }
expr = sym_get_tristate_value(sym); expr = sym_get_tristate_value(sym);
...@@ -159,12 +148,10 @@ void ConfigItem::updateMenu(void) ...@@ -159,12 +148,10 @@ void ConfigItem::updateMenu(void)
setIcon(promptColIdx, choiceYesIcon); setIcon(promptColIdx, choiceYesIcon);
else else
setIcon(promptColIdx, symbolYesIcon); setIcon(promptColIdx, symbolYesIcon);
setText(yesColIdx, "Y");
ch = 'Y'; ch = 'Y';
break; break;
case mod: case mod:
setIcon(promptColIdx, symbolModIcon); setIcon(promptColIdx, symbolModIcon);
setText(modColIdx, "M");
ch = 'M'; ch = 'M';
break; break;
default: default:
...@@ -172,31 +159,16 @@ void ConfigItem::updateMenu(void) ...@@ -172,31 +159,16 @@ void ConfigItem::updateMenu(void)
setIcon(promptColIdx, choiceNoIcon); setIcon(promptColIdx, choiceNoIcon);
else else
setIcon(promptColIdx, symbolNoIcon); setIcon(promptColIdx, symbolNoIcon);
setText(noColIdx, "N");
ch = 'N'; ch = 'N';
break; break;
} }
if (expr != no)
setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0);
if (expr != mod)
setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0);
if (expr != yes)
setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0);
setText(dataColIdx, QChar(ch)); setText(dataColIdx, QChar(ch));
break; break;
case S_INT: case S_INT:
case S_HEX: case S_HEX:
case S_STRING: case S_STRING:
const char* data; setText(dataColIdx, sym_get_string_value(sym));
data = sym_get_string_value(sym);
setText(dataColIdx, data);
if (type == S_STRING)
prompt = QString("%1: %2").arg(prompt).arg(data);
else
prompt = QString("(%2) %1").arg(prompt).arg(data);
break; break;
} }
if (!sym_has_value(sym) && visible) if (!sym_has_value(sym) && visible)
...@@ -237,6 +209,17 @@ void ConfigItem::init(void) ...@@ -237,6 +209,17 @@ void ConfigItem::init(void)
if (list->mode != fullMode) if (list->mode != fullMode)
setExpanded(true); setExpanded(true);
sym_calc_value(menu->sym); sym_calc_value(menu->sym);
if (menu->sym) {
enum symbol_type type = menu->sym->type;
// Allow to edit "int", "hex", and "string" in-place in
// the data column. Unfortunately, you cannot specify
// the flags per column. Set ItemIsEditable for all
// columns here, and check the column in createEditor().
if (type == S_INT || type == S_HEX || type == S_STRING)
setFlags(flags() | Qt::ItemIsEditable);
}
} }
updateMenu(); updateMenu();
} }
...@@ -257,46 +240,65 @@ ConfigItem::~ConfigItem(void) ...@@ -257,46 +240,65 @@ ConfigItem::~ConfigItem(void)
} }
} }
ConfigLineEdit::ConfigLineEdit(ConfigView* parent) QWidget *ConfigItemDelegate::createEditor(QWidget *parent,
: Parent(parent) const QStyleOptionViewItem &option,
const QModelIndex &index) const
{ {
connect(this, SIGNAL(editingFinished()), SLOT(hide())); ConfigItem *item;
}
void ConfigLineEdit::show(ConfigItem* i) // Only the data column is editable
{ if (index.column() != dataColIdx)
item = i; return nullptr;
if (sym_get_string_value(item->menu->sym))
setText(sym_get_string_value(item->menu->sym)); // You cannot edit invisible menus
else item = static_cast<ConfigItem *>(index.internalPointer());
setText(QString()); if (!item || !item->menu || !menu_is_visible(item->menu))
Parent::show(); return nullptr;
setFocus();
return QStyledItemDelegate::createEditor(parent, option, index);
} }
void ConfigLineEdit::keyPressEvent(QKeyEvent* e) void ConfigItemDelegate::setModelData(QWidget *editor,
QAbstractItemModel *model,
const QModelIndex &index) const
{ {
switch (e->key()) { QLineEdit *lineEdit;
case Qt::Key_Escape: ConfigItem *item;
break; struct symbol *sym;
case Qt::Key_Return: bool success;
case Qt::Key_Enter:
sym_set_string_value(item->menu->sym, text().toLatin1()); lineEdit = qobject_cast<QLineEdit *>(editor);
parent()->updateList(); // If this is not a QLineEdit, use the parent's default.
break; // (does this happen?)
default: if (!lineEdit)
Parent::keyPressEvent(e); goto parent;
return;
item = static_cast<ConfigItem *>(index.internalPointer());
if (!item || !item->menu)
goto parent;
sym = item->menu->sym;
if (!sym)
goto parent;
success = sym_set_string_value(sym, lineEdit->text().toUtf8().data());
if (success) {
ConfigList::updateListForAll();
} else {
QMessageBox::information(editor, "qconf",
"Cannot set the data (maybe due to out of range).\n"
"Setting the old value.");
lineEdit->setText(sym_get_string_value(sym));
} }
e->accept();
parent()->list->setFocus(); parent:
hide(); QStyledItemDelegate::setModelData(editor, model, index);
} }
ConfigList::ConfigList(ConfigView* p, const char *name) ConfigList::ConfigList(QWidget *parent, const char *name)
: Parent(p), : QTreeWidget(parent),
updateAll(false), updateAll(false),
showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt), showName(false), mode(singleMode), optMode(normalOpt),
rootEntry(0), headerPopup(0) rootEntry(0), headerPopup(0)
{ {
setObjectName(name); setObjectName(name);
...@@ -306,7 +308,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) ...@@ -306,7 +308,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
setVerticalScrollMode(ScrollPerPixel); setVerticalScrollMode(ScrollPerPixel);
setHorizontalScrollMode(ScrollPerPixel); setHorizontalScrollMode(ScrollPerPixel);
setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value"); setHeaderLabels(QStringList() << "Option" << "Name" << "Value");
connect(this, SIGNAL(itemSelectionChanged(void)), connect(this, SIGNAL(itemSelectionChanged(void)),
SLOT(updateSelection(void))); SLOT(updateSelection(void)));
...@@ -314,8 +316,6 @@ ConfigList::ConfigList(ConfigView* p, const char *name) ...@@ -314,8 +316,6 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
if (name) { if (name) {
configSettings->beginGroup(name); configSettings->beginGroup(name);
showName = configSettings->value("/showName", false).toBool(); showName = configSettings->value("/showName", false).toBool();
showRange = configSettings->value("/showRange", false).toBool();
showData = configSettings->value("/showData", false).toBool();
optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt(); optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();
configSettings->endGroup(); configSettings->endGroup();
connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
...@@ -323,9 +323,18 @@ ConfigList::ConfigList(ConfigView* p, const char *name) ...@@ -323,9 +323,18 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
showColumn(promptColIdx); showColumn(promptColIdx);
setItemDelegate(new ConfigItemDelegate(this));
allLists.append(this);
reinit(); reinit();
} }
ConfigList::~ConfigList()
{
allLists.removeOne(this);
}
bool ConfigList::menuSkip(struct menu *menu) bool ConfigList::menuSkip(struct menu *menu)
{ {
if (optMode == normalOpt && menu_is_visible(menu)) if (optMode == normalOpt && menu_is_visible(menu))
...@@ -339,21 +348,10 @@ bool ConfigList::menuSkip(struct menu *menu) ...@@ -339,21 +348,10 @@ bool ConfigList::menuSkip(struct menu *menu)
void ConfigList::reinit(void) void ConfigList::reinit(void)
{ {
hideColumn(dataColIdx);
hideColumn(yesColIdx);
hideColumn(modColIdx);
hideColumn(noColIdx);
hideColumn(nameColIdx); hideColumn(nameColIdx);
if (showName) if (showName)
showColumn(nameColIdx); showColumn(nameColIdx);
if (showRange) {
showColumn(noColIdx);
showColumn(modColIdx);
showColumn(yesColIdx);
}
if (showData)
showColumn(dataColIdx);
updateListAll(); updateListAll();
} }
...@@ -375,8 +373,6 @@ void ConfigList::saveSettings(void) ...@@ -375,8 +373,6 @@ void ConfigList::saveSettings(void)
if (!objectName().isEmpty()) { if (!objectName().isEmpty()) {
configSettings->beginGroup(objectName()); configSettings->beginGroup(objectName());
configSettings->setValue("/showName", showName); configSettings->setValue("/showName", showName);
configSettings->setValue("/showRange", showRange);
configSettings->setValue("/showData", showData);
configSettings->setValue("/optionMode", (int)optMode); configSettings->setValue("/optionMode", (int)optMode);
configSettings->endGroup(); configSettings->endGroup();
} }
...@@ -462,6 +458,28 @@ update: ...@@ -462,6 +458,28 @@ update:
resizeColumnToContents(0); resizeColumnToContents(0);
} }
void ConfigList::updateListForAll()
{
QListIterator<ConfigList *> it(allLists);
while (it.hasNext()) {
ConfigList *list = it.next();
list->updateList();
}
}
void ConfigList::updateListAllForAll()
{
QListIterator<ConfigList *> it(allLists);
while (it.hasNext()) {
ConfigList *list = it.next();
list->updateList();
}
}
void ConfigList::setValue(ConfigItem* item, tristate val) void ConfigList::setValue(ConfigItem* item, tristate val)
{ {
struct symbol* sym; struct symbol* sym;
...@@ -482,7 +500,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val) ...@@ -482,7 +500,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
return; return;
if (oldval == no && item->menu->list) if (oldval == no && item->menu->list)
item->setExpanded(true); item->setExpanded(true);
parent()->updateList(); ConfigList::updateListForAll();
break; break;
} }
} }
...@@ -516,12 +534,9 @@ void ConfigList::changeValue(ConfigItem* item) ...@@ -516,12 +534,9 @@ void ConfigList::changeValue(ConfigItem* item)
item->setExpanded(true); item->setExpanded(true);
} }
if (oldexpr != newexpr) if (oldexpr != newexpr)
parent()->updateList(); ConfigList::updateListForAll();
break; break;
case S_INT: default:
case S_HEX:
case S_STRING:
parent()->lineEdit->show(item);
break; break;
} }
} }
...@@ -804,15 +819,6 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e) ...@@ -804,15 +819,6 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e)
} }
} }
break; break;
case noColIdx:
setValue(item, no);
break;
case modColIdx:
setValue(item, mod);
break;
case yesColIdx:
setValue(item, yes);
break;
case dataColIdx: case dataColIdx:
changeValue(item); changeValue(item);
break; break;
...@@ -883,95 +889,31 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) ...@@ -883,95 +889,31 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action = new QAction("Show Name", this); action = new QAction("Show Name", this);
action->setCheckable(true); action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)), connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool))); SLOT(setShowName(bool)));
connect(parent(), SIGNAL(showNameChanged(bool)), connect(this, SIGNAL(showNameChanged(bool)),
action, SLOT(setChecked(bool))); action, SLOT(setChecked(bool)));
action->setChecked(showName); action->setChecked(showName);
headerPopup->addAction(action); 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(setChecked(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(setChecked(bool)));
action->setChecked(showData);
headerPopup->addAction(action);
} }
headerPopup->exec(e->globalPos()); headerPopup->exec(e->globalPos());
e->accept(); e->accept();
} }
ConfigView*ConfigView::viewList; void ConfigList::setShowName(bool on)
QAction *ConfigList::showNormalAction;
QAction *ConfigList::showAllAction;
QAction *ConfigList::showPromptAction;
ConfigView::ConfigView(QWidget* parent, const char *name)
: Parent(parent)
{
setObjectName(name);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->setContentsMargins(0, 0, 0, 0);
list = new ConfigList(this);
verticalLayout->addWidget(list);
lineEdit = new ConfigLineEdit(this);
lineEdit->hide();
verticalLayout->addWidget(lineEdit);
this->nextView = viewList;
viewList = this;
}
ConfigView::~ConfigView(void)
{ {
ConfigView** vp; if (showName == on)
return;
for (vp = &viewList; *vp; vp = &(*vp)->nextView) {
if (*vp == this) {
*vp = nextView;
break;
}
}
}
void ConfigView::setShowName(bool b)
{
if (list->showName != b) {
list->showName = b;
list->reinit();
emit showNameChanged(b);
}
}
void ConfigView::setShowRange(bool b) showName = on;
{ reinit();
if (list->showRange != b) { emit showNameChanged(on);
list->showRange = b;
list->reinit();
emit showRangeChanged(b);
}
} }
void ConfigView::setShowData(bool b) QList<ConfigList *> ConfigList::allLists;
{ QAction *ConfigList::showNormalAction;
if (list->showData != b) { QAction *ConfigList::showAllAction;
list->showData = b; QAction *ConfigList::showPromptAction;
list->reinit();
emit showDataChanged(b);
}
}
void ConfigList::setAllOpen(bool open) void ConfigList::setAllOpen(bool open)
{ {
...@@ -984,22 +926,6 @@ void ConfigList::setAllOpen(bool open) ...@@ -984,22 +926,6 @@ void ConfigList::setAllOpen(bool open)
} }
} }
void ConfigView::updateList()
{
ConfigView* v;
for (v = viewList; v; v = v->nextView)
v->list->updateList();
}
void ConfigView::updateListAll(void)
{
ConfigView* v;
for (v = viewList; v; v = v->nextView)
v->list->updateListAll();
}
ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
: Parent(parent), sym(0), _menu(0) : Parent(parent), sym(0), _menu(0)
{ {
...@@ -1315,12 +1241,12 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) ...@@ -1315,12 +1241,12 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
split = new QSplitter(this); split = new QSplitter(this);
split->setOrientation(Qt::Vertical); split->setOrientation(Qt::Vertical);
list = new ConfigView(split, "search"); list = new ConfigList(split, "search");
list->list->mode = listMode; list->mode = listMode;
info = new ConfigInfoView(split, "search"); info = new ConfigInfoView(split, "search");
connect(list->list, SIGNAL(menuChanged(struct menu *)), connect(list, SIGNAL(menuChanged(struct menu *)),
info, SLOT(setInfo(struct menu *))); info, SLOT(setInfo(struct menu *)));
connect(list->list, SIGNAL(menuChanged(struct menu *)), connect(list, SIGNAL(menuChanged(struct menu *)),
parent, SLOT(setMenuLink(struct menu *))); parent, SLOT(setMenuLink(struct menu *)));
layout1->addWidget(split); layout1->addWidget(split);
...@@ -1364,7 +1290,7 @@ void ConfigSearchWindow::search(void) ...@@ -1364,7 +1290,7 @@ void ConfigSearchWindow::search(void)
ConfigItem *lastItem = NULL; ConfigItem *lastItem = NULL;
free(result); free(result);
list->list->clear(); list->clear();
info->clear(); info->clear();
result = sym_re_search(editField->text().toLatin1()); result = sym_re_search(editField->text().toLatin1());
...@@ -1372,7 +1298,7 @@ void ConfigSearchWindow::search(void) ...@@ -1372,7 +1298,7 @@ void ConfigSearchWindow::search(void)
return; return;
for (p = result; *p; p++) { for (p = result; *p; p++) {
for_all_prompts((*p), prop) for_all_prompts((*p), prop)
lastItem = new ConfigItem(list->list, lastItem, prop->menu, lastItem = new ConfigItem(list, lastItem, prop->menu,
menu_is_visible(prop->menu)); menu_is_visible(prop->menu));
} }
} }
...@@ -1420,23 +1346,21 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1420,23 +1346,21 @@ ConfigMainWindow::ConfigMainWindow(void)
split1->setOrientation(Qt::Horizontal); split1->setOrientation(Qt::Horizontal);
split1->setChildrenCollapsible(false); split1->setChildrenCollapsible(false);
menuView = new ConfigView(widget, "menu"); menuList = new ConfigList(widget, "menu");
menuList = menuView->list;
split2 = new QSplitter(widget); split2 = new QSplitter(widget);
split2->setChildrenCollapsible(false); split2->setChildrenCollapsible(false);
split2->setOrientation(Qt::Vertical); split2->setOrientation(Qt::Vertical);
// create config tree // create config tree
configView = new ConfigView(widget, "config"); configList = new ConfigList(widget, "config");
configList = configView->list;
helpText = new ConfigInfoView(widget, "help"); helpText = new ConfigInfoView(widget, "help");
layout->addWidget(split2); layout->addWidget(split2);
split2->addWidget(split1); split2->addWidget(split1);
split1->addWidget(configView); split1->addWidget(configList);
split1->addWidget(menuView); split1->addWidget(menuList);
split2->addWidget(helpText); split2->addWidget(helpText);
setTabOrder(configList, helpText); setTabOrder(configList, helpText);
...@@ -1480,14 +1404,8 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1480,14 +1404,8 @@ ConfigMainWindow::ConfigMainWindow(void)
QAction *showNameAction = new QAction("Show Name", this); QAction *showNameAction = new QAction("Show Name", this);
showNameAction->setCheckable(true); showNameAction->setCheckable(true);
connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); connect(showNameAction, SIGNAL(toggled(bool)), configList, SLOT(setShowName(bool)));
showNameAction->setChecked(configView->showName()); showNameAction->setChecked(configList->showName);
QAction *showRangeAction = new QAction("Show Range", this);
showRangeAction->setCheckable(true);
connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
QAction *showDataAction = new QAction("Show Data", this);
showDataAction->setCheckable(true);
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
QActionGroup *optGroup = new QActionGroup(this); QActionGroup *optGroup = new QActionGroup(this);
optGroup->setExclusive(true); optGroup->setExclusive(true);
...@@ -1539,8 +1457,6 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1539,8 +1457,6 @@ ConfigMainWindow::ConfigMainWindow(void)
// create options menu // create options menu
menu = menuBar()->addMenu("&Option"); menu = menuBar()->addMenu("&Option");
menu->addAction(showNameAction); menu->addAction(showNameAction);
menu->addAction(showRangeAction);
menu->addAction(showDataAction);
menu->addSeparator(); menu->addSeparator();
menu->addActions(optGroup->actions()); menu->addActions(optGroup->actions());
menu->addSeparator(); menu->addSeparator();
...@@ -1613,7 +1529,7 @@ void ConfigMainWindow::loadConfig(void) ...@@ -1613,7 +1529,7 @@ void ConfigMainWindow::loadConfig(void)
free(configname); free(configname);
configname = xstrdup(name); configname = xstrdup(name);
ConfigView::updateListAll(); ConfigList::updateListAllForAll();
} }
bool ConfigMainWindow::saveConfig(void) bool ConfigMainWindow::saveConfig(void)
...@@ -1748,7 +1664,7 @@ void ConfigMainWindow::showSingleView(void) ...@@ -1748,7 +1664,7 @@ void ConfigMainWindow::showSingleView(void)
backAction->setEnabled(true); backAction->setEnabled(true);
menuView->hide(); menuList->hide();
menuList->setRootMenu(0); menuList->setRootMenu(0);
configList->mode = singleMode; configList->mode = singleMode;
if (configList->rootEntry == &rootmenu) if (configList->rootEntry == &rootmenu)
...@@ -1779,7 +1695,7 @@ void ConfigMainWindow::showSplitView(void) ...@@ -1779,7 +1695,7 @@ void ConfigMainWindow::showSplitView(void)
menuList->mode = symbolMode; menuList->mode = symbolMode;
menuList->setRootMenu(&rootmenu); menuList->setRootMenu(&rootmenu);
menuList->setAllOpen(true); menuList->setAllOpen(true);
menuView->show(); menuList->show();
menuList->setFocus(); menuList->setFocus();
} }
...@@ -1794,7 +1710,7 @@ void ConfigMainWindow::showFullView(void) ...@@ -1794,7 +1710,7 @@ void ConfigMainWindow::showFullView(void)
backAction->setEnabled(false); backAction->setEnabled(false);
menuView->hide(); menuList->hide();
menuList->setRootMenu(0); menuList->setRootMenu(0);
configList->mode = fullMode; configList->mode = fullMode;
if (configList->rootEntry == &rootmenu) if (configList->rootEntry == &rootmenu)
...@@ -1836,17 +1752,26 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) ...@@ -1836,17 +1752,26 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
void ConfigMainWindow::showIntro(void) void ConfigMainWindow::showIntro(void)
{ {
static const QString str = "Welcome to the qconf graphical configuration tool.\n\n" static const QString str =
"For each option, a blank box indicates the feature is disabled, a check\n" "Welcome to the qconf graphical configuration tool.\n"
"indicates it is enabled, and a dot indicates that it is to be compiled\n" "\n"
"as a module. Clicking on the box will cycle through the three states.\n\n" "For bool and tristate options, a blank box indicates the "
"If you do not see an option (e.g., a device driver) that you believe\n" "feature is disabled, a check indicates it is enabled, and a "
"should be present, try turning on Show All Options under the Options menu.\n" "dot indicates that it is to be compiled as a module. Clicking "
"Although there is no cross reference yet to help you figure out what other\n" "on the box will cycle through the three states. For int, hex, "
"options must be enabled to support the option you are interested in, you can\n" "and string options, double-clicking or pressing F2 on the "
"still view the help of a grayed-out option.\n\n" "Value cell will allow you to edit the value.\n"
"Toggling Show Debug Info under the Options menu will show the dependencies,\n" "\n"
"which you can then match by examining other options.\n\n"; "If you do not see an option (e.g., a device driver) that you "
"believe should be present, try turning on Show All Options "
"under the Options menu. Enabling Show Debug Info will help you"
"figure out what other options must be enabled to support the "
"option you are interested in, and hyperlinks will navigate to "
"them.\n"
"\n"
"Toggling Show Debug Info under the Options menu will show the "
"dependencies, which you can then match by examining other "
"options.\n";
QMessageBox::information(this, "qconf", str); QMessageBox::information(this, "qconf", str);
} }
...@@ -1926,7 +1851,6 @@ int main(int ac, char** av) ...@@ -1926,7 +1851,6 @@ int main(int ac, char** av)
const char *name; const char *name;
progname = av[0]; progname = av[0];
configApp = new QApplication(ac, av);
if (ac > 1 && av[1][0] == '-') { if (ac > 1 && av[1][0] == '-') {
switch (av[1][1]) { switch (av[1][1]) {
case 's': case 's':
...@@ -1947,6 +1871,8 @@ int main(int ac, char** av) ...@@ -1947,6 +1871,8 @@ int main(int ac, char** av)
conf_read(NULL); conf_read(NULL);
//zconfdump(stdout); //zconfdump(stdout);
configApp = new QApplication(ac, av);
configSettings = new ConfigSettings(); configSettings = new ConfigSettings();
configSettings->beginGroup("/kconfig/qconf"); configSettings->beginGroup("/kconfig/qconf");
v = new ConfigMainWindow(); v = new ConfigMainWindow();
......
...@@ -11,15 +11,14 @@ ...@@ -11,15 +11,14 @@
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
#include <QSplitter> #include <QSplitter>
#include <QStyledItemDelegate>
#include <QTextBrowser> #include <QTextBrowser>
#include <QTreeWidget> #include <QTreeWidget>
#include "expr.h" #include "expr.h"
class ConfigView;
class ConfigList; class ConfigList;
class ConfigItem; class ConfigItem;
class ConfigLineEdit;
class ConfigMainWindow; class ConfigMainWindow;
class ConfigSettings : public QSettings { class ConfigSettings : public QSettings {
...@@ -30,7 +29,7 @@ class ConfigSettings : public QSettings { ...@@ -30,7 +29,7 @@ class ConfigSettings : public QSettings {
}; };
enum colIdx { enum colIdx {
promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx promptColIdx, nameColIdx, dataColIdx
}; };
enum listMode { enum listMode {
singleMode, menuMode, symbolMode, fullMode, listMode singleMode, menuMode, symbolMode, fullMode, listMode
...@@ -43,13 +42,10 @@ class ConfigList : public QTreeWidget { ...@@ -43,13 +42,10 @@ class ConfigList : public QTreeWidget {
Q_OBJECT Q_OBJECT
typedef class QTreeWidget Parent; typedef class QTreeWidget Parent;
public: public:
ConfigList(ConfigView* p, const char *name = 0); ConfigList(QWidget *parent, const char *name = 0);
~ConfigList();
void reinit(void); void reinit(void);
ConfigItem* findConfigItem(struct menu *); ConfigItem* findConfigItem(struct menu *);
ConfigView* parent(void) const
{
return (ConfigView*)Parent::parent();
}
void setSelected(QTreeWidgetItem *item, bool enable) { void setSelected(QTreeWidgetItem *item, bool enable) {
for (int i = 0; i < selectedItems().size(); i++) for (int i = 0; i < selectedItems().size(); i++)
selectedItems().at(i)->setSelected(false); selectedItems().at(i)->setSelected(false);
...@@ -75,6 +71,7 @@ public slots: ...@@ -75,6 +71,7 @@ public slots:
void updateSelection(void); void updateSelection(void);
void saveSettings(void); void saveSettings(void);
void setOptionMode(QAction *action); void setOptionMode(QAction *action);
void setShowName(bool on);
signals: signals:
void menuChanged(struct menu *menu); void menuChanged(struct menu *menu);
...@@ -82,6 +79,7 @@ public slots: ...@@ -82,6 +79,7 @@ public slots:
void itemSelected(struct menu *menu); void itemSelected(struct menu *menu);
void parentSelected(void); void parentSelected(void);
void gotFocus(struct menu *); void gotFocus(struct menu *);
void showNameChanged(bool on);
public: public:
void updateListAll(void) void updateListAll(void)
...@@ -100,7 +98,7 @@ public slots: ...@@ -100,7 +98,7 @@ public slots:
bool updateAll; bool updateAll;
bool showName, showRange, showData; bool showName;
enum listMode mode; enum listMode mode;
enum optionMode optMode; enum optionMode optMode;
struct menu *rootEntry; struct menu *rootEntry;
...@@ -108,6 +106,10 @@ public slots: ...@@ -108,6 +106,10 @@ public slots:
QPalette inactivedColorGroup; QPalette inactivedColorGroup;
QMenu* headerPopup; QMenu* headerPopup;
static QList<ConfigList *> allLists;
static void updateListForAll();
static void updateListAllForAll();
static QAction *showNormalAction, *showAllAction, *showPromptAction; static QAction *showNormalAction, *showAllAction, *showPromptAction;
}; };
...@@ -131,7 +133,6 @@ class ConfigItem : public QTreeWidgetItem { ...@@ -131,7 +133,6 @@ class ConfigItem : public QTreeWidgetItem {
} }
~ConfigItem(void); ~ConfigItem(void);
void init(void); void init(void);
void okRename(int col);
void updateMenu(void); void updateMenu(void);
void testUpdateMenu(bool v); void testUpdateMenu(bool v);
ConfigList* listView() const ConfigList* listView() const
...@@ -168,48 +169,18 @@ class ConfigItem : public QTreeWidgetItem { ...@@ -168,48 +169,18 @@ class ConfigItem : public QTreeWidgetItem {
static QIcon menuIcon, menubackIcon; static QIcon menuIcon, menubackIcon;
}; };
class ConfigLineEdit : public QLineEdit { class ConfigItemDelegate : public QStyledItemDelegate
Q_OBJECT {
typedef class QLineEdit Parent; private:
public: struct menu *menu;
ConfigLineEdit(ConfigView* parent);
ConfigView* parent(void) const
{
return (ConfigView*)Parent::parent();
}
void show(ConfigItem *i);
void keyPressEvent(QKeyEvent *e);
public:
ConfigItem *item;
};
class ConfigView : public QWidget {
Q_OBJECT
typedef class QWidget Parent;
public:
ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void);
static void updateList();
static void updateListAll(void);
bool showName(void) const { return list->showName; }
bool showRange(void) const { return list->showRange; }
bool showData(void) const { return list->showData; }
public slots:
void setShowName(bool);
void setShowRange(bool);
void setShowData(bool);
signals:
void showNameChanged(bool);
void showRangeChanged(bool);
void showDataChanged(bool);
public: public:
ConfigList* list; ConfigItemDelegate(QObject *parent = nullptr)
ConfigLineEdit* lineEdit; : QStyledItemDelegate(parent) {}
QWidget *createEditor(QWidget *parent,
static ConfigView* viewList; const QStyleOptionViewItem &option,
ConfigView* nextView; const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;
}; };
class ConfigInfoView : public QTextBrowser { class ConfigInfoView : public QTextBrowser {
...@@ -257,7 +228,7 @@ public slots: ...@@ -257,7 +228,7 @@ public slots:
QLineEdit* editField; QLineEdit* editField;
QPushButton* searchButton; QPushButton* searchButton;
QSplitter* split; QSplitter* split;
ConfigView* list; ConfigList *list;
ConfigInfoView* info; ConfigInfoView* info;
struct symbol **result; struct symbol **result;
...@@ -292,9 +263,7 @@ public slots: ...@@ -292,9 +263,7 @@ public slots:
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);
ConfigSearchWindow *searchWindow; ConfigSearchWindow *searchWindow;
ConfigView *menuView;
ConfigList *menuList; ConfigList *menuList;
ConfigView *configView;
ConfigList *configList; ConfigList *configList;
ConfigInfoView *helpText; ConfigInfoView *helpText;
QAction *backAction; QAction *backAction;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment