forked from qt-creator/qt-creator
More Android fixes, add default android device.
Switch to new android assests scheme Change-Id: I34bf52cbb085b76df66e40391160d189301aafd2 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
7c77331ea4
commit
a16d355dce
@@ -36,7 +36,8 @@ HEADERS += \
|
||||
androidcreatekeystorecertificate.h \
|
||||
javaparser.h \
|
||||
androidplugin.h \
|
||||
androiddevicefactory.h
|
||||
androiddevicefactory.h \
|
||||
androiddevice.h
|
||||
|
||||
SOURCES += \
|
||||
androidconfigurations.cpp \
|
||||
@@ -63,7 +64,8 @@ SOURCES += \
|
||||
androidcreatekeystorecertificate.cpp \
|
||||
javaparser.cpp \
|
||||
androidplugin.cpp \
|
||||
androiddevicefactory.cpp
|
||||
androiddevicefactory.cpp \
|
||||
androiddevice.cpp
|
||||
|
||||
|
||||
FORMS += \
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace {
|
||||
QFileInfo(Core::ICore::settings(QSettings::SystemScope)->fileName()).absolutePath());
|
||||
}
|
||||
|
||||
bool androidDevicesLessThan(const AndroidDevice &dev1, const AndroidDevice &dev2)
|
||||
bool androidDevicesLessThan(const AndroidDeviceInfo &dev1, const AndroidDeviceInfo &dev2)
|
||||
{
|
||||
return dev1.sdk < dev2.sdk;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ QStringList AndroidConfigurations::sdkTargets(int minApiLevel) const
|
||||
return targets;
|
||||
}
|
||||
while (proc.canReadLine()) {
|
||||
QString line = proc.readLine();
|
||||
QString line = proc.readLine().trimmed();
|
||||
int index = line.indexOf(QLatin1String("\"android-"));
|
||||
if (index == -1)
|
||||
continue;
|
||||
@@ -392,9 +392,9 @@ Utils::FileName AndroidConfigurations::jarsignerPath() const
|
||||
|
||||
QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
|
||||
{
|
||||
QVector<AndroidDevice> devices = connectedDevices();
|
||||
QVector<AndroidDeviceInfo> devices = connectedDevices();
|
||||
|
||||
foreach (AndroidDevice device, devices) {
|
||||
foreach (AndroidDeviceInfo device, devices) {
|
||||
if (device.sdk >= *apiLevel) {
|
||||
*apiLevel = device.sdk;
|
||||
return device.serialNumber;
|
||||
@@ -403,9 +403,9 @@ QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
|
||||
return startAVD(apiLevel);
|
||||
}
|
||||
|
||||
QVector<AndroidDevice> AndroidConfigurations::connectedDevices(int apiLevel) const
|
||||
QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(int apiLevel) const
|
||||
{
|
||||
QVector<AndroidDevice> devices;
|
||||
QVector<AndroidDeviceInfo> devices;
|
||||
QProcess adbProc;
|
||||
adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
|
||||
if (!adbProc.waitForFinished(-1)) {
|
||||
@@ -414,7 +414,7 @@ QVector<AndroidDevice> AndroidConfigurations::connectedDevices(int apiLevel) con
|
||||
}
|
||||
QList<QByteArray> adbDevs = adbProc.readAll().trimmed().split('\n');
|
||||
adbDevs.removeFirst();
|
||||
AndroidDevice dev;
|
||||
AndroidDeviceInfo dev;
|
||||
foreach (const QByteArray &device, adbDevs) {
|
||||
dev.serialNumber = QString::fromLatin1(device.left(device.indexOf('\t')).trimmed());
|
||||
dev.sdk = getSDKVersion(dev.serialNumber);
|
||||
@@ -480,9 +480,9 @@ bool AndroidConfigurations::removeAVD(const QString &name) const
|
||||
return !proc.exitCode();
|
||||
}
|
||||
|
||||
QVector<AndroidDevice> AndroidConfigurations::androidVirtualDevices() const
|
||||
QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
|
||||
{
|
||||
QVector<AndroidDevice> devices;
|
||||
QVector<AndroidDeviceInfo> devices;
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("list") << QLatin1String("avd")); // list available AVDs
|
||||
@@ -492,7 +492,7 @@ QVector<AndroidDevice> AndroidConfigurations::androidVirtualDevices() const
|
||||
}
|
||||
QList<QByteArray> avds = proc.readAll().trimmed().split('\n');
|
||||
avds.removeFirst();
|
||||
AndroidDevice dev;
|
||||
AndroidDeviceInfo dev;
|
||||
for (int i = 0; i < avds.size(); i++) {
|
||||
QString line = QLatin1String(avds[i]);
|
||||
if (!line.contains(QLatin1String("Name:")))
|
||||
@@ -523,12 +523,12 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
connect(m_avdProcess, SIGNAL(finished(int)), m_avdProcess, SLOT(deleteLater()));
|
||||
|
||||
QString avdName = name;
|
||||
QVector<AndroidDevice> devices;
|
||||
QVector<AndroidDeviceInfo> devices;
|
||||
bool createAVDOnce = false;
|
||||
while (true) {
|
||||
if (avdName.isEmpty()) {
|
||||
devices = androidVirtualDevices();
|
||||
foreach (AndroidDevice device, devices)
|
||||
foreach (AndroidDeviceInfo device, devices)
|
||||
if (device.sdk >= *apiLevel) { // take first emulator how supports this package
|
||||
*apiLevel = device.sdk;
|
||||
avdName = device.serialNumber;
|
||||
@@ -575,7 +575,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
|
||||
// get connected devices
|
||||
devices = connectedDevices(*apiLevel);
|
||||
foreach (AndroidDevice device, devices)
|
||||
foreach (AndroidDeviceInfo device, devices)
|
||||
if (device.sdk == *apiLevel)
|
||||
return device.serialNumber;
|
||||
// this should not happen, but ...
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
unsigned partitionSize;
|
||||
};
|
||||
|
||||
struct AndroidDevice {
|
||||
struct AndroidDeviceInfo {
|
||||
QString serialNumber;
|
||||
QString cpuABI;
|
||||
int sdk;
|
||||
@@ -112,8 +112,8 @@ public:
|
||||
QString getDeployDeviceSerialNumber(int *apiLevel) const;
|
||||
bool createAVD(const QString &target, const QString &name, int sdcardSize) const;
|
||||
bool removeAVD(const QString &name) const;
|
||||
QVector<AndroidDevice> connectedDevices(int apiLevel = -1) const;
|
||||
QVector<AndroidDevice> androidVirtualDevices() const;
|
||||
QVector<AndroidDeviceInfo> connectedDevices(int apiLevel = -1) const;
|
||||
QVector<AndroidDeviceInfo> androidVirtualDevices() const;
|
||||
QString startAVD(int *apiLevel, const QString &name = QString()) const;
|
||||
QString bestMatch(const QString &targetAPI) const;
|
||||
|
||||
|
||||
@@ -67,7 +67,9 @@ const char ANDROID_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Android", "Androi
|
||||
const char ANDROID_SETTINGS_CATEGORY_ICON[] = ":/android/images/QtAndroid.png";
|
||||
const char ANDROID_TOOLCHAIN_ID[] = "Qt4ProjectManager.ToolChain.Android";
|
||||
const char ANDROIDQT[] = "Qt4ProjectManager.QtVersion.Android";
|
||||
|
||||
const char ANDROID_DEVICE_TYPE[] = "Android.Device.Type";
|
||||
const char ANDROID_DEVICE_ID[] = "Android Device";
|
||||
|
||||
}
|
||||
} // namespace Android
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "androidconstants.h"
|
||||
#include "androiddeploystep.h"
|
||||
#include "androidpackageinstallationstep.h"
|
||||
#include "androidpackagecreationstep.h"
|
||||
@@ -65,7 +66,9 @@ AndroidDeployConfiguration::AndroidDeployConfiguration(ProjectExplorer::Target *
|
||||
|
||||
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::DeployConfigurationFactory(parent)
|
||||
{ setObjectName(QLatin1String("AndroidDeployConfigurationFactory"));}
|
||||
{
|
||||
setObjectName(QLatin1String("AndroidDeployConfigurationFactory"));
|
||||
}
|
||||
|
||||
bool AndroidDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
{
|
||||
@@ -86,15 +89,14 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::create(
|
||||
|
||||
bool AndroidDeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return ProjectExplorer::idFromMap(map).toString().startsWith(ANDROID_DC_PREFIX);
|
||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||
}
|
||||
|
||||
ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
|
||||
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent, ProjectExplorer::idFromMap(map));
|
||||
if (dc->fromMap(map))
|
||||
return dc;
|
||||
@@ -119,14 +121,24 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::clone(P
|
||||
|
||||
QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
{
|
||||
QList<Core::Id> result;
|
||||
if (!canHandle(parent))
|
||||
return result;
|
||||
QList<Core::Id> ids;
|
||||
if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project()))
|
||||
return ids;
|
||||
|
||||
Qt4ProjectManager::Qt4Project *project = static_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
|
||||
foreach (const QString &id, project->applicationProFilePathes(QLatin1String(ANDROID_DC_PREFIX)))
|
||||
result << Core::Id(id);
|
||||
return result;
|
||||
if (!parent->project()->supportsProfile(parent->profile()))
|
||||
return ids;
|
||||
|
||||
ProjectExplorer::ToolChain *tc
|
||||
= ProjectExplorer::ToolChainProfileInformation::toolChain(parent->profile());
|
||||
|
||||
if (!tc || tc->targetAbi().osFlavor() != ProjectExplorer::Abi::AndroidLinuxFlavor)
|
||||
return ids;
|
||||
|
||||
if (QtSupport::QtProfileInformation::qtVersion(parent->profile())->type() != QLatin1String(Constants::ANDROIDQT))
|
||||
return ids;
|
||||
|
||||
ids << Core::Id(ANDROID_DEPLOYCONFIGURATION_ID);
|
||||
return ids;
|
||||
}
|
||||
|
||||
QString AndroidDeployConfigurationFactory::displayNameForId(const Core::Id id) const
|
||||
|
||||
92
src/plugins/android/androiddevice.cpp
Normal file
92
src/plugins/android/androiddevice.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "androiddevice.h"
|
||||
#include "androidconstants.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
AndroidDevice::AndroidDevice():
|
||||
ProjectExplorer::IDevice(Core::Id(Constants::ANDROID_DEVICE_TYPE), IDevice::AutoDetected,
|
||||
Core::Id(Constants::ANDROID_DEVICE_ID))
|
||||
{
|
||||
setDisplayName(QCoreApplication::translate("ProjectExplorer::AndroidDevice", "Run on Android"));
|
||||
setDeviceState(DeviceReadyToUse);
|
||||
}
|
||||
|
||||
AndroidDevice::AndroidDevice(const AndroidDevice &other):
|
||||
ProjectExplorer::IDevice(other)
|
||||
{ }
|
||||
|
||||
|
||||
ProjectExplorer::IDevice::DeviceInfo AndroidDevice::deviceInformation() const
|
||||
{
|
||||
return ProjectExplorer::IDevice::DeviceInfo();
|
||||
}
|
||||
|
||||
QString AndroidDevice::displayType() const
|
||||
{
|
||||
return QCoreApplication::translate("ProjectExplorer::AndroidDevice", "Android");
|
||||
}
|
||||
|
||||
ProjectExplorer::IDeviceWidget *AndroidDevice::createWidget()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<Core::Id> AndroidDevice::actionIds() const
|
||||
{
|
||||
return QList<Core::Id>()<<Core::Id(Constants::ANDROID_DEVICE_ID);
|
||||
}
|
||||
|
||||
QString AndroidDevice::displayNameForActionId(Core::Id actionId) const
|
||||
{
|
||||
Q_UNUSED(actionId)
|
||||
return QString();
|
||||
}
|
||||
|
||||
void AndroidDevice::executeAction(Core::Id actionId, QWidget *parent) const
|
||||
{
|
||||
Q_UNUSED(actionId)
|
||||
Q_UNUSED(parent)
|
||||
}
|
||||
|
||||
ProjectExplorer::IDevice::Ptr AndroidDevice::clone() const
|
||||
{
|
||||
return ProjectExplorer::IDevice::Ptr(new AndroidDevice(*this));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
68
src/plugins/android/androiddevice.h
Normal file
68
src/plugins/android/androiddevice.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANDROIDDEVICE_H
|
||||
#define ANDROIDDEVICE_H
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
|
||||
namespace Android {
|
||||
class AndroidPlugin; // needed for friend declaration
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class AndroidDevice : public ProjectExplorer::IDevice
|
||||
{
|
||||
public:
|
||||
|
||||
ProjectExplorer::IDevice::DeviceInfo deviceInformation() const;
|
||||
|
||||
virtual QString displayType() const;
|
||||
virtual ProjectExplorer::IDeviceWidget *createWidget();
|
||||
virtual QList<Core::Id> actionIds() const;
|
||||
virtual QString displayNameForActionId(Core::Id actionId) const;
|
||||
virtual void executeAction(Core::Id actionId, QWidget *parent = 0) const;
|
||||
|
||||
virtual ProjectExplorer::IDevice::Ptr clone() const;
|
||||
|
||||
|
||||
protected:
|
||||
friend class AndroidDeviceFactory;
|
||||
friend class Android::AndroidPlugin;
|
||||
AndroidDevice();
|
||||
AndroidDevice(const AndroidDevice &other);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
#endif // ANDROIDDEVICE_H
|
||||
@@ -31,6 +31,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "androiddevicefactory.h"
|
||||
#include "androiddevice.h"
|
||||
|
||||
#include "androidconstants.h"
|
||||
#include <coreplugin/id.h>
|
||||
@@ -39,7 +40,9 @@ namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
AndroidDeviceFactory::AndroidDeviceFactory()
|
||||
{ setObjectName(QLatin1String("AndroidDeviceFactory")); }
|
||||
{
|
||||
setObjectName(QLatin1String("AndroidDeviceFactory"));
|
||||
}
|
||||
|
||||
QString AndroidDeviceFactory::displayNameForId(Core::Id type) const
|
||||
{
|
||||
@@ -60,20 +63,19 @@ bool AndroidDeviceFactory::canCreate() const
|
||||
|
||||
ProjectExplorer::IDevice::Ptr AndroidDeviceFactory::create(Core::Id id) const
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
Q_UNUSED(id)
|
||||
return ProjectExplorer::IDevice::Ptr();
|
||||
}
|
||||
|
||||
bool AndroidDeviceFactory::canRestore(const QVariantMap &map) const
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
return false;
|
||||
return ProjectExplorer::IDevice::typeFromMap(map) == Core::Id(Constants::ANDROID_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
ProjectExplorer::IDevice::Ptr AndroidDeviceFactory::restore(const QVariantMap &map) const
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
return ProjectExplorer::IDevice::Ptr();
|
||||
Q_UNUSED(map)
|
||||
return ProjectExplorer::IDevice::Ptr(new AndroidDevice);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -408,16 +408,20 @@ bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *
|
||||
|
||||
Utils::FileName javaSrcPath
|
||||
= Utils::FileName::fromString(version->versionInfo()[QLatin1String("QT_INSTALL_PREFIX")])
|
||||
.append(QLatin1String("src/android/java"));
|
||||
.appendPath(QLatin1String("src/android/java"));
|
||||
QDir projectDir(qt4Project->projectDirectory());
|
||||
Utils::FileName androidPath = dirPath(target);
|
||||
|
||||
QStringList m_ignoreFiles;
|
||||
bool forceUpdate = false;
|
||||
QDomDocument srcVersionDoc;
|
||||
if (openXmlFile(target, srcVersionDoc, javaSrcPath.append(QLatin1String("version.xml")), false)) {
|
||||
Utils::FileName srcVersionPath = javaSrcPath;
|
||||
srcVersionPath.appendPath(QLatin1String("version.xml"));
|
||||
if (openXmlFile(target, srcVersionDoc, srcVersionPath, false)) {
|
||||
QDomDocument dstVersionDoc;
|
||||
if (openXmlFile(target, dstVersionDoc, androidPath.append(QLatin1String("version.xml")), false))
|
||||
Utils::FileName dstVersionPath=androidPath;
|
||||
dstVersionPath.appendPath(QLatin1String("version.xml"));
|
||||
if (openXmlFile(target, dstVersionDoc, dstVersionPath, false))
|
||||
forceUpdate = (srcVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble()
|
||||
> dstVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble());
|
||||
else
|
||||
@@ -458,7 +462,8 @@ bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *
|
||||
if (it.fileInfo().isDir()) {
|
||||
projectDir.mkpath(AndroidDirName + it.filePath().mid(pos));
|
||||
} else {
|
||||
const Utils::FileName dstFile = androidPath.append(it.filePath().mid(pos));
|
||||
Utils::FileName dstFile = androidPath;
|
||||
dstFile.appendPath(it.filePath().mid(pos));
|
||||
if (m_ignoreFiles.contains(it.fileName())) {
|
||||
continue;
|
||||
} else {
|
||||
|
||||
@@ -161,8 +161,7 @@ bool AndroidPackageCreationStep::init()
|
||||
androidLibPath = path.appendPath(QLatin1String("libs/armeabi-v7a"));
|
||||
else
|
||||
androidLibPath = path.appendPath(QLatin1String("libs/armeabi"));
|
||||
path = m_androidDir;
|
||||
m_gdbServerDestination = path.appendPath(QLatin1String("gdbserver"));
|
||||
m_gdbServerDestination = androidLibPath.appendPath(QLatin1String("gdbserver"));
|
||||
m_gdbServerSource = AndroidConfigurations::instance().gdbServerPath(target()->activeRunConfiguration()->abi().architecture());
|
||||
m_debugBuild = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "androidconstants.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androiddeploystepfactory.h"
|
||||
#include "androiddevice.h"
|
||||
#include "androiddevicefactory.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidmanager.h"
|
||||
@@ -48,6 +49,8 @@
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
|
||||
namespace Android {
|
||||
|
||||
AndroidPlugin::AndroidPlugin()
|
||||
@@ -76,6 +79,9 @@ bool AndroidPlugin::initialize(const QStringList &arguments,
|
||||
addAutoReleasedObject(new Internal::AndroidToolChainFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidDeployConfigurationFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidDeviceFactory);
|
||||
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance();
|
||||
if (dm->find(Core::Id(Constants::ANDROID_DEVICE_ID)).isNull())
|
||||
dm->addDevice(ProjectExplorer::IDevice::Ptr(new Internal::AndroidDevice));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
void AVDModel::setAvdList(QVector<AndroidDevice> list)
|
||||
void AVDModel::setAvdList(QVector<AndroidDeviceInfo> list)
|
||||
{
|
||||
m_list = list;
|
||||
reset();
|
||||
@@ -147,7 +147,6 @@ QString AndroidSettingsWidget::searchKeywords() const
|
||||
void AndroidSettingsWidget::initGui()
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->toolchainVersionComboBox->clear();
|
||||
if (checkSDK(m_androidConfig.sdkLocation))
|
||||
m_ui->SDKLocationLineEdit->setText(m_androidConfig.sdkLocation.toUserOutput());
|
||||
else
|
||||
@@ -167,6 +166,7 @@ void AndroidSettingsWidget::initGui()
|
||||
m_AVDModel.setAvdList(AndroidConfigurations::instance().androidVirtualDevices());
|
||||
m_ui->AVDTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
||||
m_ui->AVDTableView->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
|
||||
fillToolchainVersions();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::saveSettings(bool saveNow)
|
||||
@@ -251,9 +251,9 @@ void AndroidSettingsWidget::ndkLocationEditingFinished()
|
||||
|
||||
void AndroidSettingsWidget::fillToolchainVersions()
|
||||
{
|
||||
m_ui->toolchainVersionComboBox->clear();
|
||||
QStringList toolchainVersions = AndroidConfigurations::instance().ndkToolchainVersions();
|
||||
QString toolchain = m_androidConfig.ndkToolchainVersion;
|
||||
m_ui->toolchainVersionComboBox->clear();
|
||||
foreach (const QString &item, toolchainVersions)
|
||||
m_ui->toolchainVersionComboBox->addItem(item);
|
||||
if (!toolchain.isEmpty())
|
||||
|
||||
@@ -55,7 +55,7 @@ class AVDModel: public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void setAvdList(QVector<AndroidDevice> list);
|
||||
void setAvdList(QVector<AndroidDeviceInfo> list);
|
||||
QString avdName(const QModelIndex &index);
|
||||
|
||||
protected:
|
||||
@@ -65,7 +65,7 @@ protected:
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
private:
|
||||
QVector<AndroidDevice> m_list;
|
||||
QVector<AndroidDeviceInfo> m_list;
|
||||
};
|
||||
|
||||
class AndroidSettingsWidget : public QWidget
|
||||
|
||||
@@ -38,9 +38,11 @@
|
||||
|
||||
#include "qt4projectmanager/qt4projectmanagerconstants.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
@@ -91,6 +93,11 @@ void AndroidToolChain::addToEnvironment(Utils::Environment &env) const
|
||||
// TODO this vars should be configurable in projects -> build tab
|
||||
// TODO invalidate all .pro files !!!
|
||||
|
||||
Qt4Project *qt4pro = qobject_cast<Qt4Project *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentProject());
|
||||
if (!qt4pro || !qt4pro->activeTarget()
|
||||
|| QtSupport::QtProfileInformation::qtVersion(qt4pro->activeTarget()->profile())->type() != QLatin1String(Constants::ANDROIDQT))
|
||||
return;
|
||||
|
||||
QString ndk_host = QLatin1String(
|
||||
#if defined(Q_OS_LINUX)
|
||||
"linux-x86"
|
||||
@@ -107,11 +114,6 @@ void AndroidToolChain::addToEnvironment(Utils::Environment &env) const
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture()));
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture()));
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), AndroidConfigurations::instance().config().ndkToolchainVersion);
|
||||
|
||||
// TODO that is very ugly and likely to be wrong...
|
||||
Qt4Project *qt4pro = qobject_cast<Qt4Project *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentProject());
|
||||
if (!qt4pro || !qt4pro->activeTarget())
|
||||
return;
|
||||
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
|
||||
AndroidConfigurations::instance().bestMatch(AndroidManager::targetSDK(qt4pro->activeTarget())));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user