123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- /**************************************************************************
- **
- ** Copyright (c) 2014 Tomasz Olszak <olszak.tomasz@gmail.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** 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 "tizendebug.h"
- #include "tizendeployconfiguration.h"
- #include "tizenconfigurations.h"
- #include "tizendeploydirectorycreationstep.h"
- #include "tizendeploypackagecreationstep.h"
- #include "tizendeploypackageinstallationstep.h"
- #include "tizenconstants.h"
- #include "tizenmanager.h"
- #include <projectexplorer/buildsteplist.h>
- #include <projectexplorer/target.h>
- #include <projectexplorer/toolchain.h>
- #include <projectexplorer/buildconfiguration.h>
- #include <qmakeprojectmanager/qmakeproject.h>
- #include <qmakeprojectmanager/qmakenodes.h>
- #include <qtsupport/qtkitinformation.h>
- #include <qtsupport/qtsupportconstants.h>
- using namespace ProjectExplorer;
- namespace Tizen {
- namespace Internal {
- TizenDeployConfiguration::TizenDeployConfiguration(Target *parent, Core::Id id)
- : DeployConfiguration(parent, id)
- {
- setDisplayName(tr("Deploy to Tizen device"));
- setDefaultDisplayName(displayName());
- }
- TizenDeployConfiguration::TizenDeployConfiguration(Target *parent, DeployConfiguration *source)
- : DeployConfiguration(parent, source)
- {
- cloneSteps(source);
- }
- TizenDeployConfigurationFactory::TizenDeployConfigurationFactory(QObject *parent)
- : DeployConfigurationFactory(parent)
- {
- setObjectName(QLatin1String("TizenDeployConfigurationFactory"));
- }
- bool TizenDeployConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
- {
- return availableCreationIds(parent).contains(id);
- }
- DeployConfiguration *TizenDeployConfigurationFactory::create(Target *parent, const Core::Id id)
- {
- qCDebug(QTC_TIZEN);
- TizenDeployConfiguration *dc = new TizenDeployConfiguration(parent, id);
- if (!dc)
- return 0;
- dc->stepList()->insertStep(0, new TizenDeployDirectoryCreationStep(dc->stepList()));
- if (id == Core::Id(TIZEN_DEPLOY_MAKE_INSTALL_CONFIGURATION_ID)) {
- dc->setDisplayName(tr("Make install"));
- dc->setDefaultDisplayName(tr("Make install"));
- return dc;
- }
- QmakeProjectManager::QmakeProject *project = qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project());
- if (!project) {
- return 0;
- }
- QmakeProjectManager::QmakeProFileNode * rootQmakeProjectNode = project->rootQmakeProjectNode();
- if ( rootQmakeProjectNode && rootQmakeProjectNode->projectType() == QmakeProjectManager::ApplicationTemplate
- && QFile::exists(TizenManager::manifestPath(parent).toString())) {
- dc->stepList()->insertStep(1, new TizenDeployPackageCreationStep(dc->stepList()));
- dc->stepList()->insertStep(2, new TizenDeployPackageInstallationStep(dc->stepList()));
- }
- return dc;
- }
- bool TizenDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
- {
- return canCreate(parent, idFromMap(map));
- }
- DeployConfiguration *TizenDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
- {
- if (!canRestore(parent, map))
- return 0;
- TizenDeployConfiguration *dc = new TizenDeployConfiguration(parent, idFromMap(map));
- if (dc->fromMap(map))
- return dc;
- delete dc;
- return 0;
- }
- bool TizenDeployConfigurationFactory::canClone(Target *, DeployConfiguration *source) const
- {
- return false;
- }
- DeployConfiguration *TizenDeployConfigurationFactory::clone(Target *parent, DeployConfiguration *source)
- {
- if (!canClone(parent, source))
- return 0;
- return new TizenDeployConfiguration(parent, source);
- }
- QList<Core::Id> TizenDeployConfigurationFactory::availableCreationIds(Target *parent) const
- {
- QList<Core::Id> ids;
- if (!qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project())) {
- return ids;
- }
- if (!parent->project()->supportsKit(parent->kit()))
- return ids;
- ToolChain *tc = ToolChainKitInformation::toolChain(parent->kit());
- if (!tc || tc->type() != QLatin1String(Constants::TIZEN_TOOLCHAIN_GCC_TYPE))
- return ids;
- if (QtSupport::QtKitInformation::qtVersion(parent->kit())->type() != QLatin1String(Constants::TIZEN_QT))
- return ids;
- ids << Core::Id(TIZEN_DEPLOY_TO_DEVICE_CONFIGURATION_ID) << Core::Id(TIZEN_DEPLOY_MAKE_INSTALL_CONFIGURATION_ID);
- return ids;
- }
- QString TizenDeployConfigurationFactory::displayNameForId(const Core::Id id) const
- {
- if (id == Core::Id(TIZEN_DEPLOY_MAKE_INSTALL_CONFIGURATION_ID)) {
- return tr("Make install configuration");
- } else if (id == Core::Id(TIZEN_DEPLOY_TO_DEVICE_CONFIGURATION_ID)) {
- return tr("Deploy to Tizen device configuration");
- }
- return QString();
- }
- bool TizenDeployConfigurationFactory::canHandle(Target *parent) const
- {
- return TizenManager::supportsTizen(parent);
- }
- } // namespace Internal
- } // namespace Tizen
|