From fab70e72eb362cac57d8dfd35a5116228c2df731 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 23 Feb 2010 17:44:24 +0100 Subject: No need to have a function if we can call connect inside the class ctor. --- .../qt-maemo/maemorunconfiguration.cpp | 5 +++ .../qt-maemo/maemorunfactories.cpp | 40 ++++++---------------- .../qt4projectmanager/qt-maemo/maemorunfactories.h | 3 -- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index 2f1be28dbc..5836b7c17f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -107,6 +107,11 @@ void MaemoRunConfiguration::init() qemu = new QProcess(this); connect(qemu, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(qemuProcessFinished())); + + connect(&MaemoManager::instance(), SIGNAL(startStopQemu()), this, + SLOT(startStopQemu())); + connect(this, SIGNAL(qemuProcessStatus(bool)), &MaemoManager::instance(), + SLOT(updateQemuSimulatorStarter(bool))); } MaemoRunConfiguration::~MaemoRunConfiguration() diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp index 42034bd457..5e199b1f0c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp @@ -113,7 +113,7 @@ QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) c QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const { - QString target(targetFromId(id)); + const QString &target = targetFromId(id); if (target.isEmpty()) return QString(); return tr("%1 on Maemo Device").arg(QFileInfo(target).completeBaseName()); @@ -125,10 +125,7 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent, if (!canCreate(parent, id)) return 0; Qt4Target *pqt4parent = static_cast(parent); - MaemoRunConfiguration *rc = new MaemoRunConfiguration(pqt4parent, - targetFromId(id)); - setupRunConfiguration(rc); - return rc; + return new MaemoRunConfiguration(pqt4parent, targetFromId(id)); } @@ -137,14 +134,13 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent, { if (!canRestore(parent, map)) return 0; - Qt4Target *t = static_cast(parent); - MaemoRunConfiguration *rc = new MaemoRunConfiguration(t, QString()); - if (!rc->fromMap(map)) { - delete rc; - return 0; - } - setupRunConfiguration(rc); - return rc; + Qt4Target *target = static_cast(parent); + MaemoRunConfiguration *rc = new MaemoRunConfiguration(target, QString()); + if (rc->fromMap(map)) + return rc; + + delete rc; + return 0; } RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, @@ -152,23 +148,9 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, { if (!canClone(parent, source)) return 0; - Qt4Target *t = static_cast(parent); - MaemoRunConfiguration *old = static_cast(source); - MaemoRunConfiguration *rc = new MaemoRunConfiguration(t, old); - - setupRunConfiguration(rc); - return rc; -} - -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))); - } + MaemoRunConfiguration *old = static_cast(source); + return new MaemoRunConfiguration(static_cast(parent), old); } void MaemoRunConfigurationFactory::projectAdded( diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.h index ae99dedf94..3312e402be 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.h @@ -70,9 +70,6 @@ private slots: void targetRemoved(ProjectExplorer::Target *target); void currentProjectChanged(ProjectExplorer::Project *project); - -private: - void setupRunConfiguration(MaemoRunConfiguration *rc); }; class MaemoRunControlFactory : public IRunControlFactory -- cgit v1.2.1