1
/**************************************************************************
3
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
5
** Contact: BlackBerry (qt@blackberry.com)
6
** Contact: KDAB (info@kdab.com)
8
** This file is part of Qt Creator.
10
** Commercial License Usage
11
** Licensees holding valid commercial Qt licenses may use this file in
12
** accordance with the commercial license agreement provided with the
13
** Software or, alternatively, in accordance with the terms contained in
14
** a written agreement between you and Digia. For licensing terms and
15
** conditions see http://qt.digia.com/licensing. For further information
16
** use the contact form at http://qt.digia.com/contact-us.
18
** GNU Lesser General Public License Usage
19
** Alternatively, this file may be used under the terms of the GNU Lesser
20
** General Public License version 2.1 as published by the Free Software
21
** Foundation and appearing in the file LICENSE.LGPL included in the
22
** packaging of this file. Please review the following information to
23
** ensure the GNU Lesser General Public License version 2.1 requirements
24
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26
** In addition, as a special exception, Digia gives you certain additional
27
** rights. These rights are described in the Digia Qt LGPL Exception
28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30
****************************************************************************/
32
#include "blackberrycheckdevicestatusstepfactory.h"
34
#include "blackberrycheckdevicestatusstep.h"
35
#include "blackberrydeviceconfigurationfactory.h"
36
#include "qnxconstants.h"
38
#include <projectexplorer/buildsteplist.h>
39
#include <projectexplorer/kitinformation.h>
40
#include <projectexplorer/projectexplorerconstants.h>
41
#include <projectexplorer/target.h>
44
using namespace Qnx::Internal;
46
BlackBerryCheckDeviceStatusStepFactory::BlackBerryCheckDeviceStatusStepFactory(QObject *parent) :
47
ProjectExplorer::IBuildStepFactory(parent)
51
QList<Core::Id> BlackBerryCheckDeviceStatusStepFactory::availableCreationIds(
52
ProjectExplorer::BuildStepList *parent) const
54
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
55
return QList<Core::Id>();
57
Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->target()->kit());
58
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
59
return QList<Core::Id>();
61
return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEVICE_STATUS_BS_ID);
64
QString BlackBerryCheckDeviceStatusStepFactory::displayNameForId(const Core::Id id) const
66
if (id == Constants::QNX_CHECK_DEVICE_STATUS_BS_ID)
67
return tr("Check Device Status");
71
bool BlackBerryCheckDeviceStatusStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
73
return availableCreationIds(parent).contains(id);
76
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::create(ProjectExplorer::BuildStepList *parent,
79
if (!canCreate(parent, id))
81
return new BlackBerryCheckDeviceStatusStep(parent);
84
bool BlackBerryCheckDeviceStatusStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
86
return canCreate(parent, ProjectExplorer::idFromMap(map));
89
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
91
if (!canRestore(parent, map))
93
BlackBerryCheckDeviceStatusStep *bs = new BlackBerryCheckDeviceStatusStep(parent);
100
bool BlackBerryCheckDeviceStatusStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
102
return canCreate(parent, product->id());
105
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
107
if (!canClone(parent, product))
109
return new BlackBerryCheckDeviceStatusStep(parent, static_cast<BlackBerryCheckDeviceStatusStep *>(product));