forked from qt-creator/qt-creator
Remove BuildConfiguration::setValue/value
This commit is contained in:
@@ -35,15 +35,46 @@ using namespace CMakeProjectManager;
|
|||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro)
|
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro)
|
||||||
: BuildConfiguration(pro), m_toolChain(0)
|
: BuildConfiguration(pro),
|
||||||
|
m_toolChain(0),
|
||||||
|
m_clearSystemEnvironment(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(BuildConfiguration *source)
|
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro, const QMap<QString, QVariant> &map)
|
||||||
: BuildConfiguration(source), m_toolChain(0)
|
: BuildConfiguration(pro, map),
|
||||||
|
m_toolChain(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
QMap<QString, QVariant>::const_iterator it = map.constFind("clearSystemEnvironment");
|
||||||
|
m_clearSystemEnvironment = (it != map.constEnd() && it.value().toBool());
|
||||||
|
m_userEnvironmentChanges =
|
||||||
|
ProjectExplorer::EnvironmentItem::fromStringList(
|
||||||
|
map.value("userEnvironmentChanges").toStringList());
|
||||||
|
m_msvcVersion = map.value("msvcVersion").toString();
|
||||||
|
m_buildDirectory = map.value("buildDirectory").toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeBuildConfiguration *source)
|
||||||
|
: BuildConfiguration(source),
|
||||||
|
m_toolChain(0),
|
||||||
|
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
||||||
|
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
||||||
|
m_buildDirectory(source->m_buildDirectory),
|
||||||
|
m_msvcVersion(source->m_msvcVersion)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildConfiguration::toMap(QMap<QString, QVariant> &map) const
|
||||||
|
{
|
||||||
|
map.insert("userEnvironmentChanges",
|
||||||
|
ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
||||||
|
map.insert("msvcVersion", m_msvcVersion);
|
||||||
|
map.insert("buildDirectory", m_buildDirectory);
|
||||||
|
BuildConfiguration::toMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
||||||
@@ -73,36 +104,33 @@ ProjectExplorer::Environment CMakeBuildConfiguration::environment() const
|
|||||||
|
|
||||||
void CMakeBuildConfiguration::setUseSystemEnvironment(bool b)
|
void CMakeBuildConfiguration::setUseSystemEnvironment(bool b)
|
||||||
{
|
{
|
||||||
if (b == useSystemEnvironment())
|
if (b == m_clearSystemEnvironment)
|
||||||
return;
|
return;
|
||||||
setValue("clearSystemEnvironment", !b);
|
m_clearSystemEnvironment = !b;
|
||||||
emit environmentChanged();
|
emit environmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeBuildConfiguration::useSystemEnvironment() const
|
bool CMakeBuildConfiguration::useSystemEnvironment() const
|
||||||
{
|
{
|
||||||
bool b = !(value("clearSystemEnvironment").isValid() &&
|
return !m_clearSystemEnvironment;
|
||||||
value("clearSystemEnvironment").toBool());
|
|
||||||
return b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectExplorer::EnvironmentItem> CMakeBuildConfiguration::userEnvironmentChanges() const
|
QList<ProjectExplorer::EnvironmentItem> CMakeBuildConfiguration::userEnvironmentChanges() const
|
||||||
{
|
{
|
||||||
return ProjectExplorer::EnvironmentItem::fromStringList(value("userEnvironmentChanges").toStringList());
|
return m_userEnvironmentChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
void CMakeBuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||||
{
|
{
|
||||||
QStringList list = ProjectExplorer::EnvironmentItem::toStringList(diff);
|
if (m_userEnvironmentChanges == diff)
|
||||||
if (list == value("userEnvironmentChanges"))
|
|
||||||
return;
|
return;
|
||||||
setValue("userEnvironmentChanges", list);
|
m_userEnvironmentChanges = diff;
|
||||||
emit environmentChanged();
|
emit environmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeBuildConfiguration::buildDirectory() const
|
QString CMakeBuildConfiguration::buildDirectory() const
|
||||||
{
|
{
|
||||||
QString buildDirectory = value("buildDirectory").toString();
|
QString buildDirectory = m_buildDirectory;
|
||||||
if (buildDirectory.isEmpty())
|
if (buildDirectory.isEmpty())
|
||||||
buildDirectory = cmakeProject()->sourceDirectory() + "/qtcreator-build";
|
buildDirectory = cmakeProject()->sourceDirectory() + "/qtcreator-build";
|
||||||
return buildDirectory;
|
return buildDirectory;
|
||||||
@@ -146,7 +174,7 @@ void CMakeBuildConfiguration::updateToolChain() const
|
|||||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||||
#endif
|
#endif
|
||||||
} else { // msvc
|
} else { // msvc
|
||||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(value("msvcVersion").toString(), false);
|
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(m_msvcVersion, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||||
@@ -160,22 +188,22 @@ void CMakeBuildConfiguration::updateToolChain() const
|
|||||||
|
|
||||||
void CMakeBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
void CMakeBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||||
{
|
{
|
||||||
if (value("buildDirectory") == buildDirectory)
|
if (m_buildDirectory == buildDirectory)
|
||||||
return;
|
return;
|
||||||
setValue("buildDirectory", buildDirectory);
|
m_buildDirectory = buildDirectory;
|
||||||
emit buildDirectoryChanged();
|
emit buildDirectoryChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeBuildConfiguration::msvcVersion() const
|
QString CMakeBuildConfiguration::msvcVersion() const
|
||||||
{
|
{
|
||||||
return value("msvcVersion").toString();
|
return m_msvcVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildConfiguration::setMsvcVersion(const QString &msvcVersion)
|
void CMakeBuildConfiguration::setMsvcVersion(const QString &msvcVersion)
|
||||||
{
|
{
|
||||||
if (value("msvcVersion").toString() == msvcVersion)
|
if (m_msvcVersion == msvcVersion)
|
||||||
return;
|
return;
|
||||||
setValue("msvcVersion", msvcVersion);
|
m_msvcVersion = msvcVersion;
|
||||||
updateToolChain();
|
updateToolChain();
|
||||||
|
|
||||||
emit msvcVersionChanged();
|
emit msvcVersionChanged();
|
||||||
|
@@ -43,7 +43,8 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CMakeBuildConfiguration(CMakeProject *pro);
|
CMakeBuildConfiguration(CMakeProject *pro);
|
||||||
CMakeBuildConfiguration(BuildConfiguration *source);
|
CMakeBuildConfiguration(CMakeProject *pro, const QMap<QString, QVariant> &map);
|
||||||
|
CMakeBuildConfiguration(CMakeBuildConfiguration *source);
|
||||||
~CMakeBuildConfiguration();
|
~CMakeBuildConfiguration();
|
||||||
|
|
||||||
CMakeProject *cmakeProject() const;
|
CMakeProject *cmakeProject() const;
|
||||||
@@ -67,12 +68,18 @@ public:
|
|||||||
QString msvcVersion() const;
|
QString msvcVersion() const;
|
||||||
void setMsvcVersion(const QString &msvcVersion);
|
void setMsvcVersion(const QString &msvcVersion);
|
||||||
|
|
||||||
|
void toMap(QMap<QString, QVariant> &map) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void msvcVersionChanged();
|
void msvcVersionChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateToolChain() const;
|
void updateToolChain() const;
|
||||||
mutable ProjectExplorer::ToolChain *m_toolChain;
|
mutable ProjectExplorer::ToolChain *m_toolChain;
|
||||||
|
bool m_clearSystemEnvironment;
|
||||||
|
QList<ProjectExplorer::EnvironmentItem> m_userEnvironmentChanges;
|
||||||
|
QString m_buildDirectory;
|
||||||
|
QString m_msvcVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -141,9 +141,9 @@ BuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::Build
|
|||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration *CMakeBuildConfigurationFactory::restore() const
|
BuildConfiguration *CMakeBuildConfigurationFactory::restore(const QMap<QString, QVariant> &map) const
|
||||||
{
|
{
|
||||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project, map);
|
||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||||
ProjectExplorer::BuildConfiguration *restore() const;
|
ProjectExplorer::BuildConfiguration *restore(const QMap<QString, QVariant> &map) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMakeProject *m_project;
|
CMakeProject *m_project;
|
||||||
|
@@ -40,12 +40,24 @@ GenericBuildConfiguration::GenericBuildConfiguration(GenericProject *pro)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericBuildConfiguration::GenericBuildConfiguration(GenericProject *pro, const QMap<QString, QVariant> &map)
|
||||||
|
: BuildConfiguration(pro, map)
|
||||||
|
{
|
||||||
|
m_buildDirectory = map.value("buildDirectory").toString();
|
||||||
|
}
|
||||||
|
|
||||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericBuildConfiguration *source)
|
GenericBuildConfiguration::GenericBuildConfiguration(GenericBuildConfiguration *source)
|
||||||
: BuildConfiguration(source)
|
: BuildConfiguration(source),
|
||||||
|
m_buildDirectory(source->m_buildDirectory)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericBuildConfiguration::toMap(QMap<QString, QVariant> &map) const
|
||||||
|
{
|
||||||
|
map.insert("buildDirectory", m_buildDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
ProjectExplorer::Environment GenericBuildConfiguration::environment() const
|
ProjectExplorer::Environment GenericBuildConfiguration::environment() const
|
||||||
{
|
{
|
||||||
return ProjectExplorer::Environment::systemEnvironment();
|
return ProjectExplorer::Environment::systemEnvironment();
|
||||||
@@ -53,22 +65,20 @@ ProjectExplorer::Environment GenericBuildConfiguration::environment() const
|
|||||||
|
|
||||||
QString GenericBuildConfiguration::buildDirectory() const
|
QString GenericBuildConfiguration::buildDirectory() const
|
||||||
{
|
{
|
||||||
QString buildDirectory = value("buildDirectory").toString();
|
QString buildDirectory = m_buildDirectory;
|
||||||
|
|
||||||
if (buildDirectory.isEmpty()) {
|
if (buildDirectory.isEmpty()) {
|
||||||
QFileInfo fileInfo(project()->file()->fileName());
|
QFileInfo fileInfo(project()->file()->fileName());
|
||||||
|
|
||||||
buildDirectory = fileInfo.absolutePath();
|
buildDirectory = fileInfo.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildDirectory;
|
return buildDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||||
{
|
{
|
||||||
if (value("buildDirectory").toString() == buildDirectory)
|
if (m_buildDirectory == buildDirectory)
|
||||||
return;
|
return;
|
||||||
setValue("buildDirectory", buildDirectory);
|
m_buildDirectory = buildDirectory;
|
||||||
emit buildDirectoryChanged();
|
emit buildDirectoryChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@ class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GenericBuildConfiguration(GenericProject *pro);
|
GenericBuildConfiguration(GenericProject *pro);
|
||||||
|
GenericBuildConfiguration(GenericProject *pro, const QMap<QString, QVariant> &map);
|
||||||
GenericBuildConfiguration(GenericBuildConfiguration *source);
|
GenericBuildConfiguration(GenericBuildConfiguration *source);
|
||||||
|
|
||||||
GenericProject *genericProject() const;
|
GenericProject *genericProject() const;
|
||||||
@@ -50,6 +51,9 @@ public:
|
|||||||
virtual ProjectExplorer::Environment environment() const;
|
virtual ProjectExplorer::Environment environment() const;
|
||||||
virtual QString buildDirectory() const;
|
virtual QString buildDirectory() const;
|
||||||
void setBuildDirectory(const QString &buildDirectory);
|
void setBuildDirectory(const QString &buildDirectory);
|
||||||
|
void toMap(QMap<QString, QVariant> &map) const;
|
||||||
|
private:
|
||||||
|
QString m_buildDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GenericProjectManager
|
} // namespace GenericProjectManager
|
||||||
|
@@ -162,9 +162,9 @@ BuildConfiguration *GenericBuildConfigurationFactory::clone(BuildConfiguration *
|
|||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration *GenericBuildConfigurationFactory::restore() const
|
BuildConfiguration *GenericBuildConfigurationFactory::restore(const QMap<QString, QVariant> &map) const
|
||||||
{
|
{
|
||||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(m_project);
|
GenericBuildConfiguration *bc = new GenericBuildConfiguration(m_project, map);
|
||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||||
ProjectExplorer::BuildConfiguration *restore() const;
|
ProjectExplorer::BuildConfiguration *restore(const QMap<QString, QVariant> &map) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GenericProject *m_project;
|
GenericProject *m_project;
|
||||||
|
@@ -50,8 +50,15 @@ BuildConfiguration::BuildConfiguration(Project *pro)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BuildConfiguration::BuildConfiguration(Project *pro, const QMap<QString, QVariant> &map)
|
||||||
|
: m_project(pro)
|
||||||
|
{
|
||||||
|
m_displayName = map.value("ProjectExplorer.BuildConfiguration.DisplayName").toString();
|
||||||
|
}
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(BuildConfiguration *source)
|
BuildConfiguration::BuildConfiguration(BuildConfiguration *source)
|
||||||
: m_values(source->m_values), m_project(source->m_project)
|
: m_displayName(source->m_displayName),
|
||||||
|
m_project(source->m_project)
|
||||||
{
|
{
|
||||||
foreach(BuildStep *originalbs, source->buildSteps()) {
|
foreach(BuildStep *originalbs, source->buildSteps()) {
|
||||||
IBuildStepFactory *factory = findFactory(originalbs->name());
|
IBuildStepFactory *factory = findFactory(originalbs->name());
|
||||||
@@ -73,49 +80,20 @@ BuildConfiguration::~BuildConfiguration()
|
|||||||
|
|
||||||
QString BuildConfiguration::displayName() const
|
QString BuildConfiguration::displayName() const
|
||||||
{
|
{
|
||||||
QVariant v = value("ProjectExplorer.BuildConfiguration.DisplayName");
|
return m_displayName;
|
||||||
QTC_ASSERT(v.isValid(), return QString());
|
|
||||||
return v.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfiguration::setDisplayName(const QString &name)
|
void BuildConfiguration::setDisplayName(const QString &name)
|
||||||
{
|
{
|
||||||
if (value("ProjectExplorer.BuildConfiguration.DisplayName").toString() == name)
|
if (m_displayName == name)
|
||||||
return;
|
return;
|
||||||
setValue("ProjectExplorer.BuildConfiguration.DisplayName", name);
|
m_displayName = name;
|
||||||
emit displayNameChanged();
|
emit displayNameChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant BuildConfiguration::value(const QString & key) const
|
void BuildConfiguration::toMap(QMap<QString, QVariant> &map) const
|
||||||
{
|
{
|
||||||
QHash<QString, QVariant>::const_iterator it = m_values.find(key);
|
map.insert("ProjectExplorer.BuildConfiguration.DisplayName", m_displayName);
|
||||||
if (it != m_values.constEnd())
|
|
||||||
return *it;
|
|
||||||
else
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildConfiguration::setValue(const QString & key, QVariant value)
|
|
||||||
{
|
|
||||||
m_values[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildConfiguration::setValuesFromMap(QMap<QString, QVariant> map)
|
|
||||||
{
|
|
||||||
QMap<QString, QVariant>::const_iterator it, end;
|
|
||||||
end = map.constEnd();
|
|
||||||
for (it = map.constBegin(); it != end; ++it)
|
|
||||||
setValue(it.key(), it.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
QMap<QString, QVariant> BuildConfiguration::toMap() const
|
|
||||||
{
|
|
||||||
QMap<QString, QVariant> result;
|
|
||||||
QHash<QString, QVariant>::const_iterator it, end;
|
|
||||||
end = m_values.constEnd();
|
|
||||||
for (it = m_values.constBegin(); it != end; ++it)
|
|
||||||
result.insert(it.key(), it.value());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildStep *> BuildConfiguration::buildSteps() const
|
QList<BuildStep *> BuildConfiguration::buildSteps() const
|
||||||
|
@@ -57,8 +57,7 @@ public:
|
|||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void setDisplayName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
|
|
||||||
QMap<QString, QVariant> toMap() const;
|
virtual void toMap(QMap<QString, QVariant> &map) const;
|
||||||
void setValuesFromMap(QMap<QString, QVariant> map);
|
|
||||||
|
|
||||||
QList<BuildStep *> buildSteps() const;
|
QList<BuildStep *> buildSteps() const;
|
||||||
void insertBuildStep(int position, BuildStep *step);
|
void insertBuildStep(int position, BuildStep *step);
|
||||||
@@ -82,16 +81,13 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
BuildConfiguration(Project *project);
|
BuildConfiguration(Project *project);
|
||||||
|
BuildConfiguration(Project *project, const QMap<QString, QVariant> &map);
|
||||||
BuildConfiguration(BuildConfiguration *source);
|
BuildConfiguration(BuildConfiguration *source);
|
||||||
|
|
||||||
// TODO remove those
|
|
||||||
QVariant value(const QString &key) const;
|
|
||||||
void setValue(const QString &key, QVariant value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<BuildStep *> m_buildSteps;
|
QList<BuildStep *> m_buildSteps;
|
||||||
QList<BuildStep *> m_cleanSteps;
|
QList<BuildStep *> m_cleanSteps;
|
||||||
QHash<QString, QVariant> m_values;
|
QString m_displayName;
|
||||||
Project *m_project;
|
Project *m_project;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -117,7 +113,7 @@ public:
|
|||||||
virtual BuildConfiguration *clone(BuildConfiguration *source) const = 0;
|
virtual BuildConfiguration *clone(BuildConfiguration *source) const = 0;
|
||||||
|
|
||||||
// restores a BuildConfiguration with the name and adds it to the project
|
// restores a BuildConfiguration with the name and adds it to the project
|
||||||
virtual BuildConfiguration *restore() const = 0;
|
virtual BuildConfiguration *restore(const QMap<QString, QVariant> &values) const = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void availableCreationTypesChanged();
|
void availableCreationTypesChanged();
|
||||||
|
@@ -147,7 +147,8 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
|||||||
//save buildsettings
|
//save buildsettings
|
||||||
QStringList buildConfigurationNames;
|
QStringList buildConfigurationNames;
|
||||||
for(int i=0; i < bcs.size(); ++i) {
|
for(int i=0; i < bcs.size(); ++i) {
|
||||||
QMap<QString, QVariant> temp = bcs.at(i)->toMap();
|
QMap<QString, QVariant> temp;
|
||||||
|
bcs.at(i)->toMap(temp);
|
||||||
writer.saveValue("buildConfiguration-" + QString::number(i), temp);
|
writer.saveValue("buildConfiguration-" + QString::number(i), temp);
|
||||||
buildConfigurationNames << QString::number(i);
|
buildConfigurationNames << QString::number(i);
|
||||||
}
|
}
|
||||||
@@ -211,12 +212,10 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
||||||
|
|
||||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||||
BuildConfiguration *bc = buildConfigurationFactory()->restore();
|
|
||||||
|
|
||||||
QMap<QString, QVariant> temp =
|
QMap<QString, QVariant> temp =
|
||||||
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
||||||
bc->setValuesFromMap(temp);
|
|
||||||
|
|
||||||
|
BuildConfiguration *bc = buildConfigurationFactory()->restore(temp);
|
||||||
// Restore build steps
|
// Restore build steps
|
||||||
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildsteps");
|
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildsteps");
|
||||||
if(buildStepsValueVariant.isValid()) {
|
if(buildStepsValueVariant.isValid()) {
|
||||||
|
@@ -43,13 +43,42 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Project *pro)
|
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Project *pro)
|
||||||
: BuildConfiguration(pro)
|
: BuildConfiguration(pro),
|
||||||
|
m_clearSystemEnvironment(false),
|
||||||
|
m_shadowBuild(false),
|
||||||
|
m_qtVersion(0),
|
||||||
|
m_toolChainType(-1), // toolChainType() makes sure to return the default toolchainType
|
||||||
|
m_qmakeBuildConfiguration(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Project *pro, const QMap<QString, QVariant> &map)
|
||||||
|
: BuildConfiguration(pro, map)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
QMap<QString, QVariant>::const_iterator it;
|
||||||
|
it = map.constFind("clearSystemEnvironment");
|
||||||
|
m_clearSystemEnvironment = (it != map.constEnd() && it.value().toBool());
|
||||||
|
|
||||||
|
m_userEnvironmentChanges =
|
||||||
|
EnvironmentItem::fromStringList(map.value("userEnvironmentChanges").toStringList());
|
||||||
|
m_shadowBuild = map.value("useShadowBuild").toBool();
|
||||||
|
m_buildDirectory = map.value("buildDirectory").toString();
|
||||||
|
m_qtVersion = map.value(KEY_QT_VERSION_ID).toInt();
|
||||||
|
m_toolChainType = map.value("ToolChain").toInt();
|
||||||
|
m_qmakeBuildConfiguration = QtVersion::QmakeBuildConfigs(map.value("buildConfiguration").toInt());
|
||||||
|
}
|
||||||
|
|
||||||
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BuildConfiguration *source)
|
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BuildConfiguration *source)
|
||||||
: BuildConfiguration(source)
|
: BuildConfiguration(source),
|
||||||
|
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
||||||
|
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
||||||
|
m_shadowBuild(source->m_shadowBuild),
|
||||||
|
m_buildDirectory(source->m_buildDirectory),
|
||||||
|
m_qtVersion(source->m_qtVersion),
|
||||||
|
m_toolChainType(source->m_toolChainType),
|
||||||
|
m_qmakeBuildConfiguration(source->m_qmakeBuildConfiguration)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -59,6 +88,18 @@ Qt4BuildConfiguration::~Qt4BuildConfiguration()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Qt4BuildConfiguration::toMap(QMap<QString, QVariant> &map) const
|
||||||
|
{
|
||||||
|
map.insert("clearSystemEnvironment", m_clearSystemEnvironment);
|
||||||
|
map.insert("userEnvironmentChanges", EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
||||||
|
map.insert("useShadowBuild", m_shadowBuild);
|
||||||
|
map.insert("buildDirectory", m_buildDirectory);
|
||||||
|
map.insert(KEY_QT_VERSION_ID, m_qtVersion);
|
||||||
|
map.insert("ToolChain", m_toolChainType);
|
||||||
|
map.insert("buildConfiguration", int(m_qmakeBuildConfiguration));
|
||||||
|
BuildConfiguration::toMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
void Qt4BuildConfiguration::init()
|
void Qt4BuildConfiguration::init()
|
||||||
{
|
{
|
||||||
QtVersionManager *vm = QtVersionManager::instance();
|
QtVersionManager *vm = QtVersionManager::instance();
|
||||||
@@ -94,28 +135,25 @@ void Qt4BuildConfiguration::setUseSystemEnvironment(bool b)
|
|||||||
{
|
{
|
||||||
if (useSystemEnvironment() == b)
|
if (useSystemEnvironment() == b)
|
||||||
return;
|
return;
|
||||||
setValue("clearSystemEnvironment", !b);
|
m_clearSystemEnvironment = !b;
|
||||||
emit environmentChanged();
|
emit environmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Qt4BuildConfiguration::useSystemEnvironment() const
|
bool Qt4BuildConfiguration::useSystemEnvironment() const
|
||||||
{
|
{
|
||||||
bool b = !(value("clearSystemEnvironment").isValid()
|
return !m_clearSystemEnvironment;
|
||||||
&& value("clearSystemEnvironment").toBool());
|
|
||||||
return b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectExplorer::EnvironmentItem> Qt4BuildConfiguration::userEnvironmentChanges() const
|
QList<ProjectExplorer::EnvironmentItem> Qt4BuildConfiguration::userEnvironmentChanges() const
|
||||||
{
|
{
|
||||||
return EnvironmentItem::fromStringList(value("userEnvironmentChanges").toStringList());
|
return m_userEnvironmentChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
void Qt4BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||||
{
|
{
|
||||||
QStringList list = EnvironmentItem::toStringList(diff);
|
if (m_userEnvironmentChanges == diff)
|
||||||
if (list == value("userEnvironmentChanges").toStringList())
|
|
||||||
return;
|
return;
|
||||||
setValue("userEnvironmentChanges", list);
|
m_userEnvironmentChanges = diff;
|
||||||
emit environmentChanged();
|
emit environmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +161,8 @@ void Qt4BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplore
|
|||||||
QString Qt4BuildConfiguration::buildDirectory() const
|
QString Qt4BuildConfiguration::buildDirectory() const
|
||||||
{
|
{
|
||||||
QString workingDirectory;
|
QString workingDirectory;
|
||||||
if (value("useShadowBuild").toBool())
|
if (m_shadowBuild)
|
||||||
workingDirectory = value("buildDirectory").toString();
|
workingDirectory = m_buildDirectory;
|
||||||
if (workingDirectory.isEmpty())
|
if (workingDirectory.isEmpty())
|
||||||
workingDirectory = QFileInfo(project()->file()->fileName()).absolutePath();
|
workingDirectory = QFileInfo(project()->file()->fileName()).absolutePath();
|
||||||
return workingDirectory;
|
return workingDirectory;
|
||||||
@@ -136,23 +174,22 @@ QString Qt4BuildConfiguration::buildDirectory() const
|
|||||||
/// still be a insource build
|
/// still be a insource build
|
||||||
bool Qt4BuildConfiguration::shadowBuild() const
|
bool Qt4BuildConfiguration::shadowBuild() const
|
||||||
{
|
{
|
||||||
return value("useShadowBuild").toBool();
|
return m_shadowBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// returns the shadow build directory if set
|
/// returns the shadow build directory if set
|
||||||
/// \note buildDirectory() is probably the function you want to call
|
/// \note buildDirectory() is probably the function you want to call
|
||||||
QString Qt4BuildConfiguration::shadowBuildDirectory() const
|
QString Qt4BuildConfiguration::shadowBuildDirectory() const
|
||||||
{
|
{
|
||||||
return value("buildDirectory").toString();
|
return m_buildDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory)
|
void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory)
|
||||||
{
|
{
|
||||||
if (value("useShadowBuild").toBool() == shadowBuild
|
if (m_shadowBuild == shadowBuild && m_buildDirectory == buildDirectory)
|
||||||
&& value("buildDirectory").toString() == buildDirectory)
|
|
||||||
return;
|
return;
|
||||||
setValue("useShadowBuild", shadowBuild);
|
m_shadowBuild = shadowBuild;
|
||||||
setValue("buildDirectory", buildDirectory);
|
m_buildDirectory = buildDirectory;
|
||||||
emit buildDirectoryChanged();
|
emit buildDirectoryChanged();
|
||||||
emit targetInformationChanged();
|
emit targetInformationChanged();
|
||||||
}
|
}
|
||||||
@@ -216,22 +253,12 @@ int Qt4BuildConfiguration::qtVersionId() const
|
|||||||
QtVersionManager *vm = QtVersionManager::instance();
|
QtVersionManager *vm = QtVersionManager::instance();
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug()<<"Looking for qtVersion ID of "<<displayName();
|
qDebug()<<"Looking for qtVersion ID of "<<displayName();
|
||||||
int id = 0;
|
if (vm->version(m_qtVersion)->isValid()) {
|
||||||
QVariant vid = value(KEY_QT_VERSION_ID);
|
return m_qtVersion;
|
||||||
if (vid.isValid()) {
|
} else {
|
||||||
id = vid.toInt();
|
m_qtVersion = 0;
|
||||||
if (vm->version(id)->isValid()) {
|
return 0;
|
||||||
return id;
|
|
||||||
} else {
|
|
||||||
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (debug)
|
|
||||||
qDebug()<<" using qtversion with id ="<<id;
|
|
||||||
// Nothing found, reset to default
|
|
||||||
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, id);
|
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4BuildConfiguration::setQtVersion(int id)
|
void Qt4BuildConfiguration::setQtVersion(int id)
|
||||||
@@ -239,7 +266,7 @@ void Qt4BuildConfiguration::setQtVersion(int id)
|
|||||||
if (qtVersionId() == id)
|
if (qtVersionId() == id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setValue(KEY_QT_VERSION_ID, id);
|
m_qtVersion = id;
|
||||||
emit qtVersionChanged();
|
emit qtVersionChanged();
|
||||||
emit targetInformationChanged();
|
emit targetInformationChanged();
|
||||||
emit environmentChanged();
|
emit environmentChanged();
|
||||||
@@ -247,9 +274,9 @@ void Qt4BuildConfiguration::setQtVersion(int id)
|
|||||||
|
|
||||||
void Qt4BuildConfiguration::setToolChainType(ProjectExplorer::ToolChain::ToolChainType type)
|
void Qt4BuildConfiguration::setToolChainType(ProjectExplorer::ToolChain::ToolChainType type)
|
||||||
{
|
{
|
||||||
if (value("ToolChain").toInt() == type)
|
if (m_toolChainType == type)
|
||||||
return;
|
return;
|
||||||
setValue("ToolChain", (int)type);
|
m_toolChainType = type;
|
||||||
emit toolChainTypeChanged();
|
emit toolChainTypeChanged();
|
||||||
emit targetInformationChanged();
|
emit targetInformationChanged();
|
||||||
emit environmentChanged();
|
emit environmentChanged();
|
||||||
@@ -257,7 +284,7 @@ void Qt4BuildConfiguration::setToolChainType(ProjectExplorer::ToolChain::ToolCha
|
|||||||
|
|
||||||
ProjectExplorer::ToolChain::ToolChainType Qt4BuildConfiguration::toolChainType() const
|
ProjectExplorer::ToolChain::ToolChainType Qt4BuildConfiguration::toolChainType() const
|
||||||
{
|
{
|
||||||
ToolChain::ToolChainType originalType = ToolChain::ToolChainType(value("ToolChain").toInt());
|
ToolChain::ToolChainType originalType = ToolChain::ToolChainType(m_toolChainType);
|
||||||
ToolChain::ToolChainType type = originalType;
|
ToolChain::ToolChainType type = originalType;
|
||||||
const QtVersion *version = qtVersion();
|
const QtVersion *version = qtVersion();
|
||||||
if (!version->possibleToolChainTypes().contains(type)) {
|
if (!version->possibleToolChainTypes().contains(type)) {
|
||||||
@@ -271,14 +298,14 @@ ProjectExplorer::ToolChain::ToolChainType Qt4BuildConfiguration::toolChainType()
|
|||||||
|
|
||||||
QtVersion::QmakeBuildConfigs Qt4BuildConfiguration::qmakeBuildConfiguration() const
|
QtVersion::QmakeBuildConfigs Qt4BuildConfiguration::qmakeBuildConfiguration() const
|
||||||
{
|
{
|
||||||
return QtVersion::QmakeBuildConfigs(value("buildConfiguration").toInt());
|
return m_qmakeBuildConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4BuildConfiguration::setQMakeBuildConfiguration(QtVersion::QmakeBuildConfigs config)
|
void Qt4BuildConfiguration::setQMakeBuildConfiguration(QtVersion::QmakeBuildConfigs config)
|
||||||
{
|
{
|
||||||
if (value("buildConfiguration").toInt() == int(config))
|
if (m_qmakeBuildConfiguration == config)
|
||||||
return;
|
return;
|
||||||
setValue("buildConfiguration", int(config));
|
m_qmakeBuildConfiguration = config;
|
||||||
emit qmakeBuildConfigurationChanged();
|
emit qmakeBuildConfigurationChanged();
|
||||||
emit targetInformationChanged();
|
emit targetInformationChanged();
|
||||||
}
|
}
|
||||||
@@ -286,7 +313,7 @@ void Qt4BuildConfiguration::setQMakeBuildConfiguration(QtVersion::QmakeBuildConf
|
|||||||
void Qt4BuildConfiguration::getConfigCommandLineArguments(QStringList *addedUserConfigs, QStringList *removedUserConfigs) const
|
void Qt4BuildConfiguration::getConfigCommandLineArguments(QStringList *addedUserConfigs, QStringList *removedUserConfigs) const
|
||||||
{
|
{
|
||||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion()->defaultBuildConfig();
|
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion()->defaultBuildConfig();
|
||||||
QtVersion::QmakeBuildConfigs userBuildConfiguration = qmakeBuildConfiguration();
|
QtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration;
|
||||||
if (removedUserConfigs) {
|
if (removedUserConfigs) {
|
||||||
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(userBuildConfiguration & QtVersion::BuildAll))
|
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(userBuildConfiguration & QtVersion::BuildAll))
|
||||||
(*removedUserConfigs) << "debug_and_release";
|
(*removedUserConfigs) << "debug_and_release";
|
||||||
|
@@ -48,7 +48,10 @@ class Qt4BuildConfiguration : public ProjectExplorer::BuildConfiguration
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
// new buildconfiguration
|
||||||
Qt4BuildConfiguration(Qt4Project *pro);
|
Qt4BuildConfiguration(Qt4Project *pro);
|
||||||
|
// restore ctor
|
||||||
|
Qt4BuildConfiguration(Qt4Project *pro, const QMap<QString, QVariant> &values);
|
||||||
// copy ctor
|
// copy ctor
|
||||||
Qt4BuildConfiguration(Qt4BuildConfiguration *source);
|
Qt4BuildConfiguration(Qt4BuildConfiguration *source);
|
||||||
~Qt4BuildConfiguration();
|
~Qt4BuildConfiguration();
|
||||||
@@ -104,6 +107,7 @@ public:
|
|||||||
static QStringList removeSpecFromArgumentList(const QStringList &old);
|
static QStringList removeSpecFromArgumentList(const QStringList &old);
|
||||||
static QString extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version);
|
static QString extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version);
|
||||||
|
|
||||||
|
void toMap(QMap<QString, QVariant> &map) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// emitted if the qt version changes (either directly, or because the default qt version changed
|
/// emitted if the qt version changes (either directly, or because the default qt version changed
|
||||||
@@ -124,6 +128,13 @@ private slots:
|
|||||||
void qtVersionsChanged(const QList<int> &changedVersions);
|
void qtVersionsChanged(const QList<int> &changedVersions);
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
bool m_clearSystemEnvironment;
|
||||||
|
QList<ProjectExplorer::EnvironmentItem> m_userEnvironmentChanges;
|
||||||
|
bool m_shadowBuild;
|
||||||
|
QString m_buildDirectory;
|
||||||
|
mutable int m_qtVersion; // Changed if the qtversion is invalid
|
||||||
|
int m_toolChainType;
|
||||||
|
QtVersion::QmakeBuildConfigs m_qmakeBuildConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
@@ -300,9 +300,9 @@ BuildConfiguration *Qt4BuildConfigurationFactory::clone(BuildConfiguration *sour
|
|||||||
return newbc;
|
return newbc;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration *Qt4BuildConfigurationFactory::restore() const
|
BuildConfiguration *Qt4BuildConfigurationFactory::restore(const QMap<QString, QVariant> &values) const
|
||||||
{
|
{
|
||||||
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(m_project);
|
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(m_project, values);
|
||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +480,6 @@ Qt4BuildConfiguration *Qt4Project::addQt4BuildConfiguration(QString displayName,
|
|||||||
// Add the buildconfiguration
|
// Add the buildconfiguration
|
||||||
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(this);
|
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(this);
|
||||||
bc->setDisplayName(displayName);
|
bc->setDisplayName(displayName);
|
||||||
addBuildConfiguration(bc);
|
|
||||||
|
|
||||||
QMakeStep *qmakeStep = new QMakeStep(bc);
|
QMakeStep *qmakeStep = new QMakeStep(bc);
|
||||||
bc->insertBuildStep(0, qmakeStep);
|
bc->insertBuildStep(0, qmakeStep);
|
||||||
@@ -506,6 +505,7 @@ Qt4BuildConfiguration *Qt4Project::addQt4BuildConfiguration(QString displayName,
|
|||||||
bc->setQtVersion(0);
|
bc->setQtVersion(0);
|
||||||
else
|
else
|
||||||
bc->setQtVersion(qtversion->uniqueId());
|
bc->setQtVersion(qtversion->uniqueId());
|
||||||
|
addBuildConfiguration(bc);
|
||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -130,7 +130,7 @@ public:
|
|||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||||
ProjectExplorer::BuildConfiguration *restore() const;
|
ProjectExplorer::BuildConfiguration *restore(const QMap<QString, QVariant> &values) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void update();
|
void update();
|
||||||
|
Reference in New Issue
Block a user