Commit d4f6e347 authored by hjk's avatar hjk

projectexplorer: fix style

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