diff --git a/src/plugins/projectexplorer/buildconfigdialog.cpp b/src/plugins/projectexplorer/buildconfigdialog.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5e3a58fbe19248d1416da46f4987d34e0664e6ac
--- /dev/null
+++ b/src/plugins/projectexplorer/buildconfigdialog.cpp
@@ -0,0 +1,119 @@
+/**************************************************************************
+**
+** 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 "buildconfigdialog.h"
+#include "project.h"
+#include "runconfiguration.h"
+#include "buildconfiguration.h"
+
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QPushButton>
+#include <QtGui/QDialogButtonBox>
+#include <QtGui/QLabel>
+#include <QtGui/QComboBox>
+#include <QtGui/QFormLayout>
+
+namespace ProjectExplorer {
+namespace Internal {
+
+BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
+    : QDialog(parent),
+    m_project(project)
+{
+    QVBoxLayout *vlayout = new QVBoxLayout;
+    setLayout(vlayout);
+    QDialogButtonBox *buttonBox = new QDialogButtonBox;
+    m_changeBuildConfiguration = buttonBox->addButton(tr("Change build configuration && continue"),
+        QDialogButtonBox::ActionRole);
+    m_cancel = buttonBox->addButton(tr("Cancel"),
+        QDialogButtonBox::RejectRole);
+    m_justContinue = buttonBox->addButton(tr("Continue anyway"),
+        QDialogButtonBox::AcceptRole);
+    connect(m_changeBuildConfiguration, SIGNAL(clicked()), this, SLOT(buttonClicked()));
+    connect(m_cancel, SIGNAL(clicked()), this, SLOT(buttonClicked()));
+    connect(m_justContinue, SIGNAL(clicked()), this, SLOT(buttonClicked()));
+    setWindowTitle(tr("Run configuration does not match build configuration"));
+    QLabel *shortText = new QLabel(tr(
+            "The active build configuration builds a target "
+            "that cannot be used by the active run configuration."
+            ));
+    vlayout->addWidget(shortText);
+    QLabel *descriptiveText = new QLabel(tr(
+        "This can happen if the active build configuration "
+        "uses the wrong Qt version and/or tool chain for the active run configuration "
+        "(for example, running in Symbian emulator requires building with the WINSCW tool chain)."
+    ));
+    descriptiveText->setWordWrap(true);
+    vlayout->addWidget(descriptiveText);
+    m_configCombo = new QComboBox;
+
+    RunConfiguration *activeRun = m_project->activeTarget()->activeRunConfiguration();
+    foreach (BuildConfiguration *config, m_project->activeTarget()->buildConfigurations()) {
+        if (activeRun->isEnabled(config)) {
+            m_configCombo->addItem(config->displayName(), QVariant::fromValue(config));
+        }
+    }
+    if (m_configCombo->count() == 0) {
+        m_configCombo->addItem(tr("No valid build configuration found."));
+        m_configCombo->setEnabled(false);
+        m_changeBuildConfiguration->setEnabled(false);
+    }
+
+    QFormLayout *formlayout = new QFormLayout;
+    formlayout->addRow(tr("Active run configuration"),
+                       // ^ avoiding a new translatable string for active run configuration
+                       new QLabel(activeRun->displayName()));
+    formlayout->addRow(tr("Choose build configuration:"), m_configCombo);
+    vlayout->addLayout(formlayout);
+    vlayout->addWidget(buttonBox);
+    m_cancel->setDefault(true);
+}
+
+BuildConfiguration *BuildConfigDialog::selectedBuildConfiguration() const
+{
+    int index = m_configCombo->currentIndex();
+    if (index < 0)
+        return 0;
+    return m_configCombo->itemData(index, Qt::UserRole).value<BuildConfiguration*>();
+}
+
+void BuildConfigDialog::buttonClicked()
+{
+    QPushButton *button = qobject_cast<QPushButton *>(sender());
+    if (button == m_changeBuildConfiguration) {
+        done(ChangeBuild);
+    } else if (button == m_cancel) {
+        done(Cancel);
+    } else if (button == m_justContinue) {
+        done(Continue);
+    }
+}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/buildconfigdialog.h b/src/plugins/projectexplorer/buildconfigdialog.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3e4066badd3b02d740bef00c875158c1de369cf
--- /dev/null
+++ b/src/plugins/projectexplorer/buildconfigdialog.h
@@ -0,0 +1,73 @@
+/**************************************************************************
+**
+** 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 BUILDCONFIGDIALOG_H
+#define BUILDCONFIGDIALOG_H
+
+#include <QtGui/QDialog>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QComboBox;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer {
+class Project;
+class BuildConfiguration;
+
+namespace Internal {
+
+class BuildConfigDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    enum DialogResult {
+        ChangeBuild = 10,
+        Cancel = 11,
+        Continue = 12
+    };
+    explicit BuildConfigDialog(Project *project, QWidget *parent = 0);
+
+    BuildConfiguration *selectedBuildConfiguration() const;
+
+private slots:
+    void buttonClicked();
+
+private:
+    Project *m_project;
+    QPushButton *m_changeBuildConfiguration;
+    QPushButton *m_cancel;
+    QPushButton *m_justContinue;
+    QComboBox *m_configCombo;
+};
+
+} // namespace Internal
+} // namespace ProjectExplorer
+
+#endif // BUILDCONFIGDIALOG_H
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 144f2b19484ccc799fff7c4974056960ec417021..85ed2f2753d8e7784a43f6ddf8d1a1f6e0886227 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -67,6 +67,7 @@
 #include "projectwelcomepagewidget.h"
 #include "corelistenercheckingforrunningbuild.h"
 #include "buildconfiguration.h"
+#include "buildconfigdialog.h"
 #include "miniprojecttargetselector.h"
 
 #include <coreplugin/basemode.h>
@@ -102,7 +103,6 @@
 #include <QtGui/QFileDialog>
 #include <QtGui/QMenu>
 #include <QtGui/QMessageBox>
-#include <QtGui/QVBoxLayout>
 
 Q_DECLARE_METATYPE(Core::IEditorFactory*);
 Q_DECLARE_METATYPE(Core::IExternalEditor*);
@@ -2198,77 +2198,4 @@ Internal::ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings
     return d->m_projectExplorerSettings;
 }
 
-BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
-    : QDialog(parent),
-    m_project(project)
-{
-    QVBoxLayout *vlayout = new QVBoxLayout;
-    setLayout(vlayout);
-    QDialogButtonBox *buttonBox = new QDialogButtonBox;
-    m_changeBuildConfiguration = buttonBox->addButton(tr("Change build configuration && continue"),
-        QDialogButtonBox::ActionRole);
-    m_cancel = buttonBox->addButton(tr("Cancel"),
-        QDialogButtonBox::RejectRole);
-    m_justContinue = buttonBox->addButton(tr("Continue anyway"),
-        QDialogButtonBox::AcceptRole);
-    connect(m_changeBuildConfiguration, SIGNAL(clicked()), this, SLOT(buttonClicked()));
-    connect(m_cancel, SIGNAL(clicked()), this, SLOT(buttonClicked()));
-    connect(m_justContinue, SIGNAL(clicked()), this, SLOT(buttonClicked()));
-    setWindowTitle(tr("Run configuration does not match build configuration"));
-    QLabel *shortText = new QLabel(tr(
-            "The active build configuration builds a target "
-            "that cannot be used by the active run configuration."
-            ));
-    vlayout->addWidget(shortText);
-    QLabel *descriptiveText = new QLabel(tr(
-        "This can happen if the active build configuration "
-        "uses the wrong Qt version and/or tool chain for the active run configuration "
-        "(for example, running in Symbian emulator requires building with the WINSCW tool chain)."
-    ));
-    descriptiveText->setWordWrap(true);
-    vlayout->addWidget(descriptiveText);
-    m_configCombo = new QComboBox;
-
-    RunConfiguration *activeRun = m_project->activeTarget()->activeRunConfiguration();
-    foreach (BuildConfiguration *config, m_project->activeTarget()->buildConfigurations()) {
-        if (activeRun->isEnabled(config)) {
-            m_configCombo->addItem(config->displayName(), QVariant::fromValue(config));
-        }
-    }
-    if (m_configCombo->count() == 0) {
-        m_configCombo->addItem(tr("No valid build configuration found."));
-        m_configCombo->setEnabled(false);
-        m_changeBuildConfiguration->setEnabled(false);
-    }
-
-    QFormLayout *formlayout = new QFormLayout;
-    formlayout->addRow(tr("Active run configuration"),
-                       // ^ avoiding a new translatable string for active run configuration
-                       new QLabel(activeRun->displayName()));
-    formlayout->addRow(tr("Choose build configuration:"), m_configCombo);
-    vlayout->addLayout(formlayout);
-    vlayout->addWidget(buttonBox);
-    m_cancel->setDefault(true);
-}
-
-BuildConfiguration *BuildConfigDialog::selectedBuildConfiguration() const
-{
-    int index = m_configCombo->currentIndex();
-    if (index < 0)
-        return 0;
-    return m_configCombo->itemData(index, Qt::UserRole).value<BuildConfiguration*>();
-}
-
-void BuildConfigDialog::buttonClicked()
-{
-    QPushButton *button = qobject_cast<QPushButton *>(sender());
-    if (button == m_changeBuildConfiguration) {
-        done(ChangeBuild);
-    } else if (button == m_cancel) {
-        done(Cancel);
-    } else if (button == m_justContinue) {
-        done(Continue);
-    }
-}
-
 Q_EXPORT_PLUGIN(ProjectExplorerPlugin)
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index 43b541cd941674ea0f4f9d6e1c23d5897da3dd8b..347fbde0dbf02b1eb1b4d8cef56e9797e00b365c 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -34,14 +34,10 @@
 
 #include <extensionsystem/iplugin.h>
 
-#include <QtCore/QSharedPointer>
-#include <QtGui/QDialog>
-
 QT_BEGIN_NAMESPACE
 class QPoint;
-class QAction;
-class QComboBox;
 class QMenu;
+class QAction;
 QT_END_NAMESPACE
 
 namespace Core {
@@ -65,32 +61,7 @@ class BuildConfiguration;
 namespace Internal {
 class ProjectFileFactory;
 struct ProjectExplorerSettings;
-
-class BuildConfigDialog : public QDialog
-{
-    Q_OBJECT
-public:
-    enum DialogResult {
-        ChangeBuild = 10,
-        Cancel = 11,
-        Continue = 12
-    };
-    BuildConfigDialog(Project *project, QWidget *parent = 0);
-
-    BuildConfiguration *selectedBuildConfiguration() const;
-
-private slots:
-    void buttonClicked();
-
-private:
-    Project *m_project;
-    QPushButton *m_changeBuildConfiguration;
-    QPushButton *m_cancel;
-    QPushButton *m_justContinue;
-    QComboBox *m_configCombo;
-};
-
-} // namespace Internal
+}
 
 struct ProjectExplorerPluginPrivate;
 
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index ec21d8e8aad19b09df9da068c536a970633a6296..431893dddeab4ac14e7996bd72552033f2a16be0 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -76,7 +76,8 @@ HEADERS += projectexplorer.h \
     targetsettingswidget.h \
     doubletabwidget.h \
     addtargetdialog.h \
-    buildenvironmentwidget.h
+    buildenvironmentwidget.h \
+    buildconfigdialog.h
 SOURCES += projectexplorer.cpp \
     projectwindow.cpp \
     buildmanager.cpp \
@@ -139,7 +140,8 @@ SOURCES += projectexplorer.cpp \
     targetsettingswidget.cpp \
     doubletabwidget.cpp \
     addtargetdialog.cpp \
-    buildenvironmentwidget.cpp
+    buildenvironmentwidget.cpp \
+    buildconfigdialog.cpp
 FORMS += processstep.ui \
     editorsettingspropertiespage.ui \
     runsettingspropertiespage.ui \
diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp
index 67e89b7322a895ca2500fe305ff62005878d2281..300b28df89bcaaa48f182a7607be858ba57d5c00 100644
--- a/src/plugins/qt4projectmanager/makestep.cpp
+++ b/src/plugins/qt4projectmanager/makestep.cpp
@@ -28,6 +28,7 @@
 **************************************************************************/
 
 #include "makestep.h"
+#include "ui_makestep.h"
 
 #include "qt4project.h"
 #include "qt4target.h"
@@ -35,6 +36,8 @@
 #include "qt4projectmanagerconstants.h"
 
 #include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/projectexplorer.h>
+#include <extensionsystem/pluginmanager.h>
 
 #include <QtCore/QDir>
 #include <QtCore/QFileInfo>
@@ -206,12 +209,12 @@ void MakeStep::setUserArguments(const QStringList &arguments)
 }
 
 MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
-    : BuildStepConfigWidget(), m_makeStep(makeStep), m_ignoreChange(false)
+    : BuildStepConfigWidget(), m_ui(new Ui::MakeStep), m_makeStep(makeStep), m_ignoreChange(false)
 {
-    m_ui.setupUi(this);
-    connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)),
+    m_ui->setupUi(this);
+    connect(m_ui->makeLineEdit, SIGNAL(textEdited(QString)),
             this, SLOT(makeEdited()));
-    connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
+    connect(m_ui->makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
             this, SLOT(makeArgumentsLineEdited()));
 
     connect(makeStep, SIGNAL(userArgumentsChanged()),
@@ -225,10 +228,15 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
             this, SLOT(updateDetails()));
 }
 
+MakeStepConfigWidget::~MakeStepConfigWidget()
+{
+    delete m_ui;
+}
+
 void MakeStepConfigWidget::updateMakeOverrideLabel()
 {
     Qt4BuildConfiguration *qt4bc = m_makeStep->qt4BuildConfiguration();
-    m_ui.makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
+    m_ui->makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
 }
 
 void MakeStepConfigWidget::updateDetails()
@@ -284,7 +292,7 @@ void MakeStepConfigWidget::userArgumentsChanged()
     if (m_ignoreChange)
         return;
     const QStringList &makeArguments = m_makeStep->userArguments();
-    m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
+    m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
     updateDetails();
 }
 
@@ -293,16 +301,16 @@ void MakeStepConfigWidget::init()
     updateMakeOverrideLabel();
 
     const QString &makeCmd = m_makeStep->m_makeCmd;
-    m_ui.makeLineEdit->setText(makeCmd);
+    m_ui->makeLineEdit->setText(makeCmd);
 
     const QStringList &makeArguments = m_makeStep->userArguments();
-    m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
+    m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
     updateDetails();
 }
 
 void MakeStepConfigWidget::makeEdited()
 {
-    m_makeStep->m_makeCmd = m_ui.makeLineEdit->text();
+    m_makeStep->m_makeCmd = m_ui->makeLineEdit->text();
     updateDetails();
 }
 
@@ -310,7 +318,7 @@ void MakeStepConfigWidget::makeArgumentsLineEdited()
 {
     m_ignoreChange = true;
     m_makeStep->setUserArguments(
-            ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
+            ProjectExplorer::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text()));
     m_ignoreChange = false;
     updateDetails();
 }
diff --git a/src/plugins/qt4projectmanager/makestep.h b/src/plugins/qt4projectmanager/makestep.h
index fabbf26c871d2543f7245d9ebc9234c879517085..54f7af7876e7bc7727e566a436f5e144c07b9bef 100644
--- a/src/plugins/qt4projectmanager/makestep.h
+++ b/src/plugins/qt4projectmanager/makestep.h
@@ -30,11 +30,14 @@
 #ifndef MAKESTEP_H
 #define MAKESTEP_H
 
-#include "ui_makestep.h"
-#include "qtversionmanager.h"
-
 #include <projectexplorer/abstractprocessstep.h>
-#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/buildstep.h>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+class MakeStep;
+}
+QT_END_NAMESPACE
 
 namespace ProjectExplorer {
 class BuildStep;
@@ -110,7 +113,9 @@ class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
 {
     Q_OBJECT
 public:
-    MakeStepConfigWidget(MakeStep *makeStep);
+    explicit MakeStepConfigWidget(MakeStep *makeStep);
+    virtual ~MakeStepConfigWidget();
+
     QString displayName() const;
     void init();
     QString summaryText() const;
@@ -123,7 +128,7 @@ private slots:
     void updateDetails();
     void userArgumentsChanged();
 private:
-    Ui::MakeStep m_ui;
+    Ui::MakeStep *m_ui;
     MakeStep *m_makeStep;
     QString m_summaryText;
     bool m_ignoreChange;
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
index b2734459d97df78202324e9184bc6bb1a00d2ce1..988740f466f1a1e600d6b837effe4768d8dc94ef 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
@@ -36,6 +36,7 @@
 #include <projectexplorer/runconfiguration.h>
 
 #include <QtCore/QDateTime>
+#include <QtCore/QStringList>
 
 QT_FORWARD_DECLARE_CLASS(QProcess)
 QT_FORWARD_DECLARE_CLASS(QWidget)
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
index c62faca9b266a8827c2b6199132650ecbc1f71ae..c3466ece4842eb9bce561b9d3f9d384cc48ddfed 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
@@ -54,6 +54,7 @@
 
 #include <QtGui/QMessageBox>
 #include <QtGui/QMainWindow>
+#include <QtCore/QCoreApplication>
 
 using namespace ProjectExplorer;
 using namespace Qt4ProjectManager;
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp
index 6c6e21f552e0cba0fa0c1cb47df5d3cd335ec4dc..5c1c10355cd0b671701e87966c47e5b3995dcff4 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp
@@ -47,7 +47,9 @@
 #include <projectexplorer/persistentsettings.h>
 
 #include <QtGui/QLabel>
+#include <QtGui/QVBoxLayout>
 #include <QtGui/QLineEdit>
+#include <QtGui/QFormLayout>
 
 using namespace ProjectExplorer;
 using namespace Qt4ProjectManager;
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
index a611402d9265b0415628ea6a5260dff440bcff47..5926a0f6b0616d81945146dbb5f941fd922fc87a 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
@@ -32,6 +32,9 @@
 #include "qt4project.h"
 #include "qt4target.h"
 #include "qt4projectmanagerconstants.h"
+#include "qt4nodes.h"
+#include "qmakestep.h"
+#include "makestep.h"
 
 #include <utils/qtcassert.h>
 
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.h b/src/plugins/qt4projectmanager/qt4buildconfiguration.h
index f17320a2b348cf97a32c3eb166dbb5cfcba314ee..9dfb6d9ade1a19116f399e731162e17ce47f46ca 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.h
@@ -34,7 +34,6 @@
 
 #include <projectexplorer/buildconfiguration.h>
 #include <projectexplorer/toolchain.h>
-#include "qt4nodes.h"
 
 namespace Qt4ProjectManager {
 
@@ -42,7 +41,7 @@ class QMakeStep;
 class MakeStep;
 
 namespace Internal {
-
+class Qt4ProFileNode;
 class Qt4BuildConfigurationFactory;
 class Qt4Target;
 
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index 4d0f2531114b4d96ccc84afc4b3dd18d99306cec..c13141e2bc0705513be22a608c57c4cdfa47d5f5 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -58,6 +58,7 @@
 #include <QtCore/QDir>
 #include <QtCore/QFile>
 #include <QtCore/QFileInfo>
+#include <QtCore/QCoreApplication>
 
 #include <QtGui/QPainter>
 #include <QtGui/QMainWindow>
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index cb4b25a17aa796e259b94263f413d7998f7d9401..ae7ea1e62c82f124af80f6ecaa6538b8244d7680 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -45,6 +45,7 @@
 #include <coreplugin/coreconstants.h>
 #include <coreplugin/progressmanager/progressmanager.h>
 #include <extensionsystem/pluginmanager.h>
+#include <cpptools/cppmodelmanagerinterface.h>
 #include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/customexecutablerunconfiguration.h>
 #include <projectexplorer/nodesvisitor.h>
diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h
index 18a24d3ecfdcae9c39f2165f56f15e9c787ef580..02f540bfaa5756068857242c9675a362b56314a1 100644
--- a/src/plugins/qt4projectmanager/qt4project.h
+++ b/src/plugins/qt4projectmanager/qt4project.h
@@ -30,28 +30,18 @@
 #ifndef QT4PROJECT_H
 #define QT4PROJECT_H
 
-#include "profileevaluator.h"
 #include "qt4nodes.h"
 #include "qt4target.h"
-#include "qmakestep.h"
-#include "makestep.h"
-#include "qtversionmanager.h"
 
-#include <coreplugin/ifile.h>
-#include <projectexplorer/applicationrunconfiguration.h>
+#include <projectexplorer/project.h>
 #include <projectexplorer/projectnodes.h>
-#include <projectexplorer/toolchain.h>
-#include <projectexplorer/buildconfiguration.h>
-#include <cpptools/cppmodelmanagerinterface.h>
+#include <coreplugin/ifile.h>
 
-#include <QtCore/QObject>
-#include <QtCore/QList>
 #include <QtCore/QStringList>
-#include <QtCore/QPointer>
 #include <QtCore/QMap>
-#include <QtGui/QDirModel>
 #include <QtCore/QFutureInterface>
 #include <QtCore/QTimer>
+#include <QtCore/QFuture>
 
 QT_BEGIN_NAMESPACE
 struct ProFileOption;
@@ -64,11 +54,13 @@ namespace Internal {
     class DeployHelperRunStep;
     class FileItem;
     class Qt4ProFileNode;
+    class Qt4PriFileNode;
     class Qt4RunConfiguration;
     class GCCPreprocessor;
     struct Qt4ProjectFiles;
     class Qt4ProjectConfigWidget;
-    class Qt4Target;
+
+    class Qt4NodesWatcher;
 
     class CodeModelInfo
     {
diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
index 8621407547791e8950f9871c43dbba7215d965ba..6d074f9988240fcddde495165aafbcded8adcb93 100644
--- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
@@ -45,6 +45,8 @@
 #include <extensionsystem/pluginmanager.h>
 
 #include <QtGui/QFileDialog>
+#include <QtGui/QPushButton>
+#include <utils/detailswidget.h>
 
 namespace {
 bool debug = false;
diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h
index cf0c739a48d5e48f7f1094e90c1ef40b17213f03..37a0560fc9276b9083927d5e7d557892c9c4423b 100644
--- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h
+++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h
@@ -31,8 +31,14 @@
 #define QT4PROJECTCONFIGWIDGET_H
 
 #include <projectexplorer/buildstep.h>
-#include <QtGui/QPushButton>
-#include <utils/detailswidget.h>
+
+QT_BEGIN_NAMESPACE
+class QAbstractButton;
+QT_END_NAMESPACE
+
+namespace Utils {
+    class DetailsWidget;
+}
 
 namespace Qt4ProjectManager {
 
@@ -49,7 +55,7 @@ class Qt4ProjectConfigWidget : public ProjectExplorer::BuildConfigWidget
 {
     Q_OBJECT
 public:
-    Qt4ProjectConfigWidget(Qt4Project *project);
+    explicit Qt4ProjectConfigWidget(Qt4Project *project);
     ~Qt4ProjectConfigWidget();
 
     QString displayName() const;
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
index 751ff411be16696d628549d1f976741318e9e0c9..1ec86aa4eac1a75915a6709a87b05e57f18142f7 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
@@ -43,6 +43,7 @@
 #include <coreplugin/messagemanager.h>
 #include <coreplugin/uniqueidmanager.h>
 #include <coreplugin/editormanager/editormanager.h>
+#include <projectexplorer/projectexplorer.h>
 #include <projectexplorer/buildmanager.h>
 #include <projectexplorer/session.h>
 #include <projectexplorer/project.h>
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
index 1783d4f5fba7516901b7548a78988f6fe364f252..edf53116264731089903f7a7db93d1dd3a1c1c33 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
@@ -30,6 +30,8 @@
 #include "qt4projectmanagerplugin.h"
 
 #include "qt4projectmanager.h"
+#include "qmakestep.h"
+#include "makestep.h"
 #include "wizards/consoleappwizard.h"
 #include "wizards/guiappwizard.h"
 #include "wizards/librarywizard.h"
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
index 2daf9d05dcd4652a1cd08fb25f27c74eea989283..1fc0c9f43a5db5ad561fff7330e22c495a695960 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
@@ -30,9 +30,17 @@
 #ifndef QT4PROJECTMANAGERPLUGIN_H
 #define QT4PROJECTMANAGERPLUGIN_H
 
-#include <projectexplorer/project.h>
-#include <projectexplorer/projectexplorer.h>
+#include <extensionsystem/iplugin.h>
 
+QT_BEGIN_NAMESPACE
+class QAction;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer {
+    class Project;
+    class Node;
+    class ProjectExplorerPlugin;
+}
 namespace Qt4ProjectManager {
 
 class Qt4Manager;
diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp
index 3f3225cce75777cab1ada249b500b53a245a2692..604dbe80fad37e2f794877503aeb7110668a8919 100644
--- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp
@@ -45,6 +45,8 @@
 #include <projectexplorer/environmenteditmodel.h>
 #include <projectexplorer/persistentsettings.h>
 #include <utils/qtcassert.h>
+#include <utils/pathchooser.h>
+#include <utils/detailswidget.h>
 
 #include <QtGui/QFormLayout>
 #include <QtGui/QInputDialog>
diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h
index fd807c54265bc51636ce9dda9c3517cf65884fc0..6c2ab5172978b5593f2a0770d2313a692d87e06e 100644
--- a/src/plugins/qt4projectmanager/qt4runconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h
@@ -30,17 +30,11 @@
 #ifndef QT4RUNCONFIGURATION_H
 #define QT4RUNCONFIGURATION_H
 
-#include <utils/pathchooser.h>
-#include <utils/detailswidget.h>
 #include <projectexplorer/applicationrunconfiguration.h>
-#include <projectexplorer/environment.h>
-#include <projectexplorer/environmenteditmodel.h>
 #include <QtCore/QStringList>
 #include <QtGui/QWidget>
-#include <QtGui/QToolButton>
 
 QT_BEGIN_NAMESPACE
-class QWidget;
 class QCheckBox;
 class QLabel;
 class QLineEdit;
@@ -48,6 +42,15 @@ class QRadioButton;
 class QComboBox;
 QT_END_NAMESPACE
 
+namespace Utils {
+class PathChooser;
+class DetailsWidget;
+}
+
+namespace ProjectExplorer {
+    class EnvironmentWidget;
+}
+
 namespace Qt4ProjectManager {
 
 class Qt4Project;
diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp
index 56247089673dc20495a16746982a5639ed929cb3..a52f8f7c55af8c1ac6fa03c6a107f1bf030989bc 100644
--- a/src/plugins/qt4projectmanager/qt4target.cpp
+++ b/src/plugins/qt4projectmanager/qt4target.cpp
@@ -32,7 +32,6 @@
 #include "makestep.h"
 #include "profilereader.h"
 #include "qmakestep.h"
-#include "qt4buildconfiguration.h"
 #include "qt4project.h"
 #include "qt4runconfiguration.h"
 #include "qt4projectmanagerconstants.h"
diff --git a/src/plugins/qt4projectmanager/qt4target.h b/src/plugins/qt4projectmanager/qt4target.h
index 694b97b437073954e6a9cfdc0c76b745b6fe22dd..b6f1a2abb9510ad52578cdf209ec7ca29e7ff790 100644
--- a/src/plugins/qt4projectmanager/qt4target.h
+++ b/src/plugins/qt4projectmanager/qt4target.h
@@ -30,10 +30,7 @@
 #ifndef QT4TARGET_H
 #define QT4TARGET_H
 
-#include "qtversionmanager.h"
-
 #include "qt4buildconfiguration.h"
-
 #include <projectexplorer/target.h>
 
 #include <QtGui/QPixmap>
@@ -43,10 +40,10 @@ namespace Qt4ProjectManager {
 class Qt4Project;
 
 namespace Internal {
-
 class ProFileReader;
 class Qt4ProFileNode;
 class Qt4TargetFactory;
+class Qt4BuildConfigurationFactory;
 
 class Qt4Target : public ProjectExplorer::Target
 {
diff --git a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
index 0c900b1d53fc28ba28599806ded79a563f2c2977..20a9d25668e8048fa05810d9ddd577e63019b24f 100644
--- a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
+++ b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
@@ -33,6 +33,8 @@
 #include "qt4project.h"
 #include "qt4target.h"
 
+#include <QtCore/QProcess>
+
 using namespace Qt4ProjectManager;
 using namespace Internal;
 
diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h
index 2317c099e17ea635558aa0344be6094b8526aea1..9cb80d3e4ace4be06a9850a74a6dec5ace8b955b 100644
--- a/src/plugins/qt4projectmanager/qtversionmanager.h
+++ b/src/plugins/qt4projectmanager/qtversionmanager.h
@@ -30,7 +30,6 @@
 #ifndef QTVERSIONMANAGER_H
 #define QTVERSIONMANAGER_H
 
-#include <projectexplorer/environment.h>
 #include <projectexplorer/toolchain.h>
 #include <QSharedPointer>
 
@@ -38,10 +37,6 @@
 #include <QtCore/QSet>
 #include <QtCore/QSharedPointer>
 
-namespace ProjectExplorer {
-    class ToolChain;
-}
-
 namespace Qt4ProjectManager {
 
 namespace Internal {
diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
index f41604957893503c50b8027a17141e339417d6e9..66f046304c1da932165f3752e38166da95f4d004 100644
--- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
@@ -38,6 +38,7 @@
 #include <coreplugin/icore.h>
 #include <cpptools/cpptoolsconstants.h>
 #include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/projectexplorer.h>
 #include <QtCore/QCoreApplication>
 #include <QtCore/QVariant>