forked from qt-creator/qt-creator
Android: Automatic Kit creation
If both qt versions and ndk path exist automatically create Kits Change-Id: If7739e866eeda3df2982850ff8f8cf22ca8f22c0 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -29,11 +29,22 @@
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidtoolchain.h"
|
||||
#include "androiddevice.h"
|
||||
#include "androidgdbserverkitinformation.h"
|
||||
#include "ui_addnewavddialog.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/persistentsettings.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QSettings>
|
||||
@@ -68,6 +79,7 @@ namespace {
|
||||
const QLatin1String AntLocationKey("AntLocation");
|
||||
const QLatin1String OpenJDKLocationKey("OpenJDKLocation");
|
||||
const QLatin1String KeystoreLocationKey("KeystoreLocation");
|
||||
const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation");
|
||||
const QLatin1String PartitionSizeKey("PartitionSize");
|
||||
const QLatin1String ArmToolchainPrefix("arm-linux-androideabi");
|
||||
const QLatin1String X86ToolchainPrefix("x86");
|
||||
@@ -140,6 +152,7 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
antLocation = FileName::fromString(settings.value(AntLocationKey).toString());
|
||||
openJDKLocation = FileName::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = FileName::fromString(settings.value(KeystoreLocationKey).toString());
|
||||
automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool();
|
||||
|
||||
PersistentSettingsReader reader;
|
||||
if (reader.load(FileName::fromString(sdkSettingsFileName()))
|
||||
@@ -150,6 +163,9 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
antLocation = FileName::fromString(reader.restoreValue(AntLocationKey).toString());
|
||||
openJDKLocation = FileName::fromString(reader.restoreValue(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = FileName::fromString(reader.restoreValue(KeystoreLocationKey).toString());
|
||||
QVariant v = reader.restoreValue(AutomaticKitCreationKey);
|
||||
if (v.isValid())
|
||||
automaticKitCreation = v.toBool();
|
||||
// persistent settings
|
||||
}
|
||||
|
||||
@@ -173,6 +189,7 @@ void AndroidConfig::save(QSettings &settings) const
|
||||
settings.setValue(OpenJDKLocationKey, openJDKLocation.toString());
|
||||
settings.setValue(KeystoreLocationKey, keystoreLocation.toString());
|
||||
settings.setValue(PartitionSizeKey, partitionSize);
|
||||
settings.setValue(AutomaticKitCreationKey, automaticKitCreation);
|
||||
}
|
||||
|
||||
void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
|
||||
@@ -180,6 +197,7 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
|
||||
m_config = devConfigs;
|
||||
save();
|
||||
updateAvailablePlatforms();
|
||||
updateAutomaticKitList();
|
||||
emit updated();
|
||||
}
|
||||
|
||||
@@ -527,6 +545,99 @@ QString AndroidConfigurations::bestMatch(const QString &targetAPI) const
|
||||
return QLatin1String("android-8");
|
||||
}
|
||||
|
||||
bool equalKits(Kit *a, Kit *b)
|
||||
{
|
||||
return ToolChainKitInformation::toolChain(a) == ToolChainKitInformation::toolChain(b)
|
||||
&& QtSupport::QtKitInformation::qtVersion(a) == QtSupport::QtKitInformation::qtVersion(b);
|
||||
}
|
||||
|
||||
void AndroidConfigurations::updateAutomaticKitList()
|
||||
{
|
||||
QList<AndroidToolChain *> toolchains;
|
||||
if (AndroidConfigurations::instance().config().automaticKitCreation) {
|
||||
// having a empty toolchains list will remove all autodetected kits for android
|
||||
// exactly what we want in that case
|
||||
foreach (ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
|
||||
if (!tc->isAutoDetected())
|
||||
continue;
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
continue;
|
||||
toolchains << static_cast<AndroidToolChain *>(tc);
|
||||
}
|
||||
}
|
||||
|
||||
QList<Kit *> existingKits;
|
||||
|
||||
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::instance()->kits()) {
|
||||
if (ProjectExplorer::DeviceKitInformation::deviceId(k) != Core::Id(Constants::ANDROID_DEVICE_ID))
|
||||
continue;
|
||||
if (!k->isAutoDetected())
|
||||
continue;
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain((k));
|
||||
if (!tc)
|
||||
continue;
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
continue;
|
||||
|
||||
existingKits << k;
|
||||
}
|
||||
|
||||
QMap<ProjectExplorer::Abi::Architecture, QList<QtSupport::BaseQtVersion *> > qtVersionsForArch;
|
||||
foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::instance()->versions()) {
|
||||
if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT))
|
||||
continue;
|
||||
qtVersionsForArch[qtVersion->qtAbis().first().architecture()].append(qtVersion);
|
||||
}
|
||||
|
||||
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance();
|
||||
IDevice::ConstPtr device = dm->find(Core::Id(Constants::ANDROID_DEVICE_ID)); // should always exist
|
||||
|
||||
// register new kits
|
||||
QList<Kit *> newKits;
|
||||
foreach (AndroidToolChain *tc, toolchains) {
|
||||
QList<QtSupport::BaseQtVersion *> qtVersions = qtVersionsForArch.value(tc->targetAbi().architecture());
|
||||
foreach (QtSupport::BaseQtVersion *qt, qtVersions) {
|
||||
Kit *newKit = new Kit;
|
||||
newKit->setAutoDetected(true);
|
||||
QString arch = ProjectExplorer::Abi::toString(tc->targetAbi().architecture());
|
||||
newKit->setDisplayName(tr("Android for %1 (gcc %2, qt %3) ")
|
||||
.arg(arch)
|
||||
.arg(tc->ndkToolChainVersion())
|
||||
.arg(qt->qtVersionString()));
|
||||
DeviceTypeKitInformation::setDeviceTypeId(newKit, Core::Id(Constants::ANDROID_DEVICE_TYPE));
|
||||
ToolChainKitInformation::setToolChain(newKit, tc);
|
||||
QtSupport::QtKitInformation::setQtVersion(newKit, qt);
|
||||
DeviceKitInformation::setDevice(newKit, device);
|
||||
Debugger::DebuggerKitInformation::DebuggerItem item;
|
||||
item.engineType = Debugger::GdbEngineType;
|
||||
item.binary = tc->suggestedDebugger();
|
||||
Debugger::DebuggerKitInformation::setDebuggerItem(newKit, item);
|
||||
AndroidGdbServerKitInformation::setGdbSever(newKit, tc->suggestedGdbServer());
|
||||
newKits << newKit;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = existingKits.count() - 1; i >= 0; --i) {
|
||||
Kit *existingKit = existingKits.at(i);
|
||||
for (int j = 0; j < newKits.count(); ++j) {
|
||||
Kit *newKit = newKits.at(j);
|
||||
if (equalKits(existingKit, newKit)) {
|
||||
// Kit is already registered, nothing to do
|
||||
newKits.removeAt(j);
|
||||
existingKits.removeAt(i);
|
||||
KitManager::deleteKit(newKit);
|
||||
j = newKits.count();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Kit *k, existingKits)
|
||||
KitManager::instance()->deregisterKit(k);
|
||||
|
||||
foreach (Kit *kit, newKits)
|
||||
KitManager::instance()->registerKit(kit);
|
||||
}
|
||||
|
||||
AndroidConfigurations &AndroidConfigurations::instance(QObject *parent)
|
||||
{
|
||||
if (m_instance == 0)
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
Utils::FileName openJDKLocation;
|
||||
Utils::FileName keystoreLocation;
|
||||
unsigned partitionSize;
|
||||
bool automaticKitCreation;
|
||||
};
|
||||
|
||||
struct AndroidDeviceInfo
|
||||
@@ -116,6 +117,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
bool createAVD(int minApiLevel = 0) const;
|
||||
void updateAutomaticKitList();
|
||||
|
||||
private:
|
||||
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "androiddeployconfiguration.h"
|
||||
#include "androidgdbserverkitinformation.h"
|
||||
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
@@ -80,6 +82,9 @@ void AndroidPlugin::extensionsInitialized()
|
||||
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance();
|
||||
if (dm->find(Core::Id(Constants::ANDROID_DEVICE_ID)).isNull())
|
||||
dm->addDevice(ProjectExplorer::IDevice::Ptr(new Internal::AndroidDevice));
|
||||
Internal::AndroidConfigurations::instance().updateAutomaticKitList();
|
||||
connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
||||
&Internal::AndroidConfigurations::instance(), SLOT(updateAutomaticKitList()));
|
||||
}
|
||||
|
||||
} // namespace Android
|
||||
|
||||
@@ -82,6 +82,10 @@ void AndroidSettingsPage::apply()
|
||||
else
|
||||
ProjectExplorer::ToolChainManager::instance()->registerToolChain(tc);
|
||||
}
|
||||
|
||||
// TODO deregister old automatic toolchains?
|
||||
|
||||
AndroidConfigurations::instance().updateAutomaticKitList();
|
||||
}
|
||||
|
||||
void AndroidSettingsPage::finish()
|
||||
|
||||
@@ -32,10 +32,15 @@
|
||||
#include "ui_androidsettingswidget.h"
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
|
||||
#include "androidconstants.h"
|
||||
#include "androidtoolchain.h"
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
@@ -150,6 +155,7 @@ void AndroidSettingsWidget::initGui()
|
||||
m_ui->AntLocationLineEdit->setText(m_androidConfig.antLocation.toUserOutput());
|
||||
m_ui->OpenJDKLocationLineEdit->setText(m_androidConfig.openJDKLocation.toUserOutput());
|
||||
m_ui->DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize);
|
||||
m_ui->CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation);
|
||||
m_ui->AVDTableView->setModel(&m_AVDModel);
|
||||
m_AVDModel.setAvdList(AndroidConfigurations::instance().androidVirtualDevices());
|
||||
m_ui->AVDTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
||||
@@ -186,19 +192,79 @@ bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
|
||||
return true;
|
||||
}
|
||||
|
||||
int indexOf(const QList<AndroidToolChainFactory::AndroidToolChainInformation> &list, const Utils::FileName &f)
|
||||
{
|
||||
int end = list.count();
|
||||
for (int i = 0; i < end; ++i) {
|
||||
if (list.at(i).compilerCommand == f)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
|
||||
{
|
||||
if (location.isEmpty())
|
||||
if (location.isEmpty()) {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
m_ui->toolchainFoundLabel->setVisible(false);
|
||||
m_ui->kitWarningIconLabel->setVisible(false);
|
||||
m_ui->kitWarningLabel->setVisible(false);
|
||||
return false;
|
||||
}
|
||||
Utils::FileName platformPath = location;
|
||||
Utils::FileName toolChainPath = location;
|
||||
Utils::FileName sourcesPath = location;
|
||||
if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
|
||||
|| !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
|
||||
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
|
||||
QMessageBox::critical(this, tr("Android NDK Folder"), tr("\"%1\" does not seem to be an Android NDK top folder.").arg(location.toUserOutput()));
|
||||
m_ui->toolchainFoundLabel->setText(tr("\"%1\" does not seem to be an Android NDK top folder.").arg(location.toUserOutput()));
|
||||
m_ui->toolchainFoundLabel->setVisible(true);
|
||||
m_ui->ndkWarningIconLabel->setVisible(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check how many toolchains we could add...
|
||||
QList<AndroidToolChainFactory::AndroidToolChainInformation> compilerPaths = AndroidToolChainFactory::toolchainPathsForNdk(location);
|
||||
if (compilerPaths.isEmpty()) {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
m_ui->toolchainFoundLabel->setVisible(false);
|
||||
} else {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
m_ui->toolchainFoundLabel->setText(tr("Found %1 toolchains for this NDK.").arg(compilerPaths.count()));
|
||||
m_ui->toolchainFoundLabel->setVisible(true);
|
||||
}
|
||||
|
||||
// See if we have qt versions for those toolchains
|
||||
QSet<ProjectExplorer::Abi::Architecture> toolchainsForArch;
|
||||
foreach (const AndroidToolChainFactory::AndroidToolChainInformation &ati, compilerPaths)
|
||||
toolchainsForArch.insert(ati.architecture);
|
||||
|
||||
QSet<ProjectExplorer::Abi::Architecture> qtVersionsForArch;
|
||||
foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::instance()->versions()) {
|
||||
if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT))
|
||||
continue;
|
||||
qtVersionsForArch.insert(qtVersion->qtAbis().first().architecture());
|
||||
}
|
||||
|
||||
QSet<ProjectExplorer::Abi::Architecture> missingQtArchs = toolchainsForArch.subtract(qtVersionsForArch);
|
||||
if (missingQtArchs.isEmpty()) {
|
||||
m_ui->kitWarningIconLabel->setVisible(false);
|
||||
m_ui->kitWarningLabel->setVisible(false);
|
||||
} else {
|
||||
m_ui->kitWarningIconLabel->setVisible(true);
|
||||
m_ui->kitWarningLabel->setVisible(true);
|
||||
if (missingQtArchs.count() == 1) {
|
||||
m_ui->kitWarningLabel->setText(tr("Qt version for architecture %1 is missing. To add the Qt version, select Options > Build & Run > Qt Versions.")
|
||||
.arg(ProjectExplorer::Abi::toString((*missingQtArchs.constBegin()))));
|
||||
} else {
|
||||
QStringList missingArchs;
|
||||
foreach (ProjectExplorer::Abi::Architecture arch, missingQtArchs)
|
||||
missingArchs.append(ProjectExplorer::Abi::toString(arch));
|
||||
m_ui->kitWarningLabel->setText(tr("Qt versions for architectures %1 are missing. To add the Qt versions, select Options > Build & Run > Qt Versions.")
|
||||
.arg(missingArchs.join(QLatin1String(", "))));
|
||||
}
|
||||
}
|
||||
|
||||
m_androidConfig.ndkLocation = location;
|
||||
return true;
|
||||
|
||||
@@ -317,6 +383,11 @@ void AndroidSettingsWidget::dataPartitionSizeEditingFinished()
|
||||
m_androidConfig.partitionSize = m_ui->DataPartitionSizeSpinBox->value();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::createKitToggled()
|
||||
{
|
||||
m_androidConfig.automaticKitCreation = m_ui->CreateKitCheckBox->isChecked();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::manageAVD()
|
||||
{
|
||||
QProcess *avdProcess = new QProcess();
|
||||
|
||||
@@ -87,6 +87,7 @@ private slots:
|
||||
void avdActivated(QModelIndex);
|
||||
void dataPartitionSizeEditingFinished();
|
||||
void manageAVD();
|
||||
void createKitToggled();
|
||||
|
||||
private:
|
||||
void initGui();
|
||||
|
||||
@@ -16,8 +16,46 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="SDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Android SDK location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="SDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="SDKLocationPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="NDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Android NDK location:</string>
|
||||
</property>
|
||||
@@ -37,17 +75,101 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="ndkWarningIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_error.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="toolchainFoundLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="CreateKitCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
<string>Automatically create kits for Android tool chains</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="kitWarningIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="kitWarningLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="AntLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ant location:</string>
|
||||
</property>
|
||||
@@ -56,8 +178,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="OpenJDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OpenJDK location:</string>
|
||||
</property>
|
||||
@@ -66,36 +204,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="OpenJDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="OpenJDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="SDKLocationLabel">
|
||||
<property name="text">
|
||||
<string>Android SDK location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="SDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="SDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -107,22 +225,6 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0" rowspan="4">
|
||||
<widget class="QTableView" name="AVDTableView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="textElideMode">
|
||||
<enum>Qt::ElideMiddle</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="AVDStartPushButton">
|
||||
<property name="enabled">
|
||||
@@ -133,19 +235,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>129</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -197,13 +286,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="AVDAddPushButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="AVDRemovePushButton">
|
||||
<property name="enabled">
|
||||
@@ -214,12 +296,50 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="AVDAddPushButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="4">
|
||||
<widget class="QTableView" name="AVDTableView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="textElideMode">
|
||||
<enum>Qt::ElideMiddle</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>129</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../projectexplorer/projectexplorer.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>NDKLocationLineEdit</sender>
|
||||
@@ -461,6 +581,22 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>CreateKitCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>createKitToggled()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>358</x>
|
||||
<y>99</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>339</x>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>sdkLocationEditingFinished()</slot>
|
||||
@@ -477,5 +613,6 @@
|
||||
<slot>openJDKLocationEditingFinished()</slot>
|
||||
<slot>browseOpenJDKLocation()</slot>
|
||||
<slot>manageAVD()</slot>
|
||||
<slot>createKitToggled()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
@@ -280,6 +280,39 @@ ToolChain *AndroidToolChainFactory::restore(const QVariantMap &data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<AndroidToolChainFactory::AndroidToolChainInformation> AndroidToolChainFactory::toolchainPathsForNdk(const Utils::FileName &ndkPath)
|
||||
{
|
||||
QList<AndroidToolChainInformation> result;
|
||||
if (ndkPath.isEmpty())
|
||||
return result;
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
FileName path = ndkPath;
|
||||
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
|
||||
QStringList() << QLatin1String("*"), QDir::Dirs);
|
||||
while (it.hasNext()) {
|
||||
const QString &fileName = QFileInfo(it.next()).fileName();
|
||||
int idx = versionRegExp.indexIn(fileName);
|
||||
if (idx == -1)
|
||||
continue;
|
||||
AndroidToolChainInformation ati;
|
||||
ati.version = fileName.mid(idx + 1);
|
||||
QString platform = fileName.left(idx);
|
||||
ati.architecture = AndroidConfigurations::architectureForToolChainPrefix(platform);
|
||||
if (ati.architecture == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
|
||||
continue;
|
||||
// AndroidToolChain *tc = new AndroidToolChain(arch, version, true);
|
||||
ati.compilerCommand = ndkPath;
|
||||
ati.compilerCommand.appendPath(QString::fromLatin1("toolchains/%1/prebuilt/%3/bin/%4")
|
||||
.arg(fileName)
|
||||
.arg(ToolchainHost)
|
||||
.arg(AndroidConfigurations::toolsPrefix(ati.architecture)));
|
||||
ati.compilerCommand.append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
|
||||
// tc->setCompilerCommand(compilerPath);
|
||||
result.append(ati);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::FileName &ndkPath)
|
||||
{
|
||||
QList<ToolChain *> result;
|
||||
|
||||
@@ -103,7 +103,16 @@ public:
|
||||
bool canRestore(const QVariantMap &data);
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data);
|
||||
|
||||
class AndroidToolChainInformation
|
||||
{
|
||||
public:
|
||||
Utils::FileName compilerCommand;
|
||||
ProjectExplorer::Abi::Architecture architecture;
|
||||
QString version;
|
||||
};
|
||||
|
||||
static QList<ProjectExplorer::ToolChain *> createToolChainsForNdk(const Utils::FileName &ndkPath);
|
||||
static QList<AndroidToolChainInformation> toolchainPathsForNdk(const Utils::FileName &ndkPath);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user