From ab45d190fd4acf0b0e5d307294ce24a90a69cc23 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Thu, 8 Jun 2006 22:12:47 -0700 Subject: 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 Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/kconfig/qconf.cc | 57 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'scripts/kconfig/qconf.cc') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index f3f86e735a8..425ce5ce2d1 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 += "Symbol: "; + str += print_filter(sym->name); + str += "

value: "; + str += print_filter(sym_get_string_value(sym)); + str += "
visibility: "; + str += sym->visible == yes ? "y" : sym->visible == mod ? "m" : "n"; + str += "
"; + str += debug_info(sym); + + setText(str); +} + void ConfigInfoView::menuInfo(void) { struct symbol* sym; @@ -965,12 +996,20 @@ void ConfigInfoView::menuInfo(void) head += ""; if (sym->name) { head += " ("; + if (showDebug()) + head += QString().sprintf("", sym); head += print_filter(sym->name); + if (showDebug()) + head += ""; head += ")"; } } else if (sym->name) { head += ""; + if (showDebug()) + head += QString().sprintf("", sym); head += print_filter(sym->name); + if (showDebug()) + head += ""; head += ""; } head += "

"; @@ -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: ", prop->menu); debug += print_filter(_(prop->text)); - debug += "
"; + debug += "

"; 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(data)->append(print_filter(str)); + QString* text = reinterpret_cast(data); + QString str2 = print_filter(str); + + if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { + *text += QString().sprintf("", sym); + *text += str2; + *text += ""; + } else + *text += str2; } QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) -- cgit v1.2.3