@@ -885,7 +885,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
885885 connect (action, SIGNAL (toggled (bool )),
886886 parent (), SLOT (setShowName (bool )));
887887 connect (parent (), SIGNAL (showNameChanged (bool )),
888- action, SLOT (setOn (bool )));
888+ action, SLOT (setChecked (bool )));
889889 action->setChecked (showName);
890890 headerPopup->addAction (action);
891891
@@ -894,7 +894,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
894894 connect (action, SIGNAL (toggled (bool )),
895895 parent (), SLOT (setShowRange (bool )));
896896 connect (parent (), SIGNAL (showRangeChanged (bool )),
897- action, SLOT (setOn (bool )));
897+ action, SLOT (setChecked (bool )));
898898 action->setChecked (showRange);
899899 headerPopup->addAction (action);
900900
@@ -903,7 +903,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
903903 connect (action, SIGNAL (toggled (bool )),
904904 parent (), SLOT (setShowData (bool )));
905905 connect (parent (), SIGNAL (showDataChanged (bool )),
906- action, SLOT (setOn (bool )));
906+ action, SLOT (setChecked (bool )));
907907 action->setChecked (showData);
908908 headerPopup->addAction (action);
909909 }
@@ -1012,6 +1012,16 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
10121012 configSettings->endGroup ();
10131013 connect (configApp, SIGNAL (aboutToQuit ()), SLOT (saveSettings ()));
10141014 }
1015+
1016+ contextMenu = createStandardContextMenu ();
1017+ QAction *action = new QAction (" Show Debug Info" , contextMenu);
1018+
1019+ action->setCheckable (true );
1020+ connect (action, SIGNAL (toggled (bool )), SLOT (setShowDebug (bool )));
1021+ connect (this , SIGNAL (showDebugChanged (bool )), action, SLOT (setChecked (bool )));
1022+ action->setChecked (showDebug ());
1023+ contextMenu->addSeparator ();
1024+ contextMenu->addAction (action);
10151025}
10161026
10171027void ConfigInfoView::saveSettings (void )
@@ -1066,111 +1076,114 @@ void ConfigInfoView::symbolInfo(void)
10661076void ConfigInfoView::menuInfo (void )
10671077{
10681078 struct symbol * sym;
1069- QString head, debug, help;
1079+ QString info;
1080+ QTextStream stream (&info);
10701081
10711082 sym = _menu->sym ;
10721083 if (sym) {
10731084 if (_menu->prompt ) {
1074- head += " <big><b>" ;
1075- head += print_filter (_menu->prompt ->text );
1076- head += " </b></big>" ;
1085+ stream << " <big><b>" ;
1086+ stream << print_filter (_menu->prompt ->text );
1087+ stream << " </b></big>" ;
10771088 if (sym->name ) {
1078- head += " (" ;
1089+ stream << " (" ;
10791090 if (showDebug ())
1080- head += QString (). sprintf ( " <a href=\" s%s \" > " , sym->name ) ;
1081- head += print_filter (sym->name );
1091+ stream << " <a href=\" s" << sym->name << " \" > " ;
1092+ stream << print_filter (sym->name );
10821093 if (showDebug ())
1083- head += " </a>" ;
1084- head += " )" ;
1094+ stream << " </a>" ;
1095+ stream << " )" ;
10851096 }
10861097 } else if (sym->name ) {
1087- head += " <big><b>" ;
1098+ stream << " <big><b>" ;
10881099 if (showDebug ())
1089- head += QString (). sprintf ( " <a href=\" s%s \" > " , sym->name ) ;
1090- head += print_filter (sym->name );
1100+ stream << " <a href=\" s" << sym->name << " \" > " ;
1101+ stream << print_filter (sym->name );
10911102 if (showDebug ())
1092- head += " </a>" ;
1093- head += " </b></big>" ;
1103+ stream << " </a>" ;
1104+ stream << " </b></big>" ;
10941105 }
1095- head += " <br><br>" ;
1106+ stream << " <br><br>" ;
10961107
10971108 if (showDebug ())
1098- debug = debug_info (sym);
1109+ stream << debug_info (sym);
10991110
1100- struct gstr help_gstr = str_new ();
1101- menu_get_ext_help (_menu, &help_gstr);
1102- help = print_filter (str_get (&help_gstr));
1103- str_free (&help_gstr);
11041111 } else if (_menu->prompt ) {
1105- head += " <big><b>" ;
1106- head += print_filter (_menu->prompt ->text );
1107- head += " </b></big><br><br>" ;
1112+ stream << " <big><b>" ;
1113+ stream << print_filter (_menu->prompt ->text );
1114+ stream << " </b></big><br><br>" ;
11081115 if (showDebug ()) {
11091116 if (_menu->prompt ->visible .expr ) {
1110- debug += " dep: " ;
1111- expr_print (_menu->prompt ->visible .expr , expr_print_help, &debug, E_NONE);
1112- debug += " <br><br>" ;
1117+ stream << " dep: " ;
1118+ expr_print (_menu->prompt ->visible .expr ,
1119+ expr_print_help, &stream, E_NONE);
1120+ stream << " <br><br>" ;
11131121 }
11141122 }
11151123 }
11161124 if (showDebug ())
1117- debug += QString ().sprintf (" defined at %s:%d<br><br>" , _menu->file ->name , _menu->lineno );
1125+ stream << " defined at " << _menu->file ->name << " :"
1126+ << _menu->lineno << " <br><br>" ;
11181127
1119- setText (head + debug + help );
1128+ setText (info );
11201129}
11211130
11221131QString ConfigInfoView::debug_info (struct symbol *sym)
11231132{
11241133 QString debug;
1134+ QTextStream stream (&debug);
11251135
1126- debug += " type: " ;
1127- debug += print_filter (sym_type_name (sym->type ));
1136+ stream << " type: " ;
1137+ stream << print_filter (sym_type_name (sym->type ));
11281138 if (sym_is_choice (sym))
1129- debug += " (choice)" ;
1139+ stream << " (choice)" ;
11301140 debug += " <br>" ;
11311141 if (sym->rev_dep .expr ) {
1132- debug += " reverse dep: " ;
1133- expr_print (sym->rev_dep .expr , expr_print_help, &debug , E_NONE);
1134- debug += " <br>" ;
1142+ stream << " reverse dep: " ;
1143+ expr_print (sym->rev_dep .expr , expr_print_help, &stream , E_NONE);
1144+ stream << " <br>" ;
11351145 }
11361146 for (struct property *prop = sym->prop ; prop; prop = prop->next ) {
11371147 switch (prop->type ) {
11381148 case P_PROMPT:
11391149 case P_MENU:
1140- debug += QString (). sprintf ( " prompt: <a href=\" m%s \" > " , sym->name ) ;
1141- debug += print_filter (prop->text );
1142- debug += " </a><br>" ;
1150+ stream << " prompt: <a href=\" m" << sym->name << " \" > " ;
1151+ stream << print_filter (prop->text );
1152+ stream << " </a><br>" ;
11431153 break ;
11441154 case P_DEFAULT:
11451155 case P_SELECT:
11461156 case P_RANGE:
11471157 case P_COMMENT:
11481158 case P_IMPLY:
11491159 case P_SYMBOL:
1150- debug += prop_get_type_name (prop->type );
1151- debug += " : " ;
1152- expr_print (prop->expr , expr_print_help, &debug, E_NONE);
1153- debug += " <br>" ;
1160+ stream << prop_get_type_name (prop->type );
1161+ stream << " : " ;
1162+ expr_print (prop->expr , expr_print_help,
1163+ &stream, E_NONE);
1164+ stream << " <br>" ;
11541165 break ;
11551166 case P_CHOICE:
11561167 if (sym_is_choice (sym)) {
1157- debug += " choice: " ;
1158- expr_print (prop->expr , expr_print_help, &debug, E_NONE);
1159- debug += " <br>" ;
1168+ stream << " choice: " ;
1169+ expr_print (prop->expr , expr_print_help,
1170+ &stream, E_NONE);
1171+ stream << " <br>" ;
11601172 }
11611173 break ;
11621174 default :
1163- debug += " unknown property: " ;
1164- debug += prop_get_type_name (prop->type );
1165- debug += " <br>" ;
1175+ stream << " unknown property: " ;
1176+ stream << prop_get_type_name (prop->type );
1177+ stream << " <br>" ;
11661178 }
11671179 if (prop->visible .expr ) {
1168- debug += " dep: " ;
1169- expr_print (prop->visible .expr , expr_print_help, &debug, E_NONE);
1170- debug += " <br>" ;
1180+ stream << " dep: " ;
1181+ expr_print (prop->visible .expr , expr_print_help,
1182+ &stream, E_NONE);
1183+ stream << " <br>" ;
11711184 }
11721185 }
1173- debug += " <br>" ;
1186+ stream << " <br>" ;
11741187
11751188 return debug;
11761189}
@@ -1208,15 +1221,15 @@ QString ConfigInfoView::print_filter(const QString &str)
12081221
12091222void ConfigInfoView::expr_print_help (void *data, struct symbol *sym, const char *str)
12101223{
1211- QString* text = reinterpret_cast <QString*>(data);
1212- QString str2 = print_filter (str);
1224+ QTextStream *stream = reinterpret_cast <QTextStream *>(data);
12131225
12141226 if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
1215- *text += QString ().sprintf (" <a href=\" s%s\" >" , sym->name );
1216- *text += str2;
1217- *text += " </a>" ;
1218- } else
1219- *text += str2;
1227+ *stream << " <a href=\" s" << sym->name << " \" >" ;
1228+ *stream << print_filter (str);
1229+ *stream << " </a>" ;
1230+ } else {
1231+ *stream << print_filter (str);
1232+ }
12201233}
12211234
12221235void ConfigInfoView::clicked (const QUrl &url)
@@ -1228,7 +1241,6 @@ void ConfigInfoView::clicked(const QUrl &url)
12281241 struct menu *m = NULL ;
12291242
12301243 if (count < 1 ) {
1231- qInfo () << " Clicked link is empty" ;
12321244 delete[] data;
12331245 return ;
12341246 }
@@ -1241,7 +1253,6 @@ void ConfigInfoView::clicked(const QUrl &url)
12411253 strcat (data, " $" );
12421254 result = sym_re_search (data);
12431255 if (!result) {
1244- qInfo () << " Clicked symbol is invalid:" << data;
12451256 delete[] data;
12461257 return ;
12471258 }
@@ -1268,23 +1279,10 @@ void ConfigInfoView::clicked(const QUrl &url)
12681279 delete data;
12691280}
12701281
1271- QMenu* ConfigInfoView::createStandardContextMenu (const QPoint & pos)
1272- {
1273- QMenu* popup = Parent::createStandardContextMenu (pos);
1274- QAction* action = new QAction (" Show Debug Info" , popup);
1275-
1276- action->setCheckable (true );
1277- connect (action, SIGNAL (toggled (bool )), SLOT (setShowDebug (bool )));
1278- connect (this , SIGNAL (showDebugChanged (bool )), action, SLOT (setOn (bool )));
1279- action->setChecked (showDebug ());
1280- popup->addSeparator ();
1281- popup->addAction (action);
1282- return popup;
1283- }
1284-
1285- void ConfigInfoView::contextMenuEvent (QContextMenuEvent *e)
1282+ void ConfigInfoView::contextMenuEvent (QContextMenuEvent *event)
12861283{
1287- Parent::contextMenuEvent (e);
1284+ contextMenu->popup (event->globalPos ());
1285+ event->accept ();
12881286}
12891287
12901288ConfigSearchWindow::ConfigSearchWindow (ConfigMainWindow *parent)
0 commit comments