forked from qt-creator/qt-creator
Introduced private classes for Target/Project.
Reviewed-by: hjk
This commit is contained in:
@@ -42,9 +42,6 @@
|
||||
#include <limits>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
namespace {
|
||||
const char * const ACTIVE_TARGET_KEY("ProjectExplorer.Project.ActiveTarget");
|
||||
const char * const TARGET_KEY_PREFIX("ProjectExplorer.Project.Target.");
|
||||
@@ -54,20 +51,34 @@ const char * const EDITOR_SETTINGS_KEY("ProjectExplorer.Project.EditorSettings")
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace ProjectExplorer {
|
||||
// -------------------------------------------------------------------------
|
||||
// Project
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Project::Project() :
|
||||
class ProjectPrivate {
|
||||
public:
|
||||
ProjectPrivate();
|
||||
QSet<QString> m_supportedTargetIds;
|
||||
QList<Target *> m_targets;
|
||||
Target *m_activeTarget;
|
||||
EditorConfiguration *m_editorConfiguration;
|
||||
};
|
||||
|
||||
ProjectPrivate::ProjectPrivate() :
|
||||
m_activeTarget(0),
|
||||
m_editorConfiguration(new EditorConfiguration())
|
||||
{
|
||||
}
|
||||
|
||||
Project::Project() : d(new ProjectPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
Project::~Project()
|
||||
{
|
||||
qDeleteAll(m_targets);
|
||||
delete m_editorConfiguration;
|
||||
qDeleteAll(d->m_targets);
|
||||
delete d->m_editorConfiguration;
|
||||
}
|
||||
|
||||
bool Project::hasActiveBuildSettings() const
|
||||
@@ -89,12 +100,12 @@ QString Project::makeUnique(const QString &preferredName, const QStringList &use
|
||||
|
||||
QSet<QString> Project::supportedTargetIds() const
|
||||
{
|
||||
return m_supportedTargetIds;
|
||||
return d->m_supportedTargetIds;
|
||||
}
|
||||
|
||||
QSet<QString> Project::possibleTargetIds() const
|
||||
{
|
||||
QSet<QString> result(m_supportedTargetIds);
|
||||
QSet<QString> result(d->m_supportedTargetIds);
|
||||
foreach (ProjectExplorer::Target *t, targets())
|
||||
result.remove(t->id());
|
||||
|
||||
@@ -108,10 +119,10 @@ bool Project::canAddTarget(const QString &id) const
|
||||
|
||||
void Project::setSupportedTargetIds(const QSet<QString> &ids)
|
||||
{
|
||||
if (ids == m_supportedTargetIds)
|
||||
if (ids == d->m_supportedTargetIds)
|
||||
return;
|
||||
|
||||
m_supportedTargetIds = ids;
|
||||
d->m_supportedTargetIds = ids;
|
||||
emit supportedTargetIdsChanged();
|
||||
}
|
||||
|
||||
@@ -125,20 +136,20 @@ void Project::changeEnvironment()
|
||||
|
||||
void Project::addTarget(Target *t)
|
||||
{
|
||||
QTC_ASSERT(t && !m_targets.contains(t), return);
|
||||
QTC_ASSERT(t && !d->m_targets.contains(t), return);
|
||||
QTC_ASSERT(!target(t->id()), return);
|
||||
Q_ASSERT(t->project() == this);
|
||||
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QString targetDisplayName = t->displayName();
|
||||
QStringList displayNames;
|
||||
foreach (const Target *target, m_targets)
|
||||
foreach (const Target *target, d->m_targets)
|
||||
displayNames << target->displayName();
|
||||
targetDisplayName = makeUnique(targetDisplayName, displayNames);
|
||||
t->setDefaultDisplayName(targetDisplayName);
|
||||
|
||||
// add it
|
||||
m_targets.push_back(t);
|
||||
d->m_targets.push_back(t);
|
||||
connect(t, SIGNAL(environmentChanged()),
|
||||
SLOT(changeEnvironment()));
|
||||
emit addedTarget(t);
|
||||
@@ -150,45 +161,45 @@ void Project::addTarget(Target *t)
|
||||
|
||||
void Project::removeTarget(Target *target)
|
||||
{
|
||||
QTC_ASSERT(target && m_targets.contains(target), return);
|
||||
QTC_ASSERT(target && d->m_targets.contains(target), return);
|
||||
|
||||
emit aboutToRemoveTarget(target);
|
||||
|
||||
m_targets.removeOne(target);
|
||||
d->m_targets.removeOne(target);
|
||||
|
||||
emit removedTarget(target);
|
||||
if (target == activeTarget()) {
|
||||
if (m_targets.isEmpty())
|
||||
if (d->m_targets.isEmpty())
|
||||
setActiveTarget(0);
|
||||
else
|
||||
setActiveTarget(m_targets.at(0));
|
||||
setActiveTarget(d->m_targets.at(0));
|
||||
}
|
||||
delete target;
|
||||
}
|
||||
|
||||
QList<Target *> Project::targets() const
|
||||
{
|
||||
return m_targets;
|
||||
return d->m_targets;
|
||||
}
|
||||
|
||||
Target *Project::activeTarget() const
|
||||
{
|
||||
return m_activeTarget;
|
||||
return d->m_activeTarget;
|
||||
}
|
||||
|
||||
void Project::setActiveTarget(Target *target)
|
||||
{
|
||||
if ((!target && !m_targets.isEmpty()) ||
|
||||
(target && m_targets.contains(target) && m_activeTarget != target)) {
|
||||
m_activeTarget = target;
|
||||
emit activeTargetChanged(m_activeTarget);
|
||||
if ((!target && !d->m_targets.isEmpty()) ||
|
||||
(target && d->m_targets.contains(target) && d->m_activeTarget != target)) {
|
||||
d->m_activeTarget = target;
|
||||
emit activeTargetChanged(d->m_activeTarget);
|
||||
emit environmentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Target *Project::target(const QString &id) const
|
||||
{
|
||||
foreach (Target * target, m_targets) {
|
||||
foreach (Target * target, d->m_targets) {
|
||||
if (target->id() == id)
|
||||
return target;
|
||||
}
|
||||
@@ -218,12 +229,12 @@ QVariantMap Project::toMap() const
|
||||
const QList<Target *> ts = targets();
|
||||
|
||||
QVariantMap map;
|
||||
map.insert(QLatin1String(ACTIVE_TARGET_KEY), ts.indexOf(m_activeTarget));
|
||||
map.insert(QLatin1String(ACTIVE_TARGET_KEY), ts.indexOf(d->m_activeTarget));
|
||||
map.insert(QLatin1String(TARGET_COUNT_KEY), ts.size());
|
||||
for (int i = 0; i < ts.size(); ++i)
|
||||
map.insert(QString::fromLatin1(TARGET_KEY_PREFIX) + QString::number(i), ts.at(i)->toMap());
|
||||
|
||||
map.insert(QLatin1String(EDITOR_SETTINGS_KEY), m_editorConfiguration->toMap());
|
||||
map.insert(QLatin1String(EDITOR_SETTINGS_KEY), d->m_editorConfiguration->toMap());
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -246,7 +257,7 @@ bool Project::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (map.contains(QLatin1String(EDITOR_SETTINGS_KEY))) {
|
||||
QVariantMap values(map.value(QLatin1String(EDITOR_SETTINGS_KEY)).toMap());
|
||||
m_editorConfiguration->fromMap(values);
|
||||
d->m_editorConfiguration->fromMap(values);
|
||||
}
|
||||
|
||||
int previousFileVersion = map.value(QLatin1String(Constants::USERFILE_PREVIOUS_VERSION_KEY),
|
||||
@@ -284,7 +295,7 @@ bool Project::fromMap(const QVariantMap &map)
|
||||
|
||||
EditorConfiguration *Project::editorConfiguration() const
|
||||
{
|
||||
return m_editorConfiguration;
|
||||
return d->m_editorConfiguration;
|
||||
}
|
||||
|
||||
QByteArray Project::predefinedMacros(const QString &) const
|
||||
@@ -306,3 +317,5 @@ QString Project::generatedUiHeader(const QString & /* formFile */) const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -48,6 +48,7 @@ class EditorConfiguration;
|
||||
class ProjectNode;
|
||||
class Target;
|
||||
class ITargetFactory;
|
||||
class ProjectPrivate;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT Project
|
||||
: public QObject
|
||||
@@ -159,10 +160,7 @@ private slots:
|
||||
void changeEnvironment();
|
||||
|
||||
private:
|
||||
QSet<QString> m_supportedTargetIds;
|
||||
QList<Target *> m_targets;
|
||||
Target *m_activeTarget;
|
||||
EditorConfiguration *m_editorConfiguration;
|
||||
QScopedPointer<ProjectPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <limits>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace {
|
||||
const char * const ACTIVE_BC_KEY("ProjectExplorer.Target.ActiveBuildConfiguration");
|
||||
@@ -59,8 +59,25 @@ const char * const RC_COUNT_KEY("ProjectExplorer.Target.RunConfigurationCount");
|
||||
// Target
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Target::Target(Project *project, const QString &id) :
|
||||
ProjectConfiguration(project, id),
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class TargetPrivate {
|
||||
public:
|
||||
TargetPrivate();
|
||||
bool m_isEnabled;
|
||||
QIcon m_icon;
|
||||
QIcon m_overlayIcon;
|
||||
QString m_toolTip;
|
||||
|
||||
QList<BuildConfiguration *> m_buildConfigurations;
|
||||
BuildConfiguration *m_activeBuildConfiguration;
|
||||
QList<DeployConfiguration *> m_deployConfigurations;
|
||||
DeployConfiguration *m_activeDeployConfiguration;
|
||||
QList<RunConfiguration *> m_runConfigurations;
|
||||
RunConfiguration* m_activeRunConfiguration;
|
||||
};
|
||||
|
||||
TargetPrivate::TargetPrivate() :
|
||||
m_isEnabled(true),
|
||||
m_activeBuildConfiguration(0),
|
||||
m_activeDeployConfiguration(0),
|
||||
@@ -68,10 +85,16 @@ Target::Target(Project *project, const QString &id) :
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Target::Target(Project *project, const QString &id) :
|
||||
ProjectConfiguration(project, id), d(new TargetPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
Target::~Target()
|
||||
{
|
||||
qDeleteAll(m_buildConfigurations);
|
||||
qDeleteAll(m_runConfigurations);
|
||||
qDeleteAll(d->m_buildConfigurations);
|
||||
qDeleteAll(d->m_runConfigurations);
|
||||
}
|
||||
|
||||
void Target::changeEnvironment()
|
||||
@@ -88,7 +111,7 @@ Project *Target::project() const
|
||||
|
||||
void Target::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
QTC_ASSERT(configuration && !m_buildConfigurations.contains(configuration), return);
|
||||
QTC_ASSERT(configuration && !d->m_buildConfigurations.contains(configuration), return);
|
||||
Q_ASSERT(configuration->target() == this);
|
||||
|
||||
if (!buildConfigurationFactory())
|
||||
@@ -97,13 +120,13 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QString configurationDisplayName = configuration->displayName();
|
||||
QStringList displayNames;
|
||||
foreach (const BuildConfiguration *bc, m_buildConfigurations)
|
||||
foreach (const BuildConfiguration *bc, d->m_buildConfigurations)
|
||||
displayNames << bc->displayName();
|
||||
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
|
||||
configuration->setDisplayName(configurationDisplayName);
|
||||
|
||||
// add it
|
||||
m_buildConfigurations.push_back(configuration);
|
||||
d->m_buildConfigurations.push_back(configuration);
|
||||
|
||||
emit addedBuildConfiguration(configuration);
|
||||
|
||||
@@ -117,18 +140,18 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
void Target::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
//todo: this might be error prone
|
||||
if (!m_buildConfigurations.contains(configuration))
|
||||
if (!d->m_buildConfigurations.contains(configuration))
|
||||
return;
|
||||
|
||||
m_buildConfigurations.removeOne(configuration);
|
||||
d->m_buildConfigurations.removeOne(configuration);
|
||||
|
||||
emit removedBuildConfiguration(configuration);
|
||||
|
||||
if (activeBuildConfiguration() == configuration) {
|
||||
if (m_buildConfigurations.isEmpty())
|
||||
if (d->m_buildConfigurations.isEmpty())
|
||||
setActiveBuildConfiguration(0);
|
||||
else
|
||||
setActiveBuildConfiguration(m_buildConfigurations.at(0));
|
||||
setActiveBuildConfiguration(d->m_buildConfigurations.at(0));
|
||||
}
|
||||
|
||||
delete configuration;
|
||||
@@ -136,28 +159,28 @@ void Target::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||
|
||||
QList<BuildConfiguration *> Target::buildConfigurations() const
|
||||
{
|
||||
return m_buildConfigurations;
|
||||
return d->m_buildConfigurations;
|
||||
}
|
||||
|
||||
BuildConfiguration *Target::activeBuildConfiguration() const
|
||||
{
|
||||
return m_activeBuildConfiguration;
|
||||
return d->m_activeBuildConfiguration;
|
||||
}
|
||||
|
||||
void Target::setActiveBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
if ((!configuration && m_buildConfigurations.isEmpty()) ||
|
||||
(configuration && m_buildConfigurations.contains(configuration) &&
|
||||
configuration != m_activeBuildConfiguration)) {
|
||||
m_activeBuildConfiguration = configuration;
|
||||
emit activeBuildConfigurationChanged(m_activeBuildConfiguration);
|
||||
if ((!configuration && d->m_buildConfigurations.isEmpty()) ||
|
||||
(configuration && d->m_buildConfigurations.contains(configuration) &&
|
||||
configuration != d->m_activeBuildConfiguration)) {
|
||||
d->m_activeBuildConfiguration = configuration;
|
||||
emit activeBuildConfigurationChanged(d->m_activeBuildConfiguration);
|
||||
emit environmentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Target::addDeployConfiguration(DeployConfiguration *dc)
|
||||
{
|
||||
QTC_ASSERT(dc && !m_deployConfigurations.contains(dc), return);
|
||||
QTC_ASSERT(dc && !d->m_deployConfigurations.contains(dc), return);
|
||||
Q_ASSERT(dc->target() == this);
|
||||
|
||||
if (!deployConfigurationFactory())
|
||||
@@ -166,17 +189,17 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QString configurationDisplayName = dc->displayName();
|
||||
QStringList displayNames;
|
||||
foreach (const DeployConfiguration *current, m_deployConfigurations)
|
||||
foreach (const DeployConfiguration *current, d->m_deployConfigurations)
|
||||
displayNames << current->displayName();
|
||||
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
|
||||
dc->setDisplayName(configurationDisplayName);
|
||||
|
||||
// add it
|
||||
m_deployConfigurations.push_back(dc);
|
||||
d->m_deployConfigurations.push_back(dc);
|
||||
|
||||
emit addedDeployConfiguration(dc);
|
||||
|
||||
if (!m_activeDeployConfiguration)
|
||||
if (!d->m_activeDeployConfiguration)
|
||||
setActiveDeployConfiguration(dc);
|
||||
Q_ASSERT(activeDeployConfiguration());
|
||||
}
|
||||
@@ -184,18 +207,18 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
|
||||
void Target::removeDeployConfiguration(DeployConfiguration *dc)
|
||||
{
|
||||
//todo: this might be error prone
|
||||
if (!m_deployConfigurations.contains(dc))
|
||||
if (!d->m_deployConfigurations.contains(dc))
|
||||
return;
|
||||
|
||||
m_deployConfigurations.removeOne(dc);
|
||||
d->m_deployConfigurations.removeOne(dc);
|
||||
|
||||
emit removedDeployConfiguration(dc);
|
||||
|
||||
if (activeDeployConfiguration() == dc) {
|
||||
if (m_deployConfigurations.isEmpty())
|
||||
if (d->m_deployConfigurations.isEmpty())
|
||||
setActiveDeployConfiguration(0);
|
||||
else
|
||||
setActiveDeployConfiguration(m_deployConfigurations.at(0));
|
||||
setActiveDeployConfiguration(d->m_deployConfigurations.at(0));
|
||||
}
|
||||
|
||||
delete dc;
|
||||
@@ -203,43 +226,43 @@ void Target::removeDeployConfiguration(DeployConfiguration *dc)
|
||||
|
||||
QList<DeployConfiguration *> Target::deployConfigurations() const
|
||||
{
|
||||
return m_deployConfigurations;
|
||||
return d->m_deployConfigurations;
|
||||
}
|
||||
|
||||
DeployConfiguration *Target::activeDeployConfiguration() const
|
||||
{
|
||||
return m_activeDeployConfiguration;
|
||||
return d->m_activeDeployConfiguration;
|
||||
}
|
||||
|
||||
void Target::setActiveDeployConfiguration(DeployConfiguration *dc)
|
||||
{
|
||||
if ((!dc && m_deployConfigurations.isEmpty()) ||
|
||||
(dc && m_deployConfigurations.contains(dc) &&
|
||||
dc != m_activeDeployConfiguration)) {
|
||||
m_activeDeployConfiguration = dc;
|
||||
emit activeDeployConfigurationChanged(m_activeDeployConfiguration);
|
||||
if ((!dc && d->m_deployConfigurations.isEmpty()) ||
|
||||
(dc && d->m_deployConfigurations.contains(dc) &&
|
||||
dc != d->m_activeDeployConfiguration)) {
|
||||
d->m_activeDeployConfiguration = dc;
|
||||
emit activeDeployConfigurationChanged(d->m_activeDeployConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
QList<RunConfiguration *> Target::runConfigurations() const
|
||||
{
|
||||
return m_runConfigurations;
|
||||
return d->m_runConfigurations;
|
||||
}
|
||||
|
||||
void Target::addRunConfiguration(RunConfiguration* runConfiguration)
|
||||
{
|
||||
QTC_ASSERT(runConfiguration && !m_runConfigurations.contains(runConfiguration), return);
|
||||
QTC_ASSERT(runConfiguration && !d->m_runConfigurations.contains(runConfiguration), return);
|
||||
Q_ASSERT(runConfiguration->target() == this);
|
||||
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QString configurationDisplayName = runConfiguration->displayName();
|
||||
QStringList displayNames;
|
||||
foreach (const RunConfiguration *rc, m_runConfigurations)
|
||||
foreach (const RunConfiguration *rc, d->m_runConfigurations)
|
||||
displayNames << rc->displayName();
|
||||
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
|
||||
runConfiguration->setDisplayName(configurationDisplayName);
|
||||
|
||||
m_runConfigurations.push_back(runConfiguration);
|
||||
d->m_runConfigurations.push_back(runConfiguration);
|
||||
emit addedRunConfiguration(runConfiguration);
|
||||
|
||||
if (!activeRunConfiguration())
|
||||
@@ -248,15 +271,15 @@ void Target::addRunConfiguration(RunConfiguration* runConfiguration)
|
||||
|
||||
void Target::removeRunConfiguration(RunConfiguration* runConfiguration)
|
||||
{
|
||||
QTC_ASSERT(runConfiguration && m_runConfigurations.contains(runConfiguration), return);
|
||||
QTC_ASSERT(runConfiguration && d->m_runConfigurations.contains(runConfiguration), return);
|
||||
|
||||
m_runConfigurations.removeOne(runConfiguration);
|
||||
d->m_runConfigurations.removeOne(runConfiguration);
|
||||
|
||||
if (activeRunConfiguration() == runConfiguration) {
|
||||
if (m_runConfigurations.isEmpty())
|
||||
if (d->m_runConfigurations.isEmpty())
|
||||
setActiveRunConfiguration(0);
|
||||
else
|
||||
setActiveRunConfiguration(m_runConfigurations.at(0));
|
||||
setActiveRunConfiguration(d->m_runConfigurations.at(0));
|
||||
}
|
||||
|
||||
emit removedRunConfiguration(runConfiguration);
|
||||
@@ -265,54 +288,54 @@ void Target::removeRunConfiguration(RunConfiguration* runConfiguration)
|
||||
|
||||
RunConfiguration* Target::activeRunConfiguration() const
|
||||
{
|
||||
return m_activeRunConfiguration;
|
||||
return d->m_activeRunConfiguration;
|
||||
}
|
||||
|
||||
void Target::setActiveRunConfiguration(RunConfiguration* configuration)
|
||||
{
|
||||
if ((!configuration && m_runConfigurations.isEmpty()) ||
|
||||
(configuration && m_runConfigurations.contains(configuration) &&
|
||||
configuration != m_activeRunConfiguration)) {
|
||||
m_activeRunConfiguration = configuration;
|
||||
emit activeRunConfigurationChanged(m_activeRunConfiguration);
|
||||
if ((!configuration && d->m_runConfigurations.isEmpty()) ||
|
||||
(configuration && d->m_runConfigurations.contains(configuration) &&
|
||||
configuration != d->m_activeRunConfiguration)) {
|
||||
d->m_activeRunConfiguration = configuration;
|
||||
emit activeRunConfigurationChanged(d->m_activeRunConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
bool Target::isEnabled() const
|
||||
{
|
||||
return m_isEnabled;
|
||||
return d->m_isEnabled;
|
||||
}
|
||||
|
||||
QIcon Target::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
return d->m_icon;
|
||||
}
|
||||
|
||||
void Target::setIcon(QIcon icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
d->m_icon = icon;
|
||||
emit iconChanged();
|
||||
}
|
||||
|
||||
QIcon Target::overlayIcon() const
|
||||
{
|
||||
return m_overlayIcon;
|
||||
return d->m_overlayIcon;
|
||||
}
|
||||
|
||||
void Target::setOverlayIcon(QIcon icon)
|
||||
{
|
||||
m_overlayIcon = icon;
|
||||
d->m_overlayIcon = icon;
|
||||
emit overlayIconChanged();
|
||||
}
|
||||
|
||||
QString Target::toolTip() const
|
||||
{
|
||||
return m_toolTip;
|
||||
return d->m_toolTip;
|
||||
}
|
||||
|
||||
void Target::setToolTip(const QString &text)
|
||||
{
|
||||
m_toolTip = text;
|
||||
d->m_toolTip = text;
|
||||
emit toolTipChanged();
|
||||
}
|
||||
|
||||
@@ -321,19 +344,19 @@ QVariantMap Target::toMap() const
|
||||
const QList<BuildConfiguration *> bcs = buildConfigurations();
|
||||
|
||||
QVariantMap map(ProjectConfiguration::toMap());
|
||||
map.insert(QLatin1String(ACTIVE_BC_KEY), bcs.indexOf(m_activeBuildConfiguration));
|
||||
map.insert(QLatin1String(ACTIVE_BC_KEY), bcs.indexOf(d->m_activeBuildConfiguration));
|
||||
map.insert(QLatin1String(BC_COUNT_KEY), bcs.size());
|
||||
for (int i = 0; i < bcs.size(); ++i)
|
||||
map.insert(QString::fromLatin1(BC_KEY_PREFIX) + QString::number(i), bcs.at(i)->toMap());
|
||||
|
||||
const QList<DeployConfiguration *> dcs = deployConfigurations();
|
||||
map.insert(QLatin1String(ACTIVE_DC_KEY), dcs.indexOf(m_activeDeployConfiguration));
|
||||
map.insert(QLatin1String(ACTIVE_DC_KEY), dcs.indexOf(d->m_activeDeployConfiguration));
|
||||
map.insert(QLatin1String(DC_COUNT_KEY), dcs.size());
|
||||
for (int i = 0; i < dcs.size(); ++i)
|
||||
map.insert(QString::fromLatin1(DC_KEY_PREFIX) + QString::number(i), dcs.at(i)->toMap());
|
||||
|
||||
const QList<RunConfiguration *> rcs = runConfigurations();
|
||||
map.insert(QLatin1String(ACTIVE_RC_KEY), rcs.indexOf(m_activeRunConfiguration));
|
||||
map.insert(QLatin1String(ACTIVE_RC_KEY), rcs.indexOf(d->m_activeRunConfiguration));
|
||||
map.insert(QLatin1String(RC_COUNT_KEY), rcs.size());
|
||||
for (int i = 0; i < rcs.size(); ++i)
|
||||
map.insert(QString::fromLatin1(RC_KEY_PREFIX) + QString::number(i), rcs.at(i)->toMap());
|
||||
@@ -343,11 +366,11 @@ QVariantMap Target::toMap() const
|
||||
|
||||
void Target::setEnabled(bool enabled)
|
||||
{
|
||||
if (enabled == m_isEnabled)
|
||||
if (enabled == d->m_isEnabled)
|
||||
return;
|
||||
|
||||
m_isEnabled = enabled;
|
||||
emit targetEnabled(m_isEnabled);
|
||||
d->m_isEnabled = enabled;
|
||||
emit targetEnabled(d->m_isEnabled);
|
||||
}
|
||||
|
||||
bool Target::fromMap(const QVariantMap &map)
|
||||
@@ -451,3 +474,5 @@ ITargetFactory::ITargetFactory(QObject *parent) :
|
||||
|
||||
ITargetFactory::~ITargetFactory()
|
||||
{ }
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "projectconfiguration.h"
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
QT_FORWARD_DECLARE_CLASS(QIcon)
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -46,6 +46,8 @@ class DeployConfigurationFactory;
|
||||
class IRunConfigurationFactory;
|
||||
class Project;
|
||||
|
||||
class TargetPrivate;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT Target : public ProjectConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -136,17 +138,7 @@ private slots:
|
||||
void changeEnvironment();
|
||||
|
||||
private:
|
||||
bool m_isEnabled;
|
||||
QIcon m_icon;
|
||||
QIcon m_overlayIcon;
|
||||
QString m_toolTip;
|
||||
|
||||
QList<BuildConfiguration *> m_buildConfigurations;
|
||||
BuildConfiguration *m_activeBuildConfiguration;
|
||||
QList<DeployConfiguration *> m_deployConfigurations;
|
||||
DeployConfiguration *m_activeDeployConfiguration;
|
||||
QList<RunConfiguration *> m_runConfigurations;
|
||||
RunConfiguration* m_activeRunConfiguration;
|
||||
QScopedPointer<TargetPrivate> d;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ITargetFactory :
|
||||
|
||||
Reference in New Issue
Block a user