2012-04-18 20:30:57 +03:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (c) 2013 BogDan Vatra <bog_dan_ro@yahoo.com>
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2012-04-18 20:30:57 +03:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include "androidpackageinstallationfactory.h"
|
|
|
|
|
|
|
|
|
|
#include "androidpackageinstallationstep.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
#include "androidmanager.h"
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include <projectexplorer/buildsteplist.h>
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/target.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
AndroidPackageInstallationFactory::AndroidPackageInstallationFactory(QObject *parent)
|
|
|
|
|
: IBuildStepFactory(parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
QList<Core::Id> AndroidPackageInstallationFactory::availableCreationIds(BuildStepList *parent) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-09-17 18:24:57 +02:00
|
|
|
Q_UNUSED(parent);
|
|
|
|
|
return QList<Core::Id>();
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
QString AndroidPackageInstallationFactory::displayNameForId(const Core::Id id) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
if (id == AndroidPackageInstallationStep::Id)
|
2012-07-27 15:43:00 +02:00
|
|
|
return tr("Deploy to device");
|
2012-04-18 20:30:57 +03:00
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
bool AndroidPackageInstallationFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-09-17 18:24:57 +02:00
|
|
|
Q_UNUSED(parent);
|
|
|
|
|
Q_UNUSED(id);
|
|
|
|
|
return false;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
BuildStep *AndroidPackageInstallationFactory::create(BuildStepList *parent, const Core::Id id)
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-09-17 18:24:57 +02:00
|
|
|
Q_UNUSED(parent);
|
2012-08-09 01:56:51 +02:00
|
|
|
Q_UNUSED(id);
|
2013-09-17 18:24:57 +02:00
|
|
|
return 0;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AndroidPackageInstallationFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
|
|
|
|
|
{
|
2013-09-17 18:24:57 +02:00
|
|
|
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
|
|
|
|
return false;
|
|
|
|
|
if (!AndroidManager::supportsAndroid(parent->target()))
|
|
|
|
|
return false;
|
|
|
|
|
if (parent->contains(AndroidPackageInstallationStep::Id))
|
|
|
|
|
return false;
|
|
|
|
|
return ProjectExplorer::idFromMap(map) == AndroidPackageInstallationStep::Id;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStep *AndroidPackageInstallationFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT(canRestore(parent, map));
|
2013-09-17 18:24:57 +02:00
|
|
|
AndroidPackageInstallationStep * const step = new AndroidPackageInstallationStep(AndroidPackageInstallationStep::ProjectDirectory, parent);
|
2012-04-18 20:30:57 +03:00
|
|
|
if (!step->fromMap(map)) {
|
|
|
|
|
delete step;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return step;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AndroidPackageInstallationFactory::canClone(BuildStepList *parent, BuildStep *product) const
|
|
|
|
|
{
|
|
|
|
|
return canCreate(parent, product->id());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStep *AndroidPackageInstallationFactory::clone(BuildStepList *parent, BuildStep *product)
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT(canClone(parent, product));
|
|
|
|
|
return new AndroidPackageInstallationStep(parent, static_cast<AndroidPackageInstallationStep*>(product));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|