Commit f2392ffb authored by hjk's avatar hjk

debugger: allow the user to hide the std:: and Qt's namespace

parent b8dbb120
......@@ -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
//
......
......@@ -112,6 +112,8 @@ enum DebuggerActionCode
WatchPoint,
AssignValue,
AssignType,
ShowStdNamespace,
ShowQtNamespace,
// Source List
ListSourceFiles,
......
......@@ -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();
......
......@@ -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 //////////
......
......@@ -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;
......
......@@ -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());
......
......@@ -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
......
......@@ -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"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment