From e7ac3bf16ea9035eec0dbb83b7b85e7e469bc799 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Tue, 13 May 2014 16:09:11 +0200 Subject: ios: fix deploystep displayName updating still uses the default deploystepconfiguration, which gives some artifacts (to be fixed later) Change-Id: I3f4f8a71fbe4e18fc171aee571da72da1c9735db Reviewed-by: Tobias Hunger --- src/plugins/ios/iosdeploystep.cpp | 21 ++++++++++++++++++--- src/plugins/ios/iosdeploystep.h | 8 ++++---- src/plugins/ios/iosdeploystepwidget.cpp | 4 ++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/plugins/ios/iosdeploystep.cpp b/src/plugins/ios/iosdeploystep.cpp index ecc2c0f050..a2660c67d9 100644 --- a/src/plugins/ios/iosdeploystep.cpp +++ b/src/plugins/ios/iosdeploystep.cpp @@ -40,6 +40,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -82,14 +85,26 @@ void IosDeployStep::ctor() { m_toolHandler = 0; m_transferStatus = NoTransfer; - m_device = ProjectExplorer::DeviceKitInformation::device(target()->kit()); - const QString devName = m_device.isNull() ? IosDevice::name() : m_device->displayName(); + cleanup(); + updateDisplayNames(); + connect(DeviceManager::instance(), SIGNAL(updated()), + SLOT(updateDisplayNames())); + connect(target(), SIGNAL(kitChanged()), + SLOT(updateDisplayNames())); +} + +void IosDeployStep::updateDisplayNames() +{ + ProjectExplorer::IDevice::ConstPtr dev = + ProjectExplorer::DeviceKitInformation::device(target()->kit()); + const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName(); setDefaultDisplayName(tr("Deploy to %1").arg(devName)); + setDisplayName(tr("Deploy to %1").arg(devName)); } bool IosDeployStep::init() { - QTC_CHECK(m_transferStatus == NoTransfer); + QTC_ASSERT(m_transferStatus == NoTransfer, return false); m_device = ProjectExplorer::DeviceKitInformation::device(target()->kit()); IosRunConfiguration * runConfig = qobject_cast( this->target()->activeRunConfiguration()); diff --git a/src/plugins/ios/iosdeploystep.h b/src/plugins/ios/iosdeploystep.h index dae8438769..a5e55bd5e0 100644 --- a/src/plugins/ios/iosdeploystep.h +++ b/src/plugins/ios/iosdeploystep.h @@ -73,9 +73,6 @@ public: void run(QFutureInterface &fi) QTC_OVERRIDE; void cleanup(); - ProjectExplorer::IDevice::ConstPtr device() const; - IosDevice::ConstPtr iosdevice() const; - IosSimulator::ConstPtr iossimulator() const; void cancel(); signals: //void done(); @@ -89,7 +86,7 @@ private slots: Ios::IosToolHandler::OpStatus status); void handleFinished(Ios::IosToolHandler *handler); void handleErrorMsg(Ios::IosToolHandler *handler, const QString &msg); - + void updateDisplayNames(); private: IosDeployStep(ProjectExplorer::BuildStepList *bc, IosDeployStep *other); @@ -97,6 +94,9 @@ private: ProjectExplorer::BuildStepConfigWidget *createConfigWidget() QTC_OVERRIDE; bool immutable() const QTC_OVERRIDE { return true; } bool runInGuiThread() const QTC_OVERRIDE { return true; } + ProjectExplorer::IDevice::ConstPtr device() const; + IosDevice::ConstPtr iosdevice() const; + IosSimulator::ConstPtr iossimulator() const; void ctor(); QString deviceId() const; diff --git a/src/plugins/ios/iosdeploystepwidget.cpp b/src/plugins/ios/iosdeploystepwidget.cpp index 3c9dea8bd2..fe20218ee6 100644 --- a/src/plugins/ios/iosdeploystepwidget.cpp +++ b/src/plugins/ios/iosdeploystepwidget.cpp @@ -46,6 +46,7 @@ IosDeployStepWidget::IosDeployStepWidget(IosDeployStep *step) : m_step(step) { ui->setupUi(this); + connect(m_step, SIGNAL(displayNameChanged()), SIGNAL(updateSummary())); } IosDeployStepWidget::~IosDeployStepWidget() @@ -55,8 +56,7 @@ IosDeployStepWidget::~IosDeployStepWidget() QString IosDeployStepWidget::displayName() const { - const QString deviceName = m_step->device().isNull() ? IosDevice::name() : m_step->device()->displayName(); - return tr("Deploy to %1").arg(deviceName); + return QString::fromLatin1("%1").arg(m_step->displayName()); } QString IosDeployStepWidget::summaryText() const -- cgit v1.2.1