From e3c59a5800f5b922a58d09e18befffd1148be16d Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Tue, 12 Apr 2011 17:41:25 +0200
Subject: [PATCH] TargetSetupPage: Disable editing build directory for symbian

Shadow building is not supported so editing the path has no purpose.

Reviewed-By: hunger
---
 .../qt-desktop/qt4desktoptargetfactory.cpp         |  6 ++++++
 .../qt-desktop/qt4desktoptargetfactory.h           |  1 +
 .../qt-desktop/qt4simulatortargetfactory.cpp       |  6 ++++++
 .../qt-desktop/qt4simulatortargetfactory.h         |  1 +
 .../qt-maemo/qt4maemotargetfactory.cpp             | 10 ++++++++++
 .../qt-maemo/qt4maemotargetfactory.h               |  1 +
 .../qt-s60/qt4symbiantargetfactory.cpp             |  6 ++++++
 .../qt-s60/qt4symbiantargetfactory.h               |  1 +
 .../qt4projectmanager/qt4basetargetfactory.h       |  1 +
 src/plugins/qt4projectmanager/qt4target.cpp        | 14 +++++++++++---
 src/plugins/qt4projectmanager/qt4target.h          |  1 +
 11 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp
index 3d7122c3695..d8d733605fe 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp
@@ -184,6 +184,12 @@ bool Qt4DesktopTargetFactory::isMobileTarget(const QString &id)
     return false;
 }
 
+bool Qt4DesktopTargetFactory::supportsShadowBuilds(const QString &id)
+{
+    Q_UNUSED(id);
+    return true;
+}
+
 ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Project *parent, const QString &id, const QList<BuildConfigurationInfo> &infos)
 {
     if (!canCreate(parent, id))
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h
index 4cd939c60d0..8f3b75039a1 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h
@@ -58,6 +58,7 @@ public:
 
     Qt4TargetSetupWidget *createTargetSetupWidget(const QString &id, const QString &proFilePath, const QtVersionNumber &minimumQtVersion, bool importEnabled, QList<BuildConfigurationInfo> importInfos);
     bool isMobileTarget(const QString &id);
+    bool supportsShadowBuilds(const QString &id);
     QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtVersionNumber &minimumQtVersion);
     ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id);
     ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id, const QList<BuildConfigurationInfo> &infos);
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp
index 4bbdfb6f94d..a56f0ef0534 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp
@@ -152,6 +152,12 @@ bool Qt4SimulatorTargetFactory::isMobileTarget(const QString &id)
     return true;
 }
 
+bool Qt4SimulatorTargetFactory::supportsShadowBuilds(const QString &id)
+{
+    Q_UNUSED(id);
+    return true;
+}
+
 ProjectExplorer::Target *Qt4SimulatorTargetFactory::create(ProjectExplorer::Project *parent, const QString &id)
 {
     if (!canCreate(parent, id))
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h
index 096f03039b9..dfdb2a84fce 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h
@@ -61,6 +61,7 @@ public:
 
     QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtVersionNumber &minimumQtVersion);
     bool isMobileTarget(const QString &id);
+    bool supportsShadowBuilds(const QString &id);
     ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id);
     ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id, const QList<BuildConfigurationInfo> &infos);
 };
diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp
index c0d0ce2135b..05330426793 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp
@@ -176,6 +176,16 @@ bool Qt4MaemoTargetFactory::isMobileTarget(const QString &id)
     return true;
 }
 
+bool Qt4MaemoTargetFactory::supportsShadowBuilds(const QString &id)
+{
+    Q_UNUSED(id);
+#ifdef Q_OS_WIN
+    return false;
+#else
+    return true;
+#endif
+}
+
 ProjectExplorer::Target *Qt4MaemoTargetFactory::create(ProjectExplorer::Project *parent, const QString &id)
 {
     if (!canCreate(parent, id))
diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.h b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.h
index 010eb34faa3..6723f0e6e1d 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.h
@@ -62,6 +62,7 @@ public:
 
     QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtVersionNumber &minimumQtVersion);
     bool isMobileTarget(const QString &id);
+    bool supportsShadowBuilds(const QString &id);
 };
 
 } // namespace Internal
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp
index bdf0dc532db..90ca2bf7f28 100644
--- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp
@@ -192,6 +192,12 @@ bool Qt4SymbianTargetFactory::isMobileTarget(const QString &id)
     return true;
 }
 
+bool Qt4SymbianTargetFactory::supportsShadowBuilds(const QString &id)
+{
+    Q_UNUSED(id);
+    return false;
+}
+
 ProjectExplorer::Target *Qt4SymbianTargetFactory::create(ProjectExplorer::Project *parent, const QString &id)
 {
     if (!canCreate(parent, id))
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h
index 0cf1920557f..c2c6cef625c 100644
--- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h
+++ b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h
@@ -62,6 +62,7 @@ public:
     QList<ProjectExplorer::Task> reportIssues(const QString &proFile);
     QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtVersionNumber &minimumQtVersion);
     bool isMobileTarget(const QString &id);
+    bool supportsShadowBuilds(const QString &id);
 };
 
 } // namespace Internal
diff --git a/src/plugins/qt4projectmanager/qt4basetargetfactory.h b/src/plugins/qt4projectmanager/qt4basetargetfactory.h
index 2be2ebc5bca..d04926bf874 100644
--- a/src/plugins/qt4projectmanager/qt4basetargetfactory.h
+++ b/src/plugins/qt4projectmanager/qt4basetargetfactory.h
@@ -69,6 +69,7 @@ public:
     virtual QIcon iconForId(const QString &id) const = 0;
 
     virtual bool isMobileTarget(const QString &id) = 0;
+    virtual bool supportsShadowBuilds(const QString &id) = 0;
 
     virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id) = 0;
     virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id, const QList<BuildConfigurationInfo> &infos) = 0;
diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp
index 793348b5690..9e837cff51b 100644
--- a/src/plugins/qt4projectmanager/qt4target.cpp
+++ b/src/plugins/qt4projectmanager/qt4target.cpp
@@ -83,7 +83,9 @@ Qt4TargetSetupWidget *Qt4BaseTargetFactory::createTargetSetupWidget(const QStrin
     QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, number);
     if (infos.isEmpty())
         return 0;
-    return new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos, number, importEnabled, importInfos);
+    Qt4DefaultTargetSetupWidget *widget = new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos, number, importEnabled, importInfos);
+    widget->setShadowBuildSupported(supportsShadowBuilds(id));
+    return widget;
 }
 
 ProjectExplorer::Target *Qt4BaseTargetFactory::create(ProjectExplorer::Project *parent, const QString &id, Qt4TargetSetupWidget *widget)
@@ -374,7 +376,6 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
 
     m_shadowBuildEnabled = new QCheckBox;
     m_shadowBuildEnabled->setText(tr("Use Shadow Building"));
-    m_shadowBuildEnabled->setChecked(true);
     m_shadowBuildEnabled->setVisible(false);
     layout->addWidget(m_shadowBuildEnabled);
 
@@ -395,6 +396,8 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
         m_importEnabled << true;
     }
 
+    m_shadowBuildEnabled->setChecked(!m_hasInSourceBuild);
+
     m_selected += m_importInfos.size();
 
     setupImportWidgets();
@@ -456,10 +459,15 @@ 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);
+}
+
 void Qt4DefaultTargetSetupWidget::setShadowBuildCheckBoxVisible(bool b)
 {
     m_shadowBuildEnabled->setVisible(b);
-    m_shadowBuildEnabled->setChecked(!m_hasInSourceBuild);
 }
 
 QList<BuildConfigurationInfo> Qt4DefaultTargetSetupWidget::buildConfigurationInfos() const
diff --git a/src/plugins/qt4projectmanager/qt4target.h b/src/plugins/qt4projectmanager/qt4target.h
index b8262f7b6a1..8c01e617ea5 100644
--- a/src/plugins/qt4projectmanager/qt4target.h
+++ b/src/plugins/qt4projectmanager/qt4target.h
@@ -124,6 +124,7 @@ public:
     QList<BuildConfigurationInfo> buildConfigurationInfos() const;
     void setProFilePath(const QString &proFilePath);
 
+    void setShadowBuildSupported(bool b);
     void setShadowBuildCheckBoxVisible(bool b);
 
 public slots:
-- 
GitLab