~zeller-benjamin/qtcreator-plugin-ubuntu/qtc41-beta

« back to all changes in this revision

Viewing changes to ubunturunconfigurationfactory.cpp

  • Committer: Juhapekka Piiroinen
  • Date: 2013-09-04 15:30:00 UTC
  • mto: (23.1.14 binary-plugin)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: juhapekka.piiroinen@canonical.com-20130904153000-r4lhfhrjlwmop277
Added cordova plugin from ubuntu-qtcreator-plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2013 Canonical Ltd.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify
5
 
 * it under the terms of the GNU Lesser General Public License as published by
6
 
 * the Free Software Foundation; version 2.1.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU Lesser General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU Lesser General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Author: Juhapekka Piiroinen <juhapekka.piiroinen@canonical.com>
17
 
 */
18
 
 
19
 
#include "ubunturunconfigurationfactory.h"
20
 
 
21
 
using namespace Ubuntu;
22
 
using namespace Ubuntu::Internal;
23
 
 
24
 
QList<Core::Id> UbuntuRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const {
25
 
    if (!canHandle(parent))
26
 
        return QList<Core::Id>();
27
 
 
28
 
    QList<Core::Id> list;
29
 
    list << Core::Id(Constants::UBUNTUPROJECT_RUNCONTROL_ID);
30
 
 
31
 
    return list;
32
 
}
33
 
 
34
 
QString UbuntuRunConfigurationFactory::displayNameForId(const Core::Id id) const {
35
 
    if (id == Constants::UBUNTUPROJECT_RUNCONTROL_ID)
36
 
        return tr(Constants::UBUNTUPROJECT_DISPLAYNAME);
37
 
    return QString();
38
 
}
39
 
 
40
 
bool UbuntuRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
41
 
                                         const Core::Id id) const {
42
 
    if (!canHandle(parent))
43
 
        return false;
44
 
 
45
 
    if (id == Constants::UBUNTUPROJECT_RUNCONTROL_ID)
46
 
        return true;
47
 
 
48
 
    return false;
49
 
}
50
 
 
51
 
ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) {
52
 
    if (!canCreate(parent, id))
53
 
        return NULL;
54
 
    return new UbuntuRunConfiguration(parent, id);
55
 
}
56
 
 
57
 
bool UbuntuRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const {
58
 
    return parent && canCreate(parent, ProjectExplorer::idFromMap(map));
59
 
}
60
 
 
61
 
ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) {
62
 
    if (!canRestore(parent, map))
63
 
        return NULL;
64
 
 
65
 
    return NULL;
66
 
}
67
 
 
68
 
bool UbuntuRunConfigurationFactory::canClone(ProjectExplorer::Target *, ProjectExplorer::RunConfiguration *) const {
69
 
    return NULL;
70
 
}
71
 
 
72
 
ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::clone(ProjectExplorer::Target *parent,
73
 
                                                                   ProjectExplorer::RunConfiguration *source) {
74
 
    if (!canClone(parent, source))
75
 
        return NULL;
76
 
    return NULL;
77
 
}
78
 
 
79
 
bool UbuntuRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const {
80
 
    if (!qobject_cast<UbuntuProject *>(parent->project()))
81
 
        return false;
82
 
    return true;
83
 
}