diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2006-06-08 22:12:47 -0700 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-06-09 16:28:07 +0200 |
commit | ab45d190fd4acf0b0e5d307294ce24a90a69cc23 (patch) | |
tree | ca58fb441f19fb71f9baf7df924be3905bf825f2 /scripts/kconfig/qconf.cc | |
parent | 7fc925fd6a4c24e1db879d227fc0a0f65a335aa1 (diff) |
kconfig: create links in info window
Extend the expression print helper function to allow customization of the
symbol output and use it to add links to the info window.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/qconf.cc')
-rw-r--r-- | scripts/kconfig/qconf.cc | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index f3f86e735a87..425ce5ce2d12 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -925,6 +925,8 @@ void ConfigInfoView::setShowDebug(bool b) _showDebug = b; if (menu) menuInfo(); + else if (sym) + symbolInfo(); emit showDebugChanged(b); } } @@ -943,15 +945,44 @@ void ConfigInfoView::setSource(const QString& name) 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(); + } + 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; @@ -965,12 +996,20 @@ void ConfigInfoView::menuInfo(void) 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>"; @@ -1015,9 +1054,9 @@ QString ConfigInfoView::debug_info(struct symbol *sym) 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: "; @@ -1088,9 +1127,17 @@ QString ConfigInfoView::print_filter(const QString &str) 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) |