forked from qt-creator/qt-creator
CMakeBuildConfiguration: Less qobject_casts more static_casts
CMakeBuildConfigurations can only exist on CMakeProjects Change-Id: I8501e39f133fea854b953f9739e001cae1f2c0ea Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -56,12 +56,10 @@ const char CMAKE_BC_ID[] = "CMakeProjectManager.CMakeBuildConfiguration";
|
||||
const char BUILD_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory";
|
||||
} // namespace
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *parent) :
|
||||
BuildConfiguration(parent, Core::Id(CMAKE_BC_ID))
|
||||
{
|
||||
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
|
||||
if (project)
|
||||
m_buildDirectory = project->defaultBuildDirectory();
|
||||
m_buildDirectory = parent->defaultBuildDirectory();
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
||||
@@ -175,9 +173,7 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
|
||||
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
|
||||
if (!project)
|
||||
return 0;
|
||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||
|
||||
bool ok = true;
|
||||
QString buildConfigurationName = name;
|
||||
@@ -191,7 +187,7 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return 0;
|
||||
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(project);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
|
||||
Reference in New Issue
Block a user