From 76176a83367f3f1573a47a05872794188b7189ba Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 22 Sep 2011 17:37:05 +0200 Subject: [PATCH] RemoteLinux: Deployment improvements. - Don't depend on the order of signal connections when updating the deploy step label. - Give a meaningful error message when the init() function fails. - Don't try to upload files that don't have a target path set. Change-Id: If302cf8407b69faf8507579267afde7428edf704 Reviewed-on: http://codereview.qt-project.org/5404 Reviewed-by: Christian Kandeler --- .../abstractremotelinuxdeploystep.cpp | 6 +++++- .../remotelinux/genericdirectuploadservice.cpp | 17 +++++++++++++++++ .../remotelinux/genericdirectuploadservice.h | 1 + .../remotelinux/remotelinuxdeploystepwidget.cpp | 6 ++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp index 9d65932c616..401c2c6d26e 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp @@ -78,7 +78,11 @@ QVariantMap AbstractRemoteLinuxDeployStep::toMap() const bool AbstractRemoteLinuxDeployStep::init() { - return isDeploymentPossible(); + QString error; + const bool canDeploy = isDeploymentPossible(&error); + if (!canDeploy) + emit addOutput(tr("Deployment failed: %1").arg(error), ErrorMessageOutput); + return canDeploy; } bool AbstractRemoteLinuxDeployStep::isDeploymentPossible(QString *whyNot) const diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 9e2ada1e597..27d338d4f59 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -86,6 +86,23 @@ void GenericDirectUploadService::setIncrementalDeployment(bool incremental) d->incremental = incremental; } +bool GenericDirectUploadService::isDeploymentPossible(QString *whyNot) const +{ + if (!AbstractRemoteLinuxDeployService::isDeploymentPossible(whyNot)) + return false; + foreach (const DeployableFile &df, d->deployableFiles) { + if (df.remoteDir.isEmpty()) { // Can happen with targets. + if (whyNot) { + *whyNot = tr("Don't know where to deploy local file '%1'.") + .arg(QFileInfo(df.localFilePath).fileName()); + } + return false; + } + } + + return true; +} + bool GenericDirectUploadService::isDeploymentNecessary() const { d->filesToUpload.clear(); diff --git a/src/plugins/remotelinux/genericdirectuploadservice.h b/src/plugins/remotelinux/genericdirectuploadservice.h index b8a5ec88bf2..dd60805f615 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.h +++ b/src/plugins/remotelinux/genericdirectuploadservice.h @@ -64,6 +64,7 @@ private slots: void handleStdErrData(const QByteArray &data); private: + bool isDeploymentPossible(QString *whyNot) const; bool isDeploymentNecessary() const; void doDeviceSetup(); diff --git a/src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp b/src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp index 6dbb7fc04e9..7e227906e99 100644 --- a/src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp @@ -32,6 +32,7 @@ #include "remotelinuxdeploystepwidget.h" #include "abstractremotelinuxdeploystep.h" +#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" #include "remotelinuxutils.h" @@ -55,11 +56,12 @@ RemoteLinuxDeployStepWidget::RemoteLinuxDeployStepWidget(AbstractRemoteLinuxDepl SLOT(handleStepToBeRemoved(int))); // TODO: Move this knowledge into the deploy step itself. - connect(qobject_cast(m_step->target()->project()), - SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *, bool, bool)), + connect(qobject_cast(m_step->target()->project()), SIGNAL(proParsingDone()), SIGNAL(updateSummary())); connect(m_step->deployConfiguration(), SIGNAL(currentDeviceConfigurationChanged()), SIGNAL(updateSummary())); + connect(m_step->deployConfiguration()->deploymentInfo().data(), SIGNAL(modelReset()), + SIGNAL(updateSummary())); } RemoteLinuxDeployStepWidget::~RemoteLinuxDeployStepWidget()