Style cleanup, no functional change.

This commit is contained in:
kh1
2010-02-22 15:56:08 +01:00
parent 6bee68dcff
commit 48abff252f

View File

@@ -137,7 +137,7 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
} }
MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent, MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
MaemoRunConfiguration *source) MaemoRunConfiguration *source)
: RunConfiguration(parent, source) : RunConfiguration(parent, source)
, m_executable(source->m_executable) , m_executable(source->m_executable)
, m_proFilePath(source->m_proFilePath) , m_proFilePath(source->m_proFilePath)
@@ -169,17 +169,18 @@ void MaemoRunConfiguration::init()
setDisplayName(tr("MaemoRunConfiguration")); setDisplayName(tr("MaemoRunConfiguration"));
} }
connect(&MaemoDeviceConfigurations::instance(), SIGNAL(updated()), connect(&MaemoDeviceConfigurations::instance(), SIGNAL(updated()), this,
this, SLOT(updateDeviceConfigurations())); SLOT(updateDeviceConfigurations()));
connect(qt4Target(), SIGNAL(targetInformationChanged()), connect(qt4Target(), SIGNAL(targetInformationChanged()), this,
this, SLOT(invalidateCachedTargetInformation())); SLOT(invalidateCachedTargetInformation()));
connect(qt4Target(), SIGNAL(targetInformationChanged()), connect(qt4Target(), SIGNAL(targetInformationChanged()), this,
this, SLOT(enabledStateChanged())); SLOT(enabledStateChanged()));
connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), connect(qt4Target()->qt4Project(),
this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*))); SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*)));
qemu = new QProcess(this); qemu = new QProcess(this);
connect(qemu, SIGNAL(error(QProcess::ProcessError)), &dumper, connect(qemu, SIGNAL(error(QProcess::ProcessError)), &dumper,
@@ -239,7 +240,8 @@ QVariantMap MaemoRunConfiguration::toMap() const
map.insert(SimulatorPathKey, m_simulatorPath); map.insert(SimulatorPathKey, m_simulatorPath);
const QDir &dir = QFileInfo(qt4Target()->qt4Project()->file()->fileName()).absoluteDir(); const QDir &dir = QFileInfo(qt4Target()->qt4Project()->file()->fileName())
.absoluteDir();
map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath)); map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath));
return map; return map;
@@ -260,7 +262,8 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
m_simulatorPath = map.value(SimulatorPathKey).toString(); m_simulatorPath = map.value(SimulatorPathKey).toString();
const QDir &dir = QFileInfo(qt4Target()->qt4Project()->file()->fileName()).absoluteDir(); const QDir &dir = QFileInfo(qt4Target()->qt4Project()->file()->fileName())
.absoluteDir();
m_proFilePath = dir.filePath(map.value(ProFileKey).toString()); m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
return true; return true;
@@ -438,8 +441,9 @@ void MaemoRunConfiguration::updateTarget() const
m_executable.clear(); m_executable.clear();
m_cachedTargetInformationValid = true; m_cachedTargetInformationValid = true;
Qt4TargetInformation info = qt4Target()->targetInformation(activeQt4BuildConfiguration(), Qt4TargetInformation info =
m_proFilePath); qt4Target()->targetInformation(activeQt4BuildConfiguration(),
m_proFilePath);
if (info.error != Qt4TargetInformation::NoError) { if (info.error != Qt4TargetInformation::NoError) {
if (info.error == Qt4TargetInformation::ProParserError) { if (info.error == Qt4TargetInformation::ProParserError) {
Core::ICore::instance()->messageManager()->printToOutputPane(tr( Core::ICore::instance()->messageManager()->printToOutputPane(tr(
@@ -581,18 +585,20 @@ void MaemoRunConfiguration::updateDeviceConfigurations()
emit deviceConfigurationsUpdated(); emit deviceConfigurationsUpdated();
} }
// #pragma mark -- MaemoRunConfigurationFactory // #pragma mark -- MaemoRunConfigurationFactory
MaemoRunConfigurationFactory::MaemoRunConfigurationFactory(QObject *parent) :
IRunConfigurationFactory(parent) MaemoRunConfigurationFactory::MaemoRunConfigurationFactory(QObject *parent)
: IRunConfigurationFactory(parent)
{ {
ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance();
connect(explorer->session(), SIGNAL(projectAdded(ProjectExplorer::Project*)), connect(explorer->session(), SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(projectAdded(ProjectExplorer::Project*))); this, SLOT(projectAdded(ProjectExplorer::Project*)));
connect(explorer->session(), SIGNAL(projectRemoved(ProjectExplorer::Project*)), connect(explorer->session(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(projectRemoved(ProjectExplorer::Project*))); this, SLOT(projectRemoved(ProjectExplorer::Project*)));
connect(explorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)), connect(explorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
this, SLOT(currentProjectChanged(ProjectExplorer::Project*))); this, SLOT(currentProjectChanged(ProjectExplorer::Project*)));
} }
MaemoRunConfigurationFactory::~MaemoRunConfigurationFactory() MaemoRunConfigurationFactory::~MaemoRunConfigurationFactory()
@@ -600,39 +606,39 @@ MaemoRunConfigurationFactory::~MaemoRunConfigurationFactory()
} }
bool MaemoRunConfigurationFactory::canCreate(Target *parent, bool MaemoRunConfigurationFactory::canCreate(Target *parent,
const QString &id) const const QString &id) const
{ {
Qt4Target * t = qobject_cast<Qt4Target *>(parent); Qt4Target *target = qobject_cast<Qt4Target *>(parent);
if (!t || if (!target
(t->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID) && || (target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID)
t->id() != QLatin1String(MAEMO_EMULATOR_TARGET_ID))) && target->id() != QLatin1String(MAEMO_EMULATOR_TARGET_ID))) {
return false; return false;
}
return id == QLatin1String(MAEMO_RC_ID); return id == QLatin1String(MAEMO_RC_ID);
} }
bool MaemoRunConfigurationFactory::canRestore(Target *parent, bool MaemoRunConfigurationFactory::canRestore(Target *parent,
const QVariantMap &map) const const QVariantMap &map) const
{ {
QString id(ProjectExplorer::idFromMap(map)); return canCreate(parent, ProjectExplorer::idFromMap(map));
return canCreate(parent, id);
} }
bool MaemoRunConfigurationFactory::canClone(Target *parent, bool MaemoRunConfigurationFactory::canClone(Target *parent,
RunConfiguration *source) const RunConfiguration *source) const
{ {
QString id(source->id()); return canCreate(parent, source->id());
return canCreate(parent, id);
} }
QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) const QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) const
{ {
Qt4Target *t = qobject_cast<Qt4Target *>(parent); if (Qt4Target *t = qobject_cast<Qt4Target *>(parent)) {
if (!t || if (t->id() == QLatin1String(MAEMO_DEVICE_TARGET_ID)
(t->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID) && || t->id() == QLatin1String(MAEMO_EMULATOR_TARGET_ID)) {
t->id() != QLatin1String(MAEMO_EMULATOR_TARGET_ID))) return t->qt4Project()->
return QStringList(); applicationProFilePathes(QLatin1String(MAEMO_RC_ID_PREFIX));
}
return t->qt4Project()->applicationProFilePathes(QLatin1String(MAEMO_RC_ID_PREFIX)); }
return QStringList();
} }
QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const
@@ -644,19 +650,20 @@ QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const
} }
RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent, RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent,
const QString &id) const QString &id)
{ {
if (!canCreate(parent, id)) if (!canCreate(parent, id))
return 0; return 0;
Qt4Target *pqt4parent = static_cast<Qt4Target *>(parent); Qt4Target *pqt4parent = static_cast<Qt4Target *>(parent);
MaemoRunConfiguration *rc = new MaemoRunConfiguration(pqt4parent, targetFromId(id)); MaemoRunConfiguration *rc = new MaemoRunConfiguration(pqt4parent,
targetFromId(id));
setupRunConfiguration(rc); setupRunConfiguration(rc);
return rc; return rc;
} }
RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent, RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
const QVariantMap &map) const QVariantMap &map)
{ {
if (!canRestore(parent, map)) if (!canRestore(parent, map))
return 0; return 0;
@@ -671,7 +678,7 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
} }
RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent,
RunConfiguration *source) RunConfiguration *source)
{ {
if (!canClone(parent, source)) if (!canClone(parent, source))
return 0; return 0;
@@ -686,22 +693,21 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent,
void MaemoRunConfigurationFactory::setupRunConfiguration(MaemoRunConfiguration *rc) void MaemoRunConfigurationFactory::setupRunConfiguration(MaemoRunConfiguration *rc)
{ {
if (!rc) if (rc) {
return; connect(MaemoManager::instance(), SIGNAL(startStopQemu()), rc,
SLOT(startStopQemu()));
connect(MaemoManager::instance(), SIGNAL(startStopQemu()), connect(rc, SIGNAL(qemuProcessStatus(bool)), MaemoManager::instance(),
rc, SLOT(startStopQemu())); SLOT(updateQemuSimulatorStarter(bool)));
connect(rc, SIGNAL(qemuProcessStatus(bool)), }
MaemoManager::instance(), SLOT(updateQemuSimulatorStarter(bool)));
} }
void MaemoRunConfigurationFactory::projectAdded( void MaemoRunConfigurationFactory::projectAdded(
ProjectExplorer::Project *project) ProjectExplorer::Project *project)
{ {
disconnect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), disconnect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), this,
this, SLOT(targetAdded(ProjectExplorer::Target*))); SLOT(targetAdded(ProjectExplorer::Target*)));
disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), this,
this, SLOT(targetRemoved(ProjectExplorer::Target*))); SLOT(targetRemoved(ProjectExplorer::Target*)));
foreach (Target *target, project->targets()) foreach (Target *target, project->targets())
targetAdded(target); targetAdded(target);
@@ -710,10 +716,10 @@ void MaemoRunConfigurationFactory::projectAdded(
void MaemoRunConfigurationFactory::projectRemoved( void MaemoRunConfigurationFactory::projectRemoved(
ProjectExplorer::Project *project) ProjectExplorer::Project *project)
{ {
connect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), connect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), this,
this, SLOT(targetAdded(ProjectExplorer::Target*))); SLOT(targetAdded(ProjectExplorer::Target*)));
connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), this,
this, SLOT(targetRemoved(ProjectExplorer::Target*))); SLOT(targetRemoved(ProjectExplorer::Target*)));
foreach (Target *target, project->targets()) foreach (Target *target, project->targets())
targetRemoved(target); targetRemoved(target);
@@ -721,8 +727,8 @@ void MaemoRunConfigurationFactory::projectRemoved(
void MaemoRunConfigurationFactory::targetAdded(ProjectExplorer::Target *target) void MaemoRunConfigurationFactory::targetAdded(ProjectExplorer::Target *target)
{ {
if (target->id() != QLatin1String(MAEMO_EMULATOR_TARGET_ID) && if (target->id() != QLatin1String(MAEMO_EMULATOR_TARGET_ID)
target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID)) && target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID))
return; return;
MaemoManager::instance()->addQemuSimulatorStarter(target->project()); MaemoManager::instance()->addQemuSimulatorStarter(target->project());
@@ -730,8 +736,8 @@ void MaemoRunConfigurationFactory::targetAdded(ProjectExplorer::Target *target)
void MaemoRunConfigurationFactory::targetRemoved(ProjectExplorer::Target *target) void MaemoRunConfigurationFactory::targetRemoved(ProjectExplorer::Target *target)
{ {
if (target->id() != QLatin1String(MAEMO_EMULATOR_TARGET_ID) && if (target->id() != QLatin1String(MAEMO_EMULATOR_TARGET_ID)
target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID)) && target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID))
return; return;
MaemoManager::instance()->removeQemuSimulatorStarter(target->project()); MaemoManager::instance()->removeQemuSimulatorStarter(target->project());
@@ -746,13 +752,14 @@ void MaemoRunConfigurationFactory::currentProjectChanged(
Target *maemoTarget(project->target(QLatin1String(MAEMO_EMULATOR_TARGET_ID))); Target *maemoTarget(project->target(QLatin1String(MAEMO_EMULATOR_TARGET_ID)));
if (!maemoTarget) if (!maemoTarget)
maemoTarget = project->target(QLatin1String(MAEMO_DEVICE_TARGET_ID)); maemoTarget = project->target(QLatin1String(MAEMO_DEVICE_TARGET_ID));
MaemoManager::instance()->setQemuSimulatorStarterEnabled(maemoTarget); MaemoManager::instance()->setQemuSimulatorStarterEnabled(maemoTarget != 0);
bool isRunning(false); bool isRunning = false;
if (maemoTarget && if (maemoTarget
project->activeTarget() == maemoTarget && && project->activeTarget() == maemoTarget
maemoTarget->activeRunConfiguration()) { && maemoTarget->activeRunConfiguration()) {
MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(maemoTarget->activeRunConfiguration()); MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>
(maemoTarget->activeRunConfiguration());
if (mrc) if (mrc)
isRunning = mrc->isQemuRunning(); isRunning = mrc->isQemuRunning();
} }