Commit 10a0647d authored by dt's avatar dt
Browse files

Remove QSharedPointer<> for RunConfiguration

parent 8adef29b
......@@ -330,9 +330,9 @@ bool CMakeProject::parseCMakeLists()
// Create run configurations for m_targets
//qDebug()<<"Create run configurations of m_targets";
QMultiMap<QString, QSharedPointer<CMakeRunConfiguration> > existingRunConfigurations;
foreach(QSharedPointer<ProjectExplorer::RunConfiguration> cmakeRunConfiguration, runConfigurations()) {
if (QSharedPointer<CMakeRunConfiguration> rc = cmakeRunConfiguration.objectCast<CMakeRunConfiguration>()) {
QMultiMap<QString, CMakeRunConfiguration* > existingRunConfigurations;
foreach(ProjectExplorer::RunConfiguration* cmakeRunConfiguration, runConfigurations()) {
if (CMakeRunConfiguration* rc = qobject_cast<CMakeRunConfiguration *>(cmakeRunConfiguration)) {
existingRunConfigurations.insert(rc->title(), rc);
}
}
......@@ -343,10 +343,10 @@ bool CMakeProject::parseCMakeLists()
continue;
if (ct.title.endsWith("/fast"))
continue;
QList<QSharedPointer<CMakeRunConfiguration> > list = existingRunConfigurations.values(ct.title);
QList<CMakeRunConfiguration *> list = existingRunConfigurations.values(ct.title);
if (!list.isEmpty()) {
// Already exists, so override the settings...
foreach (QSharedPointer<CMakeRunConfiguration> rc, list) {
foreach (CMakeRunConfiguration *rc, list) {
//qDebug()<<"Updating Run Configuration with title"<<ct.title;
//qDebug()<<" Executable new:"<<ct.executable<< "old:"<<rc->executable();
//qDebug()<<" WD new:"<<ct.workingDirectory<<"old:"<<rc->workingDirectory();
......@@ -358,7 +358,7 @@ bool CMakeProject::parseCMakeLists()
// Does not exist yet
//qDebug()<<"Adding new run configuration with title"<<ct.title;
//qDebug()<<" Executable:"<<ct.executable<<"WD:"<<ct.workingDirectory;
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory, ct.title));
ProjectExplorer::RunConfiguration *rc(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory, ct.title));
addRunConfiguration(rc);
// The first one gets the honour of beeing the active one
if (setActive) {
......@@ -367,10 +367,10 @@ bool CMakeProject::parseCMakeLists()
}
}
}
QMultiMap<QString, QSharedPointer<CMakeRunConfiguration> >::const_iterator it =
QMultiMap<QString, CMakeRunConfiguration *>::const_iterator it =
existingRunConfigurations.constBegin();
for( ; it != existingRunConfigurations.constEnd(); ++it) {
QSharedPointer<CMakeRunConfiguration> rc = it.value();
CMakeRunConfiguration *rc = it.value();
//qDebug()<<"Removing old RunConfiguration with title:"<<rc->title();
//qDebug()<<" Executable:"<<rc->executable()<<rc->workingDirectory();
removeRunConfiguration(rc);
......
......@@ -429,19 +429,19 @@ QString CMakeRunConfigurationFactory::displayNameForType(const QString &type) co
return type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
}
QSharedPointer<ProjectExplorer::RunConfiguration> CMakeRunConfigurationFactory::create(ProjectExplorer::Project *project, const QString &type)
ProjectExplorer::RunConfiguration* CMakeRunConfigurationFactory::create(ProjectExplorer::Project *project, const QString &type)
{
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
Q_ASSERT(pro);
if (type == Constants::CMAKERUNCONFIGURATION) {
// Restoring, filename will be added by restoreSettings
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, QString::null, QString::null, QString::null));
ProjectExplorer::RunConfiguration* rc = new CMakeRunConfiguration(pro, QString::null, QString::null, QString::null);
return rc;
} else {
// Adding new
const QString title = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
const CMakeTarget &ct = pro->targetForTitle(title);
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, ct.executable, ct.workingDirectory, ct.title));
ProjectExplorer::RunConfiguration * rc = new CMakeRunConfiguration(pro, ct.executable, ct.workingDirectory, ct.title);
return rc;
}
}
......@@ -138,7 +138,7 @@ public:
virtual QStringList availableCreationTypes(ProjectExplorer::Project *pro) const;
// used to translate the types to names to display to the user
virtual QString displayNameForType(const QString &type) const;
virtual QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project, const QString &type);
virtual ProjectExplorer::RunConfiguration* create(ProjectExplorer::Project *project, const QString &type);
};
......
......@@ -1258,7 +1258,7 @@ void DebuggerPlugin::startExternalApplication()
if (dlg.breakAtMain())
m_manager->breakByFunctionMain();
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp, ProjectExplorer::Constants::DEBUGMODE))
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance()->startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE);
}
......@@ -1279,7 +1279,7 @@ void DebuggerPlugin::attachExternalApplication(qint64 pid, const QString &crashP
sp->attachPID = pid;
sp->crashParameter = crashParameter;
sp->startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp, ProjectExplorer::Constants::DEBUGMODE))
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance()->startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE);
}
......@@ -1311,8 +1311,7 @@ void DebuggerPlugin::attachCore(const QString &core, const QString &exe)
sp->executable = exe;
sp->coreFile = core;
sp->startMode = AttachCore;
if (RunControl *runControl = m_debuggerRunControlFactory
->create(sp, ProjectExplorer::Constants::DEBUGMODE))
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance()->startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE);
}
......@@ -1347,7 +1346,7 @@ void DebuggerPlugin::startRemoteApplication()
sp->serverStartScript = dlg.serverStartScript();
sp->sysRoot = dlg.sysroot();
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp, ProjectExplorer::Constants::DEBUGMODE))
if (RunControl *runControl = m_debuggerRunControlFactory->create(sp))
ProjectExplorerPlugin::instance()->startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE);
}
......
......@@ -63,10 +63,10 @@ DebuggerRunControlFactory::DebuggerRunControlFactory(DebuggerManager *manager)
: m_manager(manager)
{}
bool DebuggerRunControlFactory::canRun(const RunConfigurationPtr &runConfiguration, const QString &mode) const
bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
{
return mode == ProjectExplorer::Constants::DEBUGMODE
&& !runConfiguration.objectCast<LocalApplicationRunConfiguration>().isNull();
&& qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
}
QString DebuggerRunControlFactory::displayName() const
......@@ -74,22 +74,21 @@ QString DebuggerRunControlFactory::displayName() const
return tr("Debug");
}
RunControl *DebuggerRunControlFactory::create(const DebuggerStartParametersPtr &sp, const QString &mode)
RunControl *DebuggerRunControlFactory::create(const DebuggerStartParametersPtr &sp)
{
return new DebuggerRunControl(m_manager, sp);
}
RunControl *DebuggerRunControlFactory::create(const RunConfigurationPtr &runConfiguration,
RunControl *DebuggerRunControlFactory::create(RunConfiguration *runConfiguration,
const QString &mode)
{
QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
LocalApplicationRunConfigurationPtr rc =
runConfiguration.objectCast<LocalApplicationRunConfiguration>();
QTC_ASSERT(!rc.isNull(), return 0);
LocalApplicationRunConfiguration *rc = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
QTC_ASSERT(rc, return 0);
return new DebuggerRunControl(m_manager, rc);
}
QWidget *DebuggerRunControlFactory::configurationWidget(const RunConfigurationPtr &runConfiguration)
QWidget *DebuggerRunControlFactory::configurationWidget(RunConfiguration *runConfiguration)
{
// NBS TODO: Add GDB-specific configuration widget
Q_UNUSED(runConfiguration)
......@@ -106,7 +105,7 @@ QWidget *DebuggerRunControlFactory::configurationWidget(const RunConfigurationPt
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
QSharedPointer<LocalApplicationRunConfiguration> runConfiguration)
LocalApplicationRunConfiguration *runConfiguration)
: RunControl(runConfiguration),
m_startParameters(new DebuggerStartParameters()),
m_manager(manager),
......@@ -158,7 +157,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
}
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, const DebuggerStartParametersPtr &startParameters)
: RunControl(RunConfigurationPtr(0)),
: RunControl(0),
m_startParameters(startParameters),
m_manager(manager),
m_running(false)
......
......@@ -35,22 +35,12 @@
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/applicationrunconfiguration.h>
namespace ProjectExplorer {
class LocalApplicationRunConfiguration;
}
namespace Debugger {
class DebuggerManager;
namespace Internal {
class StartData;
typedef QSharedPointer<ProjectExplorer::RunConfiguration>
RunConfigurationPtr;
typedef QSharedPointer<ProjectExplorer::LocalApplicationRunConfiguration>
LocalApplicationRunConfigurationPtr;
class DebuggerRunControlFactory
: public ProjectExplorer::IRunControlFactory
{
......@@ -60,14 +50,15 @@ public:
explicit DebuggerRunControlFactory(DebuggerManager *manager);
// ProjectExplorer::IRunControlFactory
bool canRun(const RunConfigurationPtr &runConfiguration, const QString &mode) const;
virtual ProjectExplorer::RunControl *create(const RunConfigurationPtr &runConfiguration,
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const;
virtual ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode);
virtual QString displayName() const;
virtual QWidget *configurationWidget(const RunConfigurationPtr &runConfiguration);
virtual QWidget *configurationWidget(ProjectExplorer::RunConfiguration *runConfiguration);
ProjectExplorer::RunControl *create(const DebuggerStartParametersPtr &sp, const QString &mode);
ProjectExplorer::RunControl *create(const DebuggerStartParametersPtr &sp);
private:
DebuggerStartParametersPtr m_startParameters;
......@@ -82,9 +73,10 @@ class DebuggerRunControl
public:
DebuggerRunControl(DebuggerManager *manager,
LocalApplicationRunConfigurationPtr runConfiguration);
ProjectExplorer::LocalApplicationRunConfiguration *runConfiguration);
DebuggerRunControl(DebuggerManager *manager, const DebuggerStartParametersPtr &startParameters);
// ProjectExplorer::RunControl
virtual void start();
virtual void stop();
......
......@@ -78,10 +78,10 @@ LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
{
}
bool LocalApplicationRunControlFactory::canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const
bool LocalApplicationRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const
{
return (mode == ProjectExplorer::Constants::RUNMODE)
&& (!runConfiguration.objectCast<LocalApplicationRunConfiguration>().isNull());
&& (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) != 0);
}
QString LocalApplicationRunControlFactory::displayName() const
......@@ -89,13 +89,13 @@ QString LocalApplicationRunControlFactory::displayName() const
return tr("Run");
}
RunControl *LocalApplicationRunControlFactory::create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode)
RunControl *LocalApplicationRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
{
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
return new LocalApplicationRunControl(runConfiguration.objectCast<LocalApplicationRunConfiguration>());
return new LocalApplicationRunControl(qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration));
}
QWidget *LocalApplicationRunControlFactory::configurationWidget(const QSharedPointer<RunConfiguration> &runConfiguration)
QWidget *LocalApplicationRunControlFactory::configurationWidget(RunConfiguration *runConfiguration)
{
Q_UNUSED(runConfiguration)
return new QLabel("TODO add Configuration widget");
......@@ -103,9 +103,16 @@ QWidget *LocalApplicationRunControlFactory::configurationWidget(const QSharedPoi
// ApplicationRunControl
LocalApplicationRunControl::LocalApplicationRunControl(const QSharedPointer<LocalApplicationRunConfiguration> &runConfiguration)
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration)
: RunControl(runConfiguration)
{
m_applicationLauncher.setEnvironment(runConfiguration->environment().toStringList());
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
m_executable = runConfiguration->executable();
m_runMode = static_cast<ApplicationLauncher::Mode>(runConfiguration->runMode());
m_commandLineArguments = runConfiguration->commandLineArguments();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
this, SLOT(slotError(QString)));
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString)),
......@@ -122,16 +129,7 @@ LocalApplicationRunControl::~LocalApplicationRunControl()
void LocalApplicationRunControl::start()
{
QSharedPointer<LocalApplicationRunConfiguration> rc = runConfiguration().objectCast<LocalApplicationRunConfiguration>();
Q_ASSERT(!rc.isNull());
m_applicationLauncher.setEnvironment(rc->environment().toStringList());
m_applicationLauncher.setWorkingDirectory(rc->workingDirectory());
m_executable = rc->executable();
m_applicationLauncher.start(static_cast<ApplicationLauncher::Mode>(rc->runMode()),
m_executable, rc->commandLineArguments());
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
emit started();
emit addToOutputWindow(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)));
......
......@@ -72,17 +72,17 @@ class LocalApplicationRunControlFactory : public IRunControlFactory
public:
LocalApplicationRunControlFactory ();
virtual ~LocalApplicationRunControlFactory();
virtual bool canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const;
virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
virtual QString displayName() const;
virtual RunControl* create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode);
virtual QWidget *configurationWidget(const QSharedPointer<RunConfiguration> &runConfiguration);
virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode);
virtual QWidget *configurationWidget(RunConfiguration *runConfiguration);
};
class LocalApplicationRunControl : public RunControl
{
Q_OBJECT
public:
LocalApplicationRunControl(const QSharedPointer<LocalApplicationRunConfiguration> &runConfiguration);
LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration);
virtual ~LocalApplicationRunControl();
virtual void start();
virtual void stop();
......@@ -92,8 +92,10 @@ private slots:
void slotAddToOutputWindow(const QString &line);
void slotError(const QString & error);
private:
ApplicationLauncher m_applicationLauncher;
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
QString m_executable;
QStringList m_commandLineArguments;
ProjectExplorer::ApplicationLauncher::Mode m_runMode;
};
} // namespace Internal
......
......@@ -491,14 +491,14 @@ bool CustomExecutableRunConfigurationFactory::canRestore(const QString &type) co
return type == "ProjectExplorer.CustomExecutableRunConfiguration";
}
QSharedPointer<RunConfiguration> CustomExecutableRunConfigurationFactory::create(Project *project, const QString &type)
RunConfiguration* CustomExecutableRunConfigurationFactory::create(Project *project, const QString &type)
{
if (type == "ProjectExplorer.CustomExecutableRunConfiguration") {
QSharedPointer<RunConfiguration> rc(new CustomExecutableRunConfiguration(project));
RunConfiguration* rc = new CustomExecutableRunConfiguration(project);
rc->setName(tr("Custom Executable"));
return rc;
} else {
return QSharedPointer<RunConfiguration>(0);
return 0;
}
}
......
......@@ -137,7 +137,7 @@ public:
virtual ~CustomExecutableRunConfigurationFactory();
// used to recreate the runConfigurations when restoring settings
virtual bool canRestore(const QString &type) const;
virtual QSharedPointer<RunConfiguration> create(Project *project, const QString &type);
virtual RunConfiguration* create(Project *project, const QString &type);
QStringList availableCreationTypes(Project *pro) const;
QString displayNameForType(const QString &type) const;
};
......
......@@ -195,7 +195,7 @@ void OutputPane::createNewOutputWindow(RunControl *rc)
bool found = false;
for (int i = 0; i < m_tabWidget->count(); ++i) {
RunControl *old = runControlForTab(i);
if (old->runConfiguration() == rc->runConfiguration() && !old->isRunning()) {
if (old->sameRunConfiguration(rc) && !old->isRunning()) {
// Reuse this tab
delete old;
m_outputWindows.remove(old);
......@@ -212,11 +212,7 @@ void OutputPane::createNewOutputWindow(RunControl *rc)
agg->add(ow);
agg->add(new Find::BaseTextFind(ow));
m_outputWindows.insert(rc, ow);
// TODO add a displayName to RunControl, can't rely on there always beeing a runconfiguration
QString name = "External Application";
if (rc->runConfiguration())
name = rc->runConfiguration()->name();
m_tabWidget->addTab(ow, name);
m_tabWidget->addTab(ow, rc->displayName());
}
}
......@@ -248,8 +244,7 @@ void OutputPane::insertLine()
void OutputPane::reRunRunControl()
{
RunControl *rc = runControlForTab(m_tabWidget->currentIndex());
if (rc->runConfiguration() && rc->runConfiguration()->project() != 0)
rc->start();
rc->start(); //TODO check for rerun
}
void OutputPane::stopRunControl()
......@@ -287,7 +282,7 @@ void OutputPane::tabChanged(int i)
} else {
RunControl *rc = runControlForTab(i);
m_stopAction->setEnabled(rc->isRunning());
m_reRunButton->setEnabled(!rc->isRunning() && rc->runConfiguration() && rc->runConfiguration()->project());
m_reRunButton->setEnabled(!rc->isRunning()); // Check for rerun?
}
}
......@@ -304,7 +299,7 @@ void OutputPane::runControlFinished()
{
RunControl *rc = runControlForTab(m_tabWidget->currentIndex());
if (rc == qobject_cast<RunControl *>(sender())) {
m_reRunButton->setEnabled(rc->runConfiguration() && rc->runConfiguration()->project());
m_reRunButton->setEnabled(rc); // TODO check for rerun?
m_stopAction->setEnabled(false);
}
}
......
......@@ -292,7 +292,7 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
// Running
int i = 0;
int activeId = 0;
foreach (QSharedPointer<RunConfiguration> rc, m_runConfigurations) {
foreach (RunConfiguration* rc, m_runConfigurations) {
writer.setPrefix("RunConfiguration" + QString().setNum(i) + "-");
writer.saveValue("type", rc->type());
rc->save(writer);
......@@ -397,7 +397,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
const QString &type = typeVariant.toString();
foreach (IRunConfigurationFactory *factory, factories) {
if (factory->canRestore(type)) {
QSharedPointer<RunConfiguration> rc = factory->create(this, type);
RunConfiguration* rc = factory->create(this, type);
rc->restore(reader);
addRunConfiguration(rc);
if (i == activeId)
......@@ -453,12 +453,12 @@ void Project::setActiveBuildConfiguration(BuildConfiguration *configuration)
}
}
QList<QSharedPointer<RunConfiguration> > Project::runConfigurations() const
QList<RunConfiguration *> Project::runConfigurations() const
{
return m_runConfigurations;
}
void Project::addRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
void Project::addRunConfiguration(RunConfiguration* runConfiguration)
{
if (m_runConfigurations.contains(runConfiguration)) {
qWarning()<<"Not adding already existing runConfiguration"<<runConfiguration->name();
......@@ -468,7 +468,7 @@ void Project::addRunConfiguration(QSharedPointer<RunConfiguration> runConfigurat
emit addedRunConfiguration(this, runConfiguration->name());
}
void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
void Project::removeRunConfiguration(RunConfiguration* runConfiguration)
{
if(!m_runConfigurations.contains(runConfiguration)) {
qWarning()<<"Not removing runConfiguration"<<runConfiguration->name()<<"becasue it doesn't exist";
......@@ -477,7 +477,7 @@ void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfigu
if (m_activeRunConfiguration == runConfiguration) {
if (m_runConfigurations.size() <= 1)
setActiveRunConfiguration(QSharedPointer<RunConfiguration>(0));
setActiveRunConfiguration(0);
else if (m_runConfigurations.at(0) == m_activeRunConfiguration)
setActiveRunConfiguration(m_runConfigurations.at(1));
else
......@@ -488,12 +488,12 @@ void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfigu
emit removedRunConfiguration(this, runConfiguration->name());
}
QSharedPointer<RunConfiguration> Project::activeRunConfiguration() const
RunConfiguration* Project::activeRunConfiguration() const
{
return m_activeRunConfiguration;
}
void Project::setActiveRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
void Project::setActiveRunConfiguration(RunConfiguration* runConfiguration)
{
if (runConfiguration == m_activeRunConfiguration)
return;
......
......@@ -32,7 +32,6 @@
#include "projectexplorer_export.h"
#include <QtCore/QSharedPointer>
#include <QtCore/QObject>
#include <QtGui/QFileSystemModel>
......@@ -112,12 +111,12 @@ public:
QVariant value(const QString &name) const;
// Running
QList<QSharedPointer<RunConfiguration> > runConfigurations() const;
void addRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration);
void removeRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration);
QList<RunConfiguration *> runConfigurations() const;
void addRunConfiguration(RunConfiguration* runConfiguration);
void removeRunConfiguration(RunConfiguration* runConfiguration);
QSharedPointer<RunConfiguration> activeRunConfiguration() const;
void setActiveRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration);
RunConfiguration* activeRunConfiguration() const;
void setActiveRunConfiguration(RunConfiguration* runConfiguration);
EditorConfiguration *editorConfiguration() const;
......@@ -190,8 +189,8 @@ private:
QMap<QString, QVariant> m_values;
QList<BuildConfiguration *> m_buildConfigurationValues;
QString m_activeBuildConfiguration;
QList<QSharedPointer<RunConfiguration> > m_runConfigurations;
QSharedPointer<RunConfiguration> m_activeRunConfiguration;
QList<RunConfiguration *> m_runConfigurations;
RunConfiguration* m_activeRunConfiguration;
EditorConfiguration *m_editorConfiguration;
};
......
......@@ -100,7 +100,6 @@
#include <QtGui/QMessageBox>
#include <QtGui/QVBoxLayout>
Q_DECLARE_METATYPE(QSharedPointer<ProjectExplorer::RunConfiguration>);
Q_DECLARE_METATYPE(Core::IEditorFactory*);
Q_DECLARE_METATYPE(Core::IExternalEditor*);
......@@ -171,7 +170,7 @@ struct ProjectExplorerPluginPrivate {
static const int m_maxRecentProjects = 7;
QString m_lastOpenDirectory;
QSharedPointer<RunConfiguration> m_delayedRunConfiguration;
RunConfiguration *m_delayedRunConfiguration; // TODO this is not right
RunControl *m_debuggingRunControl;
QString m_runMode;
QString m_projectFilterString;
......@@ -1227,7 +1226,7 @@ void ProjectExplorerPlugin::buildStateChanged(Project * pro)
updateActions();
}
void ProjectExplorerPlugin::executeRunConfiguration(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &runMode)
void ProjectExplorerPlugin::executeRunConfiguration(RunConfiguration *runConfiguration, const QString &runMode)
{
if (IRunControlFactory *runControlFactory = findRunControlFactory(runConfiguration, runMode)) {
emit aboutToExecuteProject(runConfiguration->project());
......@@ -1274,7 +1273,7 @@ void ProjectExplorerPlugin::buildQueueFinished(bool success)
if (d->m_buildManager->tasksAvailable())
d->m_buildManager->showTaskWindow();
}
d->m_delayedRunConfiguration = QSharedPointer<RunConfiguration>(0);
d->m_delayedRunConfiguration = 0;
d->m_runMode = QString::null;
}
......@@ -1665,7 +1664,7 @@ void ProjectExplorerPlugin::startupProjectChanged()
}
// NBS TODO implement more than one runner
IRunControlFactory *ProjectExplorerPlugin::findRunControlFactory(const QSharedPointer<RunConfiguration> &config, const QString &mode)
IRunControlFactory *ProjectExplorerPlugin::findRunControlFactory(RunConfiguration *config, const QString &mode)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
const QList<IRunControlFactory *> factories = pm->getObjects<IRunControlFactory>();
......@@ -2001,11 +2000,12 @@ void ProjectExplorerPlugin::populateRunConfigurationMenu()
d->m_runConfigurationMenu->clear();
const Project *startupProject = d->m_session->startupProject();
QSharedPointer<RunConfiguration> activeRunConfiguration
= (startupProject) ? startupProject->activeRunConfiguration() : QSharedPointer<RunConfiguration>(0);
RunConfiguration *activeRunConfiguration = 0;
if (startupProject)
activeRunConfiguration = startupProject->activeRunConfiguration();
foreach (const Project *pro, d->m_session->projects()) {
foreach (QSharedPointer<RunConfiguration> runConfiguration, pro->runConfigurations()) {
foreach (RunConfiguration *runConfiguration, pro->runConfigurations()) {
if (runConfiguration->isEnabled()) {
const QString title = QString("%1 (%2)").arg(pro->name(), runConfiguration->name());
QAction *act = new QAction(title, d->m_runConfigurationActionGroup);
......@@ -2028,7 +2028,7 @@ void ProjectExplorerPlugin::runConfigurationMenuTriggered(QAction *action)
if (debug)
qDebug() << "ProjectExplorerPlugin::runConfigurationMenuTriggered" << action;
QSharedPointer<RunConfiguration> runConfiguration = qVariantValue<QSharedPointer<RunConfiguration> >(action->data());
RunConfiguration *runConfiguration = action->data().value<RunConfiguration *>();
runConfiguration->project()->setActiveRunConfiguration(runConfiguration);
setStartupProject(runConfiguration->project());
}
......@@ -2171,7 +2171,7 @@ BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
descriptiveText->setWordWrap(true);
vlayout