forked from qt-creator/qt-creator
Remove QSharedPointer<> for RunConfiguration
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user