~ubuntu-sdk-team/qtcreator-plugin-remotelinux/trunk

« back to all changes in this revision

Viewing changes to src/qnx/blackberrycheckdevicestatusstepfactory.cpp

  • Committer: CI bot
  • Author(s): Benjamin Zeller
  • Date: 2014-06-16 10:28:43 UTC
  • mfrom: (4.2.4 remotelinux)
  • Revision ID: ps-jenkins@lists.canonical.com-20140616102843-8juvmjvzwlzsboyw
Migrating to Qt5.3 and QtC 3.1 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
**
 
3
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
 
4
**
 
5
** Contact: BlackBerry (qt@blackberry.com)
 
6
** Contact: KDAB (info@kdab.com)
 
7
**
 
8
** This file is part of Qt Creator.
 
9
**
 
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.
 
17
**
 
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.
 
25
**
 
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.
 
29
**
 
30
****************************************************************************/
 
31
 
 
32
#include "blackberrycheckdevicestatusstepfactory.h"
 
33
 
 
34
#include "blackberrycheckdevicestatusstep.h"
 
35
#include "blackberrydeviceconfigurationfactory.h"
 
36
#include "qnxconstants.h"
 
37
 
 
38
#include <projectexplorer/buildsteplist.h>
 
39
#include <projectexplorer/kitinformation.h>
 
40
#include <projectexplorer/projectexplorerconstants.h>
 
41
#include <projectexplorer/target.h>
 
42
 
 
43
using namespace Qnx;
 
44
using namespace Qnx::Internal;
 
45
 
 
46
BlackBerryCheckDeviceStatusStepFactory::BlackBerryCheckDeviceStatusStepFactory(QObject *parent) :
 
47
    ProjectExplorer::IBuildStepFactory(parent)
 
48
{
 
49
}
 
50
 
 
51
QList<Core::Id> BlackBerryCheckDeviceStatusStepFactory::availableCreationIds(
 
52
        ProjectExplorer::BuildStepList *parent) const
 
53
{
 
54
    if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
 
55
        return QList<Core::Id>();
 
56
 
 
57
    Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->target()->kit());
 
58
    if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
 
59
        return QList<Core::Id>();
 
60
 
 
61
    return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEVICE_STATUS_BS_ID);
 
62
}
 
63
 
 
64
QString BlackBerryCheckDeviceStatusStepFactory::displayNameForId(const Core::Id id) const
 
65
{
 
66
    if (id == Constants::QNX_CHECK_DEVICE_STATUS_BS_ID)
 
67
        return tr("Check Device Status");
 
68
    return QString();
 
69
}
 
70
 
 
71
bool BlackBerryCheckDeviceStatusStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
 
72
{
 
73
    return availableCreationIds(parent).contains(id);
 
74
}
 
75
 
 
76
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::create(ProjectExplorer::BuildStepList *parent,
 
77
                                                                           const Core::Id id)
 
78
{
 
79
    if (!canCreate(parent, id))
 
80
        return 0;
 
81
    return new BlackBerryCheckDeviceStatusStep(parent);
 
82
}
 
83
 
 
84
bool BlackBerryCheckDeviceStatusStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
 
85
{
 
86
    return canCreate(parent, ProjectExplorer::idFromMap(map));
 
87
}
 
88
 
 
89
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
 
90
{
 
91
    if (!canRestore(parent, map))
 
92
        return 0;
 
93
    BlackBerryCheckDeviceStatusStep *bs = new BlackBerryCheckDeviceStatusStep(parent);
 
94
    if (bs->fromMap(map))
 
95
        return bs;
 
96
    delete bs;
 
97
    return 0;
 
98
}
 
99
 
 
100
bool BlackBerryCheckDeviceStatusStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
 
101
{
 
102
    return canCreate(parent, product->id());
 
103
}
 
104
 
 
105
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
 
106
{
 
107
    if (!canClone(parent, product))
 
108
        return 0;
 
109
    return new BlackBerryCheckDeviceStatusStep(parent, static_cast<BlackBerryCheckDeviceStatusStep *>(product));
 
110
}