forked from qt-creator/qt-creator
Make BuildConfiguration::setValue and ::value protected
This commit is contained in:
@@ -573,10 +573,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(this);
|
||||
bc->setDisplayName("all");
|
||||
addBuildConfiguration(bc);
|
||||
bc->setValue("msvcVersion", copw.msvcVersion());
|
||||
bc->setMsvcVersion(copw.msvcVersion());
|
||||
if (!copw.buildDirectory().isEmpty())
|
||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
||||
bc->setBuildDirectory(copw.buildDirectory());
|
||||
|
||||
// Now create a standard build configuration
|
||||
makeStep = new MakeStep(bc);
|
||||
@@ -586,12 +585,14 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
addBuildConfiguration(bc);
|
||||
setActiveBuildConfiguration(bc);
|
||||
} else {
|
||||
// We have a user file, but we could still be missing the cbp file
|
||||
// or simply run createXml with the saved settings
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
BuildConfiguration *activeBC = activeBuildConfiguration();
|
||||
CMakeBuildConfiguration *activeBC = activeCMakeBuildConfiguration();
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
|
||||
@@ -609,7 +610,7 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
activeBC->environment());
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||
activeBC->setMsvcVersion(copw.msvcVersion());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -64,6 +64,14 @@ QString GenericBuildConfiguration::buildDirectory() const
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||
{
|
||||
if (value("buildDirectory").toString() == buildDirectory)
|
||||
return;
|
||||
setValue("buildDirectory", buildDirectory);
|
||||
emit buildDirectoryChanged();
|
||||
}
|
||||
|
||||
GenericProject *GenericBuildConfiguration::genericProject() const
|
||||
{
|
||||
return static_cast<GenericProject *>(project());
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
|
||||
virtual ProjectExplorer::Environment environment() const;
|
||||
virtual QString buildDirectory() const;
|
||||
void setBuildDirectory(const QString &buildDirectory);
|
||||
};
|
||||
|
||||
} // namespace GenericProjectManager
|
||||
|
@@ -525,7 +525,7 @@ bool GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead
|
||||
const QLatin1String buildDirectory("buildDirectory");
|
||||
|
||||
const QFileInfo fileInfo(file()->fileName());
|
||||
bc->setValue(buildDirectory, fileInfo.absolutePath());
|
||||
bc->setBuildDirectory(fileInfo.absolutePath());
|
||||
|
||||
setActiveBuildConfiguration(bc);
|
||||
}
|
||||
@@ -614,7 +614,7 @@ void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
|
||||
void GenericBuildSettingsWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_buildConfiguration->setValue("buildDirectory", m_pathChooser->path());
|
||||
m_buildConfiguration->setBuildDirectory(m_pathChooser->path());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::toolChainSelected(int index)
|
||||
|
@@ -57,10 +57,6 @@ public:
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
// TODO remove those
|
||||
QVariant value(const QString &key) const;
|
||||
void setValue(const QString &key, QVariant value);
|
||||
|
||||
QMap<QString, QVariant> toMap() const;
|
||||
void setValuesFromMap(QMap<QString, QVariant> map);
|
||||
|
||||
@@ -88,6 +84,10 @@ protected:
|
||||
BuildConfiguration(Project *project);
|
||||
BuildConfiguration(BuildConfiguration *source);
|
||||
|
||||
// TODO remove those
|
||||
QVariant value(const QString &key) const;
|
||||
void setValue(const QString &key, QVariant value);
|
||||
|
||||
private:
|
||||
QList<BuildStep *> m_buildSteps;
|
||||
QList<BuildStep *> m_cleanSteps;
|
||||
|
@@ -119,6 +119,7 @@ void Qt4BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplore
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
/// returns the build directory
|
||||
QString Qt4BuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString workingDirectory;
|
||||
@@ -129,8 +130,27 @@ QString Qt4BuildConfiguration::buildDirectory() const
|
||||
return workingDirectory;
|
||||
}
|
||||
|
||||
/// returns whether this is a shadow build configuration or not
|
||||
/// note, even if shadowBuild() returns true, it might be using the
|
||||
/// source directory as the shadow build directorys, thus not
|
||||
/// still be a insource build
|
||||
bool Qt4BuildConfiguration::shadowBuild() const
|
||||
{
|
||||
return value("useShadowBuild").toBool();
|
||||
}
|
||||
|
||||
/// returns the shadow build directory if set
|
||||
/// \note buildDirectory() is probably the function you want to call
|
||||
QString Qt4BuildConfiguration::shadowBuildDirectory() const
|
||||
{
|
||||
return value("buildDirectory").toString();
|
||||
}
|
||||
|
||||
void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory)
|
||||
{
|
||||
if (value("useShadowBuild").toBool() == shadowBuild
|
||||
&& value("buildDirectory").toString() == buildDirectory)
|
||||
return;
|
||||
setValue("useShadowBuild", shadowBuild);
|
||||
setValue("buildDirectory", buildDirectory);
|
||||
emit buildDirectoryChanged();
|
||||
|
@@ -63,6 +63,8 @@ public:
|
||||
void setUseSystemEnvironment(bool b);
|
||||
|
||||
virtual QString buildDirectory() const;
|
||||
bool shadowBuild() const;
|
||||
QString shadowBuildDirectory() const;
|
||||
void setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory);
|
||||
|
||||
//returns the qtVersion, if the project is set to use the default qt version, then
|
||||
|
@@ -166,7 +166,7 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
||||
|
||||
qtVersionsChanged();
|
||||
|
||||
bool shadowBuild = m_buildConfiguration->value("useShadowBuild").toBool();
|
||||
bool shadowBuild = m_buildConfiguration->shadowBuild();
|
||||
m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
|
||||
m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
|
||||
m_browseButton->setEnabled(shadowBuild);
|
||||
@@ -225,7 +225,7 @@ void Qt4ProjectConfigWidget::qtVersionsChanged()
|
||||
|
||||
void Qt4ProjectConfigWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->value("buildDirectory").toString());
|
||||
m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->shadowBuildDirectory());
|
||||
updateDetails();
|
||||
updateImportLabel();
|
||||
}
|
||||
@@ -253,7 +253,7 @@ void Qt4ProjectConfigWidget::shadowBuildClicked(bool checked)
|
||||
|
||||
void Qt4ProjectConfigWidget::shadowBuildEdited()
|
||||
{
|
||||
if (m_buildConfiguration->value("buildDirectory").toString() == m_ui->shadowBuildDirEdit->path())
|
||||
if (m_buildConfiguration->shadowBuildDirectory() == m_ui->shadowBuildDirEdit->path())
|
||||
return;
|
||||
m_ignoreChange = true;
|
||||
m_buildConfiguration->setShadowBuildAndDirectory(true, m_ui->shadowBuildDirEdit->path());
|
||||
|
Reference in New Issue
Block a user