forked from qt-creator/qt-creator
analyzer: move responsibility for run modes to individual tools
Change-Id: Iaf2fa9d4c087470649336a453c6a9a7db12d220f Reviewed-on: http://codereview.qt.nokia.com/1051 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -175,7 +175,6 @@ public slots:
|
||||
public:
|
||||
CallgrindTool *q;
|
||||
|
||||
bool m_local;
|
||||
DataModel *m_dataModel;
|
||||
DataProxyModel *m_proxyModel;
|
||||
StackBrowser *m_stackBrowser;
|
||||
@@ -218,7 +217,6 @@ public:
|
||||
|
||||
CallgrindToolPrivate::CallgrindToolPrivate(CallgrindTool *parent)
|
||||
: q(parent)
|
||||
, m_local(true)
|
||||
, m_dataModel(new DataModel(this))
|
||||
, m_proxyModel(new DataProxyModel(this))
|
||||
, m_stackBrowser(new StackBrowser(this))
|
||||
@@ -499,11 +497,10 @@ static QToolButton *createToolButton(QAction *action)
|
||||
return button;
|
||||
}
|
||||
|
||||
CallgrindTool::CallgrindTool(bool local, QObject *parent)
|
||||
CallgrindTool::CallgrindTool(QObject *parent)
|
||||
: Analyzer::IAnalyzerTool(parent)
|
||||
{
|
||||
d = new CallgrindToolPrivate(this);
|
||||
d->m_local = local;
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
|
||||
// EditorManager
|
||||
@@ -519,19 +516,12 @@ CallgrindTool::~CallgrindTool()
|
||||
|
||||
QByteArray CallgrindTool::id() const
|
||||
{
|
||||
return d->m_local ? "CallgrindLocal" : "CallgrindRemote";
|
||||
return "Callgrind";
|
||||
}
|
||||
|
||||
QString CallgrindTool::displayName() const
|
||||
{
|
||||
return d->m_local ? tr("Valgrind Function Profile")
|
||||
: tr("Valgrind Function Profile (Remote)");
|
||||
}
|
||||
|
||||
QByteArray CallgrindTool::menuGroup() const
|
||||
{
|
||||
return d->m_local ? Analyzer::Constants::G_ANALYZER_TOOLS
|
||||
: Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS;
|
||||
return tr("Valgrind Function Profile");
|
||||
}
|
||||
|
||||
QString CallgrindTool::description() const
|
||||
@@ -540,14 +530,6 @@ QString CallgrindTool::description() const
|
||||
"record function calls when a program runs.");
|
||||
}
|
||||
|
||||
void CallgrindTool::startTool()
|
||||
{
|
||||
if (d->m_local)
|
||||
AnalyzerManager::startLocalTool(this);
|
||||
else
|
||||
AnalyzerManager::startRemoteTool(this);
|
||||
}
|
||||
|
||||
IAnalyzerTool::ToolMode CallgrindTool::mode() const
|
||||
{
|
||||
return ReleaseMode;
|
||||
@@ -947,8 +929,8 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
|
||||
|
||||
m_toggleCollectFunction = QString("%1()").arg(qualifiedFunctionName);
|
||||
|
||||
AnalyzerManager::selectTool(q);
|
||||
AnalyzerManager::startTool(q);
|
||||
AnalyzerManager::selectTool(q, StartMode(StartLocal));
|
||||
AnalyzerManager::startTool(q, StartMode(StartLocal));
|
||||
}
|
||||
|
||||
void CallgrindToolPrivate::slotRequestDump()
|
||||
|
||||
@@ -45,16 +45,14 @@ class CallgrindTool : public Analyzer::IAnalyzerTool
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CallgrindTool(bool local, QObject *parent);
|
||||
CallgrindTool(QObject *parent);
|
||||
~CallgrindTool();
|
||||
|
||||
QByteArray id() const;
|
||||
QString displayName() const;
|
||||
QByteArray menuGroup() const;
|
||||
QString description() const;
|
||||
ToolMode mode() const;
|
||||
|
||||
void startTool();
|
||||
void extensionsInitialized();
|
||||
void initializeDockWidgets();
|
||||
|
||||
|
||||
@@ -184,10 +184,9 @@ static void initKindFilterAction(QAction *action, const QList<int> &kinds)
|
||||
action->setData(data);
|
||||
}
|
||||
|
||||
MemcheckTool::MemcheckTool(bool local, QObject *parent)
|
||||
MemcheckTool::MemcheckTool(QObject *parent)
|
||||
: Analyzer::IAnalyzerTool(parent)
|
||||
{
|
||||
m_local = local;
|
||||
m_settings = 0;
|
||||
m_errorModel = 0;
|
||||
m_errorProxyModel = 0;
|
||||
@@ -295,13 +294,7 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
|
||||
|
||||
QByteArray MemcheckTool::id() const
|
||||
{
|
||||
return m_local ? "MemcheckLocal" : "MemcheckGlobal";
|
||||
}
|
||||
|
||||
QByteArray MemcheckTool::menuGroup() const
|
||||
{
|
||||
return m_local ? Analyzer::Constants::G_ANALYZER_TOOLS
|
||||
: Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS;
|
||||
return "MemcheckLocal";
|
||||
}
|
||||
|
||||
QString MemcheckTool::displayName() const
|
||||
@@ -320,14 +313,6 @@ IAnalyzerTool::ToolMode MemcheckTool::mode() const
|
||||
return DebugMode;
|
||||
}
|
||||
|
||||
void MemcheckTool::startTool()
|
||||
{
|
||||
if (m_local)
|
||||
AnalyzerManager::startLocalTool(this);
|
||||
else
|
||||
AnalyzerManager::startRemoteTool(this);
|
||||
}
|
||||
|
||||
class FrameFinder : public ErrorListModel::RelevantFrameFinder
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -91,13 +91,11 @@ class MemcheckTool : public Analyzer::IAnalyzerTool
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemcheckTool(bool local, QObject *parent);
|
||||
MemcheckTool(QObject *parent);
|
||||
|
||||
QByteArray id() const;
|
||||
QString displayName() const;
|
||||
QString description() const;
|
||||
QByteArray menuGroup() const;
|
||||
void startTool();
|
||||
|
||||
private slots:
|
||||
void settingsDestroyed(QObject *settings);
|
||||
|
||||
@@ -80,14 +80,14 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalCallgrindFactory, &projectCallgrindFactory);
|
||||
AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalMemcheckFactory, &projectMemcheckFactory);
|
||||
|
||||
StartModes modes;
|
||||
#ifndef Q_OS_WIN
|
||||
AnalyzerManager::addTool(new MemcheckTool(true, this));
|
||||
modes.append(StartMode(StartLocal));
|
||||
#endif
|
||||
AnalyzerManager::addTool(new MemcheckTool(false, this));
|
||||
#ifndef Q_OS_WIN
|
||||
AnalyzerManager::addTool(new CallgrindTool(true, this));
|
||||
#endif
|
||||
AnalyzerManager::addTool(new CallgrindTool(false, this));
|
||||
modes.append(StartMode(StartRemote));
|
||||
|
||||
AnalyzerManager::addTool(new MemcheckTool(this), modes);
|
||||
AnalyzerManager::addTool(new CallgrindTool(this), modes);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user