Commit b477441e authored by dt's avatar dt
Browse files

ProjectExplorer: Move configWidget from Project to Target

Reviewed-By: hunger
parent 68d6bfe3
......@@ -474,11 +474,6 @@ QList<ProjectExplorer::Project *> CMakeProject::dependsOn()
return QList<Project *>();
}
ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
{
return new CMakeBuildSettingsWidget(this);
}
QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
{
QList<ProjectExplorer::BuildConfigWidget*> list;
......@@ -795,8 +790,8 @@ void CMakeFile::reload(ReloadFlag flag, ChangeType type)
Q_UNUSED(type)
}
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
: m_project(project), m_buildConfiguration(0)
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeTarget *target)
: m_target(target), m_buildConfiguration(0)
{
QFormLayout *fl = new QFormLayout(this);
fl->setContentsMargins(20, -1, 0, -1);
......@@ -832,7 +827,7 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
{
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
if (m_buildConfiguration->buildDirectory() == m_project->projectDirectory())
if (m_buildConfiguration->buildDirectory() == m_target->cmakeProject()->projectDirectory())
m_changeButton->setEnabled(false);
else
m_changeButton->setEnabled(true);
......@@ -840,12 +835,13 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
{
CMakeOpenProjectWizard copw(m_project->projectManager(),
m_project->projectDirectory(),
CMakeProject *project = m_target->cmakeProject();
CMakeOpenProjectWizard copw(project->projectManager(),
project->projectDirectory(),
m_buildConfiguration->buildDirectory(),
m_buildConfiguration->environment());
if (copw.exec() == QDialog::Accepted) {
m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
}
}
......@@ -853,13 +849,14 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
void CMakeBuildSettingsWidget::runCMake()
{
// TODO skip build directory
CMakeOpenProjectWizard copw(m_project->projectManager(),
m_project->projectDirectory(),
CMakeProject *project = m_target->cmakeProject();
CMakeOpenProjectWizard copw(project->projectManager(),
project->projectDirectory(),
m_buildConfiguration->buildDirectory(),
CMakeOpenProjectWizard::WantToUpdate,
m_buildConfiguration->environment());
if (copw.exec() == QDialog::Accepted) {
m_project->parseCMakeLists();
project->parseCMakeLists();
}
}
......
......@@ -85,7 +85,6 @@ public:
QList<ProjectExplorer::Project *> dependsOn(); //NBS TODO implement dependsOn
ProjectExplorer::BuildConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
ProjectExplorer::ProjectNode *rootProjectNode() const;
......@@ -222,7 +221,7 @@ class CMakeBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
{
Q_OBJECT
public:
explicit CMakeBuildSettingsWidget(CMakeProject *project);
explicit CMakeBuildSettingsWidget(CMakeTarget *target);
QString displayName() const;
// This is called to set up the config widget before showing it
......@@ -232,7 +231,7 @@ private slots:
void openChangeBuildDirectoryDialog();
void runCMake();
private:
CMakeProject *m_project;
CMakeTarget *m_target;
QLineEdit *m_pathLineEdit;
QPushButton *m_changeButton;
CMakeBuildConfiguration *m_buildConfiguration;
......
......@@ -78,6 +78,11 @@ CMakeProject *CMakeTarget::cmakeProject() const
return static_cast<CMakeProject *>(project());
}
ProjectExplorer::BuildConfigWidget *CMakeTarget::createConfigWidget()
{
return new CMakeBuildSettingsWidget(this);
}
bool CMakeTargetFactory::supportsTargetId(const QString &id) const
{
return id == DEFAULT_CMAKE_TARGET_ID;
......
......@@ -54,6 +54,8 @@ public:
CMakeTarget(CMakeProject *parent);
~CMakeTarget();
ProjectExplorer::BuildConfigWidget *createConfigWidget();
CMakeProject *cmakeProject() const;
CMakeBuildConfiguration *activeBuildConfiguration() const;
......
......@@ -393,11 +393,6 @@ QList<ProjectExplorer::Project *> GenericProject::dependsOn()
return QList<Project *>();
}
ProjectExplorer::BuildConfigWidget *GenericProject::createConfigWidget()
{
return new GenericBuildSettingsWidget(this);
}
QList<ProjectExplorer::BuildConfigWidget*> GenericProject::subConfigWidgets()
{
QList<ProjectExplorer::BuildConfigWidget*> list;
......@@ -468,8 +463,8 @@ bool GenericProject::fromMap(const QVariantMap &map)
// GenericBuildSettingsWidget
////////////////////////////////////////////////////////////////////////////////////
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
: m_project(project), m_buildConfiguration(0)
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericTarget *target)
: m_target(target), m_buildConfiguration(0)
{
QFormLayout *fl = new QFormLayout(this);
fl->setContentsMargins(0, -1, 0, -1);
......@@ -478,7 +473,7 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
// build directory
m_pathChooser = new Utils::PathChooser(this);
m_pathChooser->setEnabled(true);
m_pathChooser->setBaseDirectory(project->projectDirectory());
m_pathChooser->setBaseDirectory(m_target->genericProject()->projectDirectory());
fl->addRow(tr("Build directory:"), m_pathChooser);
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
......@@ -490,7 +485,7 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
int selectedIndex = -1;
foreach (ToolChainType tc, ToolChain::supportedToolChains()) {
toolChainChooser->addItem(ToolChain::toolChainName(tc), QVariant::fromValue<ToolChainType>(tc));
if (m_project->toolChainType() == tc)
if (m_target->genericProject()->toolChainType() == tc)
selectedIndex = index;
++index;
}
......@@ -523,7 +518,7 @@ void GenericBuildSettingsWidget::toolChainSelected(int index)
QComboBox *toolChainChooser = qobject_cast<QComboBox*>(sender());
ToolChainType type = toolChainChooser->itemData(index).value<ToolChainType>();
m_project->setToolChainType(type);
m_target->genericProject()->setToolChainType(type);
}
////////////////////////////////////////////////////////////////////////////////////
......
......@@ -82,7 +82,6 @@ public:
QList<ProjectExplorer::Project *> dependsOn();
ProjectExplorer::BuildConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
GenericProjectNode *rootProjectNode() const;
......@@ -180,7 +179,7 @@ class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
Q_OBJECT
public:
GenericBuildSettingsWidget(GenericProject *project);
GenericBuildSettingsWidget(GenericTarget *target);
virtual ~GenericBuildSettingsWidget();
virtual QString displayName() const;
......@@ -192,7 +191,7 @@ private Q_SLOTS:
void toolChainSelected(int index);
private:
GenericProject *m_project;
GenericTarget *m_target;
Utils::PathChooser *m_pathChooser;
GenericBuildConfiguration *m_buildConfiguration;
};
......
......@@ -66,6 +66,11 @@ GenericTarget::~GenericTarget()
{
}
ProjectExplorer::BuildConfigWidget *GenericTarget::createConfigWidget()
{
return new GenericBuildSettingsWidget(this);
}
GenericProject *GenericTarget::genericProject() const
{
return static_cast<GenericProject *>(project());
......
......@@ -61,6 +61,8 @@ public:
explicit GenericTarget(GenericProject *parent);
~GenericTarget();
ProjectExplorer::BuildConfigWidget *createConfigWidget();
GenericProject *genericProject() const;
GenericBuildConfigurationFactory *buildConfigurationFactory() const;
......
......@@ -258,7 +258,7 @@ void BuildSettingsWidget::updateBuildSettings()
m_removeButton->setEnabled(m_target->buildConfigurations().size() > 1);
// Add pages
BuildConfigWidget *generalConfigWidget = m_target->project()->createConfigWidget();
BuildConfigWidget *generalConfigWidget = m_target->createConfigWidget();
addSubWidget(generalConfigWidget);
addSubWidget(new BuildStepsPage(m_target, QLatin1String(Constants::BUILDSTEPS_BUILD)));
......
......@@ -99,7 +99,6 @@ public:
void saveSettings();
bool restoreSettings();
virtual BuildConfigWidget *createConfigWidget() = 0;
virtual QList<BuildConfigWidget*> subConfigWidgets();
virtual ProjectNode *rootProjectNode() const = 0;
......
......@@ -47,6 +47,7 @@ class IBuildConfigurationFactory;
class DeployConfigurationFactory;
class IRunConfigurationFactory;
class Project;
class BuildConfigWidget;
class TargetPrivate;
......@@ -57,6 +58,8 @@ class PROJECTEXPLORER_EXPORT Target : public ProjectConfiguration
public:
virtual ~Target();
virtual BuildConfigWidget *createConfigWidget() = 0;
virtual Project *project() const;
// Build configuration
......
......@@ -233,11 +233,6 @@ QList<ProjectExplorer::Project *> QmlProject::dependsOn()
return QList<Project *>();
}
ProjectExplorer::BuildConfigWidget *QmlProject::createConfigWidget()
{
return 0;
}
QList<ProjectExplorer::BuildConfigWidget*> QmlProject::subConfigWidgets()
{
return QList<ProjectExplorer::BuildConfigWidget*>();
......
......@@ -77,7 +77,6 @@ public:
QList<ProjectExplorer::Project *> dependsOn();
ProjectExplorer::BuildConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
Internal::QmlProjectNode *rootProjectNode() const;
......
......@@ -53,6 +53,11 @@ QmlProjectTarget::~QmlProjectTarget()
{
}
ProjectExplorer::BuildConfigWidget *QmlProjectTarget::createConfigWidget()
{
return 0;
}
QmlProject *QmlProjectTarget::qmlProject() const
{
return static_cast<QmlProject *>(project());
......
......@@ -52,6 +52,8 @@ public:
explicit QmlProjectTarget(QmlProject *parent);
~QmlProjectTarget();
ProjectExplorer::BuildConfigWidget *createConfigWidget();
QmlProject *qmlProject() const;
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
......
......@@ -967,11 +967,6 @@ bool Qt4Project::validParse(const QString &proFilePath) const
return node && node->validParse();
}
BuildConfigWidget *Qt4Project::createConfigWidget()
{
return new Qt4ProjectConfigWidget(this);
}
QList<BuildConfigWidget*> Qt4Project::subConfigWidgets()
{
QList<BuildConfigWidget*> subWidgets;
......
......@@ -164,7 +164,6 @@ public:
virtual QStringList files(FilesMode fileMode) const;
virtual QString generatedUiHeader(const QString &formFile) const;
ProjectExplorer::BuildConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
QList<Internal::Qt4ProFileNode *> leafProFiles() const;
......
......@@ -32,6 +32,7 @@
#include "makestep.h"
#include "qmakestep.h"
#include "qt4project.h"
#include "qt4target.h"
#include "qt4projectmanagerconstants.h"
#include "qt4projectmanager.h"
#include "qt4buildconfiguration.h"
......@@ -58,12 +59,11 @@ using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::ToolChain;
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Target *target)
: BuildConfigWidget(),
m_buildConfiguration(0),
m_ignoreChange(false)
{
Q_UNUSED(project);
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setMargin(0);
m_detailsContainer = new Utils::DetailsWidget(this);
......@@ -79,7 +79,7 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
m_ui->shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::Directory);
m_ui->shadowBuildDirEdit->setBaseDirectory(project->projectDirectory());
m_ui->shadowBuildDirEdit->setBaseDirectory(target->qt4Project()->projectDirectory());
connect(m_ui->shadowBuildCheckBox, SIGNAL(clicked(bool)),
this, SLOT(shadowBuildClicked(bool)));
......@@ -102,10 +102,10 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
connect(m_ui->manageQtVersionPushButtons, SIGNAL(clicked()),
this, SLOT(manageQtVersions()));
connect(project, SIGNAL(environmentChanged()),
connect(target->qt4Project(), SIGNAL(environmentChanged()),
this, SLOT(environmentChanged()));
connect(project, SIGNAL(buildDirectoryInitialized()),
connect(target->qt4Project(), SIGNAL(buildDirectoryInitialized()),
this, SLOT(updateImportLabel()));
}
......
......@@ -46,6 +46,7 @@ class Qt4Project;
namespace Internal {
class Qt4BuildConfiguration;
class Qt4Target;
namespace Ui {
class Qt4ProjectConfigWidget;
......@@ -55,7 +56,7 @@ class Qt4ProjectConfigWidget : public ProjectExplorer::BuildConfigWidget
{
Q_OBJECT
public:
explicit Qt4ProjectConfigWidget(Qt4Project *project);
explicit Qt4ProjectConfigWidget(Qt4Target *target);
~Qt4ProjectConfigWidget();
QString displayName() const;
......
......@@ -44,6 +44,7 @@
#include "qt-s60/s60emulatorrunconfiguration.h"
#include "qt-s60/s60createpackagestep.h"
#include "qt-s60/s60deploystep.h"
#include "qt4projectconfigwidget.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
......@@ -272,15 +273,17 @@ Qt4Target::Qt4Target(Qt4Project *parent, const QString &id) :
this, SLOT(onAddedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
connect(this, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
this, SLOT(updateToolTipAndIcon()));
setDefaultDisplayName(displayNameForId(id));
setIcon(iconForId(id));
}
Qt4Target::~Qt4Target()
{
}
ProjectExplorer::BuildConfigWidget *Qt4Target::createConfigWidget()
{
return new Qt4ProjectConfigWidget(this);
}
Qt4BuildConfiguration *Qt4Target::activeBuildConfiguration() const
{
return static_cast<Qt4BuildConfiguration *>(Target::activeBuildConfiguration());
......
......@@ -65,6 +65,8 @@ public:
explicit Qt4Target(Qt4Project *parent, const QString &id);
virtual ~Qt4Target();
ProjectExplorer::BuildConfigWidget *createConfigWidget();
Qt4BuildConfiguration *activeBuildConfiguration() const;
Qt4ProjectManager::Qt4Project *qt4Project() const;
......
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