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
This commit is contained in:
Christian Kandeler
2010-10-27 10:50:52 +02:00
parent 2c907fb5b1
commit fe72f7c2f9
6 changed files with 27 additions and 18 deletions

View File

@@ -30,7 +30,6 @@
#include "maemodeploystep.h" #include "maemodeploystep.h"
#include "maemoconstants.h" #include "maemoconstants.h"
#include "maemodeployables.h"
#include "maemodeploystepwidget.h" #include "maemodeploystepwidget.h"
#include "maemodeviceconfiglistmodel.h" #include "maemodeviceconfiglistmodel.h"
#include "maemoglobal.h" #include "maemoglobal.h"
@@ -65,29 +64,38 @@ namespace { const int DefaultMountPort = 1050; }
const QLatin1String MaemoDeployStep::Id("Qt4ProjectManager.MaemoDeployStep"); const QLatin1String MaemoDeployStep::Id("Qt4ProjectManager.MaemoDeployStep");
MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildStepList *parent) MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildStepList *parent)
: BuildStep(parent, Id), m_deployables(new MaemoDeployables(this)) : BuildStep(parent, Id)
{ {
ctor(); ctor();
} }
MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildStepList *parent, MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildStepList *parent,
MaemoDeployStep *other) MaemoDeployStep *other)
: BuildStep(parent, other), m_deployables(new MaemoDeployables(this)), : BuildStep(parent, other), m_lastDeployed(other->m_lastDeployed)
m_lastDeployed(other->m_lastDeployed)
{ {
ctor(); ctor();
} }
MaemoDeployStep::~MaemoDeployStep() MaemoDeployStep::~MaemoDeployStep() { }
{
delete m_deployables;
}
void MaemoDeployStep::ctor() void MaemoDeployStep::ctor()
{ {
//: MaemoDeployStep default display name //: MaemoDeployStep default display name
setDefaultDisplayName(tr("Deploy to Maemo device")); 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_connecting = false;
m_needsInstall = false; m_needsInstall = false;
m_stopped = false; m_stopped = false;

View File

@@ -31,6 +31,7 @@
#define MAEMODEPLOYSTEP_H #define MAEMODEPLOYSTEP_H
#include "maemodeployable.h" #include "maemodeployable.h"
#include "maemodeployables.h"
#include "maemodeviceconfigurations.h" #include "maemodeviceconfigurations.h"
#include "maemomountspecification.h" #include "maemomountspecification.h"
@@ -58,7 +59,6 @@ class SshRemoteProcess;
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
class MaemoRemoteMounter; class MaemoRemoteMounter;
class MaemoDeployables;
class MaemoDeviceConfigListModel; class MaemoDeviceConfigListModel;
class MaemoPackageCreationStep; class MaemoPackageCreationStep;
class MaemoToolChain; class MaemoToolChain;
@@ -76,7 +76,7 @@ public:
bool currentlyNeedsDeployment(const QString &host, bool currentlyNeedsDeployment(const QString &host,
const MaemoDeployable &deployable) const; const MaemoDeployable &deployable) const;
void setDeployed(const QString &host, const MaemoDeployable &deployable); 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; } QSharedPointer<Core::SshConnection> sshConnection() const { return m_connection; }
bool isDeployToSysrootEnabled() const { return m_deployToSysroot; } bool isDeployToSysrootEnabled() const { return m_deployToSysroot; }
@@ -138,7 +138,7 @@ private:
static const QLatin1String Id; static const QLatin1String Id;
MaemoDeployables * const m_deployables; QSharedPointer<MaemoDeployables> m_deployables;
QSharedPointer<Core::SshConnection> m_connection; QSharedPointer<Core::SshConnection> m_connection;
QProcess *m_sysrootInstaller; QProcess *m_sysrootInstaller;
typedef QPair<MaemoDeployable, QSharedPointer<Core::SshRemoteProcess> > DeviceDeployAction; typedef QPair<MaemoDeployable, QSharedPointer<Core::SshRemoteProcess> > DeviceDeployAction;

View File

@@ -23,13 +23,13 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) :
{ {
ui->setupUi(this); ui->setupUi(this);
ui->tableView->setTextElideMode(Qt::ElideMiddle); ui->tableView->setTextElideMode(Qt::ElideMiddle);
ui->modelComboBox->setModel(m_step->deployables()); ui->modelComboBox->setModel(m_step->deployables().data());
connect(m_step->deployables(), SIGNAL(modelAboutToBeReset()), connect(m_step->deployables().data(), SIGNAL(modelAboutToBeReset()),
SLOT(handleModelListToBeReset())); SLOT(handleModelListToBeReset()));
// Queued connection because of race condition with combo box's reaction // Queued connection because of race condition with combo box's reaction
// to modelReset(). // to modelReset().
connect(m_step->deployables(), SIGNAL(modelReset()), connect(m_step->deployables().data(), SIGNAL(modelReset()),
SLOT(handleModelListReset()), Qt::QueuedConnection); SLOT(handleModelListReset()), Qt::QueuedConnection);
connect(ui->modelComboBox, SIGNAL(currentIndexChanged(int)), connect(ui->modelComboBox, SIGNAL(currentIndexChanged(int)),

View File

@@ -394,7 +394,8 @@ QString MaemoPackageCreationStep::targetRoot() const
bool MaemoPackageCreationStep::packagingNeeded() const bool MaemoPackageCreationStep::packagingNeeded() const
{ {
const MaemoDeployables * const deployables = deployStep()->deployables(); const QSharedPointer<MaemoDeployables> &deployables
= deployStep()->deployables();
QFileInfo packageInfo(packageFilePath()); QFileInfo packageInfo(packageFilePath());
if (!packageInfo.exists() || deployables->isModified()) if (!packageInfo.exists() || deployables->isModified())
return true; return true;

View File

@@ -161,7 +161,7 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
SLOT(handleDebuggingTypeChanged())); SLOT(handleDebuggingTypeChanged()));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this, connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation())); SLOT(updateTargetInformation()));
connect(m_runConfiguration->deployStep()->deployables(), connect(m_runConfiguration->deployStep()->deployables().data(),
SIGNAL(modelReset()), this, SLOT(handleDeploySpecsChanged())); SIGNAL(modelReset()), this, SLOT(handleDeploySpecsChanged()));
handleDeploySpecsChanged(); handleDeploySpecsChanged();
} }

View File

@@ -115,7 +115,7 @@ bool MaemoTemplatesManager::handleTarget(ProjectExplorer::Target *target)
const Qt4Target * const qt4Target = qobject_cast<Qt4Target *>(target); const Qt4Target * const qt4Target = qobject_cast<Qt4Target *>(target);
const MaemoDeployStep * const deployStep const MaemoDeployStep * const deployStep
= MaemoGlobal::buildStep<MaemoDeployStep>(qt4Target->activeDeployConfiguration()); = MaemoGlobal::buildStep<MaemoDeployStep>(qt4Target->activeDeployConfiguration());
connect(deployStep->deployables(), SIGNAL(modelReset()), this, connect(deployStep->deployables().data(), SIGNAL(modelReset()), this,
SLOT(handleProFileUpdated()), Qt::QueuedConnection); SLOT(handleProFileUpdated()), Qt::QueuedConnection);
Project * const project = target->project(); Project * const project = target->project();
@@ -335,7 +335,7 @@ bool MaemoTemplatesManager::updateDesktopFile(const Qt4Target *target,
= existsAlready ? desktopFile.readAll() : desktopTemplate; = existsAlready ? desktopFile.readAll() : desktopTemplate;
QString executable; QString executable;
const MaemoDeployables * const deployables const QSharedPointer<MaemoDeployables> &deployables
= MaemoGlobal::buildStep<MaemoDeployStep>(target->activeDeployConfiguration()) = MaemoGlobal::buildStep<MaemoDeployStep>(target->activeDeployConfiguration())
->deployables(); ->deployables();
for (int i = 0; i < deployables->modelCount(); ++i) { for (int i = 0; i < deployables->modelCount(); ++i) {