forked from qt-creator/qt-creator
projectexplorer: fix style
This commit is contained in:
@@ -70,6 +70,8 @@ public:
|
|||||||
RunConfigurationFactoryMatcher(Target * target) : m_target(target)
|
RunConfigurationFactoryMatcher(Target * target) : m_target(target)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
virtual ~RunConfigurationFactoryMatcher() { }
|
||||||
|
|
||||||
virtual bool operator()(IRunConfigurationFactory *) const = 0;
|
virtual bool operator()(IRunConfigurationFactory *) const = 0;
|
||||||
|
|
||||||
Target *target() const
|
Target *target() const
|
||||||
@@ -88,7 +90,6 @@ public:
|
|||||||
RunConfigurationFactoryMatcher(target),
|
RunConfigurationFactoryMatcher(target),
|
||||||
m_id(id)
|
m_id(id)
|
||||||
{ }
|
{ }
|
||||||
~CreateMatcher() { }
|
|
||||||
|
|
||||||
bool operator()(IRunConfigurationFactory *factory) const
|
bool operator()(IRunConfigurationFactory *factory) const
|
||||||
{
|
{
|
||||||
@@ -106,7 +107,6 @@ public:
|
|||||||
RunConfigurationFactoryMatcher(target),
|
RunConfigurationFactoryMatcher(target),
|
||||||
m_source(source)
|
m_source(source)
|
||||||
{ }
|
{ }
|
||||||
~CloneMatcher() { }
|
|
||||||
|
|
||||||
bool operator()(IRunConfigurationFactory *factory) const
|
bool operator()(IRunConfigurationFactory *factory) const
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,6 @@ public:
|
|||||||
RunConfigurationFactoryMatcher(target),
|
RunConfigurationFactoryMatcher(target),
|
||||||
m_map(map)
|
m_map(map)
|
||||||
{ }
|
{ }
|
||||||
~RestoreMatcher() { }
|
|
||||||
|
|
||||||
bool operator()(IRunConfigurationFactory *factory) const
|
bool operator()(IRunConfigurationFactory *factory) const
|
||||||
{
|
{
|
||||||
@@ -137,11 +136,11 @@ private:
|
|||||||
|
|
||||||
// Helper methods:
|
// Helper methods:
|
||||||
|
|
||||||
IRunConfigurationFactory * findRunConfigurationFactory(RunConfigurationFactoryMatcher &matcher)
|
IRunConfigurationFactory *findRunConfigurationFactory(RunConfigurationFactoryMatcher &matcher)
|
||||||
{
|
{
|
||||||
QList<IRunConfigurationFactory *>
|
QList<IRunConfigurationFactory *> factories
|
||||||
factories(ExtensionSystem::PluginManager::instance()->
|
= ExtensionSystem::PluginManager::instance()->
|
||||||
getObjects<IRunConfigurationFactory>());
|
getObjects<IRunConfigurationFactory>();
|
||||||
foreach (IRunConfigurationFactory *factory, factories) {
|
foreach (IRunConfigurationFactory *factory, factories) {
|
||||||
if (matcher(factory))
|
if (matcher(factory))
|
||||||
return factory;
|
return factory;
|
||||||
@@ -273,7 +272,7 @@ void RunConfiguration::setQmlDebugServerPort(uint port)
|
|||||||
|
|
||||||
QVariantMap RunConfiguration::toMap() const
|
QVariantMap RunConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(ProjectConfiguration::toMap());
|
QVariantMap map = ProjectConfiguration::toMap();
|
||||||
map.insert(QLatin1String(USE_CPP_DEBUGGER_KEY), m_useCppDebugger);
|
map.insert(QLatin1String(USE_CPP_DEBUGGER_KEY), m_useCppDebugger);
|
||||||
map.insert(QLatin1String(USE_QML_DEBUGGER_KEY), m_useQmlDebugger);
|
map.insert(QLatin1String(USE_QML_DEBUGGER_KEY), m_useQmlDebugger);
|
||||||
map.insert(QLatin1String(QML_DEBUG_SERVER_PORT_KEY), m_qmlDebugServerPort);
|
map.insert(QLatin1String(QML_DEBUG_SERVER_PORT_KEY), m_qmlDebugServerPort);
|
||||||
|
|||||||
@@ -46,17 +46,17 @@
|
|||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const char * const ACTIVE_BC_KEY("ProjectExplorer.Target.ActiveBuildConfiguration");
|
const char * const ACTIVE_BC_KEY = "ProjectExplorer.Target.ActiveBuildConfiguration";
|
||||||
const char * const BC_KEY_PREFIX("ProjectExplorer.Target.BuildConfiguration.");
|
const char * const BC_KEY_PREFIX = "ProjectExplorer.Target.BuildConfiguration.";
|
||||||
const char * const BC_COUNT_KEY("ProjectExplorer.Target.BuildConfigurationCount");
|
const char * const BC_COUNT_KEY = "ProjectExplorer.Target.BuildConfigurationCount";
|
||||||
|
|
||||||
const char * const ACTIVE_DC_KEY("ProjectExplorer.Target.ActiveDeployConfiguration");
|
const char * const ACTIVE_DC_KEY = "ProjectExplorer.Target.ActiveDeployConfiguration";
|
||||||
const char * const DC_KEY_PREFIX("ProjectExplorer.Target.DeployConfiguration.");
|
const char * const DC_KEY_PREFIX = "ProjectExplorer.Target.DeployConfiguration.";
|
||||||
const char * const DC_COUNT_KEY("ProjectExplorer.Target.DeployConfigurationCount");
|
const char * const DC_COUNT_KEY = "ProjectExplorer.Target.DeployConfigurationCount";
|
||||||
|
|
||||||
const char * const ACTIVE_RC_KEY("ProjectExplorer.Target.ActiveRunConfiguration");
|
const char * const ACTIVE_RC_KEY = "ProjectExplorer.Target.ActiveRunConfiguration";
|
||||||
const char * const RC_KEY_PREFIX("ProjectExplorer.Target.RunConfiguration.");
|
const char * const RC_KEY_PREFIX = "ProjectExplorer.Target.RunConfiguration.";
|
||||||
const char * const RC_COUNT_KEY("ProjectExplorer.Target.RunConfigurationCount");
|
const char * const RC_COUNT_KEY = "ProjectExplorer.Target.RunConfigurationCount";
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@@ -66,7 +66,8 @@ const char * const RC_COUNT_KEY("ProjectExplorer.Target.RunConfigurationCount");
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class TargetPrivate {
|
class TargetPrivate
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
TargetPrivate();
|
TargetPrivate();
|
||||||
|
|
||||||
@@ -112,14 +113,14 @@ Target::~Target()
|
|||||||
|
|
||||||
void Target::changeEnvironment()
|
void Target::changeEnvironment()
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildConfiguration *bc(qobject_cast<ProjectExplorer::BuildConfiguration *>(sender()));
|
BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(sender());
|
||||||
if (bc == activeBuildConfiguration())
|
if (bc == activeBuildConfiguration())
|
||||||
emit environmentChanged();
|
emit environmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Target::changeBuildConfigurationEnabled()
|
void Target::changeBuildConfigurationEnabled()
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildConfiguration *bc = qobject_cast<ProjectExplorer::BuildConfiguration *>(sender());
|
BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(sender());
|
||||||
if (bc == activeBuildConfiguration())
|
if (bc == activeBuildConfiguration())
|
||||||
emit buildConfigurationEnabledChanged();
|
emit buildConfigurationEnabledChanged();
|
||||||
}
|
}
|
||||||
@@ -454,20 +455,20 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
int bcCount(map.value(QLatin1String(BC_COUNT_KEY), 0).toInt(&ok));
|
int bcCount = map.value(QLatin1String(BC_COUNT_KEY), 0).toInt(&ok);
|
||||||
if (!ok || bcCount < 0)
|
if (!ok || bcCount < 0)
|
||||||
bcCount = 0;
|
bcCount = 0;
|
||||||
int activeConfiguration(map.value(QLatin1String(ACTIVE_BC_KEY), 0).toInt(&ok));
|
int activeConfiguration = map.value(QLatin1String(ACTIVE_BC_KEY), 0).toInt(&ok);
|
||||||
if (!ok || activeConfiguration < 0)
|
if (!ok || activeConfiguration < 0)
|
||||||
activeConfiguration = 0;
|
activeConfiguration = 0;
|
||||||
if (0 > activeConfiguration || bcCount < activeConfiguration)
|
if (0 > activeConfiguration || bcCount < activeConfiguration)
|
||||||
activeConfiguration = 0;
|
activeConfiguration = 0;
|
||||||
|
|
||||||
for (int i = 0; i < bcCount; ++i) {
|
for (int i = 0; i < bcCount; ++i) {
|
||||||
const QString key(QString::fromLatin1(BC_KEY_PREFIX) + QString::number(i));
|
const QString key = QString::fromLatin1(BC_KEY_PREFIX) + QString::number(i);
|
||||||
if (!map.contains(key))
|
if (!map.contains(key))
|
||||||
return false;
|
return false;
|
||||||
BuildConfiguration *bc(buildConfigurationFactory()->restore(this, map.value(key).toMap()));
|
BuildConfiguration *bc = buildConfigurationFactory()->restore(this, map.value(key).toMap());
|
||||||
if (!bc)
|
if (!bc)
|
||||||
continue;
|
continue;
|
||||||
addBuildConfiguration(bc);
|
addBuildConfiguration(bc);
|
||||||
@@ -477,7 +478,7 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
if (buildConfigurations().isEmpty() && buildConfigurationFactory())
|
if (buildConfigurations().isEmpty() && buildConfigurationFactory())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int dcCount(map.value(QLatin1String(DC_COUNT_KEY), 0).toInt(&ok));
|
int dcCount = map.value(QLatin1String(DC_COUNT_KEY), 0).toInt(&ok);
|
||||||
if (!ok || dcCount < 0)
|
if (!ok || dcCount < 0)
|
||||||
dcCount = 0;
|
dcCount = 0;
|
||||||
activeConfiguration = map.value(QLatin1String(ACTIVE_DC_KEY), 0).toInt(&ok);
|
activeConfiguration = map.value(QLatin1String(ACTIVE_DC_KEY), 0).toInt(&ok);
|
||||||
@@ -487,7 +488,7 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
activeConfiguration = 0;
|
activeConfiguration = 0;
|
||||||
|
|
||||||
for (int i = 0; i < dcCount; ++i) {
|
for (int i = 0; i < dcCount; ++i) {
|
||||||
const QString key(QString::fromLatin1(DC_KEY_PREFIX) + QString::number(i));
|
const QString key = QString::fromLatin1(DC_KEY_PREFIX) + QString::number(i);
|
||||||
if (!map.contains(key))
|
if (!map.contains(key))
|
||||||
return false;
|
return false;
|
||||||
DeployConfiguration *dc = 0;
|
DeployConfiguration *dc = 0;
|
||||||
@@ -507,7 +508,7 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
if (deployConfigurations().isEmpty() && d->deployFactories().isEmpty())
|
if (deployConfigurations().isEmpty() && d->deployFactories().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int rcCount(map.value(QLatin1String(RC_COUNT_KEY), 0).toInt(&ok));
|
int rcCount = map.value(QLatin1String(RC_COUNT_KEY), 0).toInt(&ok);
|
||||||
if (!ok || rcCount < 0)
|
if (!ok || rcCount < 0)
|
||||||
rcCount = 0;
|
rcCount = 0;
|
||||||
activeConfiguration = map.value(QLatin1String(ACTIVE_RC_KEY), 0).toInt(&ok);
|
activeConfiguration = map.value(QLatin1String(ACTIVE_RC_KEY), 0).toInt(&ok);
|
||||||
@@ -517,16 +518,16 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
activeConfiguration = 0;
|
activeConfiguration = 0;
|
||||||
|
|
||||||
for (int i = 0; i < rcCount; ++i) {
|
for (int i = 0; i < rcCount; ++i) {
|
||||||
const QString key(QString::fromLatin1(RC_KEY_PREFIX) + QString::number(i));
|
const QString key = QString::fromLatin1(RC_KEY_PREFIX) + QString::number(i);
|
||||||
if (!map.contains(key))
|
if (!map.contains(key))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QVariantMap valueMap(map.value(key).toMap());
|
QVariantMap valueMap = map.value(key).toMap();
|
||||||
IRunConfigurationFactory *factory(IRunConfigurationFactory::restoreFactory(this, valueMap));
|
IRunConfigurationFactory *factory = IRunConfigurationFactory::restoreFactory(this, valueMap);
|
||||||
if (!factory)
|
if (!factory)
|
||||||
continue; // Skip RCs we do not know about.)
|
continue; // Skip RCs we do not know about.)
|
||||||
|
|
||||||
RunConfiguration *rc(factory->restore(this, valueMap));
|
RunConfiguration *rc = factory->restore(this, valueMap);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
continue;
|
continue;
|
||||||
addRunConfiguration(rc);
|
addRunConfiguration(rc);
|
||||||
@@ -547,7 +548,4 @@ ITargetFactory::ITargetFactory(QObject *parent) :
|
|||||||
QObject(parent)
|
QObject(parent)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
ITargetFactory::~ITargetFactory()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ class PROJECTEXPLORER_EXPORT ITargetFactory :
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ITargetFactory(QObject *parent = 0);
|
explicit ITargetFactory(QObject *parent = 0);
|
||||||
virtual ~ITargetFactory();
|
|
||||||
|
|
||||||
virtual QStringList supportedTargetIds(ProjectExplorer::Project *project) const = 0;
|
virtual QStringList supportedTargetIds(ProjectExplorer::Project *project) const = 0;
|
||||||
virtual bool supportsTargetId(const QString &id) const = 0;
|
virtual bool supportsTargetId(const QString &id) const = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user