2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include "androidsettingswidget.h"
|
|
|
|
|
|
|
|
|
|
#include "ui_androidsettingswidget.h"
|
|
|
|
|
|
|
|
|
|
#include "androidconfigurations.h"
|
|
|
|
|
#include "androidconstants.h"
|
2013-02-14 15:51:59 +01:00
|
|
|
#include "androidtoolchain.h"
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2013-11-19 17:25:32 +01:00
|
|
|
#include <utils/environment.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2014-03-03 12:05:01 +01:00
|
|
|
#include <utils/pathchooser.h>
|
2016-02-05 15:06:15 +01:00
|
|
|
#include <utils/runextensions.h>
|
2016-08-03 17:55:54 +02:00
|
|
|
#include <utils/utilsicons.h>
|
2013-02-14 15:51:59 +01:00
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
|
|
|
|
#include <projectexplorer/kitmanager.h>
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
#include <QFile>
|
|
|
|
|
#include <QTextStream>
|
|
|
|
|
#include <QProcess>
|
2014-07-23 11:54:36 +02:00
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QTime>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2014-02-18 20:20:32 +01:00
|
|
|
#include <QDesktopServices>
|
2012-04-18 20:30:57 +03:00
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QModelIndex>
|
2014-02-18 20:20:32 +01:00
|
|
|
#include <QtCore/QUrl>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
void AvdModel::setAvdList(const QVector<AndroidDeviceInfo> &list)
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2012-09-20 10:31:34 +02:00
|
|
|
beginResetModel();
|
2012-04-18 20:30:57 +03:00
|
|
|
m_list = list;
|
2012-09-20 10:31:34 +02:00
|
|
|
endResetModel();
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2014-04-11 13:31:01 +02:00
|
|
|
QModelIndex AvdModel::indexForAvdName(const QString &avdName) const
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < m_list.size(); ++i) {
|
|
|
|
|
if (m_list.at(i).serialNumber == avdName)
|
|
|
|
|
return index(i, 0);
|
|
|
|
|
}
|
|
|
|
|
return QModelIndex();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-11 13:30:26 +02:00
|
|
|
QString AvdModel::avdName(const QModelIndex &index) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2015-04-23 16:25:44 +02:00
|
|
|
return m_list.at(index.row()).avdname;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
QVariant AvdModel::data(const QModelIndex &index, int role) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
if (role != Qt::DisplayRole || !index.isValid())
|
|
|
|
|
return QVariant();
|
|
|
|
|
switch (index.column()) {
|
|
|
|
|
case 0:
|
2015-04-23 16:25:44 +02:00
|
|
|
return m_list[index.row()].avdname;
|
2012-04-18 20:30:57 +03:00
|
|
|
case 1:
|
|
|
|
|
return QString::fromLatin1("API %1").arg(m_list[index.row()].sdk);
|
2013-10-15 13:44:11 +02:00
|
|
|
case 2: {
|
|
|
|
|
QStringList cpuAbis = m_list[index.row()].cpuAbi;
|
|
|
|
|
return cpuAbis.isEmpty() ? QVariant() : QVariant(cpuAbis.first());
|
|
|
|
|
}
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
QVariant AvdModel::headerData(int section, Qt::Orientation orientation, int role) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
|
|
|
|
switch (section) {
|
|
|
|
|
case 0:
|
2012-08-01 15:25:05 +02:00
|
|
|
//: AVD - Android Virtual Device
|
2012-04-18 20:30:57 +03:00
|
|
|
return tr("AVD Name");
|
|
|
|
|
case 1:
|
|
|
|
|
return tr("AVD Target");
|
|
|
|
|
case 2:
|
|
|
|
|
return tr("CPU/ABI");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return QAbstractItemModel::headerData(section, orientation, role );
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
int AvdModel::rowCount(const QModelIndex &/*parent*/) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
return m_list.size();
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
int AvdModel::columnCount(const QModelIndex &/*parent*/) const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
|
|
|
|
|
: QWidget(parent),
|
2013-12-16 20:19:07 +01:00
|
|
|
m_sdkState(NotSet),
|
|
|
|
|
m_ndkState(NotSet),
|
|
|
|
|
m_javaState(NotSet),
|
2012-04-18 20:30:57 +03:00
|
|
|
m_ui(new Ui_AndroidSettingsWidget),
|
2013-12-16 20:19:07 +01:00
|
|
|
m_androidConfig(AndroidConfigurations::currentConfig())
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
m_ui->setupUi(this);
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(&m_checkGdbWatcher, &QFutureWatcherBase::finished,
|
|
|
|
|
this, &AndroidSettingsWidget::checkGdbFinished);
|
2014-07-29 13:32:24 +02:00
|
|
|
|
2014-06-03 16:37:05 +02:00
|
|
|
m_ui->SDKLocationPathChooser->setFileName(m_androidConfig.sdkLocation());
|
|
|
|
|
m_ui->SDKLocationPathChooser->setPromptDialogTitle(tr("Select Android SDK folder"));
|
|
|
|
|
m_ui->NDKLocationPathChooser->setFileName(m_androidConfig.ndkLocation());
|
|
|
|
|
m_ui->NDKLocationPathChooser->setPromptDialogTitle(tr("Select Android NDK folder"));
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2014-06-03 16:37:05 +02:00
|
|
|
QString dir;
|
|
|
|
|
QString filter;
|
|
|
|
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
|
|
|
|
dir = QDir::homePath() + QLatin1String("/ant.bat");
|
|
|
|
|
filter = QLatin1String("ant (ant.bat)");
|
|
|
|
|
} else if (Utils::HostOsInfo::isMacHost()) {
|
|
|
|
|
// work around QTBUG-7739 that prohibits filters that don't start with *
|
|
|
|
|
dir = QLatin1String("/usr/bin/ant");
|
|
|
|
|
filter = QLatin1String("ant (*ant)");
|
|
|
|
|
} else {
|
|
|
|
|
dir = QLatin1String("/usr/bin/ant");
|
|
|
|
|
filter = QLatin1String("ant (ant)");
|
|
|
|
|
}
|
|
|
|
|
m_ui->AntLocationPathChooser->setFileName(m_androidConfig.antLocation());
|
|
|
|
|
m_ui->AntLocationPathChooser->setExpectedKind(Utils::PathChooser::Command);
|
|
|
|
|
m_ui->AntLocationPathChooser->setPromptDialogTitle(tr("Select ant Script"));
|
|
|
|
|
m_ui->AntLocationPathChooser->setInitialBrowsePathBackup(dir);
|
|
|
|
|
m_ui->AntLocationPathChooser->setPromptDialogFilter(filter);
|
2014-09-22 16:20:51 +03:00
|
|
|
m_ui->UseGradleCheckBox->setChecked(m_androidConfig.useGrandle());
|
2014-06-03 16:37:05 +02:00
|
|
|
|
|
|
|
|
m_ui->OpenJDKLocationPathChooser->setFileName(m_androidConfig.openJDKLocation());
|
|
|
|
|
m_ui->OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path"));
|
2013-12-16 20:19:07 +01:00
|
|
|
m_ui->DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize());
|
|
|
|
|
m_ui->CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation());
|
2012-04-18 20:30:57 +03:00
|
|
|
m_ui->AVDTableView->setModel(&m_AVDModel);
|
2014-08-28 17:33:47 +02:00
|
|
|
m_ui->AVDTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
|
|
|
|
m_ui->AVDTableView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
2013-12-16 20:19:07 +01:00
|
|
|
|
2014-05-07 13:08:16 +02:00
|
|
|
m_ui->downloadAntToolButton->setVisible(!Utils::HostOsInfo::isLinuxHost());
|
|
|
|
|
m_ui->downloadOpenJDKToolButton->setVisible(!Utils::HostOsInfo::isLinuxHost());
|
2013-12-16 20:19:07 +01:00
|
|
|
|
2016-08-03 17:55:54 +02:00
|
|
|
const QPixmap warningPixmap = Utils::Icons::WARNING.pixmap();
|
2015-10-19 12:55:13 +02:00
|
|
|
m_ui->jdkWarningIconLabel->setPixmap(warningPixmap);
|
|
|
|
|
m_ui->kitWarningIconLabel->setPixmap(warningPixmap);
|
|
|
|
|
|
2017-01-02 12:37:49 +01:00
|
|
|
const QPixmap errorPixmap = Utils::Icons::CRITICAL.pixmap();
|
2015-10-19 12:55:13 +02:00
|
|
|
m_ui->sdkWarningIconLabel->setPixmap(errorPixmap);
|
|
|
|
|
m_ui->gdbWarningIconLabel->setPixmap(errorPixmap);
|
|
|
|
|
m_ui->ndkWarningIconLabel->setPixmap(errorPixmap);
|
|
|
|
|
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(m_ui->gdbWarningLabel, &QLabel::linkActivated,
|
|
|
|
|
this, &AndroidSettingsWidget::showGdbWarningDialog);
|
2014-07-23 11:54:36 +02:00
|
|
|
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(&m_virtualDevicesWatcher, &QFutureWatcherBase::finished,
|
|
|
|
|
this, &AndroidSettingsWidget::updateAvds);
|
2015-01-08 17:05:09 +01:00
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
check(All);
|
|
|
|
|
applyToUi(All);
|
2014-04-11 13:31:01 +02:00
|
|
|
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(&m_futureWatcher, &QFutureWatcherBase::finished,
|
|
|
|
|
this, &AndroidSettingsWidget::avdAdded);
|
|
|
|
|
|
|
|
|
|
connect(m_ui->NDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
|
|
|
|
|
this, &AndroidSettingsWidget::ndkLocationEditingFinished);
|
|
|
|
|
connect(m_ui->SDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
|
|
|
|
|
this, &AndroidSettingsWidget::sdkLocationEditingFinished);
|
|
|
|
|
connect(m_ui->AntLocationPathChooser, &Utils::PathChooser::rawPathChanged,
|
|
|
|
|
this, &AndroidSettingsWidget::antLocationEditingFinished);
|
|
|
|
|
connect(m_ui->OpenJDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
|
|
|
|
|
this, &AndroidSettingsWidget::openJDKLocationEditingFinished);
|
|
|
|
|
connect(m_ui->AVDAddPushButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::addAVD);
|
|
|
|
|
connect(m_ui->AVDRemovePushButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::removeAVD);
|
|
|
|
|
connect(m_ui->AVDStartPushButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::startAVD);
|
|
|
|
|
connect(m_ui->AVDTableView, &QAbstractItemView::activated,
|
|
|
|
|
this, &AndroidSettingsWidget::avdActivated);
|
|
|
|
|
connect(m_ui->AVDTableView, &QAbstractItemView::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::avdActivated);
|
|
|
|
|
connect(m_ui->DataPartitionSizeSpinBox, &QAbstractSpinBox::editingFinished,
|
|
|
|
|
this, &AndroidSettingsWidget::dataPartitionSizeEditingFinished);
|
|
|
|
|
connect(m_ui->manageAVDPushButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::manageAVD);
|
|
|
|
|
connect(m_ui->CreateKitCheckBox, &QAbstractButton::toggled,
|
|
|
|
|
this, &AndroidSettingsWidget::createKitToggled);
|
|
|
|
|
connect(m_ui->downloadSDKToolButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::openSDKDownloadUrl);
|
|
|
|
|
connect(m_ui->downloadNDKToolButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::openNDKDownloadUrl);
|
|
|
|
|
connect(m_ui->downloadAntToolButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::openAntDownloadUrl);
|
|
|
|
|
connect(m_ui->downloadOpenJDKToolButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::openOpenJDKDownloadUrl);
|
|
|
|
|
connect(m_ui->UseGradleCheckBox, &QAbstractButton::toggled,
|
|
|
|
|
this, &AndroidSettingsWidget::useGradleToggled);
|
2015-01-08 17:05:09 +01:00
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
AndroidSettingsWidget::~AndroidSettingsWidget()
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
delete m_ui;
|
2014-04-11 13:31:01 +02:00
|
|
|
m_futureWatcher.waitForFinished();
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2014-07-23 11:54:36 +02:00
|
|
|
// NOTE: Will be run via QFuture
|
2014-07-29 13:32:24 +02:00
|
|
|
static QPair<QStringList, bool> checkGdbForBrokenPython(const QStringList &paths)
|
|
|
|
|
{
|
|
|
|
|
foreach (const QString &path, paths) {
|
|
|
|
|
QTime timer;
|
|
|
|
|
timer.start();
|
|
|
|
|
QProcess proc;
|
|
|
|
|
proc.setProcessChannelMode(QProcess::MergedChannels);
|
|
|
|
|
proc.start(path);
|
|
|
|
|
proc.waitForStarted();
|
|
|
|
|
|
|
|
|
|
QByteArray output;
|
|
|
|
|
while (proc.waitForReadyRead(300)) {
|
|
|
|
|
output += proc.readAll();
|
|
|
|
|
if (output.contains("(gdb)"))
|
|
|
|
|
break;
|
|
|
|
|
if (timer.elapsed() > 7 * 1000)
|
2014-07-30 11:24:22 +02:00
|
|
|
return qMakePair(paths, true); // Took too long, abort
|
2014-07-29 13:32:24 +02:00
|
|
|
}
|
2014-07-23 11:54:36 +02:00
|
|
|
|
2014-07-29 13:32:24 +02:00
|
|
|
output.clear();
|
2014-07-23 11:54:36 +02:00
|
|
|
|
2014-07-29 13:32:24 +02:00
|
|
|
proc.write("python import string\n");
|
|
|
|
|
proc.write("python print(string.ascii_uppercase)\n");
|
|
|
|
|
proc.write("python import struct\n");
|
|
|
|
|
proc.write("quit\n");
|
|
|
|
|
while (proc.waitForFinished(300)) {
|
|
|
|
|
if (timer.elapsed() > 9 * 1000)
|
2014-07-30 11:24:22 +02:00
|
|
|
return qMakePair(paths, true); // Took too long, abort
|
2014-07-29 13:32:24 +02:00
|
|
|
}
|
|
|
|
|
proc.waitForFinished();
|
2014-07-23 11:54:36 +02:00
|
|
|
|
2014-07-29 13:32:24 +02:00
|
|
|
output = proc.readAll();
|
2014-07-23 11:54:36 +02:00
|
|
|
|
2014-07-29 13:32:24 +02:00
|
|
|
bool error = output.contains("_PyObject_Free")
|
|
|
|
|
|| output.contains("_PyExc_IOError")
|
|
|
|
|
|| output.contains("_sysconfigdata_nd ")
|
|
|
|
|
|| !output.contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
|
|
|
if (error)
|
|
|
|
|
return qMakePair(paths, error);
|
|
|
|
|
}
|
|
|
|
|
return qMakePair(paths, false);
|
2014-07-23 11:54:36 +02:00
|
|
|
}
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
if (mode & Sdk) {
|
|
|
|
|
m_sdkState = Okay;
|
2014-03-04 23:38:21 +01:00
|
|
|
if (m_androidConfig.sdkLocation().isEmpty())
|
2013-12-16 20:19:07 +01:00
|
|
|
m_sdkState = NotSet;
|
2014-03-04 23:38:21 +01:00
|
|
|
else if (!(sdkLocationIsValid() && sdkPlatformToolsInstalled()))
|
|
|
|
|
m_sdkState = Error;
|
2013-08-01 14:48:16 +02:00
|
|
|
}
|
2013-12-16 20:19:07 +01:00
|
|
|
|
|
|
|
|
if (mode & Ndk) {
|
|
|
|
|
m_ndkState = Okay;
|
|
|
|
|
Utils::FileName platformPath = m_androidConfig.ndkLocation();
|
|
|
|
|
Utils::FileName toolChainPath = m_androidConfig.ndkLocation();
|
|
|
|
|
Utils::FileName sourcesPath = m_androidConfig.ndkLocation();
|
2014-07-29 13:32:24 +02:00
|
|
|
m_ui->gdbWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->gdbWarningLabel->setVisible(false);
|
2013-12-16 20:19:07 +01:00
|
|
|
if (m_androidConfig.ndkLocation().isEmpty()) {
|
|
|
|
|
m_ndkState = NotSet;
|
2014-10-24 13:15:54 +02:00
|
|
|
} else if (!platformPath.appendPath(QLatin1String("platforms")).exists()
|
|
|
|
|
|| !toolChainPath.appendPath(QLatin1String("toolchains")).exists()
|
|
|
|
|
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).exists()) {
|
2013-12-16 20:19:07 +01:00
|
|
|
m_ndkState = Error;
|
2014-03-18 15:55:22 +01:00
|
|
|
m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.")
|
|
|
|
|
.arg(m_androidConfig.ndkLocation().toUserOutput());
|
2014-08-29 14:00:18 +02:00
|
|
|
} else if (platformPath.toString().contains(QLatin1Char(' '))) {
|
2014-03-18 15:55:22 +01:00
|
|
|
m_ndkState = Error;
|
|
|
|
|
m_ndkErrorMessage = tr("The Android NDK cannot be installed into a path with spaces.");
|
2013-12-16 20:19:07 +01:00
|
|
|
} else {
|
|
|
|
|
QList<AndroidToolChainFactory::AndroidToolChainInformation> compilerPaths
|
|
|
|
|
= AndroidToolChainFactory::toolchainPathsForNdk(m_androidConfig.ndkLocation());
|
|
|
|
|
m_ndkCompilerCount = compilerPaths.count();
|
|
|
|
|
|
2014-07-23 11:54:36 +02:00
|
|
|
// Check for a gdb with a broken python
|
2014-07-29 13:32:24 +02:00
|
|
|
QStringList gdbPaths;
|
|
|
|
|
foreach (const AndroidToolChainFactory::AndroidToolChainInformation &ati, compilerPaths) {
|
2016-10-24 15:53:37 +02:00
|
|
|
if (ati.language == ProjectExplorer::ToolChain::Language::C)
|
|
|
|
|
continue;
|
2014-07-29 13:32:24 +02:00
|
|
|
// we only check the arm gdbs, that's indicative enough
|
2014-11-18 18:37:05 +01:00
|
|
|
if (ati.abi.architecture() != ProjectExplorer::Abi::ArmArchitecture)
|
2014-07-29 13:32:24 +02:00
|
|
|
continue;
|
2014-11-18 18:37:05 +01:00
|
|
|
Utils::FileName gdbPath = m_androidConfig.gdbPath(ati.abi, ati.version);
|
2014-10-24 13:15:54 +02:00
|
|
|
if (gdbPath.exists())
|
2014-07-29 13:32:24 +02:00
|
|
|
gdbPaths << gdbPath.toString();
|
2014-07-23 11:54:36 +02:00
|
|
|
}
|
|
|
|
|
|
2014-07-29 13:32:24 +02:00
|
|
|
if (!gdbPaths.isEmpty()) {
|
2016-02-05 15:06:15 +01:00
|
|
|
m_checkGdbWatcher.setFuture(Utils::runAsync(&checkGdbForBrokenPython, gdbPaths));
|
2014-07-29 13:32:24 +02:00
|
|
|
m_gdbCheckPaths = gdbPaths;
|
|
|
|
|
}
|
2013-12-16 20:19:07 +01:00
|
|
|
|
|
|
|
|
// See if we have qt versions for those toolchains
|
2014-11-18 18:37:05 +01:00
|
|
|
QSet<ProjectExplorer::Abi> toolchainsForAbi;
|
2016-10-24 15:53:37 +02:00
|
|
|
foreach (const AndroidToolChainFactory::AndroidToolChainInformation &ati, compilerPaths) {
|
|
|
|
|
if (ati.language == ProjectExplorer::ToolChain::Language::Cxx)
|
|
|
|
|
toolchainsForAbi.insert(ati.abi);
|
|
|
|
|
}
|
2013-12-16 20:19:07 +01:00
|
|
|
|
2017-01-11 14:43:48 +01:00
|
|
|
const QList<QtSupport::BaseQtVersion *> androidQts
|
|
|
|
|
= QtSupport::QtVersionManager::unsortedVersions([](const QtSupport::BaseQtVersion *v) {
|
|
|
|
|
return v->type() == QLatin1String(Constants::ANDROIDQT) && !v->qtAbis().isEmpty();
|
|
|
|
|
});
|
2014-11-18 18:37:05 +01:00
|
|
|
QSet<ProjectExplorer::Abi> qtVersionsForAbi;
|
2017-01-11 14:43:48 +01:00
|
|
|
foreach (QtSupport::BaseQtVersion *qtVersion, androidQts)
|
2014-11-18 18:37:05 +01:00
|
|
|
qtVersionsForAbi.insert(qtVersion->qtAbis().first());
|
2013-12-16 20:19:07 +01:00
|
|
|
|
2014-11-18 18:37:05 +01:00
|
|
|
QSet<ProjectExplorer::Abi> missingQtArchs = toolchainsForAbi.subtract(qtVersionsForAbi);
|
2013-12-16 20:19:07 +01:00
|
|
|
if (missingQtArchs.isEmpty()) {
|
|
|
|
|
m_ndkMissingQtArchs.clear();
|
|
|
|
|
} else {
|
|
|
|
|
if (missingQtArchs.count() == 1) {
|
|
|
|
|
m_ndkMissingQtArchs = tr("Qt version for architecture %1 is missing.\n"
|
|
|
|
|
"To add the Qt version, select Options > Build & Run > Qt Versions.")
|
2014-11-18 18:37:05 +01:00
|
|
|
.arg((*missingQtArchs.constBegin()).toString());
|
2013-12-16 20:19:07 +01:00
|
|
|
} else {
|
2016-11-30 13:34:42 +01:00
|
|
|
m_ndkMissingQtArchs = tr("Qt versions for %n architectures are missing.\n"
|
|
|
|
|
"To add the Qt versions, select Options > Build & Run > Qt Versions.",
|
|
|
|
|
nullptr, missingQtArchs.size());
|
2013-12-16 20:19:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
if (mode & Java) {
|
|
|
|
|
m_javaState = Okay;
|
|
|
|
|
if (m_androidConfig.openJDKLocation().isEmpty()) {
|
|
|
|
|
m_javaState = NotSet;
|
|
|
|
|
} else {
|
|
|
|
|
Utils::FileName bin = m_androidConfig.openJDKLocation();
|
2014-03-12 11:11:34 +01:00
|
|
|
bin.appendPath(QLatin1String("bin/javac" QTC_HOST_EXE_SUFFIX));
|
2014-10-24 13:15:54 +02:00
|
|
|
if (!m_androidConfig.openJDKLocation().exists() || !bin.exists())
|
2013-12-16 20:19:07 +01:00
|
|
|
m_javaState = Error;
|
|
|
|
|
}
|
2013-02-14 15:51:59 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
void AndroidSettingsWidget::applyToUi(AndroidSettingsWidget::Mode mode)
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
if (mode & Sdk) {
|
|
|
|
|
if (m_sdkState == Error) {
|
|
|
|
|
m_ui->sdkWarningIconLabel->setVisible(true);
|
|
|
|
|
m_ui->sdkWarningLabel->setVisible(true);
|
2014-06-03 16:37:05 +02:00
|
|
|
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->SDKLocationPathChooser->rawPath());
|
2014-03-04 23:38:21 +01:00
|
|
|
if (sdkLocationIsValid())
|
|
|
|
|
m_ui->sdkWarningLabel->setText(tr("The Platform tools are missing. Please use the Android SDK Manager to install them."));
|
|
|
|
|
else
|
|
|
|
|
m_ui->sdkWarningLabel->setText(tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput()));
|
2013-12-16 20:19:07 +01:00
|
|
|
} else {
|
|
|
|
|
m_ui->sdkWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->sdkWarningLabel->setVisible(false);
|
|
|
|
|
}
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
2013-02-14 15:51:59 +01:00
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
if (mode & Ndk) {
|
|
|
|
|
if (m_ndkState == NotSet) {
|
|
|
|
|
m_ui->ndkWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->toolchainFoundLabel->setVisible(false);
|
|
|
|
|
m_ui->kitWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->kitWarningLabel->setVisible(false);
|
|
|
|
|
} else if (m_ndkState == Error) {
|
2014-03-18 15:55:22 +01:00
|
|
|
m_ui->toolchainFoundLabel->setText(m_ndkErrorMessage);
|
2013-12-16 20:19:07 +01:00
|
|
|
m_ui->toolchainFoundLabel->setVisible(true);
|
|
|
|
|
m_ui->ndkWarningIconLabel->setVisible(true);
|
2014-03-18 15:54:48 +01:00
|
|
|
m_ui->kitWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->kitWarningLabel->setVisible(false);
|
2013-12-16 20:19:07 +01:00
|
|
|
} else {
|
|
|
|
|
if (m_ndkCompilerCount > 0) {
|
|
|
|
|
m_ui->ndkWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->toolchainFoundLabel->setText(tr("Found %n toolchains for this NDK.", 0, m_ndkCompilerCount));
|
|
|
|
|
m_ui->toolchainFoundLabel->setVisible(true);
|
|
|
|
|
} else {
|
|
|
|
|
m_ui->ndkWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->toolchainFoundLabel->setVisible(false);
|
|
|
|
|
}
|
2013-02-14 15:51:59 +01:00
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
if (m_ndkMissingQtArchs.isEmpty()) {
|
|
|
|
|
m_ui->kitWarningIconLabel->setVisible(false);
|
|
|
|
|
m_ui->kitWarningLabel->setVisible(false);
|
|
|
|
|
} else {
|
|
|
|
|
m_ui->kitWarningIconLabel->setVisible(true);
|
|
|
|
|
m_ui->kitWarningLabel->setVisible(true);
|
|
|
|
|
m_ui->kitWarningLabel->setText(m_ndkMissingQtArchs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-02-14 15:51:59 +01:00
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
if (mode & Java) {
|
|
|
|
|
Utils::FileName location = m_androidConfig.openJDKLocation();
|
|
|
|
|
bool error = m_javaState == Error;
|
|
|
|
|
m_ui->jdkWarningIconLabel->setVisible(error);
|
|
|
|
|
m_ui->jdkWarningLabel->setVisible(error);
|
|
|
|
|
if (error)
|
|
|
|
|
m_ui->jdkWarningLabel->setText(tr("\"%1\" does not seem to be a JDK folder.").arg(location.toUserOutput()));
|
2013-02-14 15:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
if (mode & Sdk || mode & Java) {
|
|
|
|
|
if (m_sdkState == Okay && m_javaState == Okay) {
|
|
|
|
|
m_ui->AVDManagerFrame->setEnabled(true);
|
2013-02-14 15:51:59 +01:00
|
|
|
} else {
|
2013-12-16 20:19:07 +01:00
|
|
|
m_ui->AVDManagerFrame->setEnabled(false);
|
2013-02-14 15:51:59 +01:00
|
|
|
}
|
2013-12-16 20:19:07 +01:00
|
|
|
|
2015-01-08 17:05:09 +01:00
|
|
|
startUpdateAvd();
|
2013-02-14 15:51:59 +01:00
|
|
|
}
|
2013-12-16 20:19:07 +01:00
|
|
|
}
|
2013-02-14 15:51:59 +01:00
|
|
|
|
2015-01-08 17:05:09 +01:00
|
|
|
void AndroidSettingsWidget::disableAvdControls()
|
|
|
|
|
{
|
|
|
|
|
m_ui->AVDAddPushButton->setEnabled(false);
|
|
|
|
|
m_ui->AVDTableView->setEnabled(false);
|
|
|
|
|
m_ui->AVDRemovePushButton->setEnabled(false);
|
|
|
|
|
m_ui->AVDStartPushButton->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::enableAvdControls()
|
|
|
|
|
{
|
|
|
|
|
m_ui->AVDTableView->setEnabled(true);
|
|
|
|
|
m_ui->AVDAddPushButton->setEnabled(true);
|
|
|
|
|
avdActivated(m_ui->AVDTableView->currentIndex());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::startUpdateAvd()
|
|
|
|
|
{
|
|
|
|
|
disableAvdControls();
|
|
|
|
|
m_virtualDevicesWatcher.setFuture(m_androidConfig.androidVirtualDevicesFuture());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::updateAvds()
|
|
|
|
|
{
|
|
|
|
|
m_AVDModel.setAvdList(m_virtualDevicesWatcher.result());
|
|
|
|
|
if (!m_lastAddedAvd.isEmpty()) {
|
|
|
|
|
m_ui->AVDTableView->setCurrentIndex(m_AVDModel.indexForAvdName(m_lastAddedAvd));
|
|
|
|
|
m_lastAddedAvd.clear();
|
|
|
|
|
}
|
|
|
|
|
enableAvdControls();
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-04 23:38:21 +01:00
|
|
|
bool AndroidSettingsWidget::sdkLocationIsValid() const
|
|
|
|
|
{
|
|
|
|
|
Utils::FileName androidExe = m_androidConfig.sdkLocation();
|
|
|
|
|
Utils::FileName androidBat = m_androidConfig.sdkLocation();
|
|
|
|
|
Utils::FileName emulator = m_androidConfig.sdkLocation();
|
2014-10-24 13:15:54 +02:00
|
|
|
return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).exists()
|
|
|
|
|
|| androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).exists())
|
|
|
|
|
&& emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).exists();
|
2014-03-04 23:38:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const
|
|
|
|
|
{
|
|
|
|
|
Utils::FileName adb = m_androidConfig.sdkLocation();
|
2014-10-24 13:15:54 +02:00
|
|
|
return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).exists();
|
2014-03-04 23:38:21 +01:00
|
|
|
}
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
void AndroidSettingsWidget::saveSettings()
|
|
|
|
|
{
|
|
|
|
|
sdkLocationEditingFinished();
|
|
|
|
|
ndkLocationEditingFinished();
|
|
|
|
|
antLocationEditingFinished();
|
|
|
|
|
openJDKLocationEditingFinished();
|
|
|
|
|
dataPartitionSizeEditingFinished();
|
|
|
|
|
AndroidConfigurations::setConfig(m_androidConfig);
|
|
|
|
|
}
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::sdkLocationEditingFinished()
|
|
|
|
|
{
|
2014-06-03 16:37:05 +02:00
|
|
|
m_androidConfig.setSdkLocation(Utils::FileName::fromUserInput(m_ui->SDKLocationPathChooser->rawPath()));
|
2013-12-16 20:19:07 +01:00
|
|
|
|
|
|
|
|
check(Sdk);
|
|
|
|
|
|
|
|
|
|
if (m_sdkState == Okay)
|
|
|
|
|
searchForAnt(m_androidConfig.sdkLocation());
|
|
|
|
|
|
|
|
|
|
applyToUi(Sdk);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::ndkLocationEditingFinished()
|
|
|
|
|
{
|
2014-06-03 16:37:05 +02:00
|
|
|
m_androidConfig.setNdkLocation(Utils::FileName::fromUserInput(m_ui->NDKLocationPathChooser->rawPath()));
|
2013-12-16 20:19:07 +01:00
|
|
|
|
|
|
|
|
check(Ndk);
|
|
|
|
|
|
|
|
|
|
if (m_ndkState == Okay)
|
|
|
|
|
searchForAnt(m_androidConfig.ndkLocation());
|
|
|
|
|
|
|
|
|
|
applyToUi(Ndk);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location)
|
2013-04-17 11:52:16 +02:00
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
if (!m_androidConfig.antLocation().isEmpty())
|
2013-04-17 11:52:16 +02:00
|
|
|
return;
|
|
|
|
|
if (location.isEmpty())
|
|
|
|
|
return;
|
2013-12-16 20:19:07 +01:00
|
|
|
QDir parentFolder = location.toFileInfo().absoluteDir();
|
2013-04-17 11:52:16 +02:00
|
|
|
foreach (const QString &file, parentFolder.entryList()) {
|
|
|
|
|
if (file.startsWith(QLatin1String("apache-ant"))) {
|
2013-10-30 13:23:11 +01:00
|
|
|
Utils::FileName ant = Utils::FileName::fromString(parentFolder.absolutePath());
|
2013-11-15 14:12:46 +01:00
|
|
|
ant.appendPath(file).appendPath(QLatin1String("bin"));
|
|
|
|
|
if (Utils::HostOsInfo::isWindowsHost())
|
|
|
|
|
ant.appendPath(QLatin1String("ant.bat"));
|
|
|
|
|
else
|
|
|
|
|
ant.appendPath(QLatin1String("ant"));
|
2014-10-24 13:15:54 +02:00
|
|
|
if (ant.exists()) {
|
2013-12-16 20:19:07 +01:00
|
|
|
m_androidConfig.setAntLocation(ant);
|
2014-06-03 16:37:05 +02:00
|
|
|
m_ui->AntLocationPathChooser->setFileName(ant);
|
2013-04-17 11:52:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
void AndroidSettingsWidget::antLocationEditingFinished()
|
|
|
|
|
{
|
2014-06-03 16:37:05 +02:00
|
|
|
m_androidConfig.setAntLocation(Utils::FileName::fromUserInput(m_ui->AntLocationPathChooser->rawPath()));
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::openJDKLocationEditingFinished()
|
|
|
|
|
{
|
2014-06-03 16:37:05 +02:00
|
|
|
m_androidConfig.setOpenJDKLocation(Utils::FileName::fromUserInput(m_ui->OpenJDKLocationPathChooser->rawPath()));
|
2013-12-16 20:19:07 +01:00
|
|
|
|
|
|
|
|
check(Java);
|
|
|
|
|
applyToUi(Java);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2014-02-18 20:20:32 +01:00
|
|
|
void AndroidSettingsWidget::openSDKDownloadUrl()
|
|
|
|
|
{
|
2016-09-22 20:45:00 +02:00
|
|
|
QDesktopServices::openUrl(QUrl::fromUserInput("https://developer.android.com/studio/"));
|
2014-02-18 20:20:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::openNDKDownloadUrl()
|
|
|
|
|
{
|
2016-09-22 20:45:00 +02:00
|
|
|
QDesktopServices::openUrl(QUrl::fromUserInput("https://developer.android.com/ndk/downloads/"));
|
2014-02-18 20:20:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::openAntDownloadUrl()
|
|
|
|
|
{
|
2016-09-22 20:45:00 +02:00
|
|
|
QDesktopServices::openUrl(QUrl::fromUserInput("http://ant.apache.org/bindownload.cgi"));
|
2014-02-18 20:20:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::openOpenJDKDownloadUrl()
|
|
|
|
|
{
|
2016-09-22 20:45:00 +02:00
|
|
|
QDesktopServices::openUrl(QUrl::fromUserInput("http://www.oracle.com/technetwork/java/javase/downloads/"));
|
2014-02-18 20:20:32 +01:00
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
void AndroidSettingsWidget::addAVD()
|
|
|
|
|
{
|
2015-01-08 17:05:09 +01:00
|
|
|
disableAvdControls();
|
2014-04-11 13:31:01 +02:00
|
|
|
AndroidConfig::CreateAvdInfo info = m_androidConfig.gatherCreateAVDInfo(this);
|
|
|
|
|
|
|
|
|
|
if (info.target.isEmpty()) {
|
2015-01-08 17:05:09 +01:00
|
|
|
enableAvdControls();
|
2014-04-11 13:31:01 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_futureWatcher.setFuture(m_androidConfig.createAVD(info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::avdAdded()
|
|
|
|
|
{
|
|
|
|
|
AndroidConfig::CreateAvdInfo info = m_futureWatcher.result();
|
|
|
|
|
if (!info.error.isEmpty()) {
|
2015-01-08 17:05:09 +01:00
|
|
|
enableAvdControls();
|
2014-04-11 13:31:01 +02:00
|
|
|
QMessageBox::critical(this, QApplication::translate("AndroidConfig", "Error Creating AVD"), info.error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-08 17:05:09 +01:00
|
|
|
startUpdateAvd();
|
|
|
|
|
m_lastAddedAvd = info.name;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::removeAVD()
|
|
|
|
|
{
|
2015-01-08 17:05:09 +01:00
|
|
|
disableAvdControls();
|
2014-04-11 11:45:35 +02:00
|
|
|
QString avdName = m_AVDModel.avdName(m_ui->AVDTableView->currentIndex());
|
|
|
|
|
if (QMessageBox::question(this, tr("Remove Android Virtual Device"),
|
|
|
|
|
tr("Remove device \"%1\"? This cannot be undone.").arg(avdName),
|
|
|
|
|
QMessageBox::Yes | QMessageBox::No)
|
2015-01-08 17:05:09 +01:00
|
|
|
== QMessageBox::No) {
|
|
|
|
|
enableAvdControls();
|
2014-04-11 11:45:35 +02:00
|
|
|
return;
|
2015-01-08 17:05:09 +01:00
|
|
|
}
|
2014-04-11 11:45:35 +02:00
|
|
|
|
|
|
|
|
m_androidConfig.removeAVD(avdName);
|
2015-01-08 17:05:09 +01:00
|
|
|
startUpdateAvd();
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::startAVD()
|
|
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
m_androidConfig.startAVDAsync(m_AVDModel.avdName(m_ui->AVDTableView->currentIndex()));
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2014-05-19 23:31:01 +03:00
|
|
|
void AndroidSettingsWidget::avdActivated(const QModelIndex &index)
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
m_ui->AVDRemovePushButton->setEnabled(index.isValid());
|
|
|
|
|
m_ui->AVDStartPushButton->setEnabled(index.isValid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::dataPartitionSizeEditingFinished()
|
|
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
m_androidConfig.setPartitionSize(m_ui->DataPartitionSizeSpinBox->value());
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2013-02-14 15:51:59 +01:00
|
|
|
void AndroidSettingsWidget::createKitToggled()
|
|
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
m_androidConfig.setAutomaticKitCreation(m_ui->CreateKitCheckBox->isChecked());
|
2013-02-14 15:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
void AndroidSettingsWidget::useGradleToggled()
|
|
|
|
|
{
|
|
|
|
|
m_androidConfig.setUseGradle(m_ui->UseGradleCheckBox->isChecked());
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-23 11:54:36 +02:00
|
|
|
void AndroidSettingsWidget::checkGdbFinished()
|
|
|
|
|
{
|
2014-07-29 13:32:24 +02:00
|
|
|
QPair<QStringList, bool> result = m_checkGdbWatcher.future().result();
|
|
|
|
|
if (result.first != m_gdbCheckPaths) // no longer relevant
|
2014-07-23 11:54:36 +02:00
|
|
|
return;
|
|
|
|
|
m_ui->gdbWarningIconLabel->setVisible(result.second);
|
|
|
|
|
m_ui->gdbWarningLabel->setVisible(result.second);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::showGdbWarningDialog()
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::warning(this,
|
|
|
|
|
tr("Unsupported GDB"),
|
|
|
|
|
tr("The GDB inside this NDK seems to not support Python. "
|
|
|
|
|
"The Qt Project offers fixed GDB builds at: "
|
2015-03-08 10:08:17 +01:00
|
|
|
"<a href=\"http://download.qt.io/official_releases/gdb/\">"
|
|
|
|
|
"http://download.qt.io/official_releases/gdb/</a>"));
|
2014-07-23 11:54:36 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
void AndroidSettingsWidget::manageAVD()
|
|
|
|
|
{
|
|
|
|
|
QProcess *avdProcess = new QProcess();
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(this, &QObject::destroyed, avdProcess, &QObject::deleteLater);
|
|
|
|
|
connect(avdProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
|
|
|
|
|
avdProcess, &QObject::deleteLater);
|
2013-11-19 17:25:32 +01:00
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
avdProcess->setProcessEnvironment(m_androidConfig.androidToolEnvironment().toProcessEnvironment());
|
|
|
|
|
QString executable = m_androidConfig.androidToolPath().toString();
|
2013-11-19 17:25:32 +01:00
|
|
|
QStringList arguments = QStringList() << QLatin1String("avd");
|
|
|
|
|
|
|
|
|
|
avdProcess->start(executable, arguments);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|