diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/analyzerbase/analyzermanager.cpp | 37 | ||||
-rw-r--r-- | src/plugins/analyzerbase/analyzermanager.h | 3 | ||||
-rw-r--r-- | src/plugins/analyzerbase/analyzerplugin.cpp | 147 | ||||
-rw-r--r-- | src/plugins/analyzerbase/ianalyzertool.cpp | 5 | ||||
-rw-r--r-- | src/plugins/analyzerbase/ianalyzertool.h | 3 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.cpp | 8 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.h | 1 | ||||
-rw-r--r-- | src/plugins/valgrind/callgrindtool.cpp | 5 | ||||
-rw-r--r-- | src/plugins/valgrind/callgrindtool.h | 2 | ||||
-rw-r--r-- | src/plugins/valgrind/memchecktool.cpp | 5 | ||||
-rw-r--r-- | src/plugins/valgrind/memchecktool.h | 1 | ||||
-rw-r--r-- | src/plugins/valgrind/valgrindplugin.cpp | 166 | ||||
-rw-r--r-- | src/plugins/valgrind/valgrindplugin.h | 1 |
13 files changed, 188 insertions, 196 deletions
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 1c9caaefe1..f939c41069 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -42,6 +42,8 @@ #include "analyzerutils.h" #include "ianalyzertool.h" +#include "startremotedialog.h" + #include <coreplugin/coreconstants.h> #include <coreplugin/findplaceholder.h> #include <coreplugin/icore.h> @@ -846,11 +848,6 @@ void AnalyzerManager::stopTool() stopAction()->trigger(); } -void AnalyzerManager::startLocalTool(IAnalyzerTool *tool, StartMode mode) -{ - m_instance->d->startLocalTool(tool, mode); -} - QAction *AnalyzerManager::stopAction() { return m_instance->d->m_stopAction; @@ -870,6 +867,36 @@ IAnalyzerTool *AnalyzerManager::toolFromId(const QByteArray &id) return 0; } +static void startRemoteTool(IAnalyzerTool *tool, StartMode mode) +{ + StartRemoteDialog dlg; + if (dlg.exec() != QDialog::Accepted) + return; + + AnalyzerStartParameters sp; + sp.toolId = tool->id(); + sp.startMode = mode; + sp.connParams = dlg.sshParams(); + sp.debuggee = dlg.executable(); + sp.debuggeeArgs = dlg.arguments(); + sp.displayName = dlg.executable(); + sp.workingDirectory = dlg.workingDirectory(); + + AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0); + QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); + + ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id()); +} + +void AnalyzerManager::defaultStartTool(IAnalyzerTool *tool, StartMode mode) +{ + if (mode == StartLocal) + m_instance->d->startLocalTool(tool, mode); + if (mode == StartRemote) + startRemoteTool(tool, mode); + // m_instance->d->startRemoteTool(tool, mode); +} + } // namespace Analyzer #include "analyzermanager.moc" diff --git a/src/plugins/analyzerbase/analyzermanager.h b/src/plugins/analyzerbase/analyzermanager.h index 26bb66a0a8..68a81611de 100644 --- a/src/plugins/analyzerbase/analyzermanager.h +++ b/src/plugins/analyzerbase/analyzermanager.h @@ -84,7 +84,8 @@ public: static void stopTool(); // Convenience functions. - static void startLocalTool(IAnalyzerTool *tool, StartMode mode); + //static void startLocalTool(IAnalyzerTool *tool, StartMode mode); + static void defaultStartTool(IAnalyzerTool *tool, StartMode mode); static QString msgToolStarted(const QString &name); static QString msgToolFinished(const QString &name, int issuesFound); diff --git a/src/plugins/analyzerbase/analyzerplugin.cpp b/src/plugins/analyzerbase/analyzerplugin.cpp index e914130f0d..05e10f2389 100644 --- a/src/plugins/analyzerbase/analyzerplugin.cpp +++ b/src/plugins/analyzerbase/analyzerplugin.cpp @@ -33,8 +33,14 @@ **************************************************************************/ #include "analyzerplugin.h" + #include "analyzerconstants.h" #include "analyzermanager.h" +#include "analyzerruncontrol.h" +#include "analyzersettings.h" +#include "analyzerstartparameters.h" +#include "analyzerrunconfigwidget.h" +#include "startremotedialog.h" #include "ianalyzertool.h" #include <coreplugin/icore.h> @@ -43,19 +49,152 @@ #include <coreplugin/editormanager/editormanager.h> #include <extensionsystem/pluginmanager.h> + +#include <projectexplorer/applicationrunconfiguration.h> +#include <projectexplorer/projectexplorer.h> #include <projectexplorer/task.h> #include <projectexplorer/taskhub.h> +#include <remotelinux/linuxdeviceconfiguration.h> +#include <remotelinux/remotelinuxrunconfiguration.h> + +#include <utils/qtcassert.h> + #include <QtCore/QtPlugin> +#include <QtGui/QAction> #include <QtGui/QMessageBox> #include <QtGui/QMainWindow> #include <QtGui/QApplication> using namespace Analyzer; using namespace Analyzer::Internal; +using namespace ProjectExplorer; static AnalyzerPlugin *m_instance = 0; +namespace Analyzer { +namespace Internal { + +///////////////////////////////////////////////////////////////////////////////// +// +// AnalyzerRunControlFactory +// +///////////////////////////////////////////////////////////////////////////////// + +static AnalyzerStartParameters localStartParameters(RunConfiguration *runConfiguration) +{ + AnalyzerStartParameters sp; + QTC_ASSERT(runConfiguration, return sp); + LocalApplicationRunConfiguration *rc = + qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); + QTC_ASSERT(rc, return sp); + + sp.startMode = StartLocal; + sp.environment = rc->environment(); + sp.workingDirectory = rc->workingDirectory(); + sp.debuggee = rc->executable(); + sp.debuggeeArgs = rc->commandLineArguments(); + sp.displayName = rc->displayName(); + sp.connParams.host = QLatin1String("localhost"); + sp.connParams.port = rc->qmlDebugServerPort(); + return sp; +} + +static AnalyzerStartParameters remoteLinuxStartParameters(RunConfiguration *runConfiguration) +{ + AnalyzerStartParameters sp; + RemoteLinux::RemoteLinuxRunConfiguration * const rc + = qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration); + QTC_ASSERT(rc, return sp); + + sp.startMode = StartRemote; + sp.debuggee = rc->remoteExecutableFilePath(); + sp.debuggeeArgs = rc->arguments(); + sp.connParams = rc->deviceConfig()->sshParameters(); + sp.analyzerCmdPrefix = rc->commandPrefix(); + sp.displayName = rc->displayName(); + return sp; +} + + +class AnalyzerRunControlFactory : public ProjectExplorer::IRunControlFactory +{ + Q_OBJECT + +public: + AnalyzerRunControlFactory(QObject *parent = 0); + + typedef ProjectExplorer::RunConfiguration RunConfiguration; + typedef ProjectExplorer::RunControl RunControl; + + // IRunControlFactory + bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; + RunControl *create(RunConfiguration *runConfiguration, const QString &mode); + QString displayName() const; + + ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); + ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); +}; + +AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent) + : IRunControlFactory(parent) +{ + setObjectName(QLatin1String("AnalyzerRunControlFactory")); +} + +bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const +{ + Q_UNUSED(runConfiguration); + // FIXME: This is not generic. + return mode.startsWith("Callgrind") || mode.startsWith("Memcheck") || mode == "QmlProfiler"; +} + +RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) +{ + QTC_ASSERT(canRun(runConfiguration, mode), return 0); + + AnalyzerStartParameters sp; + if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) { + sp = localStartParameters(runConfiguration); + } else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { + sp = remoteLinuxStartParameters(runConfiguration); + } else { + // Might be S60DeviceRunfiguration, or something else ... + //sp.startMode = StartRemote; + sp.startMode = StartRemote; + } + + IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1()); + AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration); + QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); + //m_isRunning = true; + return rc; +} + +QString AnalyzerRunControlFactory::displayName() const +{ + return tr("Analyzer"); +} + +IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect() +{ + return new AnalyzerProjectSettings; +} + +RunConfigWidget *AnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration) +{ + LocalApplicationRunConfiguration *localRc = + qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); + if (!localRc) + return 0; + AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); + if (!settings) + return 0; + + AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget; + ret->setRunConfiguration(runConfiguration); + return ret; +} //////////////////////////////////////////////////////////////////////// // @@ -106,6 +245,9 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri //: Category under which Analyzer tasks are listed in build issues view hub->addCategory(QLatin1String(Constants::ANALYZERTASK_ID), tr("Analyzer")); + AnalyzerRunControlFactory *factory = new AnalyzerRunControlFactory(); + addAutoReleasedObject(factory); + return true; } @@ -125,4 +267,9 @@ AnalyzerPlugin *AnalyzerPlugin::instance() return m_instance; } +} // namespace Internal +} // namespace Analyzer + Q_EXPORT_PLUGIN(AnalyzerPlugin) + +#include "analyzerplugin.moc" diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp index f0dce04541..3945fdb9a7 100644 --- a/src/plugins/analyzerbase/ianalyzertool.cpp +++ b/src/plugins/analyzerbase/ianalyzertool.cpp @@ -64,4 +64,9 @@ QString IAnalyzerTool::defaultActionName(const IAnalyzerTool *tool, StartMode mo return base; } +void IAnalyzerTool::defaultStartTool(IAnalyzerTool *tool, StartMode mode) +{ + AnalyzerManager::defaultStartTool(tool, mode); +} + } // namespace Analyzer diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h index 5ddcde892a..180e15cd76 100644 --- a/src/plugins/analyzerbase/ianalyzertool.h +++ b/src/plugins/analyzerbase/ianalyzertool.h @@ -105,6 +105,7 @@ public: static QByteArray defaultMenuGroup(StartMode mode); static QByteArray defaultActionId(const IAnalyzerTool *tool, StartMode mode); static QString defaultActionName(const IAnalyzerTool *tool, StartMode mode); + static void defaultStartTool(IAnalyzerTool *tool, StartMode mode); /// This gets called after all analyzation tools where initialized. virtual void extensionsInitialized() = 0; @@ -124,7 +125,7 @@ public: virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0; - virtual void startTool(StartMode mode) = 0; + virtual void startTool(StartMode mode) { defaultStartTool(this, mode); } /// Called when tools gets selected. virtual void toolSelected() const {} diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 3360dea0a2..716d4f332e 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -537,11 +537,3 @@ void QmlProfilerTool::updateRecordingState() if (d->m_traceWindow->isRecording()) clearDisplay(); } - -void QmlProfilerTool::startTool(StartMode mode) -{ - if (mode == StartLocal) - AnalyzerManager::startLocalTool(this, mode); - if (mode == StartRemote) - AnalyzerManager::startLocalTool(this, mode); -} diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index f3d9b3063e..50e3d1d55c 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -62,7 +62,6 @@ public: ProjectExplorer::RunConfiguration *runConfiguration = 0); QWidget *createControlWidget(); - void startTool(Analyzer::StartMode mode); public slots: void connectClient(int port); diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 7e0ea98b19..c74dbd4a00 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -680,11 +680,6 @@ IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameter return engine; } -void CallgrindTool::startTool(StartMode mode) -{ - ValgrindPlugin::startValgrindTool(this, mode); -} - QWidget *CallgrindTool::createControlWidget() { return d->createControlWidget(); diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h index 64b034d640..517753287f 100644 --- a/src/plugins/valgrind/callgrindtool.h +++ b/src/plugins/valgrind/callgrindtool.h @@ -60,8 +60,6 @@ public: ProjectExplorer::RunConfiguration *runConfiguration = 0); QWidget *createControlWidget(); - void startTool(Analyzer::StartMode mode); - private: CallgrindToolPrivate *d; }; diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 52ad2a8aa0..a3a1079e99 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -467,11 +467,6 @@ IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp, return engine; } -void MemcheckTool::startTool(StartMode mode) -{ - ValgrindPlugin::startValgrindTool(this, mode); -} - void MemcheckTool::engineStarting(const IAnalyzerEngine *engine) { clearErrorView(); diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h index 6f00fa70f9..3035c0d7c3 100644 --- a/src/plugins/valgrind/memchecktool.h +++ b/src/plugins/valgrind/memchecktool.h @@ -118,7 +118,6 @@ private: Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); - void startTool(Analyzer::StartMode mode); void clearErrorView(); diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp index c5ec6cf839..94fdadc927 100644 --- a/src/plugins/valgrind/valgrindplugin.cpp +++ b/src/plugins/valgrind/valgrindplugin.cpp @@ -42,17 +42,6 @@ #include <analyzerbase/analyzerconstants.h> #include <analyzerbase/analyzermanager.h> -#include <analyzerbase/analyzerrunconfigwidget.h> -#include <analyzerbase/analyzerruncontrol.h> -#include <analyzerbase/analyzersettings.h> -#include <analyzerbase/analyzerstartparameters.h> -#include <analyzerbase/startremotedialog.h> - -#include <projectexplorer/applicationrunconfiguration.h> -#include <projectexplorer/projectexplorer.h> - -#include <remotelinux/linuxdeviceconfiguration.h> -#include <remotelinux/remotelinuxrunconfiguration.h> #include <utils/qtcassert.h> @@ -62,168 +51,16 @@ #include <QtGui/QAction> using namespace Analyzer; -using namespace Valgrind::Internal; -using namespace ProjectExplorer; - -///////////////////////////////////////////////////////////////////////////////// -// -// ValgrindRunControlFactory -// -///////////////////////////////////////////////////////////////////////////////// namespace Valgrind { namespace Internal { -static AnalyzerStartParameters localStartParameters(RunConfiguration *runConfiguration) -{ - AnalyzerStartParameters sp; - QTC_ASSERT(runConfiguration, return sp); - LocalApplicationRunConfiguration *rc = - qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); - QTC_ASSERT(rc, return sp); - - sp.startMode = StartLocal; - sp.environment = rc->environment(); - sp.workingDirectory = rc->workingDirectory(); - sp.debuggee = rc->executable(); - sp.debuggeeArgs = rc->commandLineArguments(); - sp.displayName = rc->displayName(); - sp.connParams.host = QLatin1String("localhost"); - sp.connParams.port = rc->qmlDebugServerPort(); - return sp; -} - -static AnalyzerStartParameters remoteLinuxStartParameters(RunConfiguration *runConfiguration) -{ - AnalyzerStartParameters sp; - RemoteLinux::RemoteLinuxRunConfiguration * const rc - = qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration); - QTC_ASSERT(rc, return sp); - - sp.startMode = StartRemote; - sp.debuggee = rc->remoteExecutableFilePath(); - sp.debuggeeArgs = rc->arguments(); - sp.connParams = rc->deviceConfig()->sshParameters(); - sp.analyzerCmdPrefix = rc->commandPrefix(); - sp.displayName = rc->displayName(); - return sp; -} - - -class ValgrindRunControlFactory: public ProjectExplorer::IRunControlFactory -{ - Q_OBJECT - -public: - ValgrindRunControlFactory(QObject *parent = 0); - - typedef ProjectExplorer::RunConfiguration RunConfiguration; - typedef ProjectExplorer::RunControl RunControl; - - // IRunControlFactory - bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; - RunControl *create(RunConfiguration *runConfiguration, const QString &mode); - QString displayName() const; - - ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); - ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); -}; - -ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent) - : IRunControlFactory(parent) -{ - setObjectName(QLatin1String("ValgrindRunControlFactory")); -} - -bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const -{ - Q_UNUSED(runConfiguration); - return mode.startsWith("Callgrind") || mode.startsWith("Memcheck"); -} - -RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) -{ - QTC_ASSERT(canRun(runConfiguration, mode), return 0); - - AnalyzerStartParameters sp; - if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) { - sp = localStartParameters(runConfiguration); - } else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { - sp = remoteLinuxStartParameters(runConfiguration); - } else { - // Might be S60DeviceRunfiguration, or something else ... - //sp.startMode = StartRemote; - sp.startMode = StartRemote; - } - - IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1()); - AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration); - QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); - //m_isRunning = true; - return rc; -} - -QString ValgrindRunControlFactory::displayName() const -{ - return tr("Analyzer"); -} - -IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect() -{ - return new AnalyzerProjectSettings; -} - -RunConfigWidget *ValgrindRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration) -{ - LocalApplicationRunConfiguration *localRc = - qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); - if (!localRc) - return 0; - AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); - if (!settings) - return 0; - - AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget; - ret->setRunConfiguration(runConfiguration); - return ret; -} - ///////////////////////////////////////////////////////////////////////////////// // // ValgrindPlugin // ///////////////////////////////////////////////////////////////////////////////// -static void startRemoteTool(IAnalyzerTool *tool, StartMode mode) -{ - Q_UNUSED(tool); - StartRemoteDialog dlg; - if (dlg.exec() != QDialog::Accepted) - return; - - AnalyzerStartParameters sp; - sp.toolId = tool->id(); - sp.startMode = mode; - sp.connParams = dlg.sshParams(); - sp.debuggee = dlg.executable(); - sp.debuggeeArgs = dlg.arguments(); - sp.displayName = dlg.executable(); - sp.workingDirectory = dlg.workingDirectory(); - - AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0); - //m_currentRunControl = rc; - QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); - - ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id()); -} - -void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode) -{ - if (mode == StartLocal) - AnalyzerManager::startLocalTool(tool, mode); - if (mode == StartRemote) - startRemoteTool(tool, mode); -} static AbstractAnalyzerSubConfig *valgrindConfigFactory() { @@ -265,9 +102,6 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *) AnalyzerManager::addTool(new MemcheckTool(this), modes); AnalyzerManager::addTool(new CallgrindTool(this), modes); - ValgrindRunControlFactory *factory = new ValgrindRunControlFactory(); - addAutoReleasedObject(factory); - return true; } diff --git a/src/plugins/valgrind/valgrindplugin.h b/src/plugins/valgrind/valgrindplugin.h index 9598572bd3..e07961d559 100644 --- a/src/plugins/valgrind/valgrindplugin.h +++ b/src/plugins/valgrind/valgrindplugin.h @@ -51,7 +51,6 @@ public: virtual bool initialize(const QStringList &arguments, QString *errorString); virtual void extensionsInitialized() {} - static void startValgrindTool(Analyzer::IAnalyzerTool *tool, Analyzer::StartMode mode); }; } // namespace Internal |