Commit 4a54ac45 authored by dt_'s avatar dt_
Browse files

Correctly restore disabled shadow building setting

Task-Nr: QTCREATORBUG-4781
parent aa2acec1
......@@ -125,15 +125,15 @@ ProjectExplorer::Target *Qt4DesktopTargetFactory::restore(ProjectExplorer::Proj
Qt4TargetSetupWidget *Qt4DesktopTargetFactory::createTargetSetupWidget(const QString &id, const QString &proFilePath, const QtVersionNumber &number, bool importEnabled, QList<BuildConfigurationInfo> importInfos)
{
Qt4DefaultTargetSetupWidget *widget
= static_cast<Qt4DefaultTargetSetupWidget *>(
Qt4BaseTargetFactory::createTargetSetupWidget(id, proFilePath,
number, importEnabled,
importInfos));
if (widget) {
widget->setShadowBuildCheckBoxVisible(true);
widget->setBuildConfiguraionComboBoxVisible(true);
}
QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, number);
if (infos.isEmpty())
return 0;
Qt4DefaultTargetSetupWidget *widget = new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos,
number, importEnabled,
importInfos,
Qt4DefaultTargetSetupWidget::USER);
widget->setBuildConfiguraionComboBoxVisible(true);
return widget;
}
......
......@@ -83,8 +83,11 @@ Qt4TargetSetupWidget *Qt4BaseTargetFactory::createTargetSetupWidget(const QStrin
QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, number);
if (infos.isEmpty())
return 0;
Qt4DefaultTargetSetupWidget *widget = new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos, number, importEnabled, importInfos);
widget->setShadowBuildSupported(supportsShadowBuilds(id));
Qt4DefaultTargetSetupWidget *widget = new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos,
number, importEnabled && supportsShadowBuilds(id),
importInfos,
supportsShadowBuilds(id) ? Qt4DefaultTargetSetupWidget::ENABLE :
Qt4DefaultTargetSetupWidget::DISABLE);
return widget;
}
......@@ -365,7 +368,8 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
const QList<BuildConfigurationInfo> &infos,
const QtVersionNumber &minimumQtVersion,
bool importEnabled,
const QList<BuildConfigurationInfo> &importInfos)
const QList<BuildConfigurationInfo> &importInfos,
ShadowBuildOption shadowBuild)
: Qt4TargetSetupWidget(),
m_id(id),
m_factory(factory),
......@@ -459,7 +463,8 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
m_shadowBuildEnabled = new QCheckBox;
m_shadowBuildEnabled->setText(tr("Use Shadow Building"));
m_shadowBuildEnabled->setVisible(false);
m_shadowBuildCheckBoxVisible = shadowBuild == USER;
m_shadowBuildEnabled->setVisible(m_shadowBuildCheckBoxVisible);
layout->addWidget(m_shadowBuildEnabled);
......@@ -492,10 +497,16 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
m_importEnabled << true;
}
if (m_hasInSourceBuild)
if (m_hasInSourceBuild || shadowBuild == DISABLE) {
m_shadowBuildEnabled->setChecked(false);
else
m_shadowBuildEnabled->setChecked(s->value("Qt4ProjectManager.TargetSetupPage.ShadowBuilding", true).toBool());
m_directoriesEnabled = false;
} else if (shadowBuild == ENABLE) {
m_shadowBuildEnabled->setChecked(true);
m_directoriesEnabled = true;
} else {
m_directoriesEnabled = s->value("Qt4ProjectManager.TargetSetupPage.ShadowBuilding", true).toBool();
m_shadowBuildEnabled->setChecked(m_directoriesEnabled);
}
m_selected += m_importInfos.size();
......@@ -589,19 +600,6 @@ void Qt4DefaultTargetSetupWidget::setProFilePath(const QString &proFilePath)
setBuildConfigurationInfos(m_factory->availableBuildConfigurations(m_id, proFilePath, m_minimumQtVersion), false);
}
void Qt4DefaultTargetSetupWidget::setShadowBuildSupported(bool b)
{
// if shadow building is supported we want to enable it, unless we have a in source build
m_shadowBuildEnabled->setChecked(b && !m_hasInSourceBuild);
m_importLineButton->setVisible(b);
}
void Qt4DefaultTargetSetupWidget::setShadowBuildCheckBoxVisible(bool b)
{
m_shadowBuildCheckBoxVisible = b;
m_shadowBuildEnabled->setVisible(b);
}
void Qt4DefaultTargetSetupWidget::setBuildConfiguraionComboBoxVisible(bool b)
{
m_buildConfigurationLabel->setVisible(b);
......
......@@ -108,13 +108,15 @@ class Qt4DefaultTargetSetupWidget : public Qt4TargetSetupWidget
{
Q_OBJECT
public:
enum ShadowBuildOption { DISABLE, ENABLE, USER };
Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *factory,
const QString &id,
const QString &proFilePath,
const QList<BuildConfigurationInfo> &info,
const QtVersionNumber &minimumQtVersion,
bool importEnabled,
const QList<BuildConfigurationInfo> &importInfos);
const QList<BuildConfigurationInfo> &importInfos,
ShadowBuildOption shadowBuild);
~Qt4DefaultTargetSetupWidget();
bool isTargetSelected() const;
void setTargetSelected(bool b);
......@@ -123,8 +125,6 @@ public:
QList<BuildConfigurationInfo> buildConfigurationInfos() const;
void setProFilePath(const QString &proFilePath);
void setShadowBuildSupported(bool b);
void setShadowBuildCheckBoxVisible(bool b);
void setBuildConfiguraionComboBoxVisible(bool b);
enum BuildConfigurationTemplate { PERQT = 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment