Commit fab70e72 authored by kh1's avatar kh1
Browse files

No need to have a function if we can call connect inside the class ctor.

parent 69ebf668
...@@ -107,6 +107,11 @@ void MaemoRunConfiguration::init() ...@@ -107,6 +107,11 @@ void MaemoRunConfiguration::init()
qemu = new QProcess(this); qemu = new QProcess(this);
connect(qemu, SIGNAL(finished(int, QProcess::ExitStatus)), this, connect(qemu, SIGNAL(finished(int, QProcess::ExitStatus)), this,
SLOT(qemuProcessFinished())); SLOT(qemuProcessFinished()));
connect(&MaemoManager::instance(), SIGNAL(startStopQemu()), this,
SLOT(startStopQemu()));
connect(this, SIGNAL(qemuProcessStatus(bool)), &MaemoManager::instance(),
SLOT(updateQemuSimulatorStarter(bool)));
} }
MaemoRunConfiguration::~MaemoRunConfiguration() MaemoRunConfiguration::~MaemoRunConfiguration()
......
...@@ -113,7 +113,7 @@ QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) c ...@@ -113,7 +113,7 @@ QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) c
QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const
{ {
QString target(targetFromId(id)); const QString &target = targetFromId(id);
if (target.isEmpty()) if (target.isEmpty())
return QString(); return QString();
return tr("%1 on Maemo Device").arg(QFileInfo(target).completeBaseName()); return tr("%1 on Maemo Device").arg(QFileInfo(target).completeBaseName());
...@@ -125,10 +125,7 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent, ...@@ -125,10 +125,7 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent,
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, return new MaemoRunConfiguration(pqt4parent, targetFromId(id));
targetFromId(id));
setupRunConfiguration(rc);
return rc;
} }
...@@ -137,14 +134,13 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent, ...@@ -137,14 +134,13 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
{ {
if (!canRestore(parent, map)) if (!canRestore(parent, map))
return 0; return 0;
Qt4Target *t = static_cast<Qt4Target *>(parent); Qt4Target *target = static_cast<Qt4Target *>(parent);
MaemoRunConfiguration *rc = new MaemoRunConfiguration(t, QString()); MaemoRunConfiguration *rc = new MaemoRunConfiguration(target, QString());
if (!rc->fromMap(map)) { if (rc->fromMap(map))
delete rc; return rc;
return 0;
} delete rc;
setupRunConfiguration(rc); return 0;
return rc;
} }
RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent,
...@@ -152,23 +148,9 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, ...@@ -152,23 +148,9 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent,
{ {
if (!canClone(parent, source)) if (!canClone(parent, source))
return 0; return 0;
Qt4Target *t = static_cast<Qt4Target *>(parent);
MaemoRunConfiguration *old = static_cast<MaemoRunConfiguration *>(source);
MaemoRunConfiguration *rc = new MaemoRunConfiguration(t, old);
setupRunConfiguration(rc);
return rc; MaemoRunConfiguration *old = static_cast<MaemoRunConfiguration *>(source);
} return new MaemoRunConfiguration(static_cast<Qt4Target *>(parent), old);
void MaemoRunConfigurationFactory::setupRunConfiguration(MaemoRunConfiguration *rc)
{
if (rc) {
connect(&MaemoManager::instance(), SIGNAL(startStopQemu()), rc,
SLOT(startStopQemu()));
connect(rc, SIGNAL(qemuProcessStatus(bool)), &MaemoManager::instance(),
SLOT(updateQemuSimulatorStarter(bool)));
}
} }
void MaemoRunConfigurationFactory::projectAdded( void MaemoRunConfigurationFactory::projectAdded(
......
...@@ -70,9 +70,6 @@ private slots: ...@@ -70,9 +70,6 @@ private slots:
void targetRemoved(ProjectExplorer::Target *target); void targetRemoved(ProjectExplorer::Target *target);
void currentProjectChanged(ProjectExplorer::Project *project); void currentProjectChanged(ProjectExplorer::Project *project);
private:
void setupRunConfiguration(MaemoRunConfiguration *rc);
}; };
class MaemoRunControlFactory : public IRunControlFactory class MaemoRunControlFactory : public IRunControlFactory
......
Supports Markdown
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