}
}
+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;
rootEntry = menu;
updateListAll();
setSelected(currentItem(), hasFocus());
+ ensureItemVisible(currentItem());
}
void ConfigList::setParentMenu(void)
void ConfigList::focusInEvent(QFocusEvent *e)
{
- Parent::focusInEvent(e);
+ struct menu *menu = NULL;
- QListViewItem* item = currentItem();
- if (!item)
- return;
+ Parent::focusInEvent(e);
- setSelected(item, TRUE);
- emit gotFocus();
+ ConfigItem* item = (ConfigItem *)currentItem();
+ if (item) {
+ setSelected(item, TRUE);
+ menu = item->menu;
+ }
+ emit gotFocus(menu);
}
void ConfigList::contextMenuEvent(QContextMenuEvent *e)
QAction *action;
headerPopup = new QPopupMenu(this);
- action = new QAction("Show Name", 0, this);
+ action = new QAction(NULL, "Show Name", 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool)));
action, SLOT(setOn(bool)));
action->setOn(showName);
action->addTo(headerPopup);
- action = new QAction("Show Range", 0, this);
+ action = new QAction(NULL, "Show Range", 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowRange(bool)));
action, SLOT(setOn(bool)));
action->setOn(showRange);
action->addTo(headerPopup);
- action = new QAction("Show Data", 0, this);
+ action = new QAction(NULL, "Show Data", 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowData(bool)));
_showDebug = b;
if (menu)
menuInfo();
+ else if (sym)
+ symbolInfo();
emit showDebugChanged(b);
}
}
void ConfigInfoView::setInfo(struct menu *m)
{
+ if (menu == m)
+ return;
menu = m;
if (!menu)
clear();
const char *p = name.latin1();
menu = NULL;
+ sym = NULL;
switch (p[0]) {
case 'm':
- if (sscanf(p, "m%p", &menu) == 1)
+ struct menu *m;
+
+ if (sscanf(p, "m%p", &m) == 1 && menu != m) {
+ menu = m;
menuInfo();
+ emit menuSelected(menu);
+ }
+ break;
+ case 's':
+ struct symbol *s;
+
+ if (sscanf(p, "s%p", &s) == 1 && sym != s) {
+ sym = s;
+ symbolInfo();
+ }
break;
}
}
+void ConfigInfoView::symbolInfo(void)
+{
+ QString str;
+
+ str += "<big>Symbol: <b>";
+ str += print_filter(sym->name);
+ str += "</b></big><br><br>value: ";
+ str += print_filter(sym_get_string_value(sym));
+ str += "<br>visibility: ";
+ str += sym->visible == yes ? "y" : sym->visible == mod ? "m" : "n";
+ str += "<br>";
+ str += debug_info(sym);
+
+ setText(str);
+}
+
void ConfigInfoView::menuInfo(void)
{
struct symbol* sym;
head += "</b></big>";
if (sym->name) {
head += " (";
+ if (showDebug())
+ head += QString().sprintf("<a href=\"s%p\">", sym);
head += print_filter(sym->name);
+ if (showDebug())
+ head += "</a>";
head += ")";
}
} else if (sym->name) {
head += "<big><b>";
+ if (showDebug())
+ head += QString().sprintf("<a href=\"s%p\">", sym);
head += print_filter(sym->name);
+ if (showDebug())
+ head += "</a>";
head += "</b></big>";
}
head += "<br><br>";
switch (prop->type) {
case P_PROMPT:
case P_MENU:
- debug += "prompt: ";
+ debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu);
debug += print_filter(_(prop->text));
- debug += "<br>";
+ debug += "</a><br>";
break;
case P_DEFAULT:
debug += "default: ";
return res;
}
-void ConfigInfoView::expr_print_help(void *data, const char *str)
+void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str)
{
- reinterpret_cast<QString*>(data)->append(print_filter(str));
+ QString* text = reinterpret_cast<QString*>(data);
+ QString str2 = print_filter(str);
+
+ if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
+ *text += QString().sprintf("<a href=\"s%p\">", sym);
+ *text += str2;
+ *text += "</a>";
+ } else
+ *text += str2;
}
QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
{
QPopupMenu* popup = Parent::createPopupMenu(pos);
- QAction* action = new QAction("Show Debug Info", 0, popup);
+ QAction* action = new QAction(NULL,"Show Debug Info", 0, popup);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
* Construct the complete config widget
*/
ConfigMainWindow::ConfigMainWindow(void)
+ : searchWindow(0)
{
QMenuBar* menu;
bool ok;
connect(menuList, SIGNAL(menuSelected(struct menu *)),
SLOT(changeMenu(struct menu *)));
- connect(configList, SIGNAL(gotFocus(void)),
- SLOT(listFocusChanged(void)));
- connect(menuList, SIGNAL(gotFocus(void)),
+ connect(configList, SIGNAL(gotFocus(struct menu *)),
+ helpText, SLOT(setInfo(struct menu *)));
+ connect(menuList, SIGNAL(gotFocus(struct menu *)),
+ helpText, SLOT(setInfo(struct menu *)));
+ connect(menuList, SIGNAL(gotFocus(struct menu *)),
SLOT(listFocusChanged(void)));
+ connect(helpText, SIGNAL(menuSelected(struct menu *)),
+ SLOT(setMenuLink(struct menu *)));
QString listMode = configSettings->readEntry("/listMode", "symbol");
if (listMode == "single")
split2->setSizes(sizes);
}
-/*
- * display a new help entry as soon as a new menu entry is selected
- */
-void ConfigMainWindow::setHelp(QListViewItem* item)
-{
- struct menu* menu = 0;
-
- if (item)
- menu = ((ConfigItem*)item)->menu;
- helpText->setInfo(menu);
-}
-
void ConfigMainWindow::loadConfig(void)
{
QString s = QFileDialog::getOpenFileName(".config", NULL, this);
backAction->setEnabled(TRUE);
}
-void ConfigMainWindow::listFocusChanged(void)
+void ConfigMainWindow::setMenuLink(struct menu *menu)
{
- if (menuList->hasFocus()) {
- if (menuList->mode == menuMode)
+ struct menu *parent;
+ ConfigList* list = NULL;
+ ConfigItem* item;
+
+ if (!menu_is_visible(menu) && !configView->showAll())
+ 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();
- setHelp(menuList->selectedItem());
- } else if (configList->hasFocus()) {
- setHelp(configList->selectedItem());
+ 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;
}
+
+ 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)