2
* Copyright 2013 Canonical Ltd.
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.
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.
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/>.
16
* Author: Juhapekka Piiroinen <juhapekka.piiroinen@canonical.com>
19
#include "ubunturunconfigurationfactory.h"
21
using namespace Ubuntu;
22
using namespace Ubuntu::Internal;
24
QList<Core::Id> UbuntuRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const {
25
if (!canHandle(parent))
26
return QList<Core::Id>();
29
list << Core::Id(Constants::UBUNTUPROJECT_RUNCONTROL_ID);
34
QString UbuntuRunConfigurationFactory::displayNameForId(const Core::Id id) const {
35
if (id == Constants::UBUNTUPROJECT_RUNCONTROL_ID)
36
return tr(Constants::UBUNTUPROJECT_DISPLAYNAME);
40
bool UbuntuRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
41
const Core::Id id) const {
42
if (!canHandle(parent))
45
if (id == Constants::UBUNTUPROJECT_RUNCONTROL_ID)
51
ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) {
52
if (!canCreate(parent, id))
54
return new UbuntuRunConfiguration(parent, id);
57
bool UbuntuRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const {
58
return parent && canCreate(parent, ProjectExplorer::idFromMap(map));
61
ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) {
62
if (!canRestore(parent, map))
68
bool UbuntuRunConfigurationFactory::canClone(ProjectExplorer::Target *, ProjectExplorer::RunConfiguration *) const {
72
ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::clone(ProjectExplorer::Target *parent,
73
ProjectExplorer::RunConfiguration *source) {
74
if (!canClone(parent, source))
79
bool UbuntuRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const {
80
if (!qobject_cast<UbuntuProject *>(parent->project()))