@@ -885,7 +885,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
885
885
connect (action, SIGNAL (toggled (bool )),
886
886
parent (), SLOT (setShowName (bool )));
887
887
connect (parent (), SIGNAL (showNameChanged (bool )),
888
- action, SLOT (setOn (bool )));
888
+ action, SLOT (setChecked (bool )));
889
889
action->setChecked (showName);
890
890
headerPopup->addAction (action);
891
891
@@ -894,7 +894,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
894
894
connect (action, SIGNAL (toggled (bool )),
895
895
parent (), SLOT (setShowRange (bool )));
896
896
connect (parent (), SIGNAL (showRangeChanged (bool )),
897
- action, SLOT (setOn (bool )));
897
+ action, SLOT (setChecked (bool )));
898
898
action->setChecked (showRange);
899
899
headerPopup->addAction (action);
900
900
@@ -903,7 +903,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
903
903
connect (action, SIGNAL (toggled (bool )),
904
904
parent (), SLOT (setShowData (bool )));
905
905
connect (parent (), SIGNAL (showDataChanged (bool )),
906
- action, SLOT (setOn (bool )));
906
+ action, SLOT (setChecked (bool )));
907
907
action->setChecked (showData);
908
908
headerPopup->addAction (action);
909
909
}
@@ -1012,6 +1012,16 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
1012
1012
configSettings->endGroup ();
1013
1013
connect (configApp, SIGNAL (aboutToQuit ()), SLOT (saveSettings ()));
1014
1014
}
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);
1015
1025
}
1016
1026
1017
1027
void ConfigInfoView::saveSettings (void )
@@ -1066,111 +1076,114 @@ void ConfigInfoView::symbolInfo(void)
1066
1076
void ConfigInfoView::menuInfo (void )
1067
1077
{
1068
1078
struct symbol * sym;
1069
- QString head, debug, help;
1079
+ QString info;
1080
+ QTextStream stream (&info);
1070
1081
1071
1082
sym = _menu->sym ;
1072
1083
if (sym) {
1073
1084
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>" ;
1077
1088
if (sym->name ) {
1078
- head += " (" ;
1089
+ stream << " (" ;
1079
1090
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 );
1082
1093
if (showDebug ())
1083
- head += " </a>" ;
1084
- head += " )" ;
1094
+ stream << " </a>" ;
1095
+ stream << " )" ;
1085
1096
}
1086
1097
} else if (sym->name ) {
1087
- head += " <big><b>" ;
1098
+ stream << " <big><b>" ;
1088
1099
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 );
1091
1102
if (showDebug ())
1092
- head += " </a>" ;
1093
- head += " </b></big>" ;
1103
+ stream << " </a>" ;
1104
+ stream << " </b></big>" ;
1094
1105
}
1095
- head += " <br><br>" ;
1106
+ stream << " <br><br>" ;
1096
1107
1097
1108
if (showDebug ())
1098
- debug = debug_info (sym);
1109
+ stream << debug_info (sym);
1099
1110
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);
1104
1111
} 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>" ;
1108
1115
if (showDebug ()) {
1109
1116
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>" ;
1113
1121
}
1114
1122
}
1115
1123
}
1116
1124
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>" ;
1118
1127
1119
- setText (head + debug + help );
1128
+ setText (info );
1120
1129
}
1121
1130
1122
1131
QString ConfigInfoView::debug_info (struct symbol *sym)
1123
1132
{
1124
1133
QString debug;
1134
+ QTextStream stream (&debug);
1125
1135
1126
- debug += " type: " ;
1127
- debug += print_filter (sym_type_name (sym->type ));
1136
+ stream << " type: " ;
1137
+ stream << print_filter (sym_type_name (sym->type ));
1128
1138
if (sym_is_choice (sym))
1129
- debug += " (choice)" ;
1139
+ stream << " (choice)" ;
1130
1140
debug += " <br>" ;
1131
1141
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>" ;
1135
1145
}
1136
1146
for (struct property *prop = sym->prop ; prop; prop = prop->next ) {
1137
1147
switch (prop->type ) {
1138
1148
case P_PROMPT:
1139
1149
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>" ;
1143
1153
break ;
1144
1154
case P_DEFAULT:
1145
1155
case P_SELECT:
1146
1156
case P_RANGE:
1147
1157
case P_COMMENT:
1148
1158
case P_IMPLY:
1149
1159
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>" ;
1154
1165
break ;
1155
1166
case P_CHOICE:
1156
1167
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>" ;
1160
1172
}
1161
1173
break ;
1162
1174
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>" ;
1166
1178
}
1167
1179
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>" ;
1171
1184
}
1172
1185
}
1173
- debug += " <br>" ;
1186
+ stream << " <br>" ;
1174
1187
1175
1188
return debug;
1176
1189
}
@@ -1208,15 +1221,15 @@ QString ConfigInfoView::print_filter(const QString &str)
1208
1221
1209
1222
void ConfigInfoView::expr_print_help (void *data, struct symbol *sym, const char *str)
1210
1223
{
1211
- QString* text = reinterpret_cast <QString*>(data);
1212
- QString str2 = print_filter (str);
1224
+ QTextStream *stream = reinterpret_cast <QTextStream *>(data);
1213
1225
1214
1226
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
+ }
1220
1233
}
1221
1234
1222
1235
void ConfigInfoView::clicked (const QUrl &url)
@@ -1228,7 +1241,6 @@ void ConfigInfoView::clicked(const QUrl &url)
1228
1241
struct menu *m = NULL ;
1229
1242
1230
1243
if (count < 1 ) {
1231
- qInfo () << " Clicked link is empty" ;
1232
1244
delete[] data;
1233
1245
return ;
1234
1246
}
@@ -1241,7 +1253,6 @@ void ConfigInfoView::clicked(const QUrl &url)
1241
1253
strcat (data, " $" );
1242
1254
result = sym_re_search (data);
1243
1255
if (!result) {
1244
- qInfo () << " Clicked symbol is invalid:" << data;
1245
1256
delete[] data;
1246
1257
return ;
1247
1258
}
@@ -1268,23 +1279,10 @@ void ConfigInfoView::clicked(const QUrl &url)
1268
1279
delete data;
1269
1280
}
1270
1281
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)
1286
1283
{
1287
- Parent::contextMenuEvent (e);
1284
+ contextMenu->popup (event->globalPos ());
1285
+ event->accept ();
1288
1286
}
1289
1287
1290
1288
ConfigSearchWindow::ConfigSearchWindow (ConfigMainWindow *parent)
0 commit comments