diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2006-06-09 01:12:47 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-06-09 10:28:07 -0400 |
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) | |||
925 | _showDebug = b; | 925 | _showDebug = b; |
926 | if (menu) | 926 | if (menu) |
927 | menuInfo(); | 927 | menuInfo(); |
928 | else if (sym) | ||
929 | symbolInfo(); | ||
928 | emit showDebugChanged(b); | 930 | emit showDebugChanged(b); |
929 | } | 931 | } |
930 | } | 932 | } |
@@ -943,15 +945,44 @@ void ConfigInfoView::setSource(const QString& name) | |||
943 | const char *p = name.latin1(); | 945 | const char *p = name.latin1(); |
944 | 946 | ||
945 | menu = NULL; | 947 | menu = NULL; |
948 | sym = NULL; | ||
946 | 949 | ||
947 | switch (p[0]) { | 950 | switch (p[0]) { |
948 | case 'm': | 951 | case 'm': |
949 | if (sscanf(p, "m%p", &menu) == 1) | 952 | struct menu *m; |
953 | |||
954 | if (sscanf(p, "m%p", &m) == 1 && menu != m) { | ||
955 | menu = m; | ||
950 | menuInfo(); | 956 | menuInfo(); |
957 | } | ||
958 | break; | ||
959 | case 's': | ||
960 | struct symbol *s; | ||
961 | |||
962 | if (sscanf(p, "s%p", &s) == 1 && sym != s) { | ||
963 | sym = s; | ||
964 | symbolInfo(); | ||
965 | } | ||
951 | break; | 966 | break; |
952 | } | 967 | } |
953 | } | 968 | } |
954 | 969 | ||
970 | void ConfigInfoView::symbolInfo(void) | ||
971 | { | ||
972 | QString str; | ||
973 | |||
974 | str += "<big>Symbol: <b>"; | ||
975 | str += print_filter(sym->name); | ||
976 | str += "</b></big><br><br>value: "; | ||
977 | str += print_filter(sym_get_string_value(sym)); | ||
978 | str += "<br>visibility: "; | ||
979 | str += sym->visible == yes ? "y" : sym->visible == mod ? "m" : "n"; | ||
980 | str += "<br>"; | ||
981 | str += debug_info(sym); | ||
982 | |||
983 | setText(str); | ||
984 | } | ||
985 | |||
955 | void ConfigInfoView::menuInfo(void) | 986 | void ConfigInfoView::menuInfo(void) |
956 | { | 987 | { |
957 | struct symbol* sym; | 988 | struct symbol* sym; |
@@ -965,12 +996,20 @@ void ConfigInfoView::menuInfo(void) | |||
965 | head += "</b></big>"; | 996 | head += "</b></big>"; |
966 | if (sym->name) { | 997 | if (sym->name) { |
967 | head += " ("; | 998 | head += " ("; |
999 | if (showDebug()) | ||
1000 | head += QString().sprintf("<a href=\"s%p\">", sym); | ||
968 | head += print_filter(sym->name); | 1001 | head += print_filter(sym->name); |
1002 | if (showDebug()) | ||
1003 | head += "</a>"; | ||
969 | head += ")"; | 1004 | head += ")"; |
970 | } | 1005 | } |
971 | } else if (sym->name) { | 1006 | } else if (sym->name) { |
972 | head += "<big><b>"; | 1007 | head += "<big><b>"; |
1008 | if (showDebug()) | ||
1009 | head += QString().sprintf("<a href=\"s%p\">", sym); | ||
973 | head += print_filter(sym->name); | 1010 | head += print_filter(sym->name); |
1011 | if (showDebug()) | ||
1012 | head += "</a>"; | ||
974 | head += "</b></big>"; | 1013 | head += "</b></big>"; |
975 | } | 1014 | } |
976 | head += "<br><br>"; | 1015 | head += "<br><br>"; |
@@ -1015,9 +1054,9 @@ QString ConfigInfoView::debug_info(struct symbol *sym) | |||
1015 | switch (prop->type) { | 1054 | switch (prop->type) { |
1016 | case P_PROMPT: | 1055 | case P_PROMPT: |
1017 | case P_MENU: | 1056 | case P_MENU: |
1018 | debug += "prompt: "; | 1057 | debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu); |
1019 | debug += print_filter(_(prop->text)); | 1058 | debug += print_filter(_(prop->text)); |
1020 | debug += "<br>"; | 1059 | debug += "</a><br>"; |
1021 | break; | 1060 | break; |
1022 | case P_DEFAULT: | 1061 | case P_DEFAULT: |
1023 | debug += "default: "; | 1062 | debug += "default: "; |
@@ -1088,9 +1127,17 @@ QString ConfigInfoView::print_filter(const QString &str) | |||
1088 | return res; | 1127 | return res; |
1089 | } | 1128 | } |
1090 | 1129 | ||
1091 | void ConfigInfoView::expr_print_help(void *data, const char *str) | 1130 | void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str) |
1092 | { | 1131 | { |
1093 | reinterpret_cast<QString*>(data)->append(print_filter(str)); | 1132 | QString* text = reinterpret_cast<QString*>(data); |
1133 | QString str2 = print_filter(str); | ||
1134 | |||
1135 | if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { | ||
1136 | *text += QString().sprintf("<a href=\"s%p\">", sym); | ||
1137 | *text += str2; | ||
1138 | *text += "</a>"; | ||
1139 | } else | ||
1140 | *text += str2; | ||
1094 | } | 1141 | } |
1095 | 1142 | ||
1096 | QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) | 1143 | QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) |