debugger: make output format of non-printable characters customizable

This commit is contained in:
hjk
2011-02-17 19:00:33 +01:00
parent 8c3e61e083
commit 98c4b82c2d
4 changed files with 66 additions and 10 deletions

View File

@@ -286,14 +286,31 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
mi0.data(LocalsIndividualFormatRole).toInt();
const int effectiveIndividualFormat =
individualFormat == -1 ? typeFormat : individualFormat;
const int unprintableBase = handler->unprintableBase();
QMenu formatMenu;
QList<QAction *> typeFormatActions;
QList<QAction *> individualFormatActions;
QAction *clearTypeFormatAction = 0;
QAction *clearIndividualFormatAction = 0;
QAction *showUnprintableUnicode = 0;
QAction *showUnprintableOctal = 0;
QAction *showUnprintableHexadecimal = 0;
formatMenu.setTitle(tr("Change Display Format..."));
if (idx.isValid() && !alternativeFormats.isEmpty()) {
if (true /*idx.isValid() && !alternativeFormats.isEmpty() */) {
showUnprintableUnicode =
formatMenu.addAction(tr("Treat All Characters as Printable"));
showUnprintableUnicode->setCheckable(true);
showUnprintableUnicode->setChecked(unprintableBase == 0);
showUnprintableOctal =
formatMenu.addAction(tr("Show Unprintable Characters as Octal"));
showUnprintableOctal->setCheckable(true);
showUnprintableOctal->setChecked(unprintableBase == 8);
showUnprintableHexadecimal =
formatMenu.addAction(tr("Show Unprintable Characters as Hexadecimal"));
showUnprintableHexadecimal->setCheckable(true);
showUnprintableHexadecimal->setChecked(unprintableBase == 16);
formatMenu.addSeparator();
QAction *dummy = formatMenu.addAction(
tr("Change Display for Type \"%1\"").arg(type));
dummy->setEnabled(false);
@@ -515,6 +532,12 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == actShowInEditor) {
QString contents = handler->editorContents();
debuggerCore()->openTextEditor(tr("Locals & Watchers"), contents);
} else if (act == showUnprintableUnicode) {
handler->setUnprintableBase(0);
} else if (act == showUnprintableOctal) {
handler->setUnprintableBase(8);
} else if (act == showUnprintableHexadecimal) {
handler->setUnprintableBase(16);
} else {
for (int i = 0; i != typeFormatActions.size(); ++i) {
if (act == typeFormatActions.at(i))