diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 52a483d9521942c80e0988e4cd740eb0a3952182..0e5c5326351e961d3393be6a6e0905486a2eea4b 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -196,6 +196,22 @@ DebuggerSettings *DebuggerSettings::instance() item = new SavedAction(instance); instance->insertItem(WatchPoint, item); + item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("ShowStandardNamespace")); + item->setText(tr("Show std:: namespace for types")); + item->setCheckable(true); + item->setDefaultValue(true); + item->setValue(true); + instance->insertItem(ShowStdNamespace, item); + + item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("ShowQtNamespace")); + item->setText(tr("Show Qt's namespace for types")); + item->setCheckable(true); + item->setDefaultValue(true); + item->setValue(true); + instance->insertItem(ShowQtNamespace, item); + // // DebuggingHelper // diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 234cf21731ccd3eb20b79c75742ba903a534733f..e6a817cb1609c534f5813ec132fff912e34a5803 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -112,6 +112,8 @@ enum DebuggerActionCode WatchPoint, AssignValue, AssignType, + ShowStdNamespace, + ShowQtNamespace, // Source List ListSourceFiles, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 8868f38b104a8b49cb5da0278432c7ce25ab2145..585cc3f03bc5f8aef744e588b538a3d0f716f5a9 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -362,6 +362,8 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent) m_ui.checkBoxEnableReverseDebugging); m_group.insert(theDebuggerAction(MaximalStackDepth), m_ui.spinBoxMaximalStackDepth); + m_group.insert(theDebuggerAction(ShowStdNamespace), 0); + m_group.insert(theDebuggerAction(ShowQtNamespace), 0); #ifdef USE_REVERSE_DEBUGGING m_ui.checkBoxEnableReverseDebugging->hide(); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index dc1acf68fcc3feb27b3a642d0a8eca215b499d16..92707a78f43911f70f9b536777897f6c07c129fd 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -111,6 +111,7 @@ private: ////////// General Interface ////////// virtual void shutdown(); virtual void executeDebuggerCommand(const QString &command); + virtual QString qtNamespace() const { return m_dumperHelper.qtNamespace(); } private: ////////// General State ////////// diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index 7766b73b7c276f0a1c01d972d981ca37fee1837b..b47a6d15478fa6e11c63b2b82c8300bc2bd36a5a 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -120,6 +120,7 @@ public: virtual bool checkConfiguration(int /* toolChain */, QString * /* errorMessage */, QString * /* settingsPage */ = 0) const { return true; } virtual bool isSynchroneous() const { return false; } + virtual QString qtNamespace() const { return QString(); } protected: void showStatusMessage(const QString &msg, int timeout = -1); DebuggerState state() const; diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 90e1e9ad462826cad1d2e3e450127c3e4a3b36a3..5e90d9d5263c62be549545c797b3ed1adc20cf41 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -330,6 +330,7 @@ QString WatchData::shadowedName(const QString &name, int seen) return QCoreApplication::translate("Debugger::Internal::WatchData", "%1 <shadowed %2>").arg(name).arg(seen); } + /////////////////////////////////////////////////////////////////////// // // WatchModel @@ -385,6 +386,11 @@ void WatchModel::reinitialize() endRemoveRows(); } +void WatchModel::emitAllChanged() +{ + emit layoutChanged(); +} + void WatchModel::beginCycle() { emit enableUpdates(false); @@ -486,7 +492,7 @@ static inline QRegExp stdStringRegExp(const QString &charType) return re; } -QString niceType(const QString typeIn) +static QString niceTypeHelper(const QString typeIn) { static QMap<QString, QString> cache; const QMap<QString, QString>::const_iterator it = cache.constFind(typeIn); @@ -588,6 +594,16 @@ QString niceType(const QString typeIn) return type; } +QString WatchModel::niceType(const QString &typeIn) const +{ + QString type = niceTypeHelper(typeIn); + if (theDebuggerBoolSetting(ShowStdNamespace)) + type = type.remove("std::"); + if (theDebuggerBoolSetting(ShowQtNamespace)) + type = type.remove(m_handler->m_manager->currentEngine()->qtNamespace()); + return type; +} + static QString formattedValue(const WatchData &data, int individualFormat, int typeFormat) { @@ -1092,6 +1108,10 @@ WatchHandler::WatchHandler(DebuggerManager *manager) SIGNAL(triggered()), this, SLOT(watchExpression())); connect(theDebuggerAction(RemoveWatchExpression), SIGNAL(triggered()), this, SLOT(removeWatchExpression())); + connect(theDebuggerAction(ShowStdNamespace), + SIGNAL(triggered()), this, SLOT(emitAllChanged())); + connect(theDebuggerAction(ShowQtNamespace), + SIGNAL(triggered()), this, SLOT(emitAllChanged())); } void WatchHandler::beginCycle() @@ -1125,6 +1145,13 @@ void WatchHandler::cleanup() #endif } +void WatchHandler::emitAllChanged() +{ + m_locals->emitAllChanged(); + m_watchers->emitAllChanged(); + m_tooltips->emitAllChanged(); +} + void WatchHandler::insertData(const WatchData &data) { MODEL_DEBUG("INSERTDATA: " << data.toString()); diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index dfd36da559700d8349ec57bec9f24e6a9ba94e08..a53a80989f6706c27f0756fcff81f0f30626275f 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -221,10 +221,14 @@ private: void dump(); void dumpHelper(WatchItem *item); + void emitAllChanged(); + signals: void enableUpdates(bool); private: + QString niceType(const QString &typeIn) const; + WatchHandler *m_handler; WatchType m_type; WatchItem *m_root; @@ -245,6 +249,7 @@ public: Q_SLOT void watchExpression(const QString &exp); Q_SLOT void removeWatchExpression(); Q_SLOT void removeWatchExpression(const QString &exp); + Q_SLOT void emitAllChanged(); void beginCycle(); // called at begin of updateLocals() cycle void updateWatchers(); // called after locals are fetched void endCycle(); // called after all results have been received diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index b4c7a55afff557c60b03a0635352df17aaf76817..4c931520ccf3f3806100b1b8a7f3ddfbd3689291 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -284,6 +284,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(theDebuggerAction(UseToolTipsInLocalsView)); menu.addAction(theDebuggerAction(AutoDerefPointers)); + menu.addAction(theDebuggerAction(ShowStdNamespace)); + menu.addAction(theDebuggerAction(ShowQtNamespace)); QAction *actAdjustColumnWidths = menu.addAction(tr("Adjust column widths to contents"));