summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorBoris Barbulovski <bbarbulovski@gmail.com>2015-09-22 11:36:14 -0700
committerMichal Marek <mmarek@suse.com>2015-10-14 14:59:02 +0200
commit76538660fb08f2f794d569a594a95fc55eb03932 (patch)
tree8594586cb8a8a77d2ce3fab373ebd2ed095e8604 /scripts/kconfig
parent780505e33f0af32808257fd8b6ace5c3e3d9666f (diff)
downloadlinux-stable-76538660fb08f2f794d569a594a95fc55eb03932.tar.gz
linux-stable-76538660fb08f2f794d569a594a95fc55eb03932.tar.bz2
linux-stable-76538660fb08f2f794d569a594a95fc55eb03932.zip
Port xconfig to Qt5 - Remove custom ListView classes.
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Thiago Macieira <thiago.macieira@intel.com> Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/qconf.cc904
-rw-r--r--scripts/kconfig/qconf.h177
2 files changed, 15 insertions, 1066 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index f439f355dddc..319559f361ac 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -87,213 +87,15 @@ bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
return writeEntry(key, stringList);
}
-
-/*
- * set the new data
- * TODO check the value
- */
-void ConfigItem::okRename(int col)
-{
- Parent::okRename(col);
- sym_set_string_value(menu->sym, text(dataColIdx).latin1());
- listView()->updateList(this);
-}
-
-/*
- * update the displayed of a menu entry
- */
-void ConfigItem::updateMenu(void)
-{
- ConfigList* list;
- struct symbol* sym;
- struct property *prop;
- QString prompt;
- int type;
- tristate expr;
-
- list = listView();
- if (goParent) {
- setPixmap(promptColIdx, list->menuBackPix);
- prompt = "..";
- goto set_prompt;
- }
-
- sym = menu->sym;
- prop = menu->prompt;
- prompt = _(menu_get_prompt(menu));
-
- if (prop) switch (prop->type) {
- case P_MENU:
- if (list->mode == singleMode || list->mode == symbolMode) {
- /* a menuconfig entry is displayed differently
- * depending whether it's at the view root or a child.
- */
- if (sym && list->rootEntry == menu)
- break;
- setPixmap(promptColIdx, list->menuPix);
- } else {
- if (sym)
- break;
- setPixmap(promptColIdx, 0);
- }
- goto set_prompt;
- case P_COMMENT:
- setPixmap(promptColIdx, 0);
- goto set_prompt;
- default:
- ;
- }
- if (!sym)
- goto set_prompt;
-
- setText(nameColIdx, QString::fromLocal8Bit(sym->name));
-
- type = sym_get_type(sym);
- switch (type) {
- case S_BOOLEAN:
- case S_TRISTATE:
- char ch;
-
- if (!sym_is_changable(sym) && list->optMode == normalOpt) {
- setPixmap(promptColIdx, 0);
- setText(noColIdx, QString::null);
- setText(modColIdx, QString::null);
- setText(yesColIdx, QString::null);
- break;
- }
- expr = sym_get_tristate_value(sym);
- switch (expr) {
- case yes:
- if (sym_is_choice_value(sym) && type == S_BOOLEAN)
- setPixmap(promptColIdx, list->choiceYesPix);
- else
- setPixmap(promptColIdx, list->symbolYesPix);
- setText(yesColIdx, "Y");
- ch = 'Y';
- break;
- case mod:
- setPixmap(promptColIdx, list->symbolModPix);
- setText(modColIdx, "M");
- ch = 'M';
- break;
- default:
- if (sym_is_choice_value(sym) && type == S_BOOLEAN)
- setPixmap(promptColIdx, list->choiceNoPix);
- else
- setPixmap(promptColIdx, list->symbolNoPix);
- setText(noColIdx, "N");
- ch = 'N';
- 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));
- break;
- case S_INT:
- case S_HEX:
- case S_STRING:
- const char* data;
-
- data = sym_get_string_value(sym);
-
- int i = list->mapIdx(dataColIdx);
- if (i >= 0)
- setRenameEnabled(i, TRUE);
- 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;
- }
- if (!sym_has_value(sym) && visible)
- prompt += _(" (NEW)");
-set_prompt:
- setText(promptColIdx, prompt);
-}
-
-void ConfigItem::testUpdateMenu(bool v)
-{
- ConfigItem* i;
-
- visible = v;
- if (!menu)
- return;
-
- sym_calc_value(menu->sym);
- if (menu->flags & MENU_CHANGED) {
- /* the menu entry changed, so update all list items */
- menu->flags &= ~MENU_CHANGED;
- for (i = (ConfigItem*)menu->data; i; i = i->nextItem)
- i->updateMenu();
- } else if (listView()->updateAll)
- updateMenu();
-}
-
-void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
-{
- ConfigList* list = listView();
-
- if (visible) {
- if (isSelected() && !list->hasFocus() && list->mode == menuMode)
- Parent::paintCell(p, list->inactivedColorGroup, column, width, align);
- else
- Parent::paintCell(p, cg, column, width, align);
- } else
- Parent::paintCell(p, list->disabledColorGroup, column, width, align);
-}
-
-/*
- * construct a menu entry
- */
-void ConfigItem::init(void)
-{
- if (menu) {
- ConfigList* list = listView();
- nextItem = (ConfigItem*)menu->data;
- menu->data = this;
-
- if (list->mode != fullMode)
- setOpen(TRUE);
- sym_calc_value(menu->sym);
- }
- updateMenu();
-}
-
-/*
- * destruct a menu entry
- */
-ConfigItem::~ConfigItem(void)
-{
- if (menu) {
- ConfigItem** ip = (ConfigItem**)&menu->data;
- for (; *ip; ip = &(*ip)->nextItem) {
- if (*ip == this) {
- *ip = nextItem;
- break;
- }
- }
- }
-}
-
ConfigLineEdit::ConfigLineEdit(ConfigView* parent)
: Parent(parent)
{
connect(this, SIGNAL(lostFocus()), SLOT(hide()));
}
-void ConfigLineEdit::show(ConfigItem* i)
+void ConfigLineEdit::show(Q3ListViewItem *i)
{
item = i;
- if (sym_get_string_value(item->menu->sym))
- setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym)));
- else
- setText(QString::null);
Parent::show();
setFocus();
}
@@ -305,7 +107,6 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
break;
case Qt::Key_Return:
case Qt::Key_Enter:
- sym_set_string_value(item->menu->sym, text().latin1());
parent()->updateList(item);
break;
default:
@@ -317,536 +118,6 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
hide();
}
-ConfigList::ConfigList(ConfigView* p, const char *name)
- : Parent(p, 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),
- showName(false), showRange(false), showData(false), optMode(normalOpt),
- rootEntry(0), headerPopup(0)
-{
- int i;
-
- setSorting(-1);
- setRootIsDecorated(TRUE);
- disabledColorGroup = palette().active();
- disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text());
- inactivedColorGroup = palette().active();
- inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight());
-
- connect(this, SIGNAL(selectionChanged(void)),
- SLOT(updateSelection(void)));
-
- if (name) {
- configSettings->beginGroup(name);
- showName = configSettings->readBoolEntry("/showName", false);
- showRange = configSettings->readBoolEntry("/showRange", false);
- showData = configSettings->readBoolEntry("/showData", false);
- optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false);
- configSettings->endGroup();
- connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
- }
-
- for (i = 0; i < colNr; i++)
- colMap[i] = colRevMap[i] = -1;
- addColumn(promptColIdx, _("Option"));
-
- reinit();
-}
-
-bool ConfigList::menuSkip(struct menu *menu)
-{
- if (optMode == normalOpt && menu_is_visible(menu))
- return false;
- if (optMode == promptOpt && menu_has_prompt(menu))
- return false;
- if (optMode == allOpt)
- return false;
- return true;
-}
-
-void ConfigList::reinit(void)
-{
- removeColumn(dataColIdx);
- removeColumn(yesColIdx);
- removeColumn(modColIdx);
- removeColumn(noColIdx);
- removeColumn(nameColIdx);
-
- if (showName)
- addColumn(nameColIdx, _("Name"));
- if (showRange) {
- addColumn(noColIdx, "N");
- addColumn(modColIdx, "M");
- addColumn(yesColIdx, "Y");
- }
- if (showData)
- addColumn(dataColIdx, _("Value"));
-
- updateListAll();
-}
-
-void ConfigList::saveSettings(void)
-{
- if (name()) {
- configSettings->beginGroup(name());
- configSettings->writeEntry("/showName", showName);
- configSettings->writeEntry("/showRange", showRange);
- configSettings->writeEntry("/showData", showData);
- configSettings->writeEntry("/optionMode", (int)optMode);
- configSettings->endGroup();
- }
-}
-
-ConfigItem* ConfigList::findConfigItem(struct menu *menu)
-{
- ConfigItem* item = (ConfigItem*)menu->data;
-
- for (; item; item = item->nextItem) {
- if (this == item->listView())
- break;
- }
-
- return item;
-}
-
-void ConfigList::updateSelection(void)
-{
- struct menu *menu;
- enum prop_type type;
-
- ConfigItem* item = (ConfigItem*)selectedItem();
- if (!item)
- return;
-
- menu = item->menu;
- emit menuChanged(menu);
- if (!menu)
- return;
- type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
- if (mode == menuMode && type == P_MENU)
- emit menuSelected(menu);
-}
-
-void ConfigList::updateList(ConfigItem* item)
-{
- ConfigItem* last = 0;
-
- if (!rootEntry) {
- if (mode != listMode)
- goto update;
- Q3ListViewItemIterator it(this);
- ConfigItem* item;
-
- for (; it.current(); ++it) {
- item = (ConfigItem*)it.current();
- if (!item->menu)
- continue;
- item->testUpdateMenu(menu_is_visible(item->menu));
- }
- return;
- }
-
- if (rootEntry != &rootmenu && (mode == singleMode ||
- (mode == symbolMode && rootEntry->parent != &rootmenu))) {
- item = firstChild();
- if (!item)
- item = new ConfigItem(this, 0, true);
- last = item;
- }
- if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
- rootEntry->sym && rootEntry->prompt) {
- item = last ? last->nextSibling() : firstChild();
- if (!item)
- item = new ConfigItem(this, last, rootEntry, true);
- else
- item->testUpdateMenu(true);
-
- updateMenuList(item, rootEntry);
- triggerUpdate();
- return;
- }
-update:
- updateMenuList(this, rootEntry);
- triggerUpdate();
-}
-
-void ConfigList::setValue(ConfigItem* item, tristate val)
-{
- struct symbol* sym;
- int type;
- tristate oldval;
-
- sym = item->menu ? item->menu->sym : 0;
- if (!sym)
- return;
-
- type = sym_get_type(sym);
- switch (type) {
- case S_BOOLEAN:
- case S_TRISTATE:
- oldval = sym_get_tristate_value(sym);
-
- if (!sym_set_tristate_value(sym, val))
- return;
- if (oldval == no && item->menu->list)
- item->setOpen(TRUE);
- parent()->updateList(item);
- break;
- }
-}
-
-void ConfigList::changeValue(ConfigItem* item)
-{
- struct symbol* sym;
- struct menu* menu;
- int type, oldexpr, newexpr;
-
- menu = item->menu;
- if (!menu)
- return;
- sym = menu->sym;
- if (!sym) {
- if (item->menu->list)
- item->setOpen(!item->isOpen());
- return;
- }
-
- type = sym_get_type(sym);
- switch (type) {
- case S_BOOLEAN:
- case S_TRISTATE:
- oldexpr = sym_get_tristate_value(sym);
- newexpr = sym_toggle_tristate_value(sym);
- if (item->menu->list) {
- if (oldexpr == newexpr)
- item->setOpen(!item->isOpen());
- else if (oldexpr == no)
- item->setOpen(TRUE);
- }
- if (oldexpr != newexpr)
- parent()->updateList(item);
- break;
- case S_INT:
- case S_HEX:
- case S_STRING:
- if (colMap[dataColIdx] >= 0)
- item->startRename(colMap[dataColIdx]);
- else
- parent()->lineEdit->show(item);
- break;
- }
-}
-
-void ConfigList::setRootMenu(struct menu *menu)
-{
- enum prop_type type;
-
- if (rootEntry == menu)
- return;
- type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN;
- if (type != P_MENU)
- return;
- updateMenuList(this, 0);
- rootEntry = menu;
- updateListAll();
- setSelected(currentItem(), hasFocus());
- ensureItemVisible(currentItem());
-}
-
-void ConfigList::setParentMenu(void)
-{
- ConfigItem* item;
- struct menu *oldroot;
-
- oldroot = rootEntry;
- if (rootEntry == &rootmenu)
- return;
- setRootMenu(menu_get_parent_menu(rootEntry->parent));
-
- Q3ListViewItemIterator it(this);
- for (; (item = (ConfigItem*)it.current()); it++) {
- if (item->menu == oldroot) {
- setCurrentItem(item);
- ensureItemVisible(item);
- break;
- }
- }
-}
-
-/*
- * update all the children of a menu entry
- * removes/adds the entries from the parent widget as necessary
- *
- * parent: either the menu list widget or a menu entry widget
- * menu: entry to be updated
- */
-template <class P>
-void ConfigList::updateMenuList(P* parent, struct menu* menu)
-{
- struct menu* child;
- ConfigItem* item;
- ConfigItem* last;
- bool visible;
- enum prop_type type;
-
- if (!menu) {
- while ((item = parent->firstChild()))
- delete item;
- return;
- }
-
- last = parent->firstChild();
- if (last && !last->goParent)
- last = 0;
- for (child = menu->list; child; child = child->next) {
- item = last ? last->nextSibling() : parent->firstChild();
- type = child->prompt ? child->prompt->type : P_UNKNOWN;
-
- switch (mode) {
- case menuMode:
- if (!(child->flags & MENU_ROOT))
- goto hide;
- break;
- case symbolMode:
- if (child->flags & MENU_ROOT)
- goto hide;
- break;
- default:
- break;
- }
-
- visible = menu_is_visible(child);
- if (!menuSkip(child)) {
- if (!child->sym && !child->list && !child->prompt)
- continue;
- if (!item || item->menu != child)
- item = new ConfigItem(parent, last, child, visible);
- else
- item->testUpdateMenu(visible);
-
- if (mode == fullMode || mode == menuMode || type != P_MENU)
- updateMenuList(item, child);
- else
- updateMenuList(item, 0);
- last = item;
- continue;
- }
- hide:
- if (item && item->menu == child) {
- last = parent->firstChild();
- if (last == item)
- last = 0;
- else while (last->nextSibling() != item)
- last = last->nextSibling();
- delete item;
- }
- }
-}
-
-void ConfigList::keyPressEvent(QKeyEvent* ev)
-{
- Q3ListViewItem* i = currentItem();
- ConfigItem* item;
- struct menu *menu;
- enum prop_type type;
-
- if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) {
- emit parentSelected();
- ev->accept();
- return;
- }
-
- if (!i) {
- Parent::keyPressEvent(ev);
- return;
- }
- item = (ConfigItem*)i;
-
- switch (ev->key()) {
- case Qt::Key_Return:
- case Qt::Key_Enter:
- if (item->goParent) {
- emit parentSelected();
- break;
- }
- menu = item->menu;
- if (!menu)
- break;
- type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
- if (type == P_MENU && rootEntry != menu &&
- mode != fullMode && mode != menuMode) {
- emit menuSelected(menu);
- break;
- }
- case Qt::Key_Space:
- changeValue(item);
- break;
- case Qt::Key_N:
- setValue(item, no);
- break;
- case Qt::Key_M:
- setValue(item, mod);
- break;
- case Qt::Key_Y:
- setValue(item, yes);
- break;
- default:
- Parent::keyPressEvent(ev);
- return;
- }
- ev->accept();
-}
-
-void ConfigList::contentsMousePressEvent(QMouseEvent* e)
-{
- //QPoint p(contentsToViewport(e->pos()));
- //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
- Parent::contentsMousePressEvent(e);
-}
-
-void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
-{
- QPoint p(contentsToViewport(e->pos()));
- ConfigItem* item = (ConfigItem*)itemAt(p);
- struct menu *menu;
- enum prop_type ptype;
- const QPixmap* pm;
- int idx, x;
-
- if (!item)
- goto skip;
-
- menu = item->menu;
- x = header()->offset() + p.x();
- idx = colRevMap[header()->sectionAt(x)];
- switch (idx) {
- case promptColIdx:
- pm = item->pixmap(promptColIdx);
- if (pm) {
- int off = header()->sectionPos(0) + itemMargin() +
- treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0));
- if (x >= off && x < off + pm->width()) {
- if (item->goParent) {
- emit parentSelected();
- break;
- } else if (!menu)
- break;
- ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
- if (ptype == P_MENU && rootEntry != menu &&
- mode != fullMode && mode != menuMode)
- emit menuSelected(menu);
- else
- changeValue(item);
- }
- }
- break;
- case noColIdx:
- setValue(item, no);
- break;
- case modColIdx:
- setValue(item, mod);
- break;
- case yesColIdx:
- setValue(item, yes);
- break;
- case dataColIdx:
- changeValue(item);
- break;
- }
-
-skip:
- //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
- Parent::contentsMouseReleaseEvent(e);
-}
-
-void ConfigList::contentsMouseMoveEvent(QMouseEvent* e)
-{
- //QPoint p(contentsToViewport(e->pos()));
- //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
- Parent::contentsMouseMoveEvent(e);
-}
-
-void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
-{
- QPoint p(contentsToViewport(e->pos()));
- ConfigItem* item = (ConfigItem*)itemAt(p);
- struct menu *menu;
- enum prop_type ptype;
-
- if (!item)
- goto skip;
- if (item->goParent) {
- emit parentSelected();
- goto skip;
- }
- menu = item->menu;
- if (!menu)
- goto skip;
- ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
- if (ptype == P_MENU && (mode == singleMode || mode == symbolMode))
- emit menuSelected(menu);
- else if (menu->sym)
- changeValue(item);
-
-skip:
- //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
- Parent::contentsMouseDoubleClickEvent(e);
-}
-
-void ConfigList::focusInEvent(QFocusEvent *e)
-{
- struct menu *menu = NULL;
-
- Parent::focusInEvent(e);
-
- ConfigItem* item = (ConfigItem *)currentItem();
- if (item) {
- setSelected(item, TRUE);
- menu = item->menu;
- }
- emit gotFocus(menu);
-}
-
-void ConfigList::contextMenuEvent(QContextMenuEvent *e)
-{
- if (e->y() <= header()->geometry().bottom()) {
- 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);
- action->addTo(headerPopup);
- 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);
- action->addTo(headerPopup);
- 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);
- action->addTo(headerPopup);
- }
- headerPopup->exec(e->globalPos());
- e->accept();
- } else
- e->ignore();
-}
-
ConfigView*ConfigView::viewList;
QAction *ConfigView::showNormalAction;
QAction *ConfigView::showAllAction;
@@ -858,7 +129,7 @@ ConfigView::ConfigView(QWidget* parent, const char *name)
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->setContentsMargins(0, 0, 0, 0);
- list = new ConfigList(this, name);
+ list = new Q3ListView(this, name);
verticalLayout->addWidget(list);
lineEdit = new ConfigLineEdit(this);
lineEdit->hide();
@@ -882,65 +153,26 @@ 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) {
- list->showName = b;
- list->reinit();
- emit showNameChanged(b);
- }
}
void ConfigView::setShowRange(bool b)
{
- if (list->showRange != b) {
- list->showRange = b;
- list->reinit();
- emit showRangeChanged(b);
- }
}
void ConfigView::setShowData(bool b)
{
- if (list->showData != b) {
- list->showData = b;
- list->reinit();
- emit showDataChanged(b);
- }
-}
-
-void ConfigList::setAllOpen(bool open)
-{
- Q3ListViewItemIterator it(this);
-
- for (; it.current(); it++)
- it.current()->setOpen(open);
}
-void ConfigView::updateList(ConfigItem* item)
+void ConfigView::updateList(Q3ListViewItem* item)
{
- ConfigView* v;
-
- for (v = viewList; v; v = v->nextView)
- v->list->updateList(item);
}
void ConfigView::updateListAll(void)
{
- ConfigView* v;
-
- for (v = viewList; v; v = v->nextView)
- v->list->updateListAll();
}
ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
@@ -1195,7 +427,6 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
split = new QSplitter(this);
split->setOrientation(Qt::Vertical);
list = new ConfigView(split, name);
- list->list->mode = listMode;
info = new ConfigInfoView(split, name);
connect(list->list, SIGNAL(menuChanged(struct menu *)),
info, SLOT(setInfo(struct menu *)));
@@ -1240,22 +471,6 @@ void ConfigSearchWindow::saveSettings(void)
void ConfigSearchWindow::search(void)
{
- struct symbol **p;
- struct property *prop;
- ConfigItem *lastItem = NULL;
-
- free(result);
- list->list->clear();
- info->clear();
-
- result = sym_re_search(editField->text().latin1());
- if (!result)
- return;
- for (p = result; *p; p++) {
- for_all_prompts((*p), prop)
- lastItem = new ConfigItem(list->list, lastItem, prop->menu,
- menu_is_visible(prop->menu));
- }
}
/*
@@ -1348,12 +563,10 @@ ConfigMainWindow::ConfigMainWindow(void)
showRangeAction->setCheckable(TRUE);
connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
- showRangeAction->setChecked(configList->showRange);
QAction *showDataAction = new QAction(_("Show Data"), this);
showDataAction->setCheckable(TRUE);
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
- showDataAction->setChecked(configList->showData);
QActionGroup *optGroup = new QActionGroup(this);
optGroup->setExclusive(TRUE);
@@ -1366,11 +579,8 @@ ConfigMainWindow::ConfigMainWindow(void)
configView->showAllAction = new QAction(_("Show All Options"), optGroup);
configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup);
configView->showNormalAction->setCheckable(TRUE);
- configView->showNormalAction->setChecked(configList->optMode == normalOpt);
configView->showAllAction->setCheckable(TRUE);
- configView->showAllAction->setChecked(configList->optMode == allOpt);
configView->showPromptAction->setCheckable(TRUE);
- configView->showPromptAction->setChecked(configList->optMode == promptOpt);
QAction *showDebugAction = new QAction( _("Show Debug Info"), this);
showDebugAction->setCheckable(TRUE);
@@ -1498,86 +708,19 @@ void ConfigMainWindow::searchConfig(void)
void ConfigMainWindow::changeMenu(struct menu *menu)
{
- configList->setRootMenu(menu);
- if (configList->rootEntry->parent == &rootmenu)
- backAction->setEnabled(FALSE);
- else
- backAction->setEnabled(TRUE);
+
}
void ConfigMainWindow::setMenuLink(struct menu *menu)
{
- struct menu *parent;
- ConfigList* list = NULL;
- ConfigItem* item;
-
- if (configList->menuSkip(menu))
- return;
-
- switch (configList->mode) {
- case singleMode:
- list = configList;
- parent = menu_get_parent_menu(menu);
- if (!parent)
- return;
- list->setRootMenu(parent);
- break;
- case symbolMode:
- if (menu->flags & MENU_ROOT) {
- configList->setRootMenu(menu);
- configList->clearSelection();
- list = menuList;
- } else {
- list = configList;
- parent = menu_get_parent_menu(menu->parent);
- if (!parent)
- return;
- item = menuList->findConfigItem(parent);
- if (item) {
- menuList->setSelected(item, TRUE);
- menuList->ensureItemVisible(item);
- }
- list->setRootMenu(parent);
- }
- break;
- case fullMode:
- list = configList;
- break;
- default:
- break;
- }
-
- if (list) {
- item = list->findConfigItem(menu);
- if (item) {
- list->setSelected(item, TRUE);
- list->ensureItemVisible(item);
- list->setFocus();
- }
- }
}
void ConfigMainWindow::listFocusChanged(void)
{
- if (menuList->mode == menuMode)
- configList->clearSelection();
}
void ConfigMainWindow::goBack(void)
{
- ConfigItem* item;
-
- configList->setParentMenu();
- if (configList->rootEntry == &rootmenu)
- backAction->setEnabled(FALSE);
- item = (ConfigItem*)menuList->selectedItem();
- while (item) {
- if (item->menu == configList->rootEntry) {
- menuList->setSelected(item, TRUE);
- break;
- }
- item = (ConfigItem*)item->parent();
- }
}
void ConfigMainWindow::showSingleView(void)
@@ -1590,13 +733,6 @@ void ConfigMainWindow::showSingleView(void)
fullViewAction->setChecked(false);
menuView->hide();
- menuList->setRootMenu(0);
- configList->mode = singleMode;
- if (configList->rootEntry == &rootmenu)
- configList->updateListAll();
- else
- configList->setRootMenu(&rootmenu);
- configList->setAllOpen(TRUE);
configList->setFocus();
}
@@ -1609,16 +745,6 @@ void ConfigMainWindow::showSplitView(void)
fullViewAction->setEnabled(true);
fullViewAction->setChecked(false);
- configList->mode = symbolMode;
- if (configList->rootEntry == &rootmenu)
- configList->updateListAll();
- else
- configList->setRootMenu(&rootmenu);
- configList->setAllOpen(TRUE);
- configApp->processEvents();
- menuList->mode = menuMode;
- menuList->setRootMenu(&rootmenu);
- menuList->setAllOpen(TRUE);
menuView->show();
menuList->setFocus();
}
@@ -1633,13 +759,6 @@ void ConfigMainWindow::showFullView(void)
fullViewAction->setChecked(true);
menuView->hide();
- menuList->setRootMenu(0);
- configList->mode = fullMode;
- if (configList->rootEntry == &rootmenu)
- configList->updateListAll();
- else
- configList->setRootMenu(&rootmenu);
- configList->setAllOpen(FALSE);
configList->setFocus();
}
@@ -1707,22 +826,7 @@ void ConfigMainWindow::saveSettings(void)
configSettings->writeEntry("/window height", size().height());
QString entry;
- switch(configList->mode) {
- case singleMode :
- entry = "single";
- break;
-
- case symbolMode :
- entry = "split";
- break;
-
- case fullMode :
- entry = "full";
- break;
- default:
- break;
- }
configSettings->writeEntry("/listMode", entry);
configSettings->writeSizes("/split1", split1->sizes());
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 213990129e51..d025f29694c6 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -8,8 +8,6 @@
#include <qsettings.h>
class ConfigView;
-class ConfigList;
-class ConfigItem;
class ConfigLineEdit;
class ConfigMainWindow;
@@ -30,159 +28,6 @@ enum optionMode {
normalOpt = 0, allOpt, promptOpt
};
-class ConfigList : public Q3ListView {
- Q_OBJECT
- typedef class Q3ListView Parent;
-public:
- ConfigList(ConfigView* p, const char *name = 0);
- void reinit(void);
- ConfigView* parent(void) const
- {
- return (ConfigView*)Parent::parent();
- }
- ConfigItem* findConfigItem(struct menu *);
-
-protected:
- void keyPressEvent(QKeyEvent *e);
- void contentsMousePressEvent(QMouseEvent *e);
- void contentsMouseReleaseEvent(QMouseEvent *e);
- void contentsMouseMoveEvent(QMouseEvent *e);
- void contentsMouseDoubleClickEvent(QMouseEvent *e);
- void focusInEvent(QFocusEvent *e);
- void contextMenuEvent(QContextMenuEvent *e);
-
-public slots:
- void setRootMenu(struct menu *menu);
-
- void updateList(ConfigItem *item);
- void setValue(ConfigItem* item, tristate val);
- void changeValue(ConfigItem* item);
- void updateSelection(void);
- void saveSettings(void);
-signals:
- void menuChanged(struct menu *menu);
- void menuSelected(struct menu *menu);
- void parentSelected(void);
- void gotFocus(struct menu *);
-
-public:
- void updateListAll(void)
- {
- updateAll = true;
- updateList(NULL);
- updateAll = false;
- }
- ConfigList* listView()
- {
- return this;
- }
- ConfigItem* firstChild() const
- {
- return (ConfigItem *)Parent::firstChild();
- }
- int mapIdx(colIdx idx)
- {
- return colMap[idx];
- }
- void addColumn(colIdx idx, const QString& label)
- {
- colMap[idx] = Parent::addColumn(label);
- colRevMap[colMap[idx]] = idx;
- }
- void removeColumn(colIdx idx)
- {
- int col = colMap[idx];
- if (col >= 0) {
- Parent::removeColumn(col);
- colRevMap[col] = colMap[idx] = -1;
- }
- }
- void setAllOpen(bool open);
- void setParentMenu(void);
-
- bool menuSkip(struct menu *);
-
- template <class P>
- void updateMenuList(P*, struct 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;
- struct menu *rootEntry;
- QColorGroup disabledColorGroup;
- QColorGroup inactivedColorGroup;
- QMenu* headerPopup;
-
-private:
- int colMap[colNr];
- int colRevMap[colNr];
-};
-
-class ConfigItem : public Q3ListViewItem {
- typedef class Q3ListViewItem Parent;
-public:
- ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
- : Parent(parent, after), menu(m), visible(v), goParent(false)
- {
- init();
- }
- ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
- : Parent(parent, after), menu(m), visible(v), goParent(false)
- {
- init();
- }
- ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
- : Parent(parent, after), menu(0), visible(v), goParent(true)
- {
- init();
- }
- ~ConfigItem(void);
- void init(void);
- void okRename(int col);
- void updateMenu(void);
- void testUpdateMenu(bool v);
- ConfigList* listView() const
- {
- return (ConfigList*)Parent::listView();
- }
- ConfigItem* firstChild() const
- {
- return (ConfigItem *)Parent::firstChild();
- }
- ConfigItem* nextSibling() const
- {
- return (ConfigItem *)Parent::nextSibling();
- }
- void setText(colIdx idx, const QString& text)
- {
- Parent::setText(listView()->mapIdx(idx), text);
- }
- QString text(colIdx idx) const
- {
- return Parent::text(listView()->mapIdx(idx));
- }
- void setPixmap(colIdx idx, const QPixmap& pm)
- {
- Parent::setPixmap(listView()->mapIdx(idx), pm);
- }
- const QPixmap* pixmap(colIdx idx) const
- {
- return Parent::pixmap(listView()->mapIdx(idx));
- }
- void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
-
- ConfigItem* nextItem;
- struct menu *menu;
- bool visible;
- bool goParent;
-};
-
class ConfigLineEdit : public QLineEdit {
Q_OBJECT
typedef class QLineEdit Parent;
@@ -192,11 +37,11 @@ public:
{
return (ConfigView*)Parent::parent();
}
- void show(ConfigItem *i);
+ void show(Q3ListViewItem *i);
void keyPressEvent(QKeyEvent *e);
public:
- ConfigItem *item;
+ Q3ListViewItem *item;
};
class ConfigView : public QWidget {
@@ -205,12 +50,12 @@ class ConfigView : public QWidget {
public:
ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void);
- static void updateList(ConfigItem* item);
+ static void updateList(Q3ListViewItem* item);
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; }
+ bool showName(void) const { return false; } // TODO: Implement me.
+ bool showRange(void) const { return false; } // TODO: Implement me.
+ bool showData(void) const { return false; } // TODO: Implement me.
public slots:
void setShowName(bool);
void setShowRange(bool);
@@ -221,7 +66,7 @@ signals:
void showRangeChanged(bool);
void showDataChanged(bool);
public:
- ConfigList* list;
+ Q3ListView* list;
ConfigLineEdit* lineEdit;
static ConfigView* viewList;
@@ -310,15 +155,15 @@ protected:
ConfigSearchWindow *searchWindow;
ConfigView *menuView;
- ConfigList *menuList;
+ Q3ListView *menuList;
ConfigView *configView;
- ConfigList *configList;
+ Q3ListView *configList;
ConfigInfoView *helpText;
QToolBar *toolBar;
QAction *backAction;
QAction *singleViewAction;
QAction *splitViewAction;
QAction *fullViewAction;
- QSplitter* split1;
- QSplitter* split2;
+ QSplitter *split1;
+ QSplitter *split2;
};