From fe72f7c2f9e2ddcde695e34373797f0fd9ef59f0 Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Wed, 27 Oct 2010 10:50:52 +0200 Subject: [PATCH] Maemo: Have only one MaemoDeployables object per Maemo target. It does not depend on any of the settings in the deploy configuration. Task-number: QTCREATORBUG-2678 --- .../qt-maemo/maemodeploystep.cpp | 24 ++++++++++++------- .../qt-maemo/maemodeploystep.h | 6 ++--- .../qt-maemo/maemodeploystepwidget.cpp | 6 ++--- .../qt-maemo/maemopackagecreationstep.cpp | 3 ++- .../qt-maemo/maemorunconfigurationwidget.cpp | 2 +- .../qt-maemo/maemotemplatesmanager.cpp | 4 ++-- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp index 1481ec1dd69..67664f0cd0c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp @@ -30,7 +30,6 @@ #include "maemodeploystep.h" #include "maemoconstants.h" -#include "maemodeployables.h" #include "maemodeploystepwidget.h" #include "maemodeviceconfiglistmodel.h" #include "maemoglobal.h" @@ -65,29 +64,38 @@ namespace { const int DefaultMountPort = 1050; } const QLatin1String MaemoDeployStep::Id("Qt4ProjectManager.MaemoDeployStep"); MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildStepList *parent) - : BuildStep(parent, Id), m_deployables(new MaemoDeployables(this)) + : BuildStep(parent, Id) { ctor(); } MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildStepList *parent, MaemoDeployStep *other) - : BuildStep(parent, other), m_deployables(new MaemoDeployables(this)), - m_lastDeployed(other->m_lastDeployed) + : BuildStep(parent, other), m_lastDeployed(other->m_lastDeployed) { ctor(); } -MaemoDeployStep::~MaemoDeployStep() -{ - delete m_deployables; -} +MaemoDeployStep::~MaemoDeployStep() { } void MaemoDeployStep::ctor() { //: MaemoDeployStep default display name setDefaultDisplayName(tr("Deploy to Maemo device")); + // A MaemoDeployables object is only dependent on the active build + // configuration and therefore can (and should) be shared among all + // deploy steps. + const QList<DeployConfiguration *> &deployConfigs + = target()->deployConfigurations(); + if (deployConfigs.isEmpty()) { + m_deployables = QSharedPointer<MaemoDeployables>(new MaemoDeployables(this)); + } else { + const MaemoDeployStep *const other + = MaemoGlobal::buildStep<MaemoDeployStep>(deployConfigs.first()); + m_deployables = other->deployables(); + } + m_connecting = false; m_needsInstall = false; m_stopped = false; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h index d5b52fa94f6..c88ab5f7a47 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h @@ -31,6 +31,7 @@ #define MAEMODEPLOYSTEP_H #include "maemodeployable.h" +#include "maemodeployables.h" #include "maemodeviceconfigurations.h" #include "maemomountspecification.h" @@ -58,7 +59,6 @@ class SshRemoteProcess; namespace Qt4ProjectManager { namespace Internal { class MaemoRemoteMounter; -class MaemoDeployables; class MaemoDeviceConfigListModel; class MaemoPackageCreationStep; class MaemoToolChain; @@ -76,7 +76,7 @@ public: bool currentlyNeedsDeployment(const QString &host, const MaemoDeployable &deployable) const; void setDeployed(const QString &host, const MaemoDeployable &deployable); - MaemoDeployables *deployables() const { return m_deployables; } + QSharedPointer<MaemoDeployables> deployables() const { return m_deployables; } QSharedPointer<Core::SshConnection> sshConnection() const { return m_connection; } bool isDeployToSysrootEnabled() const { return m_deployToSysroot; } @@ -138,7 +138,7 @@ private: static const QLatin1String Id; - MaemoDeployables * const m_deployables; + QSharedPointer<MaemoDeployables> m_deployables; QSharedPointer<Core::SshConnection> m_connection; QProcess *m_sysrootInstaller; typedef QPair<MaemoDeployable, QSharedPointer<Core::SshRemoteProcess> > DeviceDeployAction; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp index 2c8d5800152..c5c797f26a3 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp @@ -23,13 +23,13 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) : { ui->setupUi(this); ui->tableView->setTextElideMode(Qt::ElideMiddle); - ui->modelComboBox->setModel(m_step->deployables()); - connect(m_step->deployables(), SIGNAL(modelAboutToBeReset()), + ui->modelComboBox->setModel(m_step->deployables().data()); + connect(m_step->deployables().data(), SIGNAL(modelAboutToBeReset()), SLOT(handleModelListToBeReset())); // Queued connection because of race condition with combo box's reaction // to modelReset(). - connect(m_step->deployables(), SIGNAL(modelReset()), + connect(m_step->deployables().data(), SIGNAL(modelReset()), SLOT(handleModelListReset()), Qt::QueuedConnection); connect(ui->modelComboBox, SIGNAL(currentIndexChanged(int)), diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp index 77749cc4020..67069ce7c31 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -394,7 +394,8 @@ QString MaemoPackageCreationStep::targetRoot() const bool MaemoPackageCreationStep::packagingNeeded() const { - const MaemoDeployables * const deployables = deployStep()->deployables(); + const QSharedPointer<MaemoDeployables> &deployables + = deployStep()->deployables(); QFileInfo packageInfo(packageFilePath()); if (!packageInfo.exists() || deployables->isModified()) return true; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp index f5bbb17e71b..72ccb2ad716 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp @@ -161,7 +161,7 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout) SLOT(handleDebuggingTypeChanged())); connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this, SLOT(updateTargetInformation())); - connect(m_runConfiguration->deployStep()->deployables(), + connect(m_runConfiguration->deployStep()->deployables().data(), SIGNAL(modelReset()), this, SLOT(handleDeploySpecsChanged())); handleDeploySpecsChanged(); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp index e16489d0d2e..9b44773fb0f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp @@ -115,7 +115,7 @@ bool MaemoTemplatesManager::handleTarget(ProjectExplorer::Target *target) const Qt4Target * const qt4Target = qobject_cast<Qt4Target *>(target); const MaemoDeployStep * const deployStep = MaemoGlobal::buildStep<MaemoDeployStep>(qt4Target->activeDeployConfiguration()); - connect(deployStep->deployables(), SIGNAL(modelReset()), this, + connect(deployStep->deployables().data(), SIGNAL(modelReset()), this, SLOT(handleProFileUpdated()), Qt::QueuedConnection); Project * const project = target->project(); @@ -335,7 +335,7 @@ bool MaemoTemplatesManager::updateDesktopFile(const Qt4Target *target, = existsAlready ? desktopFile.readAll() : desktopTemplate; QString executable; - const MaemoDeployables * const deployables + const QSharedPointer<MaemoDeployables> &deployables = MaemoGlobal::buildStep<MaemoDeployStep>(target->activeDeployConfiguration()) ->deployables(); for (int i = 0; i < deployables->modelCount(); ++i) { -- GitLab