From 1f738ce62c4b4c2e2f1ce90c61cec0713278d8ca Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Fri, 24 Jul 2009 18:53:54 +0200
Subject: [PATCH] Make importing update the widgets of QMakeStep and MakeStep

---
 src/plugins/qt4projectmanager/makestep.cpp        | 15 +++++++++++++++
 src/plugins/qt4projectmanager/makestep.h          |  4 ++++
 src/plugins/qt4projectmanager/qmakestep.cpp       | 13 +++++++++++++
 src/plugins/qt4projectmanager/qmakestep.h         |  6 ++++++
 .../qt4projectmanager/qt4projectconfigwidget.cpp  |  4 ++--
 5 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp
index 37501d873a8..449acfedebb 100644
--- a/src/plugins/qt4projectmanager/makestep.cpp
+++ b/src/plugins/qt4projectmanager/makestep.cpp
@@ -157,6 +157,12 @@ ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
     return new MakeStepConfigWidget(this);
 }
 
+void MakeStep::setMakeArguments(const QString &buildConfiguration, const QStringList &arguments)
+{
+    setValue(buildConfiguration, "makeargs", arguments);
+    emit changed();
+}
+
 MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
     : BuildStepConfigWidget(), m_makeStep(makeStep)
 {
@@ -165,6 +171,10 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
             this, SLOT(makeLineEditTextEdited()));
     connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
             this, SLOT(makeArgumentsLineEditTextEdited()));
+
+    connect(makeStep, SIGNAL(changed()),
+            this, SLOT(update()));
+
 }
 
 QString MakeStepConfigWidget::displayName() const
@@ -172,6 +182,11 @@ QString MakeStepConfigWidget::displayName() const
     return m_makeStep->displayName();
 }
 
+void MakeStepConfigWidget::update()
+{
+    init(m_buildConfiguration);
+}
+
 void MakeStepConfigWidget::init(const QString &buildConfiguration)
 {
     m_buildConfiguration = buildConfiguration;
diff --git a/src/plugins/qt4projectmanager/makestep.h b/src/plugins/qt4projectmanager/makestep.h
index 6f069df0153..b8d3d859978 100644
--- a/src/plugins/qt4projectmanager/makestep.h
+++ b/src/plugins/qt4projectmanager/makestep.h
@@ -72,6 +72,9 @@ public:
     virtual QString displayName();
     virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
     virtual bool immutable() const;
+    void setMakeArguments(const QString &buildConfiguration, const QStringList &arguments);
+signals:
+    void changed();
 private:
     QString m_buildConfiguration;
 };
@@ -86,6 +89,7 @@ public:
 private slots:
     void makeLineEditTextEdited();
     void makeArgumentsLineEditTextEdited();
+    void update();
 private:
     QString m_buildConfiguration;
     Ui::MakeStep m_ui;
diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp
index 45699c6d2ee..41b32669a12 100644
--- a/src/plugins/qt4projectmanager/qmakestep.cpp
+++ b/src/plugins/qt4projectmanager/qmakestep.cpp
@@ -193,6 +193,12 @@ bool QMakeStep::processFinished(int exitCode, QProcess::ExitStatus status)
     return result;
 }
 
+void QMakeStep::setQMakeArguments(const QString &buildConfiguration, const QStringList &arguments)
+{
+    setValue(buildConfiguration, "qmakeArgs", arguments);
+    emit changed();
+}
+
 QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
     : BuildStepConfigWidget(), m_step(step)
 {
@@ -200,6 +206,8 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
     connect(m_ui.qmakeAdditonalArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
             this, SLOT(qmakeArgumentsLineEditTextEdited()));
     connect(m_ui.buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(buildConfigurationChanged()));
+    connect(step, SIGNAL(changed()),
+            this, SLOT(update()));
 }
 
 void QMakeStepConfigWidget::qmakeArgumentsLineEditTextEdited()
@@ -229,6 +237,11 @@ QString QMakeStepConfigWidget::displayName() const
     return m_step->displayName();
 }
 
+void QMakeStepConfigWidget::update()
+{
+    init(m_buildConfiguration);
+}
+
 void QMakeStepConfigWidget::init(const QString &buildConfiguration)
 {
     m_buildConfiguration = buildConfiguration;
diff --git a/src/plugins/qt4projectmanager/qmakestep.h b/src/plugins/qt4projectmanager/qmakestep.h
index e4b4ee58702..59b87cecc63 100644
--- a/src/plugins/qt4projectmanager/qmakestep.h
+++ b/src/plugins/qt4projectmanager/qmakestep.h
@@ -77,6 +77,11 @@ public:
     void setForced(bool b);
     bool forced();
 
+    void setQMakeArguments(const QString &buildConfiguraion, const QStringList &arguments);
+
+signals:
+    void changed();
+
 protected:
     virtual void processStartupFailed();
     virtual bool processFinished(int exitCode, QProcess::ExitStatus status);
@@ -100,6 +105,7 @@ public:
 private slots:
     void qmakeArgumentsLineEditTextEdited();
     void buildConfigurationChanged();
+    void update();
 private:
     QString m_buildConfiguration;
     Ui::QMakeStep m_ui;
diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
index 2f4b2273ae9..e3bb5c6dafa 100644
--- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
@@ -263,7 +263,7 @@ void Qt4ProjectConfigWidget::importLabelClicked()
             // Combo box will be updated at the end
 
             QMakeStep *qmakeStep = m_pro->qmakeStep();
-            qmakeStep->setValue(m_buildConfiguration, "qmakeArgs", additionalArguments);
+            qmakeStep->setQMakeArguments(m_buildConfiguration, additionalArguments);
             MakeStep *makeStep = m_pro->makeStep();
 
             m_pro->setValue(m_buildConfiguration, "buildConfiguration", int(qmakeBuildConfig));
@@ -281,7 +281,7 @@ void Qt4ProjectConfigWidget::importLabelClicked()
                 makeCmdArguments.removeAll("debug");
                 makeCmdArguments.removeAll("release");
             }
-            makeStep->setValue(m_buildConfiguration, "makeargs", makeCmdArguments);
+            makeStep->setMakeArguments(m_buildConfiguration, makeCmdArguments);
         }
     }
     setupQtVersionsComboBox();
-- 
GitLab