From 81a3ac3a10b2d5fe7c221a1c3dc96359aed93e5a Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari <mfekari@blackberry.com> Date: Thu, 23 Jan 2014 14:38:23 +0100 Subject: [PATCH] Qnx: Add device runtime check to build steps Extend the previous "debug token check" build step to a more generic "device status step" build step that can check both debug token and device runtime. Task-number: QTCREATORBUG-9709 Change-Id: I50fd3eb88b692678af6f0204455165e2cdcf41b2 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> --- .../qnx/blackberrycheckdebugtokenstep.cpp | 156 ---------- .../qnx/blackberrycheckdevicestatusstep.cpp | 274 ++++++++++++++++++ ...ep.h => blackberrycheckdevicestatusstep.h} | 32 +- ...errycheckdevicestatusstepconfigwidget.cpp} | 34 ++- ...kberrycheckdevicestatusstepconfigwidget.h} | 20 +- ...kberrycheckdevicestatusstepconfigwidget.ui | 35 +++ ...lackberrycheckdevicestatusstepfactory.cpp} | 36 +-- ... blackberrycheckdevicestatusstepfactory.h} | 10 +- .../blackberrydeployconfigurationfactory.cpp | 4 +- src/plugins/qnx/qnx.pro | 19 +- src/plugins/qnx/qnx.qbs | 13 +- src/plugins/qnx/qnxconstants.h | 2 +- src/plugins/qnx/qnxplugin.cpp | 4 +- 13 files changed, 420 insertions(+), 219 deletions(-) delete mode 100644 src/plugins/qnx/blackberrycheckdebugtokenstep.cpp create mode 100644 src/plugins/qnx/blackberrycheckdevicestatusstep.cpp rename src/plugins/qnx/{blackberrycheckdebugtokenstep.h => blackberrycheckdevicestatusstep.h} (67%) rename src/plugins/qnx/{blackberrycheckdebugtokenstepconfigwidget.cpp => blackberrycheckdevicestatusstepconfigwidget.cpp} (54%) rename src/plugins/qnx/{blackberrycheckdebugtokenstepconfigwidget.h => blackberrycheckdevicestatusstepconfigwidget.h} (70%) create mode 100644 src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.ui rename src/plugins/qnx/{blackberrycheckdebugtokenstepfactory.cpp => blackberrycheckdevicestatusstepfactory.cpp} (61%) rename src/plugins/qnx/{blackberrycheckdebugtokenstepfactory.h => blackberrycheckdevicestatusstepfactory.h} (87%) diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstep.cpp b/src/plugins/qnx/blackberrycheckdebugtokenstep.cpp deleted file mode 100644 index b707e6d1b63..00000000000 --- a/src/plugins/qnx/blackberrycheckdebugtokenstep.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2014 BlackBerry Limited. All rights reserved. -** -** Contact: BlackBerry (qt@blackberry.com) -** Contact: KDAB (info@kdab.com) -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "blackberrycheckdebugtokenstep.h" - -#include "blackberrycheckdebugtokenstepconfigwidget.h" -#include "blackberrydeviceinformation.h" -#include "qnxconstants.h" - -#include <projectexplorer/buildconfiguration.h> -#include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/target.h> -#include <projectexplorer/task.h> -#include <ssh/sshconnection.h> - -#include <qeventloop.h> - -using namespace Qnx; -using namespace Qnx::Internal; - -BlackBerryCheckDebugTokenStep::BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl) : - ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID)) - , m_deviceInfo(0) - , m_eventLoop(0) -{ - setDisplayName(tr("Check Debug Token")); -} - -BlackBerryCheckDebugTokenStep::BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDebugTokenStep *bs) : - ProjectExplorer::BuildStep(bsl, bs) - , m_deviceInfo(0) - , m_eventLoop(0) -{ - setDisplayName(tr("Check Debug Token")); -} - -void BlackBerryCheckDebugTokenStep::checkDeviceInfo(int status) -{ - // Skip debug token check for internal non secure devices and simulators - if (m_deviceInfo->isProductionDevice() && !m_deviceInfo->isSimulator()) { - if (status != BlackBerryDeviceInformation::Success) { - switch (status) { - case BlackBerryDeviceInformation::AuthenticationFailed: - raiseError(tr("Authentication failed.")); - break; - case BlackBerryDeviceInformation::NoRouteToHost: - raiseError(tr("Cannot connect to device.")); - break; - case BlackBerryDeviceInformation::DevelopmentModeDisabled: - raiseError(tr("Device is not in the development mode.")); - break; - case BlackBerryDeviceInformation::InferiorProcessTimedOut: - raiseError(tr("Timeout querying device information.")); - break; - case BlackBerryDeviceInformation::FailedToStartInferiorProcess: - raiseError(tr("Failed to query device information.")); - break; - case BlackBerryDeviceInformation::InferiorProcessCrashed: - raiseError(tr("Process to query device information has crashed.")); - break; - default: - raiseError(tr("Cannot query device information.")); - break; - } - m_eventLoop->exit(false); - return; - } - - if (!m_deviceInfo->debugTokenValid()) { - raiseError(m_deviceInfo->debugTokenValidationError()); - m_eventLoop->exit(false); - return; - } - } - - m_eventLoop->exit(true); -} - -void BlackBerryCheckDebugTokenStep::emitOutputInfo() -{ - emit addOutput(tr("Checking debug token..."), BuildStep::MessageOutput); -} - -bool BlackBerryCheckDebugTokenStep::init() -{ - m_device = BlackBerryDeviceConfiguration::device(target()->kit()); - if (!m_device) - return false; - - if (m_device->sshParameters().host.isEmpty()) { - raiseError(tr("No hostname specified for the device")); - return false; - } - - return true; -} - -void BlackBerryCheckDebugTokenStep::run(QFutureInterface<bool> &fi) -{ - m_eventLoop = new QEventLoop; - m_deviceInfo = new BlackBerryDeviceInformation; - - connect(m_deviceInfo, SIGNAL(started()), this, SLOT(emitOutputInfo())); - connect(m_deviceInfo, SIGNAL(finished(int)), this, SLOT(checkDeviceInfo(int)), Qt::DirectConnection); - m_deviceInfo->setDeviceTarget(m_device->sshParameters().host, m_device->sshParameters().password); - - bool returnValue = m_eventLoop->exec(); - - delete m_eventLoop; - m_eventLoop = 0; - - delete m_deviceInfo; - m_deviceInfo = 0; - - return fi.reportResult(returnValue); -} - -ProjectExplorer::BuildStepConfigWidget *BlackBerryCheckDebugTokenStep::createConfigWidget() -{ - return new BlackBerryCheckDebugTokenConfigWidget(); -} - -void BlackBerryCheckDebugTokenStep::raiseError(const QString &errorMessage) -{ - emit addOutput(errorMessage, BuildStep::ErrorMessageOutput); - emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1, - ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)); -} diff --git a/src/plugins/qnx/blackberrycheckdevicestatusstep.cpp b/src/plugins/qnx/blackberrycheckdevicestatusstep.cpp new file mode 100644 index 00000000000..7aafad078ea --- /dev/null +++ b/src/plugins/qnx/blackberrycheckdevicestatusstep.cpp @@ -0,0 +1,274 @@ +/************************************************************************** +** +** Copyright (C) 2014 BlackBerry Limited. All rights reserved. +** +** Contact: BlackBerry (qt@blackberry.com) +** Contact: KDAB (info@kdab.com) +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "blackberrycheckdevicestatusstep.h" + +#include "blackberrycheckdevicestatusstepconfigwidget.h" +#include "blackberrydeviceinformation.h" +#include "blackberryversionnumber.h" +#include "qnxconstants.h" + +#include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/target.h> +#include <projectexplorer/kit.h> +#include <projectexplorer/task.h> +#include <ssh/sshconnection.h> + +#include <coreplugin/icore.h> + +#include <qfileinfo.h> + +#include <qmessagebox.h> + +#include <qeventloop.h> + +using namespace Qnx; +using namespace Qnx::Internal; + +namespace { +const char RUNTIME_CHECK_ENABLED[] = + "Qnx.Internal.BlackBerryCheckDeviceStatusStep.RuntimeCheckEnabled"; +const char DEBUG_TOKEN_CHECK_ENABLED[] = + "Qnx.Internal.BlackBerryCheckDeviceStatusStep.DebugTokenCheckEnabled"; +} + +BlackBerryCheckDeviceStatusStep::BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl) : + ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QNX_CHECK_DEVICE_STATUS_BS_ID)) + , m_deviceInfo(0) + , m_eventLoop(0) + , m_runtimeCheckEnabled(true) + , m_debugTokenCheckEnabled(true) +{ + setDisplayName(tr("Check Device Status")); +} + +BlackBerryCheckDeviceStatusStep::BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl, + BlackBerryCheckDeviceStatusStep *bs) : + ProjectExplorer::BuildStep(bsl, bs) + , m_deviceInfo(0) + , m_eventLoop(0) + , m_runtimeCheckEnabled(true) + , m_debugTokenCheckEnabled(true) +{ + setDisplayName(tr("Check Device Status")); +} + +void BlackBerryCheckDeviceStatusStep::checkDeviceInfo(int status) +{ + if (!m_runtimeCheckEnabled && m_debugTokenCheckEnabled) { + // Skip debug token check for internal non secure devices and simulators + if (!m_deviceInfo->isProductionDevice() || m_deviceInfo->isSimulator()) { + m_eventLoop->exit(true); + return; + } + } + + if (status != BlackBerryDeviceInformation::Success) { + switch (status) { + case BlackBerryDeviceInformation::AuthenticationFailed: + raiseError(tr("Authentication failed.")); + break; + case BlackBerryDeviceInformation::NoRouteToHost: + raiseError(tr("Cannot connect to device.")); + break; + case BlackBerryDeviceInformation::DevelopmentModeDisabled: + raiseError(tr("Device is not in the development mode.")); + break; + case BlackBerryDeviceInformation::InferiorProcessTimedOut: + raiseError(tr("Timeout querying device information.")); + break; + case BlackBerryDeviceInformation::FailedToStartInferiorProcess: + raiseError(tr("Failed to query device information.")); + break; + case BlackBerryDeviceInformation::InferiorProcessCrashed: + raiseError(tr("Process to query device information has crashed.")); + break; + default: + raiseError(tr("Cannot query device information.")); + break; + } + m_eventLoop->exit(false); + return; + } + + if (m_debugTokenCheckEnabled && !m_deviceInfo->debugTokenValid()) { + raiseError(m_deviceInfo->debugTokenValidationError()); + m_eventLoop->exit(false); + return; + } + + if (m_runtimeCheckEnabled) { + BlackBerryVersionNumber deviceRuntimeVersion(m_deviceInfo->scmBundle()); + QFileInfo fi(target()->kit()->autoDetectionSource()); + + if (deviceRuntimeVersion.isEmpty()) { + // Skip the check if device runtime is not determined + m_eventLoop->exit(true); + raiseWarning(tr("Cannot determine device runtime version.")); + return; + } + + BlackBerryVersionNumber apiLevelVersion = BlackBerryVersionNumber::fromNdkEnvFileName(fi.baseName()); + if (apiLevelVersion.isEmpty()) { + // Skip the check if device API level version is not determined + m_eventLoop->exit(true); + raiseWarning(tr("Cannot determine API level version.")); + return; + } + + bool ok = true; + if (deviceRuntimeVersion.toString() != apiLevelVersion.toString()) { + raiseError(tr("The device runtime version (%1) does not match API level version (%2)") + .arg(deviceRuntimeVersion.toString(), apiLevelVersion.toString())); + + QMetaObject::invokeMethod(this, "handleVersionMismatch", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(bool, ok), + Q_ARG(QString, deviceRuntimeVersion.toString()), + Q_ARG(QString, apiLevelVersion.toString())); + } + + m_eventLoop->exit(ok); + return; + } + + m_eventLoop->exit(true); +} + +void BlackBerryCheckDeviceStatusStep::emitOutputInfo() +{ + emit addOutput(tr("Checking device status..."), BuildStep::MessageOutput); +} + +void BlackBerryCheckDeviceStatusStep::enableDebugTokenCheck(bool enable) +{ + m_debugTokenCheckEnabled = enable; +} + +void BlackBerryCheckDeviceStatusStep::enableRuntimeCheck(bool enable) +{ + m_runtimeCheckEnabled = enable; +} + +bool BlackBerryCheckDeviceStatusStep::handleVersionMismatch(const QString &runtimeVersion, const QString &apiLevelVersion) +{ + // TODO: Check if a matching API level exists in the user configurations, + // otherwise let the user download the matching device runtime. + const QMessageBox::StandardButton answer = QMessageBox::question(Core::ICore::mainWindow(), tr("Confirmation"), + tr("The device runtime version(%1) does not match the API level version(%2).\n" + "Do you want to continue anyway?").arg(runtimeVersion, apiLevelVersion), + QMessageBox::Yes | QMessageBox::No); + return answer == QMessageBox::Yes; +} + +bool BlackBerryCheckDeviceStatusStep::init() +{ + m_device = BlackBerryDeviceConfiguration::device(target()->kit()); + if (!m_device) + return false; + + if (m_device->sshParameters().host.isEmpty()) { + raiseError(tr("No hostname specified for the device")); + return false; + } + + return true; +} + +void BlackBerryCheckDeviceStatusStep::run(QFutureInterface<bool> &fi) +{ + if (!m_runtimeCheckEnabled && !m_debugTokenCheckEnabled) + return fi.reportResult(true); + + m_eventLoop = new QEventLoop; + m_deviceInfo = new BlackBerryDeviceInformation; + + connect(m_deviceInfo, SIGNAL(started()), this, SLOT(emitOutputInfo())); + connect(m_deviceInfo, SIGNAL(finished(int)), this, SLOT(checkDeviceInfo(int)), Qt::DirectConnection); + m_deviceInfo->setDeviceTarget(m_device->sshParameters().host, m_device->sshParameters().password); + + bool returnValue = m_eventLoop->exec(); + + delete m_eventLoop; + m_eventLoop = 0; + + delete m_deviceInfo; + m_deviceInfo = 0; + + return fi.reportResult(returnValue); +} + +ProjectExplorer::BuildStepConfigWidget *BlackBerryCheckDeviceStatusStep::createConfigWidget() +{ + return new BlackBerryCheckDeviceStatusStepConfigWidget(this); +} + +void BlackBerryCheckDeviceStatusStep::raiseError(const QString &errorMessage) +{ + emit addOutput(errorMessage, BuildStep::ErrorMessageOutput); + emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)); +} + +void BlackBerryCheckDeviceStatusStep::raiseWarning(const QString &warningMessage) +{ + emit addOutput(warningMessage, BuildStep::ErrorOutput); + emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Warning, warningMessage, Utils::FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)); +} + + +bool BlackBerryCheckDeviceStatusStep::fromMap(const QVariantMap &map) +{ + m_runtimeCheckEnabled = map.value(QLatin1String(RUNTIME_CHECK_ENABLED), false).toBool(); + m_debugTokenCheckEnabled = map.value(QLatin1String(DEBUG_TOKEN_CHECK_ENABLED), false).toBool(); + + return BuildStep::fromMap(map); +} + +QVariantMap BlackBerryCheckDeviceStatusStep::toMap() const +{ + QVariantMap map = BuildStep::toMap(); + map.insert(QLatin1String(RUNTIME_CHECK_ENABLED), m_runtimeCheckEnabled); + map.insert(QLatin1String(DEBUG_TOKEN_CHECK_ENABLED), m_debugTokenCheckEnabled); + + return map; +} + +bool BlackBerryCheckDeviceStatusStep::debugTokenCheckEnabled() const +{ + return m_debugTokenCheckEnabled; +} + +bool BlackBerryCheckDeviceStatusStep::runtimeCheckEnabled() const +{ + return m_runtimeCheckEnabled; +} diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstep.h b/src/plugins/qnx/blackberrycheckdevicestatusstep.h similarity index 67% rename from src/plugins/qnx/blackberrycheckdebugtokenstep.h rename to src/plugins/qnx/blackberrycheckdevicestatusstep.h index 3a397779585..1443215a9d1 100644 --- a/src/plugins/qnx/blackberrycheckdebugtokenstep.h +++ b/src/plugins/qnx/blackberrycheckdevicestatusstep.h @@ -29,8 +29,8 @@ ** ****************************************************************************/ -#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H -#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H +#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H +#define QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H #include "blackberrydeviceconfiguration.h" @@ -44,34 +44,50 @@ namespace Qnx { namespace Internal { class BlackBerryDeviceInformation; -class BlackBerryCheckDebugTokenStep : public ProjectExplorer::BuildStep +class BlackBerryCheckDeviceStatusStep : public ProjectExplorer::BuildStep { Q_OBJECT - friend class BlackBerryCheckDebugTokenStepFactory; + friend class BlackBerryCheckDeviceStatusStepFactory; public: - explicit BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl); + explicit BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl); bool init(); void run(QFutureInterface<bool> &fi); ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - void raiseError(const QString& error); + void raiseError(const QString &error); + void raiseWarning(const QString &warning); + + bool fromMap(const QVariantMap &map); + QVariantMap toMap() const; + + bool debugTokenCheckEnabled () const; + bool runtimeCheckEnabled() const; protected: - BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDebugTokenStep *bs); + BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl, + BlackBerryCheckDeviceStatusStep *bs); protected slots: void checkDeviceInfo(int status); void emitOutputInfo(); + void enableDebugTokenCheck(bool enable); + void enableRuntimeCheck(bool enable); + + bool handleVersionMismatch(const QString &runtimeVersion, const QString &apiLevelVersion); + private: BlackBerryDeviceInformation *m_deviceInfo; BlackBerryDeviceConfiguration::ConstPtr m_device; QEventLoop *m_eventLoop; + + bool m_runtimeCheckEnabled; + bool m_debugTokenCheckEnabled; }; } // namespace Internal } // namespace Qnx -#endif // QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H +#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.cpp b/src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.cpp similarity index 54% rename from src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.cpp rename to src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.cpp index 3b19d5c32a1..6b2de4c847b 100644 --- a/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.cpp +++ b/src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.cpp @@ -29,27 +29,45 @@ ** ****************************************************************************/ -#include "blackberrycheckdebugtokenstepconfigwidget.h" +#include "blackberrycheckdevicestatusstepconfigwidget.h" +#include "ui_blackberrycheckdevicestatusstepconfigwidget.h" +#include "blackberrycheckdevicestatusstep.h" using namespace Qnx; using namespace Qnx::Internal; -BlackBerryCheckDebugTokenConfigWidget::BlackBerryCheckDebugTokenConfigWidget() : - ProjectExplorer::BuildStepConfigWidget() +BlackBerryCheckDeviceStatusStepConfigWidget::BlackBerryCheckDeviceStatusStepConfigWidget( + BlackBerryCheckDeviceStatusStep *checkDeviceStatuStep) + : ProjectExplorer::BuildStepConfigWidget() + , m_checkDeviceStatusStep(checkDeviceStatuStep) + , m_ui(new Ui::BlackBerryCheckDeviceStatusStepConfigWidget) { + m_ui->setupUi(this); + m_ui->checkRuntime->setChecked(m_checkDeviceStatusStep->runtimeCheckEnabled()); + m_ui->checkDebugToken->setChecked(m_checkDeviceStatusStep->debugTokenCheckEnabled()); + + connect(m_ui->checkRuntime, SIGNAL(clicked(bool)), + m_checkDeviceStatusStep, SLOT(enableRuntimeCheck(bool))); + connect(m_ui->checkDebugToken, SIGNAL(clicked(bool)), + m_checkDeviceStatusStep, SLOT(enableDebugTokenCheck(bool))); +} + +BlackBerryCheckDeviceStatusStepConfigWidget::~BlackBerryCheckDeviceStatusStepConfigWidget() +{ + delete m_ui; } -QString BlackBerryCheckDebugTokenConfigWidget::displayName() const +QString BlackBerryCheckDeviceStatusStepConfigWidget::displayName() const { - return tr("<b>Check debug token</b>"); + return tr("<b>Check device status</b>"); } -QString BlackBerryCheckDebugTokenConfigWidget::summaryText() const +QString BlackBerryCheckDeviceStatusStepConfigWidget::summaryText() const { return displayName(); } -bool BlackBerryCheckDebugTokenConfigWidget::showWidget() const +bool BlackBerryCheckDeviceStatusStepConfigWidget::showWidget() const { - return false; + return true; } diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.h b/src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.h similarity index 70% rename from src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.h rename to src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.h index e7d6a16df0b..791f8575df2 100644 --- a/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.h +++ b/src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.h @@ -29,27 +29,37 @@ ** ****************************************************************************/ -#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H -#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H +#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPCONFIGWIDGET_H +#define QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPCONFIGWIDGET_H #include <projectexplorer/buildstep.h> namespace Qnx { namespace Internal { -class BlackBerryCheckDebugTokenConfigWidget : public ProjectExplorer::BuildStepConfigWidget +namespace Ui { +class BlackBerryCheckDeviceStatusStepConfigWidget; +} + +class BlackBerryCheckDeviceStatusStep; +class BlackBerryCheckDeviceStatusStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget { Q_OBJECT public: - explicit BlackBerryCheckDebugTokenConfigWidget(); + explicit BlackBerryCheckDeviceStatusStepConfigWidget( + BlackBerryCheckDeviceStatusStep *checkDeviceStatuStep); + ~BlackBerryCheckDeviceStatusStepConfigWidget(); QString displayName() const; QString summaryText() const; bool showWidget() const; +private: + BlackBerryCheckDeviceStatusStep *m_checkDeviceStatusStep; + Ui::BlackBerryCheckDeviceStatusStepConfigWidget *m_ui; }; } // namespace Internal } // namespace Qnx -#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H +#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPCONFIGWIDGET_H diff --git a/src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.ui b/src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.ui new file mode 100644 index 00000000000..e6b495651dd --- /dev/null +++ b/src/plugins/qnx/blackberrycheckdevicestatusstepconfigwidget.ui @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BlackBerryCheckDeviceStatusStepConfigWidget</class> + <widget class="QWidget" name="Qnx::Internal::BlackBerryCheckDeviceStatusStepConfigWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>126</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="checkRuntime"> + <property name="text"> + <string>Check Device Runtime</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkDebugToken"> + <property name="text"> + <string>Check Debug Token</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.cpp b/src/plugins/qnx/blackberrycheckdevicestatusstepfactory.cpp similarity index 61% rename from src/plugins/qnx/blackberrycheckdebugtokenstepfactory.cpp rename to src/plugins/qnx/blackberrycheckdevicestatusstepfactory.cpp index b20912bfde0..8e8da5bfb07 100644 --- a/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.cpp +++ b/src/plugins/qnx/blackberrycheckdevicestatusstepfactory.cpp @@ -29,9 +29,9 @@ ** ****************************************************************************/ -#include "blackberrycheckdebugtokenstepfactory.h" +#include "blackberrycheckdevicestatusstepfactory.h" -#include "blackberrycheckdebugtokenstep.h" +#include "blackberrycheckdevicestatusstep.h" #include "blackberrydeviceconfigurationfactory.h" #include "qnxconstants.h" @@ -43,12 +43,13 @@ using namespace Qnx; using namespace Qnx::Internal; -BlackBerryCheckDebugTokenStepFactory::BlackBerryCheckDebugTokenStepFactory(QObject *parent) : +BlackBerryCheckDeviceStatusStepFactory::BlackBerryCheckDeviceStatusStepFactory(QObject *parent) : ProjectExplorer::IBuildStepFactory(parent) { } -QList<Core::Id> BlackBerryCheckDebugTokenStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const +QList<Core::Id> BlackBerryCheckDeviceStatusStepFactory::availableCreationIds( + ProjectExplorer::BuildStepList *parent) const { if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY) return QList<Core::Id>(); @@ -57,52 +58,53 @@ QList<Core::Id> BlackBerryCheckDebugTokenStepFactory::availableCreationIds(Proje if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType()) return QList<Core::Id>(); - return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID); + return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEVICE_STATUS_BS_ID); } -QString BlackBerryCheckDebugTokenStepFactory::displayNameForId(const Core::Id id) const +QString BlackBerryCheckDeviceStatusStepFactory::displayNameForId(const Core::Id id) const { - if (id == Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID) - return tr("Check Debug Token"); + if (id == Constants::QNX_CHECK_DEVICE_STATUS_BS_ID) + return tr("Check Device Status"); return QString(); } -bool BlackBerryCheckDebugTokenStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const +bool BlackBerryCheckDeviceStatusStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const { return availableCreationIds(parent).contains(id); } -ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id) +ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::create(ProjectExplorer::BuildStepList *parent, + const Core::Id id) { if (!canCreate(parent, id)) return 0; - return new BlackBerryCheckDebugTokenStep(parent); + return new BlackBerryCheckDeviceStatusStep(parent); } -bool BlackBerryCheckDebugTokenStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const +bool BlackBerryCheckDeviceStatusStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const { return canCreate(parent, ProjectExplorer::idFromMap(map)); } -ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) +ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) { if (!canRestore(parent, map)) return 0; - BlackBerryCheckDebugTokenStep *bs = new BlackBerryCheckDebugTokenStep(parent); + BlackBerryCheckDeviceStatusStep *bs = new BlackBerryCheckDeviceStatusStep(parent); if (bs->fromMap(map)) return bs; delete bs; return 0; } -bool BlackBerryCheckDebugTokenStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const +bool BlackBerryCheckDeviceStatusStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const { return canCreate(parent, product->id()); } -ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) +ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) { if (!canClone(parent, product)) return 0; - return new BlackBerryCheckDebugTokenStep(parent, static_cast<BlackBerryCheckDebugTokenStep *>(product)); + return new BlackBerryCheckDeviceStatusStep(parent, static_cast<BlackBerryCheckDeviceStatusStep *>(product)); } diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.h b/src/plugins/qnx/blackberrycheckdevicestatusstepfactory.h similarity index 87% rename from src/plugins/qnx/blackberrycheckdebugtokenstepfactory.h rename to src/plugins/qnx/blackberrycheckdevicestatusstepfactory.h index be3676f0ad7..25ccdbf52e7 100644 --- a/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.h +++ b/src/plugins/qnx/blackberrycheckdevicestatusstepfactory.h @@ -29,19 +29,19 @@ ** ****************************************************************************/ -#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H -#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H +#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPFACTORY_H +#define QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPFACTORY_H #include <projectexplorer/buildstep.h> namespace Qnx { namespace Internal { -class BlackBerryCheckDebugTokenStepFactory : public ProjectExplorer::IBuildStepFactory +class BlackBerryCheckDeviceStatusStepFactory : public ProjectExplorer::IBuildStepFactory { Q_OBJECT public: - explicit BlackBerryCheckDebugTokenStepFactory(QObject *parent = 0); + explicit BlackBerryCheckDeviceStatusStepFactory(QObject *parent = 0); QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const; QString displayNameForId(const Core::Id id) const; @@ -61,4 +61,4 @@ public: } // namespace Internal } // namespace Qnx -#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H +#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPFACTORY_H diff --git a/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp b/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp index 04d4af8963c..e4bbabee14c 100644 --- a/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp +++ b/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp @@ -32,7 +32,7 @@ #include "blackberrydeployconfigurationfactory.h" #include "qnxconstants.h" -#include "blackberrycheckdebugtokenstep.h" +#include "blackberrycheckdevicestatusstep.h" #include "blackberrydeployconfiguration.h" #include "blackberrycreatepackagestep.h" #include "blackberrydeploystep.h" @@ -93,7 +93,7 @@ ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::crea return 0; BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent); - dc->stepList()->insertStep(0, new BlackBerryCheckDebugTokenStep(dc->stepList())); + dc->stepList()->insertStep(0, new BlackBerryCheckDeviceStatusStep(dc->stepList())); dc->stepList()->insertStep(1, new BlackBerryCreatePackageStep(dc->stepList())); dc->stepList()->insertStep(2, new BlackBerryDeployStep(dc->stepList())); return dc; diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro index fc2607ba4c7..4d74b7be039 100644 --- a/src/plugins/qnx/qnx.pro +++ b/src/plugins/qnx/qnx.pro @@ -68,9 +68,6 @@ SOURCES += qnxplugin.cpp \ blackberrydebugtokenuploader.cpp \ blackberrydebugtokenreader.cpp \ blackberryndkprocess.cpp \ - blackberrycheckdebugtokenstep.cpp \ - blackberrycheckdebugtokenstepconfigwidget.cpp \ - blackberrycheckdebugtokenstepfactory.cpp \ blackberrydeviceconnection.cpp \ blackberrydeviceconnectionmanager.cpp \ blackberrydeviceinformation.cpp \ @@ -99,7 +96,10 @@ SOURCES += qnxplugin.cpp \ qnxtoolchain.cpp \ slog2inforunner.cpp \ blackberryversionnumber.cpp \ - blackberrydebugtokenpinsdialog.cpp + blackberrydebugtokenpinsdialog.cpp \ + blackberrycheckdevicestatusstepfactory.cpp \ + blackberrycheckdevicestatusstepconfigwidget.cpp \ + blackberrycheckdevicestatusstep.cpp HEADERS += qnxplugin.h\ qnxconstants.h \ @@ -167,9 +167,6 @@ HEADERS += qnxplugin.h\ blackberrydebugtokenuploader.h \ blackberrydebugtokenreader.h \ blackberryndkprocess.h \ - blackberrycheckdebugtokenstep.h \ - blackberrycheckdebugtokenstepconfigwidget.h \ - blackberrycheckdebugtokenstepfactory.h \ blackberrydeviceconnection.h \ blackberrydeviceconnectionmanager.h \ blackberrydeviceinformation.h \ @@ -198,7 +195,10 @@ HEADERS += qnxplugin.h\ qnxtoolchain.h \ slog2inforunner.h \ blackberryversionnumber.h \ - blackberrydebugtokenpinsdialog.h + blackberrydebugtokenpinsdialog.h \ + blackberrycheckdevicestatusstep.h \ + blackberrycheckdevicestatusstepfactory.h \ + blackberrycheckdevicestatusstepconfigwidget.h FORMS += \ @@ -231,7 +231,8 @@ FORMS += \ blackberryinstallwizardndkpage.ui \ blackberryinstallwizardprocesspage.ui \ blackberryinstallwizardoptionpage.ui \ - blackberrydebugtokenpinsdialog.ui + blackberrydebugtokenpinsdialog.ui \ + blackberrycheckdevicestatusstepconfigwidget.ui include(../../private_headers.pri) include(./cascadesimport/cascadesimport.pri) diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index 6ee90f4777b..5332a2abc35 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -57,12 +57,13 @@ QtcPlugin { "blackberryabstractdeploystep.h", "blackberryapplicationrunner.cpp", "blackberryapplicationrunner.h", - "blackberrycheckdebugtokenstep.cpp", - "blackberrycheckdebugtokenstep.h", - "blackberrycheckdebugtokenstepconfigwidget.cpp", - "blackberrycheckdebugtokenstepconfigwidget.h", - "blackberrycheckdebugtokenstepfactory.cpp", - "blackberrycheckdebugtokenstepfactory.h", + "blackberrycheckdevicestatusstep.cpp", + "blackberrycheckdevicestatusstep.h", + "blackberrycheckdevicestatusstepconfigwidget.cpp", + "blackberrycheckdevicestatusstepconfigwidget.h", + "blackberrycheckdevicestatusstepconfigwidget.ui", + "blackberrycheckdevicestatusstepfactory.cpp", + "blackberrycheckdevicestatusstepfactory.h", "blackberryconfigurationmanager.cpp", "blackberryconfigurationmanager.h", "blackberrycreatepackagestep.cpp", diff --git a/src/plugins/qnx/qnxconstants.h b/src/plugins/qnx/qnxconstants.h index 62366b99ab6..1bb3311b046 100644 --- a/src/plugins/qnx/qnxconstants.h +++ b/src/plugins/qnx/qnxconstants.h @@ -69,7 +69,7 @@ const char QNX_QNX_RUNCONFIGURATION_PREFIX[] = "Qt4ProjectManager.QNX.QNXRunConf const char QNX_CREATE_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxCreatePackageBuildStep"; const char QNX_DEPLOY_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxDeployPackageBuildStep"; -const char QNX_CHECK_DEBUG_TOKEN_BS_ID[] = "Qt4ProjectManager.QnxCheckDebugTokenBuildStep"; +const char QNX_CHECK_DEVICE_STATUS_BS_ID[] = "Qt4ProjectManager.QnxCheckDeviceStatusBuildStep"; const char QNX_PROFILEPATH_KEY[] = "Qt4ProjectManager.QnxRunConfiguration.ProFilePath"; diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp index ae3c3027950..a0063e63152 100644 --- a/src/plugins/qnx/qnxplugin.cpp +++ b/src/plugins/qnx/qnxplugin.cpp @@ -49,7 +49,7 @@ #include "bardescriptoreditorfactory.h" #include "bardescriptormagicmatcher.h" #include "blackberrykeyspage.h" -#include "blackberrycheckdebugtokenstepfactory.h" +#include "blackberrycheckdevicestatusstepfactory.h" #include "blackberrydeviceconnectionmanager.h" #include "blackberryconfigurationmanager.h" #include "blackberryconfiguration.h" @@ -91,7 +91,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString) addAutoReleasedObject(new BlackBerryRunControlFactory); addAutoReleasedObject(new BlackBerryNDKSettingsPage); addAutoReleasedObject(new BlackBerryKeysPage); - addAutoReleasedObject(new BlackBerryCheckDebugTokenStepFactory); + addAutoReleasedObject(new BlackBerryCheckDeviceStatusStepFactory); addAutoReleasedObject(new CascadesImportWizard); BlackBerryDeviceConnectionManager::instance()->initialize(); -- GitLab