Update valgrind plugin namespace and use new APIs.

Merge-request: 284
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Mike McQuaid
2011-04-04 14:39:28 +02:00
committed by hjk
parent 6ac987c846
commit 0af81b8fd8
9 changed files with 45 additions and 47 deletions

View File

@@ -41,7 +41,7 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
using namespace Analyzer::Internal; using namespace Valgrind::Internal;
ValgrindConfigWidget::ValgrindConfigWidget(ValgrindSettings *settings, QWidget *parent) ValgrindConfigWidget::ValgrindConfigWidget(ValgrindSettings *settings, QWidget *parent)
: QWidget(parent), : QWidget(parent),

View File

@@ -39,14 +39,12 @@
#include <QtGui/QWidget> #include <QtGui/QWidget>
QT_BEGIN_NAMESPACE namespace Valgrind {
namespace Internal {
namespace Ui { namespace Ui {
class ValgrindConfigWidget; class ValgrindConfigWidget;
} }
QT_END_NAMESPACE
namespace Analyzer {
namespace Internal {
class ValgrindSettings; class ValgrindSettings;
@@ -64,7 +62,6 @@ private:
}; };
} }
} }
#endif // ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H #endif // ANALYZER_INTERNAL_VALGRINDCONFIGWIDGET_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ValgrindConfigWidget</class> <class>Valgrind::Internal::ValgrindConfigWidget</class>
<widget class="QWidget" name="ValgrindConfigWidget"> <widget class="QWidget" name="Valgrind::Internal::ValgrindConfigWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -20,7 +20,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title"> <property name="title">
<string>Common Valgrind Options</string> <string>Generic Settings</string>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">

View File

@@ -46,26 +46,21 @@
#define VALGRIND_DEBUG_OUTPUT 0 #define VALGRIND_DEBUG_OUTPUT 0
using namespace Analyzer; using namespace Analyzer;
using namespace Analyzer::Internal; using namespace Valgrind::Internal;
using namespace Utils; using namespace Utils;
ValgrindEngine::ValgrindEngine(ProjectExplorer::RunConfiguration *runConfiguration) ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
: IAnalyzerEngine(runConfiguration), ProjectExplorer::RunConfiguration *runConfiguration)
: IAnalyzerEngine(sp, runConfiguration),
m_settings(0), m_settings(0),
m_progress(new QFutureInterface<void>()) , m_progress(new QFutureInterface<void>()) ,
m_isStopping(false) m_isStopping(false)
{ {
ProjectExplorer::LocalApplicationRunConfiguration *localAppConfig = if (runConfiguration)
qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration);
m_settings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); m_settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
if (!localAppConfig || !m_settings)
return;
m_workingDirectory = localAppConfig->workingDirectory(); if (!m_settings)
m_executable = localAppConfig->executable(); m_settings = AnalyzerGlobalSettings::instance();
m_commandLineArguments = localAppConfig->commandLineArguments();
m_environment = localAppConfig->environment();
} }
ValgrindEngine::~ValgrindEngine() ValgrindEngine::~ValgrindEngine()
@@ -77,7 +72,7 @@ void ValgrindEngine::start()
{ {
emit starting(this); emit starting(this);
Core::FutureProgress* fp = Core::ICore::instance()->progressManager()->addTask(m_progress->future(), Core::FutureProgress *fp = Core::ICore::instance()->progressManager()->addTask(m_progress->future(),
progressTitle(), "valgrind"); progressTitle(), "valgrind");
fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish); fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish);
m_progress->reportStarted(); m_progress->reportStarted();
@@ -88,13 +83,16 @@ void ValgrindEngine::start()
emit standardOutputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments)); emit standardOutputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments));
#endif #endif
runner()->setWorkingDirectory(m_workingDirectory); const AnalyzerStartParameters &sp = startParameters();
runner()->setValgrindExecutable(m_settings->subConfig<ValgrindSettings>()->valgrindExecutable()); runner()->setWorkingDirectory(sp.workingDirectory);
QString valgrindExe = m_settings->subConfig<ValgrindSettings>()->valgrindExecutable();
if (!sp.analyzerCmdPrefix.isEmpty())
valgrindExe = sp.analyzerCmdPrefix + ' ' + valgrindExe;
runner()->setValgrindExecutable(valgrindExe);
runner()->setValgrindArguments(toolArguments()); runner()->setValgrindArguments(toolArguments());
runner()->setDebuggeeExecutable(m_executable); runner()->setDebuggeeExecutable(sp.debuggee);
// note that m_commandLineArguments may contain several arguments in one string runner()->setDebuggeeArguments(sp.debuggeeArgs);
runner()->setDebuggeeArguments(m_commandLineArguments); runner()->setEnvironment(sp.environment);
runner()->setEnvironment(m_environment);
connect(runner(), SIGNAL(standardOutputReceived(QByteArray)), connect(runner(), SIGNAL(standardOutputReceived(QByteArray)),
SLOT(receiveStandardOutput(QByteArray))); SLOT(receiveStandardOutput(QByteArray)));
@@ -105,6 +103,9 @@ void ValgrindEngine::start()
connect(runner(), SIGNAL(finished()), connect(runner(), SIGNAL(finished()),
SLOT(runnerFinished())); SLOT(runnerFinished()));
if (sp.startMode == StartRemote)
runner()->startRemotely(sp.connParams);
else
runner()->start(); runner()->start();
} }
@@ -116,12 +117,12 @@ void ValgrindEngine::stop()
QString ValgrindEngine::executable() const QString ValgrindEngine::executable() const
{ {
return m_executable; return startParameters().debuggee;
} }
void ValgrindEngine::runnerFinished() void ValgrindEngine::runnerFinished()
{ {
emit standardOutputReceived(tr("** Analysing finished **")); emit standardOutputReceived(tr("** Analyzing finished **"));
emit finished(); emit finished();
m_progress->reportFinished(); m_progress->reportFinished();

View File

@@ -36,6 +36,8 @@
#ifndef VALGRINDENGINE_H #ifndef VALGRINDENGINE_H
#define VALGRINDENGINE_H #define VALGRINDENGINE_H
#include <analyzerbase/ianalyzerengine.h>
#include "valgrindtoolbase_global.h" #include "valgrindtoolbase_global.h"
#include <analyzerbase/ianalyzerengine.h> #include <analyzerbase/ianalyzerengine.h>
@@ -49,16 +51,18 @@
#include <QtCore/QFutureInterface> #include <QtCore/QFutureInterface>
namespace Analyzer { namespace Analyzer {
class AnalyzerSettings; class AnalyzerSettings;
}
namespace Valgrind {
namespace Internal { namespace Internal {
class VALGRINDTOOLBASE_EXPORT ValgrindEngine : public IAnalyzerEngine class VALGRINDTOOLBASE_EXPORT ValgrindEngine : public Analyzer::IAnalyzerEngine
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ValgrindEngine(ProjectExplorer::RunConfiguration *runConfiguration); explicit ValgrindEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
virtual ~ValgrindEngine(); virtual ~ValgrindEngine();
void start(); void start();
@@ -71,7 +75,7 @@ protected:
virtual QStringList toolArguments() const = 0; virtual QStringList toolArguments() const = 0;
virtual Valgrind::ValgrindRunner *runner() = 0; virtual Valgrind::ValgrindRunner *runner() = 0;
AnalyzerSettings *m_settings; Analyzer::AnalyzerSettings *m_settings;
QFutureInterface<void> *m_progress; QFutureInterface<void> *m_progress;
private slots: private slots:
@@ -82,14 +86,10 @@ private slots:
void receiveProcessError(const QString &, QProcess::ProcessError); void receiveProcessError(const QString &, QProcess::ProcessError);
private: private:
QString m_workingDirectory;
QString m_executable;
QString m_commandLineArguments;
Utils::Environment m_environment;
bool m_isStopping; bool m_isStopping;
}; };
} // namespace Internal } // namespace Internal
} // namespace Analyzer } // namespace Valgrind
#endif // VALGRINDENGINE_H #endif // VALGRINDENGINE_H

View File

@@ -42,7 +42,7 @@
#include <QtCore/QSettings> #include <QtCore/QSettings>
using namespace Analyzer::Internal; using namespace Valgrind::Internal;
using namespace Analyzer; using namespace Analyzer;
static const QLatin1String groupC("Analyzer"); static const QLatin1String groupC("Analyzer");

View File

@@ -43,13 +43,13 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QVariant> #include <QtCore/QVariant>
namespace Analyzer { namespace Valgrind {
namespace Internal { namespace Internal {
/** /**
* Generic Valgrind settings shared by all tools. * Generic Valgrind settings shared by all tools.
*/ */
class VALGRINDTOOLBASE_EXPORT ValgrindSettings : public AbstractAnalyzerSubConfig class VALGRINDTOOLBASE_EXPORT ValgrindSettings : public Analyzer::AbstractAnalyzerSubConfig
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -43,7 +43,7 @@
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
using namespace Analyzer; using namespace Analyzer;
using namespace Analyzer::Internal; using namespace Valgrind::Internal;
ValgrindToolbasePlugin::ValgrindToolbasePlugin() ValgrindToolbasePlugin::ValgrindToolbasePlugin()
{ {

View File

@@ -38,7 +38,7 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
namespace Analyzer { namespace Valgrind {
namespace Internal { namespace Internal {
class ValgrindToolbasePlugin : public ExtensionSystem::IPlugin class ValgrindToolbasePlugin : public ExtensionSystem::IPlugin