summaryrefslogtreecommitdiff
path: root/src/plugins/genericprojectmanager
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2012-04-24 15:49:09 +0200
committerTobias Hunger <tobias.hunger@nokia.com>2012-06-21 12:08:12 +0200
commit24314562165588b56a318b3b8a846bf5deda7c41 (patch)
treeb5dcf951e76d003c2623011b0e91994e06e7e061 /src/plugins/genericprojectmanager
parent8c77b8c9d7b25d0c89003c8c4a54e8da5bfb7edd (diff)
downloadqt-creator-24314562165588b56a318b3b8a846bf5deda7c41.tar.gz
Profile introduction
Introduce Profiles to store sets of values that describe a system/device. These profiles are held by a target, getting rid of much of the information stored in the Build-/Run-/DeployConfigurations, greatly simplifying those. This is a squash of the wip/profile branch which has been on gerrit for a while, rebased to current master. Change-Id: I25956c8dd4d1962b2134bfaa8a8076ae3909460f Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src/plugins/genericprojectmanager')
-rw-r--r--src/plugins/genericprojectmanager/genericbuildconfiguration.cpp104
-rw-r--r--src/plugins/genericprojectmanager/genericbuildconfiguration.h46
-rw-r--r--src/plugins/genericprojectmanager/genericmakestep.cpp20
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp172
-rw-r--r--src/plugins/genericprojectmanager/genericproject.h47
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.pro2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.qbs2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectplugin.cpp5
-rw-r--r--src/plugins/genericprojectmanager/generictarget.cpp176
-rw-r--r--src/plugins/genericprojectmanager/generictarget.h100
10 files changed, 141 insertions, 533 deletions
diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
index 56fde6ba6b..d48728b809 100644
--- a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
+++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
@@ -34,13 +34,15 @@
#include "genericmakestep.h"
#include "genericproject.h"
-#include "generictarget.h"
#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/toolchain.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchain.h>
+#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
+#include <QFormLayout>
#include <QInputDialog>
using namespace GenericProjectManager;
@@ -53,17 +55,17 @@ const char * const GENERIC_BC_ID("GenericProjectManager.GenericBuildConfiguratio
const char * const BUILD_DIRECTORY_KEY("GenericProjectManager.GenericBuildConfiguration.BuildDirectory");
}
-GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent)
+GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent)
: BuildConfiguration(parent, Core::Id(GENERIC_BC_ID))
{
}
-GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent, const Core::Id id)
+GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id)
: BuildConfiguration(parent, id)
{
}
-GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent, GenericBuildConfiguration *source) :
+GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source) :
BuildConfiguration(parent, source),
m_buildDirectory(source->m_buildDirectory)
{
@@ -112,17 +114,16 @@ void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
emit buildDirectoryChanged();
}
-GenericTarget *GenericBuildConfiguration::genericTarget() const
+ProjectExplorer::BuildConfigWidget *GenericBuildConfiguration::createConfigWidget()
{
- return static_cast<GenericTarget *>(target());
+ return new GenericBuildSettingsWidget;
}
ProjectExplorer::IOutputParser *GenericBuildConfiguration::createOutputParser() const
{
- ProjectExplorer::ToolChain *tc = genericTarget()->genericProject()->toolChain();
- if (tc)
- return tc->outputParser();
- return 0;
+ ProjectExplorer::ToolChain *tc =
+ ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
+ return tc ? tc->outputParser() : 0;
}
@@ -139,9 +140,9 @@ GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory()
{
}
-QList<Core::Id> GenericBuildConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
+QList<Core::Id> GenericBuildConfigurationFactory::availableCreationIds(const ProjectExplorer::Target *parent) const
{
- if (!qobject_cast<GenericTarget *>(parent))
+ if (!canHandle(parent))
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(GENERIC_BC_ID);
}
@@ -153,33 +154,35 @@ QString GenericBuildConfigurationFactory::displayNameForId(const Core::Id id) co
return QString();
}
-bool GenericBuildConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
+bool GenericBuildConfigurationFactory::canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const
{
- if (!qobject_cast<GenericTarget *>(parent))
+ if (!canHandle(parent))
return false;
if (id == Core::Id(GENERIC_BC_ID))
return true;
return false;
}
-BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
+BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
{
if (!canCreate(parent, id))
return 0;
- GenericTarget *target(static_cast<GenericTarget *>(parent));
//TODO asking for name is duplicated everywhere, but maybe more
- // wizards will show up, that incorporate choosing the name
- bool ok;
- QString buildConfigurationName = QInputDialog::getText(0,
- tr("New Configuration"),
- tr("New configuration name:"),
- QLineEdit::Normal,
- QString(),
- &ok);
+ // wizards will show up, that incorporate choosing the nam
+ bool ok = true;
+ QString buildConfigurationName = name;
+ if (buildConfigurationName.isEmpty())
+ buildConfigurationName = QInputDialog::getText(0,
+ tr("New Configuration"),
+ tr("New configuration name:"),
+ QLineEdit::Normal,
+ QString(), &ok);
+ buildConfigurationName = buildConfigurationName.trimmed();
if (!ok || buildConfigurationName.isEmpty())
return 0;
- GenericBuildConfiguration *bc = new GenericBuildConfiguration(target);
+
+ GenericBuildConfiguration *bc = new GenericBuildConfiguration(parent);
bc->setDisplayName(buildConfigurationName);
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
@@ -196,11 +199,10 @@ BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Ta
cleanMakeStep->setBuildTarget(QLatin1String("clean"), /* on = */ true);
cleanMakeStep->setClean(true);
- target->addBuildConfiguration(bc); // also makes the name unique...
return bc;
}
-bool GenericBuildConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
+bool GenericBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
{
return canCreate(parent, source->id());
}
@@ -209,11 +211,10 @@ BuildConfiguration *GenericBuildConfigurationFactory::clone(ProjectExplorer::Tar
{
if (!canClone(parent, source))
return 0;
- GenericTarget *target(static_cast<GenericTarget *>(parent));
- return new GenericBuildConfiguration(target, qobject_cast<GenericBuildConfiguration *>(source));
+ return new GenericBuildConfiguration(parent, qobject_cast<GenericBuildConfiguration *>(source));
}
-bool GenericBuildConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
+bool GenericBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
@@ -222,16 +223,53 @@ BuildConfiguration *GenericBuildConfigurationFactory::restore(ProjectExplorer::T
{
if (!canRestore(parent, map))
return 0;
- GenericTarget *target(static_cast<GenericTarget *>(parent));
- GenericBuildConfiguration *bc(new GenericBuildConfiguration(target));
+ GenericBuildConfiguration *bc(new GenericBuildConfiguration(parent));
if (bc->fromMap(map))
return bc;
delete bc;
return 0;
}
+bool GenericBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ return qobject_cast<GenericProject *>(t->project());
+}
+
BuildConfiguration::BuildType GenericBuildConfiguration::buildType() const
{
return Unknown;
}
+////////////////////////////////////////////////////////////////////////////////////
+// GenericBuildSettingsWidget
+////////////////////////////////////////////////////////////////////////////////////
+
+GenericBuildSettingsWidget::GenericBuildSettingsWidget() : m_buildConfiguration(0)
+{
+ QFormLayout *fl = new QFormLayout(this);
+ fl->setContentsMargins(0, -1, 0, -1);
+ fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
+
+ // build directory
+ m_pathChooser = new Utils::PathChooser(this);
+ m_pathChooser->setEnabled(true);
+ fl->addRow(tr("Build directory:"), m_pathChooser);
+ connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
+}
+
+QString GenericBuildSettingsWidget::displayName() const
+{ return tr("Generic Manager"); }
+
+void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
+{
+ m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
+ m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
+ m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
+}
+
+void GenericBuildSettingsWidget::buildDirectoryChanged()
+{
+ m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
+}
diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.h b/src/plugins/genericprojectmanager/genericbuildconfiguration.h
index 6a2058861a..0f34074485 100644
--- a/src/plugins/genericprojectmanager/genericbuildconfiguration.h
+++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.h
@@ -34,6 +34,9 @@
#define GENERICBUILDCONFIGURATION_H
#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/buildstep.h> // for BuildConfigWidget
+
+namespace Utils { class PathChooser; }
namespace GenericProjectManager {
namespace Internal {
@@ -47,11 +50,10 @@ class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
friend class GenericBuildConfigurationFactory;
public:
- explicit GenericBuildConfiguration(GenericTarget *parent);
+ explicit GenericBuildConfiguration(ProjectExplorer::Target *parent);
virtual ~GenericBuildConfiguration();
- GenericTarget *genericTarget() const;
-
+ ProjectExplorer::BuildConfigWidget *createConfigWidget();
virtual QString buildDirectory() const;
QString rawBuildDirectory() const;
@@ -64,8 +66,8 @@ public:
BuildType buildType() const;
protected:
- GenericBuildConfiguration(GenericTarget *parent, GenericBuildConfiguration *source);
- GenericBuildConfiguration(GenericTarget *parent, const Core::Id id);
+ GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source);
+ GenericBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id);
virtual bool fromMap(const QVariantMap &map);
private:
@@ -80,17 +82,39 @@ public:
explicit GenericBuildConfigurationFactory(QObject *parent = 0);
~GenericBuildConfigurationFactory();
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
+ QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
- bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
- ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
- bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
+ bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
+ ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
+ bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+ bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
+
+private:
+ bool canHandle(const ProjectExplorer::Target *t) const;
+};
+
+class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
+{
+ Q_OBJECT
+
+public:
+ GenericBuildSettingsWidget();
+
+ QString displayName() const;
+
+ void init(ProjectExplorer::BuildConfiguration *bc);
+
+private slots:
+ void buildDirectoryChanged();
+
+private:
+ Utils::PathChooser *m_pathChooser;
+ GenericBuildConfiguration *m_buildConfiguration;
};
-} // namespace GenericProjectManager
} // namespace Internal
+} // namespace GenericProjectManager
#endif // GENERICBUILDCONFIGURATION_H
diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp
index 37dcc2566d..d6d176667e 100644
--- a/src/plugins/genericprojectmanager/genericmakestep.cpp
+++ b/src/plugins/genericprojectmanager/genericmakestep.cpp
@@ -33,16 +33,16 @@
#include "genericmakestep.h"
#include "genericprojectconstants.h"
#include "genericproject.h"
-#include "generictarget.h"
#include "ui_genericmakestep.h"
#include "genericbuildconfiguration.h"
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/toolchain.h>
-#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchain.h>
#include <coreplugin/variablemanager.h>
#include <utils/stringutils.h>
#include <utils/qtcassert.h>
@@ -126,8 +126,10 @@ bool GenericMakeStep::init()
setIgnoreReturnValue(m_clean);
setOutputParser(new ProjectExplorer::GnuMakeParser());
- if (bc->genericTarget()->genericProject()->toolChain())
- appendOutputParser(bc->genericTarget()->genericProject()->toolChain()->outputParser());
+ ProjectExplorer::ToolChain *tc =
+ ProjectExplorer::ToolChainProfileInformation::toolChain(bc->target()->profile());
+ if (tc)
+ appendOutputParser(tc->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
@@ -175,9 +177,9 @@ QString GenericMakeStep::makeCommand() const
{
QString command = m_makeCommand;
if (command.isEmpty()) {
- GenericProject *pro = static_cast<GenericProject *>(target()->project());
- if (ProjectExplorer::ToolChain *toolChain = pro->toolChain())
- command = toolChain->makeCommand();
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
+ if (tc)
+ command = tc->makeCommand();
else
command = QLatin1String("make");
}
@@ -249,7 +251,7 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
this, SLOT(updateDetails()));
- connect(pro, SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
+ connect(m_makeStep->target(), SIGNAL(profileChanged()),
this, SLOT(updateMakeOverrrideLabel()));
}
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index c63ab87f00..01fb99ae39 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -34,17 +34,19 @@
#include "genericbuildconfiguration.h"
#include "genericprojectconstants.h"
-#include "generictarget.h"
+
+#include "genericmakestep.h"
#include <projectexplorer/abi.h>
#include <projectexplorer/buildenvironmentwidget.h>
+#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/headerpath.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <cpptools/ModelManagerInterface.h>
#include <extensionsystem/pluginmanager.h>
-#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <coreplugin/icore.h>
@@ -54,7 +56,6 @@
#include <QDir>
#include <QProcessEnvironment>
-#include <QFormLayout>
#include <QMainWindow>
#include <QComboBox>
@@ -62,18 +63,13 @@ using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
using namespace ProjectExplorer;
-namespace {
-const char * const TOOLCHAIN_KEY("GenericProjectManager.GenericProject.Toolchain");
-} // end of anonymous namespace
-
////////////////////////////////////////////////////////////////////////////////////
// GenericProject
////////////////////////////////////////////////////////////////////////////////////
GenericProject::GenericProject(Manager *manager, const QString &fileName)
: m_manager(manager),
- m_fileName(fileName),
- m_toolChain(0)
+ m_fileName(fileName)
{
setProjectContext(Core::Context(GenericProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -107,12 +103,6 @@ GenericProject::~GenericProject()
m_manager->unregisterProject(this);
delete m_rootNode;
- // do not delete m_toolChain
-}
-
-GenericTarget *GenericProject::activeTarget() const
-{
- return static_cast<GenericTarget *>(Project::activeTarget());
}
QString GenericProject::filesFileName() const
@@ -261,11 +251,13 @@ void GenericProject::refresh(RefreshOptions options)
CPlusPlus::CppModelManagerInterface::ProjectPart::Ptr part(
new CPlusPlus::CppModelManagerInterface::ProjectPart);
- if (m_toolChain) {
- part->defines = m_toolChain->predefinedMacros(QStringList());
+ ToolChain *tc = activeTarget() ?
+ ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile()) : 0;
+ if (tc) {
+ part->defines = tc->predefinedMacros(QStringList());
part->defines += '\n';
- foreach (const HeaderPath &headerPath, m_toolChain->systemHeaderPaths()) {
+ foreach (const HeaderPath &headerPath, tc->systemHeaderPaths()) {
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
part->frameworkPaths.append(headerPath.path());
else
@@ -389,27 +381,6 @@ QByteArray GenericProject::defines() const
return m_defines;
}
-void GenericProject::setToolChain(ToolChain *tc)
-{
- if (m_toolChain == tc)
- return;
-
- m_toolChain = tc;
- refresh(Configuration);
-
- foreach (Target *t, targets()) {
- foreach (BuildConfiguration *bc, t->buildConfigurations())
- bc->setToolChain(tc);
- }
-
- emit toolChainChanged(m_toolChain);
-}
-
-ToolChain *GenericProject::toolChain() const
-{
- return m_toolChain;
-}
-
QString GenericProject::displayName() const
{
return m_projectName;
@@ -456,18 +427,14 @@ QStringList GenericProject::buildTargets() const
return targets;
}
-QVariantMap GenericProject::toMap() const
-{
- QVariantMap map(Project::toMap());
- map.insert(QLatin1String(TOOLCHAIN_KEY), m_toolChain ? m_toolChain->id() : QString());
- return map;
-}
-
bool GenericProject::fromMap(const QVariantMap &map)
{
if (!Project::fromMap(map))
return false;
+ if (!activeTarget())
+ addTarget(createTarget(ProfileManager::instance()->defaultProfile()));
+
// Sanity check: We need both a buildconfiguration and a runconfiguration!
QList<Target *> targetList = targets();
foreach (Target *t, targetList) {
@@ -480,119 +447,16 @@ bool GenericProject::fromMap(const QVariantMap &map)
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
}
- // Add default setup:
- if (targets().isEmpty()) {
- GenericTargetFactory *factory =
- ExtensionSystem::PluginManager::getObject<GenericTargetFactory>();
- addTarget(factory->create(this, Core::Id(GENERIC_DESKTOP_TARGET_ID)));
- }
-
- QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
- const ToolChainManager *toolChainManager = ToolChainManager::instance();
-
- if (!id.isNull()) {
- setToolChain(toolChainManager->findToolChain(id));
- } else {
- ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
- abi = ProjectExplorer::Abi(abi.architecture(), abi.os(), ProjectExplorer::Abi::UnknownFlavor,
- abi.binaryFormat(), abi.wordWidth() == 32 ? 32 : 0);
- QList<ToolChain *> tcs = toolChainManager->findToolChains(abi);
- if (tcs.isEmpty())
- tcs = toolChainManager->toolChains();
- if (!tcs.isEmpty())
- setToolChain(tcs.at(0));
- }
-
setIncludePaths(allIncludePaths());
- refresh(Everything);
+ evaluateBuildSystem();
return true;
}
-////////////////////////////////////////////////////////////////////////////////////
-// GenericBuildSettingsWidget
-////////////////////////////////////////////////////////////////////////////////////
-
-GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericTarget *target)
- : m_target(target), m_toolChainChooser(0), m_buildConfiguration(0)
-{
- QFormLayout *fl = new QFormLayout(this);
- fl->setContentsMargins(0, -1, 0, -1);
- fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
-
- // build directory
- m_pathChooser = new Utils::PathChooser(this);
- m_pathChooser->setEnabled(true);
- m_pathChooser->setBaseDirectory(m_target->genericProject()->projectDirectory());
- fl->addRow(tr("Build directory:"), m_pathChooser);
- connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
-
- // tool chain
- m_toolChainChooser = new QComboBox;
- m_toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- updateToolChainList();
-
- fl->addRow(tr("Tool chain:"), m_toolChainChooser);
- connect(m_toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
- connect(m_target->genericProject(), SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
- this, SLOT(toolChainChanged(ProjectExplorer::ToolChain*)));
- connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainList()));
- connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainList()));
-}
-
-GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
-{ }
-
-QString GenericBuildSettingsWidget::displayName() const
-{ return tr("Generic Manager"); }
-
-void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
-{
- m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
- m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
-}
-
-void GenericBuildSettingsWidget::buildDirectoryChanged()
-{
- m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
-}
-
-void GenericBuildSettingsWidget::toolChainSelected(int index)
-{
- using namespace ProjectExplorer;
-
- ToolChain *tc = static_cast<ToolChain *>(m_toolChainChooser->itemData(index).value<void *>());
- m_target->genericProject()->setToolChain(tc);
-}
-
-void GenericBuildSettingsWidget::toolChainChanged(ProjectExplorer::ToolChain *tc)
-{
- for (int i = 0; i < m_toolChainChooser->count(); ++i) {
- ToolChain * currentTc = static_cast<ToolChain *>(m_toolChainChooser->itemData(i).value<void *>());
- if (currentTc != tc)
- continue;
- m_toolChainChooser->setCurrentIndex(i);
- return;
- }
-}
-
-void GenericBuildSettingsWidget::updateToolChainList()
+void GenericProject::evaluateBuildSystem()
{
- m_toolChainChooser->clear();
-
- QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
- if (!m_target->genericProject()->toolChain()) {
- m_toolChainChooser->addItem(tr("<Invalid tool chain>"), qVariantFromValue(static_cast<void *>(0)));
- m_toolChainChooser->setCurrentIndex(0);
- }
- foreach (ToolChain *tc, tcs) {
- m_toolChainChooser->addItem(tc->displayName(), qVariantFromValue(static_cast<void *>(tc)));
- if (m_target->genericProject()->toolChain()
- && m_target->genericProject()->toolChain()->id() == tc->id())
- m_toolChainChooser->setCurrentIndex(m_toolChainChooser->count() - 1);
- }
+ refresh(Everything);
+ buildSystemEvaluationFinished(true);
}
////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h
index a36f2323c4..17c5791677 100644
--- a/src/plugins/genericprojectmanager/genericproject.h
+++ b/src/plugins/genericprojectmanager/genericproject.h
@@ -35,13 +35,11 @@
#include "genericprojectmanager.h"
#include "genericprojectnodes.h"
-#include "generictarget.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
-#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildconfiguration.h>
#include <coreplugin/idocument.h>
@@ -51,13 +49,7 @@ QT_BEGIN_NAMESPACE
class QComboBox;
QT_END_NAMESPACE
-namespace Utils {
-class PathChooser;
-}
-
-namespace ProjectExplorer {
-class ToolChain;
-}
+namespace ProjectExplorer { class ToolChain; }
namespace GenericProjectManager {
namespace Internal {
@@ -84,7 +76,6 @@ public:
Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
- GenericTarget *activeTarget() const;
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
@@ -114,18 +105,12 @@ public:
QStringList projectIncludePaths() const;
QStringList files() const;
QStringList generated() const;
- ProjectExplorer::ToolChain *toolChain() const;
- void setToolChain(ProjectExplorer::ToolChain *tc);
-
- QVariantMap toMap() const;
-
-signals:
- void toolChainChanged(ProjectExplorer::ToolChain *);
protected:
- virtual bool fromMap(const QVariantMap &map);
+ bool fromMap(const QVariantMap &map);
private:
+ void evaluateBuildSystem();
bool saveRawFileList(const QStringList &rawFileList);
void parseProject(RefreshOptions options);
QStringList processEntries(const QStringList &paths,
@@ -150,7 +135,6 @@ private:
QByteArray m_defines;
GenericProjectNode *m_rootNode;
- ProjectExplorer::ToolChain *m_toolChain;
QFuture<void> m_codeModelFuture;
};
@@ -182,31 +166,6 @@ private:
GenericProject::RefreshOptions m_options;
};
-class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
-{
- Q_OBJECT
-
-public:
- GenericBuildSettingsWidget(GenericTarget *target);
- virtual ~GenericBuildSettingsWidget();
-
- virtual QString displayName() const;
-
- virtual void init(ProjectExplorer::BuildConfiguration *bc);
-
-private Q_SLOTS:
- void buildDirectoryChanged();
- void toolChainSelected(int index);
- void toolChainChanged(ProjectExplorer::ToolChain *);
- void updateToolChainList();
-
-private:
- GenericTarget *m_target;
- Utils::PathChooser *m_pathChooser;
- QComboBox *m_toolChainChooser;
- GenericBuildConfiguration *m_buildConfiguration;
-};
-
} // namespace Internal
} // namespace GenericProjectManager
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.pro b/src/plugins/genericprojectmanager/genericprojectmanager.pro
index 5c57d8a4d0..02c60f9540 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.pro
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.pro
@@ -4,7 +4,6 @@ include(../../qtcreatorplugin.pri)
include(genericprojectmanager_dependencies.pri)
HEADERS = genericproject.h \
genericprojectplugin.h \
- generictarget.h \
genericprojectmanager.h \
genericprojectconstants.h \
genericprojectnodes.h \
@@ -17,7 +16,6 @@ HEADERS = genericproject.h \
filesselectionwizardpage.h
SOURCES = genericproject.cpp \
genericprojectplugin.cpp \
- generictarget.cpp \
genericprojectmanager.cpp \
genericprojectnodes.cpp \
genericprojectwizard.cpp \
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.qbs b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
index e4070e88e6..9b47c6767b 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.qbs
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
@@ -25,7 +25,6 @@ QtcPlugin {
files: [
"genericproject.h",
"genericprojectplugin.h",
- "generictarget.h",
"genericprojectmanager.h",
"genericprojectconstants.h",
"genericprojectnodes.h",
@@ -38,7 +37,6 @@ QtcPlugin {
"filesselectionwizardpage.h",
"genericproject.cpp",
"genericprojectplugin.cpp",
- "generictarget.cpp",
"genericprojectmanager.cpp",
"genericprojectnodes.cpp",
"genericprojectwizard.cpp",
diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
index da87b4e91f..bf49f107a9 100644
--- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
@@ -31,12 +31,13 @@
**************************************************************************/
#include "genericprojectplugin.h"
+
+#include "genericbuildconfiguration.h"
#include "genericprojectmanager.h"
#include "genericprojectwizard.h"
#include "genericprojectconstants.h"
#include "genericprojectfileseditor.h"
#include "genericmakestep.h"
-#include "generictarget.h"
#include "genericproject.h"
#include "selectablefilesmodel.h"
@@ -92,7 +93,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
addAutoReleasedObject(manager);
addAutoReleasedObject(new GenericMakeStepFactory);
addAutoReleasedObject(new GenericProjectWizard);
- addAutoReleasedObject(new GenericTargetFactory);
+ addAutoReleasedObject(new GenericBuildConfigurationFactory);
const Core::Context projectContext(Constants::PROJECTCONTEXT);
Core::ActionContainer *mproject =
diff --git a/src/plugins/genericprojectmanager/generictarget.cpp b/src/plugins/genericprojectmanager/generictarget.cpp
deleted file mode 100644
index 8255a8b5b3..0000000000
--- a/src/plugins/genericprojectmanager/generictarget.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** 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.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "generictarget.h"
-
-#include "genericbuildconfiguration.h"
-#include "genericproject.h"
-#include "genericmakestep.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/deployconfiguration.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-
-#include <QApplication>
-#include <QStyle>
-
-const char GENERIC_DESKTOP_TARGET_DISPLAY_NAME[] = "Desktop";
-
-using namespace GenericProjectManager;
-using namespace GenericProjectManager::Internal;
-
-////////////////////////////////////////////////////////////////////////////////////
-// GenericTarget
-////////////////////////////////////////////////////////////////////////////////////
-
-GenericTarget::GenericTarget(GenericProject *parent) :
- ProjectExplorer::Target(parent, Core::Id(GENERIC_DESKTOP_TARGET_ID)),
- m_buildConfigurationFactory(new GenericBuildConfigurationFactory(this))
-{
- setDefaultDisplayName(QApplication::translate("GenericProjectManager::GenericTarget",
- GENERIC_DESKTOP_TARGET_DISPLAY_NAME));
- setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
-}
-
-ProjectExplorer::BuildConfigWidget *GenericTarget::createConfigWidget()
-{
- return new GenericBuildSettingsWidget(this);
-}
-
-GenericProject *GenericTarget::genericProject() const
-{
- return static_cast<GenericProject *>(project());
-}
-
-GenericBuildConfigurationFactory *GenericTarget::buildConfigurationFactory() const
-{
- return m_buildConfigurationFactory;
-}
-
-GenericBuildConfiguration *GenericTarget::activeBuildConfiguration() const
-{
- return static_cast<GenericBuildConfiguration *>(Target::activeBuildConfiguration());
-}
-
-bool GenericTarget::fromMap(const QVariantMap &map)
-{
- return Target::fromMap(map);
-}
-
-////////////////////////////////////////////////////////////////////////////////////
-// GenericTargetFactory
-////////////////////////////////////////////////////////////////////////////////////
-
-GenericTargetFactory::GenericTargetFactory(QObject *parent) :
- ITargetFactory(parent)
-{
-}
-
-bool GenericTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(GENERIC_DESKTOP_TARGET_ID);
-}
-
-QList<Core::Id> GenericTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(GENERIC_DESKTOP_TARGET_ID);
-}
-
-QString GenericTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(GENERIC_DESKTOP_TARGET_ID))
- return QCoreApplication::translate("GenericProjectManager::GenericTarget",
- GENERIC_DESKTOP_TARGET_DISPLAY_NAME,
- "Generic desktop target display name");
- return QString();
-}
-
-bool GenericTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<GenericProject *>(parent))
- return false;
- return id == Core::Id(GENERIC_DESKTOP_TARGET_ID);
-}
-
-GenericTarget *GenericTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
- GenericProject *genericproject = static_cast<GenericProject *>(parent);
- GenericTarget *t = new GenericTarget(genericproject);
-
- // Set up BuildConfiguration:
- GenericBuildConfiguration *bc = new GenericBuildConfiguration(t);
- bc->setDisplayName(QLatin1String("all"));
-
- ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
- ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
-
- GenericMakeStep *makeStep = new GenericMakeStep(buildSteps);
- buildSteps->insertStep(0, makeStep);
- makeStep->setBuildTarget(QLatin1String("all"), /* on = */ true);
-
- GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps);
- cleanSteps->insertStep(0, cleanMakeStep);
- cleanMakeStep->setBuildTarget(QLatin1String("clean"), /* on = */ true);
- cleanMakeStep->setClean(true);
-
- bc->setBuildDirectory(genericproject->projectDirectory());
-
- t->addBuildConfiguration(bc);
-
- t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID));
-
- // Add a runconfiguration. The CustomExecutableRC one will query the user
- // for its settings, so it is a good choice here.
- t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
-
- return t;
-}
-
-bool GenericTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return canCreate(parent, ProjectExplorer::idFromMap(map));
-}
-
-GenericTarget *GenericTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
- GenericProject *genericproject = static_cast<GenericProject *>(parent);
- GenericTarget *target = new GenericTarget(genericproject);
- if (target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
diff --git a/src/plugins/genericprojectmanager/generictarget.h b/src/plugins/genericprojectmanager/generictarget.h
deleted file mode 100644
index 48eef3e9f5..0000000000
--- a/src/plugins/genericprojectmanager/generictarget.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** 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.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef GENERICTARGET_H
-#define GENERICTARGET_H
-
-#include <projectexplorer/target.h>
-
-#include "genericbuildconfiguration.h"
-
-#include <QStringList>
-#include <QVariantMap>
-
-namespace ProjectExplorer {
-class IBuildConfigurationFactory;
-} // namespace ProjectExplorer
-
-namespace GenericProjectManager {
-namespace Internal {
-
-const char GENERIC_DESKTOP_TARGET_ID[] = "GenericProjectManager.GenericTarget";
-
-class GenericProject;
-class GenericRunConfiguration;
-
-class GenericTargetFactory;
-
-class GenericTarget : public ProjectExplorer::Target
-{
- Q_OBJECT
- friend class GenericTargetFactory;
-
-public:
- explicit GenericTarget(GenericProject *parent);
-
- ProjectExplorer::BuildConfigWidget *createConfigWidget();
-
- GenericProject *genericProject() const;
-
- GenericBuildConfigurationFactory *buildConfigurationFactory() const;
- GenericBuildConfiguration *activeBuildConfiguration() const;
-
-protected:
- bool fromMap(const QVariantMap &map);
-
-private:
- GenericBuildConfigurationFactory *m_buildConfigurationFactory;
-};
-
-class GenericTargetFactory : public ProjectExplorer::ITargetFactory
-{
- Q_OBJECT
-
-public:
- explicit GenericTargetFactory(QObject *parent = 0);
-
- bool supportsTargetId(const Core::Id id) const;
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- GenericTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- GenericTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-};
-
-} // namespace Internal
-} // namespace GenericProjectManager
-
-#endif // GENERICTARGET_H