Commit fe72f7c2 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

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
parent 2c907fb5
......@@ -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;
......
......@@ -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;
......
......@@ -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)),
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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) {
......
Markdown is supported
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