forked from qt-creator/qt-creator
Move build environment customization down to BuildConfiguration
The functionality was duplicated between the Qt4 and CMake build configurations and their configuration widgets. This change moves it down to BuildConfiguration, in addition also making it available for the Generic Project. Also provides an upgrade path for the configuration. Task-number: QTCREATOR-24 Reviewed-by: dt Reviewed-by: Tobias Hunger
This commit is contained in:
@@ -44,23 +44,19 @@ using namespace Internal;
|
|||||||
namespace {
|
namespace {
|
||||||
const char * const CMAKE_BC_ID("CMakeProjectManager.CMakeBuildConfiguration");
|
const char * const CMAKE_BC_ID("CMakeProjectManager.CMakeBuildConfiguration");
|
||||||
|
|
||||||
const char * const USER_ENVIRONMENT_CHANGES_KEY("CMakeProjectManager.CMakeBuildConfiguration.UserEnvironmentChanges");
|
|
||||||
const char * const MSVC_VERSION_KEY("CMakeProjectManager.CMakeBuildConfiguration.MsvcVersion");
|
const char * const MSVC_VERSION_KEY("CMakeProjectManager.CMakeBuildConfiguration.MsvcVersion");
|
||||||
const char * const BUILD_DIRECTORY_KEY("CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory");
|
const char * const BUILD_DIRECTORY_KEY("CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory");
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent) :
|
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent) :
|
||||||
BuildConfiguration(parent, QLatin1String(CMAKE_BC_ID)),
|
BuildConfiguration(parent, QLatin1String(CMAKE_BC_ID)),
|
||||||
m_toolChain(0),
|
m_toolChain(0)
|
||||||
m_clearSystemEnvironment(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuildConfiguration *source) :
|
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuildConfiguration *source) :
|
||||||
BuildConfiguration(parent, source),
|
BuildConfiguration(parent, source),
|
||||||
m_toolChain(0),
|
m_toolChain(0),
|
||||||
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
|
||||||
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
|
||||||
m_buildDirectory(source->m_buildDirectory),
|
m_buildDirectory(source->m_buildDirectory),
|
||||||
m_msvcVersion(source->m_msvcVersion)
|
m_msvcVersion(source->m_msvcVersion)
|
||||||
{
|
{
|
||||||
@@ -70,8 +66,6 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuild
|
|||||||
QVariantMap CMakeBuildConfiguration::toMap() const
|
QVariantMap CMakeBuildConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
|
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
|
||||||
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY),
|
|
||||||
ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
|
||||||
map.insert(QLatin1String(MSVC_VERSION_KEY), m_msvcVersion);
|
map.insert(QLatin1String(MSVC_VERSION_KEY), m_msvcVersion);
|
||||||
map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory);
|
map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory);
|
||||||
return map;
|
return map;
|
||||||
@@ -79,7 +73,6 @@ QVariantMap CMakeBuildConfiguration::toMap() const
|
|||||||
|
|
||||||
bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
m_userEnvironmentChanges = ProjectExplorer::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
|
||||||
m_msvcVersion = map.value(QLatin1String(MSVC_VERSION_KEY)).toString();
|
m_msvcVersion = map.value(QLatin1String(MSVC_VERSION_KEY)).toString();
|
||||||
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
|
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
|
||||||
|
|
||||||
@@ -96,55 +89,6 @@ CMakeTarget *CMakeBuildConfiguration::cmakeTarget() const
|
|||||||
return static_cast<CMakeTarget *>(target());
|
return static_cast<CMakeTarget *>(target());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Environment CMakeBuildConfiguration::baseEnvironment() const
|
|
||||||
{
|
|
||||||
ProjectExplorer::Environment env = useSystemEnvironment() ?
|
|
||||||
ProjectExplorer::Environment(QProcess::systemEnvironment()) :
|
|
||||||
ProjectExplorer::Environment();
|
|
||||||
return env;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CMakeBuildConfiguration::baseEnvironmentText() const
|
|
||||||
{
|
|
||||||
if (useSystemEnvironment())
|
|
||||||
return tr("System Environment");
|
|
||||||
else
|
|
||||||
return tr("Clear Environment");
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::Environment CMakeBuildConfiguration::environment() const
|
|
||||||
{
|
|
||||||
ProjectExplorer::Environment env = baseEnvironment();
|
|
||||||
env.modify(userEnvironmentChanges());
|
|
||||||
return env;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMakeBuildConfiguration::setUseSystemEnvironment(bool b)
|
|
||||||
{
|
|
||||||
if (b == m_clearSystemEnvironment)
|
|
||||||
return;
|
|
||||||
m_clearSystemEnvironment = !b;
|
|
||||||
emit environmentChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMakeBuildConfiguration::useSystemEnvironment() const
|
|
||||||
{
|
|
||||||
return !m_clearSystemEnvironment;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ProjectExplorer::EnvironmentItem> CMakeBuildConfiguration::userEnvironmentChanges() const
|
|
||||||
{
|
|
||||||
return m_userEnvironmentChanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMakeBuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
|
||||||
{
|
|
||||||
if (m_userEnvironmentChanges == diff)
|
|
||||||
return;
|
|
||||||
m_userEnvironmentChanges = diff;
|
|
||||||
emit environmentChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CMakeBuildConfiguration::buildDirectory() const
|
QString CMakeBuildConfiguration::buildDirectory() const
|
||||||
{
|
{
|
||||||
QString buildDirectory = m_buildDirectory;
|
QString buildDirectory = m_buildDirectory;
|
||||||
|
|||||||
@@ -50,14 +50,6 @@ public:
|
|||||||
|
|
||||||
CMakeTarget *cmakeTarget() const;
|
CMakeTarget *cmakeTarget() const;
|
||||||
|
|
||||||
ProjectExplorer::Environment environment() const;
|
|
||||||
ProjectExplorer::Environment baseEnvironment() const;
|
|
||||||
QString baseEnvironmentText() const;
|
|
||||||
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff);
|
|
||||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const;
|
|
||||||
bool useSystemEnvironment() const;
|
|
||||||
void setUseSystemEnvironment(bool b);
|
|
||||||
|
|
||||||
virtual QString buildDirectory() const;
|
virtual QString buildDirectory() const;
|
||||||
|
|
||||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||||
@@ -80,8 +72,6 @@ protected:
|
|||||||
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_buildDirectory;
|
||||||
QString m_msvcVersion;
|
QString m_msvcVersion;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,10 +34,10 @@
|
|||||||
#include "cmaketarget.h"
|
#include "cmaketarget.h"
|
||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
#include "cmakeopenprojectwizard.h"
|
#include "cmakeopenprojectwizard.h"
|
||||||
#include "cmakebuildenvironmentwidget.h"
|
|
||||||
#include "cmakebuildconfiguration.h"
|
#include "cmakebuildconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
#include <cpptools/cppmodelmanagerinterface.h>
|
#include <cpptools/cppmodelmanagerinterface.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -449,7 +449,7 @@ ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
|
|||||||
QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
|
QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
|
||||||
{
|
{
|
||||||
QList<ProjectExplorer::BuildConfigWidget*> list;
|
QList<ProjectExplorer::BuildConfigWidget*> list;
|
||||||
list << new CMakeBuildEnvironmentWidget(this);
|
list << new BuildEnvironmentWidget;
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ HEADERS = cmakeproject.h \
|
|||||||
makestep.h \
|
makestep.h \
|
||||||
cmakerunconfiguration.h \
|
cmakerunconfiguration.h \
|
||||||
cmakeopenprojectwizard.h \
|
cmakeopenprojectwizard.h \
|
||||||
cmakebuildenvironmentwidget.h \
|
|
||||||
cmakebuildconfiguration.h
|
cmakebuildconfiguration.h
|
||||||
SOURCES = cmakeproject.cpp \
|
SOURCES = cmakeproject.cpp \
|
||||||
cmakeprojectplugin.cpp \
|
cmakeprojectplugin.cpp \
|
||||||
@@ -21,7 +20,6 @@ SOURCES = cmakeproject.cpp \
|
|||||||
makestep.cpp \
|
makestep.cpp \
|
||||||
cmakerunconfiguration.cpp \
|
cmakerunconfiguration.cpp \
|
||||||
cmakeopenprojectwizard.cpp \
|
cmakeopenprojectwizard.cpp \
|
||||||
cmakebuildenvironmentwidget.cpp \
|
|
||||||
cmakebuildconfiguration.cpp
|
cmakebuildconfiguration.cpp
|
||||||
RESOURCES += cmakeproject.qrc
|
RESOURCES += cmakeproject.qrc
|
||||||
FORMS +=
|
FORMS +=
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
#include "generictarget.h"
|
#include "generictarget.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <cpptools/cppmodelmanagerinterface.h>
|
#include <cpptools/cppmodelmanagerinterface.h>
|
||||||
@@ -399,7 +400,9 @@ ProjectExplorer::BuildConfigWidget *GenericProject::createConfigWidget()
|
|||||||
|
|
||||||
QList<ProjectExplorer::BuildConfigWidget*> GenericProject::subConfigWidgets()
|
QList<ProjectExplorer::BuildConfigWidget*> GenericProject::subConfigWidgets()
|
||||||
{
|
{
|
||||||
return QList<ProjectExplorer::BuildConfigWidget*>();
|
QList<ProjectExplorer::BuildConfigWidget*> list;
|
||||||
|
list << new BuildEnvironmentWidget;
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericProjectNode *GenericProject::rootProjectNode() const
|
GenericProjectNode *GenericProject::rootProjectNode() const
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <QtCore/QProcess>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -59,19 +61,24 @@ const char * const BUILD_STEPS_COUNT_KEY("ProjectExplorer.BuildConfiguration.Bui
|
|||||||
const char * const BUILD_STEPS_PREFIX("ProjectExplorer.BuildConfiguration.BuildStep.");
|
const char * const BUILD_STEPS_PREFIX("ProjectExplorer.BuildConfiguration.BuildStep.");
|
||||||
const char * const CLEAN_STEPS_COUNT_KEY("ProjectExplorer.BuildConfiguration.CleanStepsCount");
|
const char * const CLEAN_STEPS_COUNT_KEY("ProjectExplorer.BuildConfiguration.CleanStepsCount");
|
||||||
const char * const CLEAN_STEPS_PREFIX("ProjectExplorer.BuildConfiguration.CleanStep.");
|
const char * const CLEAN_STEPS_PREFIX("ProjectExplorer.BuildConfiguration.CleanStep.");
|
||||||
|
const char * const CLEAR_SYSTEM_ENVIRONMENT_KEY("ProjectExplorer.BuildConfiguration.ClearSystemEnvironment");
|
||||||
|
const char * const USER_ENVIRONMENT_CHANGES_KEY("ProjectExplorer.BuildConfiguration.UserEnvironmentChanges");
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(Target *target, const QString &id) :
|
BuildConfiguration::BuildConfiguration(Target *target, const QString &id) :
|
||||||
ProjectConfiguration(id),
|
ProjectConfiguration(id),
|
||||||
m_target(target)
|
m_target(target),
|
||||||
|
m_clearSystemEnvironment(false)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_target);
|
Q_ASSERT(m_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
|
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
|
||||||
ProjectConfiguration(source),
|
ProjectConfiguration(source),
|
||||||
m_target(target)
|
m_target(target),
|
||||||
|
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
||||||
|
m_userEnvironmentChanges(source->m_userEnvironmentChanges)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_target);
|
Q_ASSERT(m_target);
|
||||||
}
|
}
|
||||||
@@ -91,6 +98,8 @@ QVariantMap BuildConfiguration::toMap() const
|
|||||||
map.insert(QLatin1String(CLEAN_STEPS_COUNT_KEY), m_cleanSteps.count());
|
map.insert(QLatin1String(CLEAN_STEPS_COUNT_KEY), m_cleanSteps.count());
|
||||||
for (int i = 0; i < m_cleanSteps.count(); ++i)
|
for (int i = 0; i < m_cleanSteps.count(); ++i)
|
||||||
map.insert(QString::fromLatin1(CLEAN_STEPS_PREFIX) + QString::number(i), m_cleanSteps.at(i)->toMap());
|
map.insert(QString::fromLatin1(CLEAN_STEPS_PREFIX) + QString::number(i), m_cleanSteps.at(i)->toMap());
|
||||||
|
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment);
|
||||||
|
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -165,6 +174,9 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
insertCleanStep(m_cleanSteps.count(), bs);
|
insertCleanStep(m_cleanSteps.count(), bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
|
||||||
|
m_userEnvironmentChanges = EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,6 +232,54 @@ Target *BuildConfiguration::target() const
|
|||||||
return m_target;
|
return m_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Environment BuildConfiguration::baseEnvironment() const
|
||||||
|
{
|
||||||
|
if (useSystemEnvironment())
|
||||||
|
return Environment(QProcess::systemEnvironment());
|
||||||
|
return Environment();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BuildConfiguration::baseEnvironmentText() const
|
||||||
|
{
|
||||||
|
if (useSystemEnvironment())
|
||||||
|
return tr("System Environment");
|
||||||
|
else
|
||||||
|
return tr("Clean Environment");
|
||||||
|
}
|
||||||
|
|
||||||
|
Environment BuildConfiguration::environment() const
|
||||||
|
{
|
||||||
|
Environment env = baseEnvironment();
|
||||||
|
env.modify(userEnvironmentChanges());
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfiguration::setUseSystemEnvironment(bool b)
|
||||||
|
{
|
||||||
|
if (useSystemEnvironment() == b)
|
||||||
|
return;
|
||||||
|
m_clearSystemEnvironment = !b;
|
||||||
|
emit environmentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BuildConfiguration::useSystemEnvironment() const
|
||||||
|
{
|
||||||
|
return !m_clearSystemEnvironment;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<EnvironmentItem> BuildConfiguration::userEnvironmentChanges() const
|
||||||
|
{
|
||||||
|
return m_userEnvironmentChanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||||
|
{
|
||||||
|
if (m_userEnvironmentChanges == diff)
|
||||||
|
return;
|
||||||
|
m_userEnvironmentChanges = diff;
|
||||||
|
emit environmentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
// IBuildConfigurationFactory
|
// IBuildConfigurationFactory
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -63,11 +63,19 @@ public:
|
|||||||
void removeCleanStep(int position);
|
void removeCleanStep(int position);
|
||||||
void moveCleanStepUp(int position);
|
void moveCleanStepUp(int position);
|
||||||
|
|
||||||
virtual Environment environment() const = 0;
|
|
||||||
virtual QString buildDirectory() const = 0;
|
virtual QString buildDirectory() const = 0;
|
||||||
|
|
||||||
Target *target() const;
|
Target *target() const;
|
||||||
|
|
||||||
|
// TODO: Maybe the BuildConfiguration is not the best place for the environment
|
||||||
|
virtual Environment baseEnvironment() const;
|
||||||
|
QString baseEnvironmentText() const;
|
||||||
|
Environment environment() const;
|
||||||
|
void setUserEnvironmentChanges(const QList<EnvironmentItem> &diff);
|
||||||
|
QList<EnvironmentItem> userEnvironmentChanges() const;
|
||||||
|
bool useSystemEnvironment() const;
|
||||||
|
void setUseSystemEnvironment(bool b);
|
||||||
|
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -85,6 +93,9 @@ private:
|
|||||||
QList<BuildStep *> m_buildSteps;
|
QList<BuildStep *> m_buildSteps;
|
||||||
QList<BuildStep *> m_cleanSteps;
|
QList<BuildStep *> m_cleanSteps;
|
||||||
Target *m_target;
|
Target *m_target;
|
||||||
|
|
||||||
|
bool m_clearSystemEnvironment;
|
||||||
|
QList<EnvironmentItem> m_userEnvironmentChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory :
|
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory :
|
||||||
|
|||||||
@@ -27,29 +27,27 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "cmakebuildenvironmentwidget.h"
|
#include "buildenvironmentwidget.h"
|
||||||
#include "cmakeproject.h"
|
|
||||||
#include "cmakebuildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
#include <projectexplorer/environmenteditmodel.h>
|
#include "environmenteditmodel.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
|
|
||||||
namespace {
|
using namespace ProjectExplorer;
|
||||||
bool debug = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace CMakeProjectManager;
|
BuildEnvironmentWidget::BuildEnvironmentWidget()
|
||||||
using namespace CMakeProjectManager::Internal;
|
: m_buildConfiguration(0)
|
||||||
|
|
||||||
CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project)
|
|
||||||
: BuildConfigWidget(), m_pro(project), m_buildConfiguration(0)
|
|
||||||
{
|
{
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
vbox->setMargin(0);
|
vbox->setMargin(0);
|
||||||
m_clearSystemEnvironmentCheckBox = new QCheckBox(this);
|
m_clearSystemEnvironmentCheckBox = new QCheckBox(this);
|
||||||
m_clearSystemEnvironmentCheckBox->setText(tr("Clear system environment"));
|
m_clearSystemEnvironmentCheckBox->setText(tr("Clear system environment"));
|
||||||
|
|
||||||
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
|
m_buildEnvironmentWidget = new EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
|
||||||
vbox->addWidget(m_buildEnvironmentWidget);
|
vbox->addWidget(m_buildEnvironmentWidget);
|
||||||
|
|
||||||
connect(m_buildEnvironmentWidget, SIGNAL(userChangesChanged()),
|
connect(m_buildEnvironmentWidget, SIGNAL(userChangesChanged()),
|
||||||
@@ -58,26 +56,31 @@ CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project)
|
|||||||
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeBuildEnvironmentWidget::displayName() const
|
QString BuildEnvironmentWidget::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Build Environment");
|
return tr("Build Environment");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
void BuildEnvironmentWidget::init(BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
if (debug)
|
QTC_ASSERT(bc, return);
|
||||||
qDebug() << "Qt4BuildConfigWidget::init()";
|
|
||||||
|
|
||||||
if (m_buildConfiguration) {
|
if (m_buildConfiguration) {
|
||||||
disconnect(m_buildConfiguration, SIGNAL(environmentChanged()),
|
disconnect(m_buildConfiguration, SIGNAL(environmentChanged()),
|
||||||
this, SLOT(environmentChanged()));
|
this, SLOT(environmentChanged()));
|
||||||
}
|
}
|
||||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
|
||||||
|
m_buildConfiguration = static_cast<BuildConfiguration *>(bc);
|
||||||
|
|
||||||
|
if (!m_buildConfiguration) {
|
||||||
|
setEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setEnabled(true);
|
||||||
|
|
||||||
connect(m_buildConfiguration, SIGNAL(environmentChanged()),
|
connect(m_buildConfiguration, SIGNAL(environmentChanged()),
|
||||||
this, SLOT(environmentChanged()));
|
this, SLOT(environmentChanged()));
|
||||||
|
|
||||||
|
|
||||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||||
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
||||||
@@ -85,19 +88,19 @@ void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
|||||||
m_buildEnvironmentWidget->updateButtons();
|
m_buildEnvironmentWidget->updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::environmentModelUserChangesChanged()
|
void BuildEnvironmentWidget::environmentModelUserChangesChanged()
|
||||||
{
|
{
|
||||||
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
void BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
||||||
{
|
{
|
||||||
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||||
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::environmentChanged()
|
void BuildEnvironmentWidget::environmentChanged()
|
||||||
{
|
{
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||||
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
||||||
@@ -27,32 +27,29 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef QT4BUILDENVIRONMENTWIDGET_H
|
#ifndef BUILDENVIRONMENTWIDGET_H
|
||||||
#define QT4BUILDENVIRONMENTWIDGET_H
|
#define BUILDENVIRONMENTWIDGET_H
|
||||||
|
|
||||||
#include <projectexplorer/buildstep.h>
|
#include <projectexplorer/buildstep.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class EnvironmentWidget;
|
class EnvironmentWidget;
|
||||||
}
|
class BuildConfiguration;
|
||||||
|
|
||||||
namespace CMakeProjectManager {
|
class PROJECTEXPLORER_EXPORT BuildEnvironmentWidget : public BuildConfigWidget
|
||||||
namespace Internal {
|
|
||||||
class CMakeProject;
|
|
||||||
class CMakeBuildConfiguration;
|
|
||||||
|
|
||||||
class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMakeBuildEnvironmentWidget(CMakeProject *project);
|
BuildEnvironmentWidget();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
void init(BuildConfiguration *bc);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void environmentModelUserChangesChanged();
|
void environmentModelUserChangesChanged();
|
||||||
@@ -60,13 +57,11 @@ private slots:
|
|||||||
void environmentChanged();
|
void environmentChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
EnvironmentWidget *m_buildEnvironmentWidget;
|
||||||
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
||||||
CMakeProject *m_pro;
|
BuildConfiguration *m_buildConfiguration;
|
||||||
CMakeBuildConfiguration *m_buildConfiguration;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
#endif // QT4BUILDENVIRONMENTWIDGET_H
|
#endif // BUILDENVIRONMENTWIDGET_H
|
||||||
@@ -75,7 +75,8 @@ HEADERS += projectexplorer.h \
|
|||||||
targetselector.h \
|
targetselector.h \
|
||||||
targetsettingswidget.h \
|
targetsettingswidget.h \
|
||||||
doubletabwidget.h \
|
doubletabwidget.h \
|
||||||
addtargetdialog.h
|
addtargetdialog.h \
|
||||||
|
buildenvironmentwidget.h
|
||||||
SOURCES += projectexplorer.cpp \
|
SOURCES += projectexplorer.cpp \
|
||||||
projectwindow.cpp \
|
projectwindow.cpp \
|
||||||
buildmanager.cpp \
|
buildmanager.cpp \
|
||||||
@@ -137,7 +138,8 @@ SOURCES += projectexplorer.cpp \
|
|||||||
targetselector.cpp \
|
targetselector.cpp \
|
||||||
targetsettingswidget.cpp \
|
targetsettingswidget.cpp \
|
||||||
doubletabwidget.cpp \
|
doubletabwidget.cpp \
|
||||||
addtargetdialog.cpp
|
addtargetdialog.cpp \
|
||||||
|
buildenvironmentwidget.cpp
|
||||||
FORMS += processstep.ui \
|
FORMS += processstep.ui \
|
||||||
editorsettingspropertiespage.ui \
|
editorsettingspropertiespage.ui \
|
||||||
runsettingspropertiespage.ui \
|
runsettingspropertiespage.ui \
|
||||||
|
|||||||
@@ -49,13 +49,10 @@ const char * const WAS_UPDATED("ProjectExplorer.Project.Updater.DidUpdate");
|
|||||||
const char * const PROJECT_FILE_POSTFIX(".user");
|
const char * const PROJECT_FILE_POSTFIX(".user");
|
||||||
|
|
||||||
// Version 0 is used in Qt Creator 1.3.x and
|
// Version 0 is used in Qt Creator 1.3.x and
|
||||||
// (in a slighly differnt flavour) post 1.3 master.
|
// (in a slighly different flavour) post 1.3 master.
|
||||||
class Version0Handler : public UserFileVersionHandler
|
class Version0Handler : public UserFileVersionHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Version0Handler();
|
|
||||||
~Version0Handler();
|
|
||||||
|
|
||||||
int userFileVersion() const
|
int userFileVersion() const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@@ -80,9 +77,6 @@ private:
|
|||||||
class Version1Handler : public UserFileVersionHandler
|
class Version1Handler : public UserFileVersionHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Version1Handler();
|
|
||||||
~Version1Handler();
|
|
||||||
|
|
||||||
int userFileVersion() const
|
int userFileVersion() const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@@ -115,11 +109,29 @@ private:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Version 2 is used in master post Qt Creator 2.0 alpha.
|
||||||
|
class Version2Handler : public UserFileVersionHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int userFileVersion() const
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString displayUserFileVersion() const
|
||||||
|
{
|
||||||
|
return QLatin1String("2.0-alpha+git");
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap update(Project *project, const QVariantMap &map);
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Helper functions:
|
// Helper functions:
|
||||||
//
|
//
|
||||||
|
|
||||||
QString fileNameFor(const QString &name) {
|
static QString fileNameFor(const QString &name)
|
||||||
|
{
|
||||||
QString baseName(name);
|
QString baseName(name);
|
||||||
QString environmentExtension(QString::fromLocal8Bit(qgetenv("QTC_EXTENSION")));
|
QString environmentExtension(QString::fromLocal8Bit(qgetenv("QTC_EXTENSION")));
|
||||||
if (!environmentExtension.isEmpty()) {
|
if (!environmentExtension.isEmpty()) {
|
||||||
@@ -147,6 +159,31 @@ UserFileVersionHandler::~UserFileVersionHandler()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a simple renaming of the listed keys in \a changes recursively on \a map.
|
||||||
|
*/
|
||||||
|
QVariantMap UserFileVersionHandler::renameKeys(const QList<Change> &changes, QVariantMap map)
|
||||||
|
{
|
||||||
|
foreach (const Change &change, changes) {
|
||||||
|
QVariantMap::iterator oldSetting = map.find(change.first);
|
||||||
|
if (oldSetting != map.end()) {
|
||||||
|
map.insert(change.second, oldSetting.value());
|
||||||
|
map.erase(oldSetting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap::iterator i = map.begin();
|
||||||
|
while (i != map.end()) {
|
||||||
|
QVariant v = i.value();
|
||||||
|
if (v.type() == QVariant::Map)
|
||||||
|
i.value() = renameKeys(changes, v.toMap());
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// UserFileAccessor
|
// UserFileAccessor
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -157,6 +194,7 @@ UserFileAccessor::UserFileAccessor() :
|
|||||||
{
|
{
|
||||||
addVersionHandler(new Version0Handler);
|
addVersionHandler(new Version0Handler);
|
||||||
addVersionHandler(new Version1Handler);
|
addVersionHandler(new Version1Handler);
|
||||||
|
addVersionHandler(new Version2Handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserFileAccessor::~UserFileAccessor()
|
UserFileAccessor::~UserFileAccessor()
|
||||||
@@ -250,14 +288,6 @@ void UserFileAccessor::addVersionHandler(UserFileVersionHandler *handler)
|
|||||||
// Version0Handler
|
// Version0Handler
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
Version0Handler::Version0Handler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Version0Handler::~Version0Handler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap Version0Handler::convertBuildConfigurations(Project *project, const QVariantMap &map)
|
QVariantMap Version0Handler::convertBuildConfigurations(Project *project, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
Q_ASSERT(project);
|
Q_ASSERT(project);
|
||||||
@@ -703,14 +733,6 @@ QVariantMap Version0Handler::update(Project *project, const QVariantMap &map)
|
|||||||
// Version1Handler
|
// Version1Handler
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
Version1Handler::Version1Handler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Version1Handler::~Version1Handler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap Version1Handler::update(Project *project, const QVariantMap &map)
|
QVariantMap Version1Handler::update(Project *project, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
QVariantMap result;
|
QVariantMap result;
|
||||||
@@ -812,3 +834,22 @@ QVariantMap Version1Handler::update(Project *project, const QVariantMap &map)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Version2Handler
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
QVariantMap Version2Handler::update(Project *, const QVariantMap &map)
|
||||||
|
{
|
||||||
|
QList<Change> changes;
|
||||||
|
changes.append(qMakePair(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.UserEnvironmentChanges"),
|
||||||
|
QLatin1String("ProjectExplorer.BuildConfiguration.UserEnvironmentChanges")));
|
||||||
|
changes.append(qMakePair(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.ClearSystemEnvironment"),
|
||||||
|
QLatin1String("ProjectExplorer.BuildConfiguration.ClearSystemEnvironment")));
|
||||||
|
changes.append(qMakePair(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.UserEnvironmentChanges"),
|
||||||
|
QLatin1String("ProjectExplorer.BuildConfiguration.UserEnvironmentChanges")));
|
||||||
|
changes.append(qMakePair(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.ClearSystemEnvironment"),
|
||||||
|
QLatin1String("ProjectExplorer.BuildConfiguration.ClearSystemEnvironment")));
|
||||||
|
|
||||||
|
return renameKeys(changes, QVariantMap(map));
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ public:
|
|||||||
virtual QString displayUserFileVersion() const = 0;
|
virtual QString displayUserFileVersion() const = 0;
|
||||||
// Update from userFileVersion() to userFileVersion() + 1
|
// Update from userFileVersion() to userFileVersion() + 1
|
||||||
virtual QVariantMap update(Project *project, const QVariantMap &map) = 0;
|
virtual QVariantMap update(Project *project, const QVariantMap &map) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef QPair<QLatin1String,QLatin1String> Change;
|
||||||
|
QVariantMap renameKeys(const QList<Change> &changes, QVariantMap map);
|
||||||
};
|
};
|
||||||
|
|
||||||
class UserFileAccessor
|
class UserFileAccessor
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ namespace {
|
|||||||
const char * const QT4_BC_ID_PREFIX("Qt4ProjectManager.Qt4BuildConfiguration.");
|
const char * const QT4_BC_ID_PREFIX("Qt4ProjectManager.Qt4BuildConfiguration.");
|
||||||
const char * const QT4_BC_ID("Qt4ProjectManager.Qt4BuildConfiguration");
|
const char * const QT4_BC_ID("Qt4ProjectManager.Qt4BuildConfiguration");
|
||||||
|
|
||||||
const char * const CLEAR_SYSTEM_ENVIRONMENT_KEY("Qt4ProjectManager.Qt4BuildConfiguration.ClearSystemEnvironment");
|
|
||||||
const char * const USER_ENVIRONMENT_CHANGES_KEY("Qt4ProjectManager.Qt4BuildConfiguration.UserEnvironmentChanges");
|
|
||||||
const char * const USE_SHADOW_BUILD_KEY("Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild");
|
const char * const USE_SHADOW_BUILD_KEY("Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild");
|
||||||
const char * const BUILD_DIRECTORY_KEY("Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory");
|
const char * const BUILD_DIRECTORY_KEY("Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory");
|
||||||
const char * const TOOLCHAIN_KEY("Qt4ProjectManager.Qt4BuildConfiguration.ToolChain");
|
const char * const TOOLCHAIN_KEY("Qt4ProjectManager.Qt4BuildConfiguration.ToolChain");
|
||||||
@@ -59,7 +57,6 @@ enum { debug = 0 };
|
|||||||
|
|
||||||
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target) :
|
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target) :
|
||||||
BuildConfiguration(target, QLatin1String(QT4_BC_ID)),
|
BuildConfiguration(target, QLatin1String(QT4_BC_ID)),
|
||||||
m_clearSystemEnvironment(false),
|
|
||||||
m_shadowBuild(false),
|
m_shadowBuild(false),
|
||||||
m_qtVersionId(-1),
|
m_qtVersionId(-1),
|
||||||
m_toolChainType(-1), // toolChainType() makes sure to return the default toolchainType
|
m_toolChainType(-1), // toolChainType() makes sure to return the default toolchainType
|
||||||
@@ -71,7 +68,6 @@ Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target) :
|
|||||||
|
|
||||||
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target, const QString &id) :
|
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target, const QString &id) :
|
||||||
BuildConfiguration(target, id),
|
BuildConfiguration(target, id),
|
||||||
m_clearSystemEnvironment(false),
|
|
||||||
m_shadowBuild(false),
|
m_shadowBuild(false),
|
||||||
m_qtVersionId(-1),
|
m_qtVersionId(-1),
|
||||||
m_toolChainType(-1), // toolChainType() makes sure to return the default toolchainType
|
m_toolChainType(-1), // toolChainType() makes sure to return the default toolchainType
|
||||||
@@ -83,8 +79,6 @@ Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target, const QString &i
|
|||||||
|
|
||||||
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target, Qt4BuildConfiguration *source) :
|
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Target *target, Qt4BuildConfiguration *source) :
|
||||||
BuildConfiguration(target, source),
|
BuildConfiguration(target, source),
|
||||||
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
|
||||||
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
|
||||||
m_shadowBuild(source->m_shadowBuild),
|
m_shadowBuild(source->m_shadowBuild),
|
||||||
m_buildDirectory(source->m_buildDirectory),
|
m_buildDirectory(source->m_buildDirectory),
|
||||||
m_qtVersionId(source->m_qtVersionId),
|
m_qtVersionId(source->m_qtVersionId),
|
||||||
@@ -103,8 +97,6 @@ Qt4BuildConfiguration::~Qt4BuildConfiguration()
|
|||||||
QVariantMap Qt4BuildConfiguration::toMap() const
|
QVariantMap Qt4BuildConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(BuildConfiguration::toMap());
|
QVariantMap map(BuildConfiguration::toMap());
|
||||||
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment);
|
|
||||||
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
|
||||||
map.insert(QLatin1String(USE_SHADOW_BUILD_KEY), m_shadowBuild);
|
map.insert(QLatin1String(USE_SHADOW_BUILD_KEY), m_shadowBuild);
|
||||||
map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory);
|
map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory);
|
||||||
map.insert(QLatin1String(QT_VERSION_ID_KEY), m_qtVersionId);
|
map.insert(QLatin1String(QT_VERSION_ID_KEY), m_qtVersionId);
|
||||||
@@ -119,8 +111,6 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
if (!BuildConfiguration::fromMap(map))
|
if (!BuildConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
|
|
||||||
m_userEnvironmentChanges = EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
|
||||||
m_shadowBuild = map.value(QLatin1String(USE_SHADOW_BUILD_KEY), false).toBool();
|
m_shadowBuild = map.value(QLatin1String(USE_SHADOW_BUILD_KEY), false).toBool();
|
||||||
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
|
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
|
||||||
m_qtVersionId = map.value(QLatin1String(QT_VERSION_ID_KEY)).toInt();
|
m_qtVersionId = map.value(QLatin1String(QT_VERSION_ID_KEY)).toInt();
|
||||||
@@ -179,14 +169,9 @@ Qt4Target *Qt4BuildConfiguration::qt4Target() const
|
|||||||
return static_cast<Qt4Target *>(target());
|
return static_cast<Qt4Target *>(target());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Qt4BuildConfiguration::baseEnvironmentText() const
|
|
||||||
{
|
|
||||||
return useSystemEnvironment() ? tr("System Environment") : tr("Clean Environment");
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::Environment Qt4BuildConfiguration::baseEnvironment() const
|
ProjectExplorer::Environment Qt4BuildConfiguration::baseEnvironment() const
|
||||||
{
|
{
|
||||||
Environment env = useSystemEnvironment() ? Environment::systemEnvironment() : Environment();
|
Environment env = BuildConfiguration::baseEnvironment();
|
||||||
qtVersion()->addToEnvironment(env);
|
qtVersion()->addToEnvironment(env);
|
||||||
ToolChain *tc = toolChain();
|
ToolChain *tc = toolChain();
|
||||||
if (tc)
|
if (tc)
|
||||||
@@ -194,39 +179,6 @@ ProjectExplorer::Environment Qt4BuildConfiguration::baseEnvironment() const
|
|||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Environment Qt4BuildConfiguration::environment() const
|
|
||||||
{
|
|
||||||
Environment env = baseEnvironment();
|
|
||||||
env.modify(userEnvironmentChanges());
|
|
||||||
return env;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4BuildConfiguration::setUseSystemEnvironment(bool b)
|
|
||||||
{
|
|
||||||
if (useSystemEnvironment() == b)
|
|
||||||
return;
|
|
||||||
m_clearSystemEnvironment = !b;
|
|
||||||
emit environmentChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Qt4BuildConfiguration::useSystemEnvironment() const
|
|
||||||
{
|
|
||||||
return !m_clearSystemEnvironment;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ProjectExplorer::EnvironmentItem> Qt4BuildConfiguration::userEnvironmentChanges() const
|
|
||||||
{
|
|
||||||
return m_userEnvironmentChanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
|
||||||
{
|
|
||||||
if (m_userEnvironmentChanges == diff)
|
|
||||||
return;
|
|
||||||
m_userEnvironmentChanges = diff;
|
|
||||||
emit environmentChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// returns the build directory
|
/// returns the build directory
|
||||||
QString Qt4BuildConfiguration::buildDirectory() const
|
QString Qt4BuildConfiguration::buildDirectory() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,13 +57,7 @@ public:
|
|||||||
|
|
||||||
Qt4Target *qt4Target() const;
|
Qt4Target *qt4Target() const;
|
||||||
|
|
||||||
ProjectExplorer::Environment environment() const;
|
virtual ProjectExplorer::Environment baseEnvironment() const;
|
||||||
ProjectExplorer::Environment baseEnvironment() const;
|
|
||||||
QString baseEnvironmentText() const;
|
|
||||||
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff);
|
|
||||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const;
|
|
||||||
bool useSystemEnvironment() const;
|
|
||||||
void setUseSystemEnvironment(bool b);
|
|
||||||
|
|
||||||
virtual QString buildDirectory() const;
|
virtual QString buildDirectory() const;
|
||||||
bool shadowBuild() const;
|
bool shadowBuild() const;
|
||||||
@@ -138,8 +132,6 @@ private:
|
|||||||
void ctor();
|
void ctor();
|
||||||
void pickValidQtVersion();
|
void pickValidQtVersion();
|
||||||
|
|
||||||
bool m_clearSystemEnvironment;
|
|
||||||
QList<ProjectExplorer::EnvironmentItem> m_userEnvironmentChanges;
|
|
||||||
bool m_shadowBuild;
|
bool m_shadowBuild;
|
||||||
QString m_buildDirectory;
|
QString m_buildDirectory;
|
||||||
int m_qtVersionId;
|
int m_qtVersionId;
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** Commercial Usage
|
|
||||||
**
|
|
||||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
||||||
** accordance with the Qt Commercial License Agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** If you are unsure which license is appropriate for your use, please
|
|
||||||
** contact the sales department at http://qt.nokia.com/contact.
|
|
||||||
**
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#include "qt4buildenvironmentwidget.h"
|
|
||||||
#include "qt4project.h"
|
|
||||||
#include "qt4buildconfiguration.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/environmenteditmodel.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QtGui/QCheckBox>
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
bool debug = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace Qt4ProjectManager;
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
|
||||||
|
|
||||||
Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project)
|
|
||||||
: BuildConfigWidget(), m_pro(project), m_buildConfiguration(0)
|
|
||||||
{
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
|
||||||
vbox->setMargin(0);
|
|
||||||
|
|
||||||
m_clearSystemEnvironmentCheckBox = new QCheckBox(this);
|
|
||||||
m_clearSystemEnvironmentCheckBox->setText(tr("Clear system environment"));
|
|
||||||
|
|
||||||
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
|
|
||||||
vbox->addWidget(m_buildEnvironmentWidget);
|
|
||||||
|
|
||||||
connect(m_buildEnvironmentWidget, SIGNAL(userChangesChanged()),
|
|
||||||
this, SLOT(environmentModelUserChangesUpdated()));
|
|
||||||
|
|
||||||
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
|
|
||||||
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Qt4BuildEnvironmentWidget::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Build Environment");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4BuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(bc, return);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
qDebug() << "Qt4BuildConfigWidget::init()";
|
|
||||||
|
|
||||||
if (m_buildConfiguration) {
|
|
||||||
disconnect(m_buildConfiguration, SIGNAL(environmentChanged()),
|
|
||||||
this, SLOT(environmentChanged()));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
|
|
||||||
|
|
||||||
if (!m_buildConfiguration) {
|
|
||||||
setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setEnabled(true);
|
|
||||||
|
|
||||||
connect(m_buildConfiguration, SIGNAL(environmentChanged()),
|
|
||||||
this, SLOT(environmentChanged()));
|
|
||||||
|
|
||||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
|
||||||
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
|
||||||
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
|
|
||||||
m_buildEnvironmentWidget->updateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4BuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
|
||||||
{
|
|
||||||
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
|
||||||
{
|
|
||||||
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
|
||||||
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4BuildEnvironmentWidget::environmentChanged()
|
|
||||||
{
|
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
|
||||||
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** Commercial Usage
|
|
||||||
**
|
|
||||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
||||||
** accordance with the Qt Commercial License Agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** If you are unsure which license is appropriate for your use, please
|
|
||||||
** contact the sales department at http://qt.nokia.com/contact.
|
|
||||||
**
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QT4BUILDENVIRONMENTWIDGET_H
|
|
||||||
#define QT4BUILDENVIRONMENTWIDGET_H
|
|
||||||
|
|
||||||
#include <projectexplorer/buildstep.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QCheckBox;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class EnvironmentWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
|
|
||||||
class Qt4Project;
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
class Qt4BuildConfiguration;
|
|
||||||
|
|
||||||
class Qt4BuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
Qt4BuildEnvironmentWidget(Qt4Project *project);
|
|
||||||
|
|
||||||
QString displayName() const;
|
|
||||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void environmentModelUserChangesUpdated();
|
|
||||||
void clearSystemEnvironmentCheckBoxClicked(bool checked);
|
|
||||||
void environmentChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
|
||||||
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
|
||||||
Qt4Project *m_pro;
|
|
||||||
Qt4BuildConfiguration *m_buildConfiguration;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qt4ProjectManager
|
|
||||||
|
|
||||||
#endif // QT4BUILDENVIRONMENTWIDGET_H
|
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "qt4runconfiguration.h"
|
#include "qt4runconfiguration.h"
|
||||||
#include "qt4nodes.h"
|
#include "qt4nodes.h"
|
||||||
#include "qt4projectconfigwidget.h"
|
#include "qt4projectconfigwidget.h"
|
||||||
#include "qt4buildenvironmentwidget.h"
|
|
||||||
#include "qt4projectmanagerconstants.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
#include "projectloadwizard.h"
|
#include "projectloadwizard.h"
|
||||||
#include "qt4buildconfiguration.h"
|
#include "qt4buildconfiguration.h"
|
||||||
@@ -46,6 +45,7 @@
|
|||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
#include <projectexplorer/customexecutablerunconfiguration.h>
|
#include <projectexplorer/customexecutablerunconfiguration.h>
|
||||||
#include <projectexplorer/nodesvisitor.h>
|
#include <projectexplorer/nodesvisitor.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -933,7 +933,7 @@ BuildConfigWidget *Qt4Project::createConfigWidget()
|
|||||||
QList<BuildConfigWidget*> Qt4Project::subConfigWidgets()
|
QList<BuildConfigWidget*> Qt4Project::subConfigWidgets()
|
||||||
{
|
{
|
||||||
QList<BuildConfigWidget*> subWidgets;
|
QList<BuildConfigWidget*> subWidgets;
|
||||||
subWidgets << new Qt4BuildEnvironmentWidget(this);
|
subWidgets << new BuildEnvironmentWidget;
|
||||||
return subWidgets;
|
return subWidgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ HEADERS += qt4projectmanagerplugin.h \
|
|||||||
qt4runconfiguration.h \
|
qt4runconfiguration.h \
|
||||||
qtmodulesinfo.h \
|
qtmodulesinfo.h \
|
||||||
qt4projectconfigwidget.h \
|
qt4projectconfigwidget.h \
|
||||||
qt4buildenvironmentwidget.h \
|
|
||||||
projectloadwizard.h \
|
projectloadwizard.h \
|
||||||
qtversionmanager.h \
|
qtversionmanager.h \
|
||||||
qtoptionspage.h \
|
qtoptionspage.h \
|
||||||
@@ -75,7 +74,6 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
|||||||
qt4runconfiguration.cpp \
|
qt4runconfiguration.cpp \
|
||||||
qtmodulesinfo.cpp \
|
qtmodulesinfo.cpp \
|
||||||
qt4projectconfigwidget.cpp \
|
qt4projectconfigwidget.cpp \
|
||||||
qt4buildenvironmentwidget.cpp \
|
|
||||||
projectloadwizard.cpp \
|
projectloadwizard.cpp \
|
||||||
qtversionmanager.cpp \
|
qtversionmanager.cpp \
|
||||||
qtoptionspage.cpp \
|
qtoptionspage.cpp \
|
||||||
|
|||||||
Reference in New Issue
Block a user