forked from qt-creator/qt-creator
		
	Enable restoring the default names of project configuration items
* Enable support for this in all ProjectConfiguration items (Targets, projects, BCs, DCs, RCs, etc.). This is nicer than having custom code in individual configuraiton items. Reviewed-by: dt
This commit is contained in:
		@@ -108,7 +108,7 @@ CMakeRunConfiguration::~CMakeRunConfiguration()
 | 
			
		||||
 | 
			
		||||
void CMakeRunConfiguration::ctor()
 | 
			
		||||
{
 | 
			
		||||
    setDisplayName(m_title);
 | 
			
		||||
    setDefaultDisplayName(defaultDisplayName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CMakeTarget *CMakeRunConfiguration::cmakeTarget() const
 | 
			
		||||
@@ -205,6 +205,13 @@ bool CMakeRunConfiguration::fromMap(const QVariantMap &map)
 | 
			
		||||
    return RunConfiguration::fromMap(map);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString CMakeRunConfiguration::defaultDisplayName() const
 | 
			
		||||
{
 | 
			
		||||
    if (m_title.isEmpty())
 | 
			
		||||
        return tr("Run CMake target");
 | 
			
		||||
    return m_title + (m_enabled ? "" : tr(" (disabled)"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QWidget *CMakeRunConfiguration::createConfigurationWidget()
 | 
			
		||||
{
 | 
			
		||||
    return new CMakeRunConfigurationWidget(this);
 | 
			
		||||
@@ -302,7 +309,7 @@ void CMakeRunConfiguration::setEnabled(bool b)
 | 
			
		||||
        return;
 | 
			
		||||
    m_enabled = b;
 | 
			
		||||
    emit isEnabledChanged(isEnabled());
 | 
			
		||||
    setDisplayName(m_title + (m_enabled ? "" : tr(" (disabled)")));
 | 
			
		||||
    setDefaultDisplayName(defaultDisplayName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CMakeRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *bc) const
 | 
			
		||||
 
 | 
			
		||||
@@ -97,6 +97,7 @@ private slots:
 | 
			
		||||
protected:
 | 
			
		||||
    CMakeRunConfiguration(CMakeTarget *parent, CMakeRunConfiguration *source);
 | 
			
		||||
    virtual bool fromMap(const QVariantMap &map);
 | 
			
		||||
    QString defaultDisplayName() const;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void ctor();
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ CMakeTarget::CMakeTarget(CMakeProject *parent) :
 | 
			
		||||
    m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
 | 
			
		||||
    m_deployConfigurationFactory(new ProjectExplorer::DeployConfigurationFactory(this))
 | 
			
		||||
{
 | 
			
		||||
    setDisplayName(displayNameForId(id()));
 | 
			
		||||
    setDefaultDisplayName(displayNameForId(id()));
 | 
			
		||||
    setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
 | 
			
		||||
    connect(parent, SIGNAL(buildTargetsChanged()), SLOT(updateRunConfigurations()));
 | 
			
		||||
}
 | 
			
		||||
@@ -100,11 +100,7 @@ QString CMakeTarget::defaultBuildDirectory() const
 | 
			
		||||
 | 
			
		||||
bool CMakeTarget::fromMap(const QVariantMap &map)
 | 
			
		||||
{
 | 
			
		||||
    if (!Target::fromMap(map))
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    setDisplayName(displayNameForId(id()));
 | 
			
		||||
    return true;
 | 
			
		||||
    return Target::fromMap(map);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CMakeTarget::updateRunConfigurations()
 | 
			
		||||
@@ -194,7 +190,7 @@ CMakeTarget *CMakeTargetFactory::create(ProjectExplorer::Project *parent, const
 | 
			
		||||
 | 
			
		||||
    // Add default build configuration:
 | 
			
		||||
    CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t));
 | 
			
		||||
    bc->setDisplayName("all");
 | 
			
		||||
    bc->setDefaultDisplayName("all");
 | 
			
		||||
 | 
			
		||||
    ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
 | 
			
		||||
    ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,8 @@ MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) :
 | 
			
		||||
void MakeStep::ctor()
 | 
			
		||||
{
 | 
			
		||||
    m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
 | 
			
		||||
    setDisplayName(tr("Make", "CMakeProjectManager::MakeStep display name."));
 | 
			
		||||
    //: Default display name for the cmake make step.
 | 
			
		||||
    setDefaultDisplayName(tr("Make"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MakeStep::~MakeStep()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user