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"
|
2017-04-03 11:11:17 +02:00
|
|
|
#include "androidavdmanager.h"
|
2017-08-18 08:22:34 +02:00
|
|
|
#include "androidsdkmanager.h"
|
|
|
|
|
#include "avddialog.h"
|
2019-12-23 16:13:23 +02:00
|
|
|
#include "androidsdkdownloader.h"
|
2017-09-18 13:48:00 +02:00
|
|
|
#include "androidsdkmanagerwidget.h"
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2013-11-19 17:25:32 +01:00
|
|
|
#include <utils/environment.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2019-12-12 23:15:48 +01:00
|
|
|
#include <utils/infolabel.h>
|
2014-03-03 12:05:01 +01:00
|
|
|
#include <utils/pathchooser.h>
|
2020-02-28 19:27:03 +02:00
|
|
|
#include <utils/qtcprocess.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>
|
2016-12-16 00:43:14 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2013-02-14 15:51:59 +01:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
|
2020-01-10 12:53:28 +01:00
|
|
|
#include <QAbstractTableModel>
|
2014-02-18 20:20:32 +01:00
|
|
|
#include <QDesktopServices>
|
2019-12-23 16:13:23 +02:00
|
|
|
#include <QDir>
|
2020-01-10 12:53:28 +01:00
|
|
|
#include <QFutureWatcher>
|
|
|
|
|
#include <QList>
|
2012-04-18 20:30:57 +03:00
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QModelIndex>
|
2020-01-13 15:18:35 +02:00
|
|
|
#include <QSettings>
|
2020-01-10 12:53:28 +01:00
|
|
|
#include <QString>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QUrl>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2020-01-10 12:53:28 +01:00
|
|
|
class AndroidSdkManagerWidget;
|
|
|
|
|
|
|
|
|
|
class AndroidAvdManager;
|
|
|
|
|
|
|
|
|
|
class AvdModel final : public QAbstractTableModel
|
|
|
|
|
{
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(Android::Internal::AvdModel)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void setAvdList(const AndroidDeviceInfoList &list);
|
|
|
|
|
QString avdName(const QModelIndex &index) const;
|
|
|
|
|
QModelIndex indexForAvdName(const QString &avdName) const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const final;
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const final;
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const final;
|
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const final;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
AndroidDeviceInfoList m_list;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class AndroidSettingsWidget final : public Core::IOptionsPageWidget
|
|
|
|
|
{
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(Android::Internal::AndroidSettingsWidget)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
|
|
|
|
|
AndroidSettingsWidget();
|
|
|
|
|
~AndroidSettingsWidget() final;
|
|
|
|
|
|
|
|
|
|
private:
|
2020-01-15 13:27:27 +01:00
|
|
|
void apply() final { AndroidConfigurations::setConfig(m_androidConfig); }
|
2020-01-10 12:53:28 +01:00
|
|
|
|
|
|
|
|
void validateJdk();
|
2020-01-13 15:18:35 +02:00
|
|
|
Utils::FilePath findJdkInCommonPaths();
|
2020-01-10 12:53:28 +01:00
|
|
|
void validateNdk();
|
2019-12-23 16:13:23 +02:00
|
|
|
void updateNdkList();
|
2020-01-10 12:53:28 +01:00
|
|
|
void onSdkPathChanged();
|
|
|
|
|
void validateSdk();
|
|
|
|
|
void openSDKDownloadUrl();
|
|
|
|
|
void openNDKDownloadUrl();
|
|
|
|
|
void openOpenJDKDownloadUrl();
|
2020-02-28 19:27:03 +02:00
|
|
|
void downloadOpenSslRepo(const bool silent = false);
|
2020-01-10 12:53:28 +01:00
|
|
|
void addAVD();
|
|
|
|
|
void avdAdded();
|
|
|
|
|
void removeAVD();
|
|
|
|
|
void startAVD();
|
|
|
|
|
void avdActivated(const QModelIndex &);
|
|
|
|
|
void dataPartitionSizeEditingFinished();
|
|
|
|
|
void manageAVD();
|
|
|
|
|
void createKitToggled();
|
|
|
|
|
|
|
|
|
|
void updateUI();
|
|
|
|
|
void updateAvds();
|
|
|
|
|
|
|
|
|
|
void startUpdateAvd();
|
|
|
|
|
void enableAvdControls();
|
|
|
|
|
void disableAvdControls();
|
|
|
|
|
|
2019-12-23 16:13:23 +02:00
|
|
|
void downloadSdk();
|
|
|
|
|
bool allEssentialsInstalled();
|
|
|
|
|
bool sdkToolsOk() const;
|
|
|
|
|
Utils::FilePath getDefaultSdkPath();
|
2020-02-10 20:25:24 +02:00
|
|
|
void showEvent(QShowEvent *event) override;
|
2020-02-24 11:19:02 +02:00
|
|
|
void addCustomNdkItem();
|
2020-02-28 19:27:03 +02:00
|
|
|
void validateOpenSsl();
|
2019-12-23 16:13:23 +02:00
|
|
|
|
2020-01-10 12:53:28 +01:00
|
|
|
Ui_AndroidSettingsWidget *m_ui;
|
|
|
|
|
AndroidSdkManagerWidget *m_sdkManagerWidget = nullptr;
|
|
|
|
|
AndroidConfig m_androidConfig;
|
|
|
|
|
AvdModel m_AVDModel;
|
|
|
|
|
QFutureWatcher<CreateAvdInfo> m_futureWatcher;
|
|
|
|
|
|
|
|
|
|
QFutureWatcher<AndroidDeviceInfoList> m_virtualDevicesWatcher;
|
|
|
|
|
QString m_lastAddedAvd;
|
|
|
|
|
std::unique_ptr<AndroidAvdManager> m_avdManager;
|
|
|
|
|
std::unique_ptr<AndroidSdkManager> m_sdkManager;
|
2020-02-10 20:25:24 +02:00
|
|
|
bool m_isInitialReloadDone = false;
|
2020-01-10 12:53:28 +01:00
|
|
|
};
|
|
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
enum JavaValidation {
|
|
|
|
|
JavaPathExistsRow,
|
|
|
|
|
JavaJdkValidRow
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum AndroidValidation {
|
|
|
|
|
SdkPathExistsRow,
|
2019-08-12 01:41:41 +02:00
|
|
|
SdkPathWritableRow,
|
2017-09-14 13:29:46 +02:00
|
|
|
SdkToolsInstalledRow,
|
|
|
|
|
PlatformToolsInstalledRow,
|
|
|
|
|
BuildToolsInstalledRow,
|
2019-08-05 14:46:01 +02:00
|
|
|
SdkManagerSuccessfulRow,
|
2017-09-14 13:29:46 +02:00
|
|
|
PlatformSdkInstalledRow,
|
2019-12-23 16:13:23 +02:00
|
|
|
AllEssentialsInstalledRow,
|
2017-09-14 13:29:46 +02:00
|
|
|
NdkPathExistsRow,
|
|
|
|
|
NdkDirStructureRow,
|
|
|
|
|
NdkinstallDirOkRow
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-28 19:27:03 +02:00
|
|
|
enum OpenSslValidation {
|
|
|
|
|
OpenSslPathExistsRow,
|
|
|
|
|
OpenSslPriPathExists,
|
|
|
|
|
OpenSslCmakeListsPathExists
|
|
|
|
|
};
|
|
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
class SummaryWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
class RowData {
|
|
|
|
|
public:
|
2019-12-12 23:15:48 +01:00
|
|
|
Utils::InfoLabel *m_infoLabel = nullptr;
|
2017-09-14 13:29:46 +02:00
|
|
|
bool m_valid = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
SummaryWidget(const QMap<int, QString> &validationPoints, const QString &validText,
|
|
|
|
|
const QString &invalidText, Utils::DetailsWidget *detailsWidget) :
|
|
|
|
|
QWidget(detailsWidget),
|
|
|
|
|
m_validText(validText),
|
|
|
|
|
m_invalidText(invalidText),
|
|
|
|
|
m_detailsWidget(detailsWidget)
|
|
|
|
|
{
|
|
|
|
|
QTC_CHECK(m_detailsWidget);
|
2019-12-12 23:15:48 +01:00
|
|
|
auto layout = new QVBoxLayout(this);
|
2019-08-29 10:36:01 +02:00
|
|
|
layout->setContentsMargins(12, 12, 12, 12);
|
2017-09-14 13:29:46 +02:00
|
|
|
for (auto itr = validationPoints.cbegin(); itr != validationPoints.cend(); ++itr) {
|
|
|
|
|
RowData data;
|
2019-12-12 23:15:48 +01:00
|
|
|
data.m_infoLabel = new Utils::InfoLabel(itr.value());
|
|
|
|
|
layout->addWidget(data.m_infoLabel);
|
2017-09-14 13:29:46 +02:00
|
|
|
m_validationData[itr.key()] = data;
|
|
|
|
|
setPointValid(itr.key(), true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setPointValid(int key, bool valid)
|
|
|
|
|
{
|
|
|
|
|
if (!m_validationData.contains(key))
|
|
|
|
|
return;
|
|
|
|
|
RowData& data = m_validationData[key];
|
|
|
|
|
data.m_valid = valid;
|
2019-12-12 23:15:48 +01:00
|
|
|
data.m_infoLabel->setType(valid ? Utils::InfoLabel::Ok : Utils::InfoLabel::NotOk);
|
2017-09-18 13:48:00 +02:00
|
|
|
updateUi();
|
2017-09-14 13:29:46 +02:00
|
|
|
}
|
|
|
|
|
|
2017-09-18 13:48:00 +02:00
|
|
|
bool rowsOk(QList<int> keys) const
|
2017-09-14 13:29:46 +02:00
|
|
|
{
|
2017-09-18 13:48:00 +02:00
|
|
|
for (auto key : keys) {
|
|
|
|
|
if (!m_validationData[key].m_valid)
|
2017-09-14 13:29:46 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-18 13:48:00 +02:00
|
|
|
bool allRowsOk() const { return rowsOk(m_validationData.keys()); }
|
|
|
|
|
void setInfoText(const QString &text) {
|
|
|
|
|
m_infoText = text;
|
|
|
|
|
updateUi();
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
private:
|
2017-09-18 13:48:00 +02:00
|
|
|
void updateUi() {
|
|
|
|
|
bool ok = allRowsOk();
|
|
|
|
|
m_detailsWidget->setIcon(ok ? Utils::Icons::OK.icon() :
|
|
|
|
|
Utils::Icons::CRITICAL.icon());
|
|
|
|
|
m_detailsWidget->setSummaryText(ok ? QString("%1 %2").arg(m_validText).arg(m_infoText)
|
|
|
|
|
: m_invalidText);
|
|
|
|
|
}
|
2017-09-14 13:29:46 +02:00
|
|
|
QString m_validText;
|
|
|
|
|
QString m_invalidText;
|
2017-09-18 13:48:00 +02:00
|
|
|
QString m_infoText;
|
2017-09-14 13:29:46 +02:00
|
|
|
Utils::DetailsWidget *m_detailsWidget = nullptr;
|
|
|
|
|
QMap<int, RowData> m_validationData;
|
|
|
|
|
};
|
|
|
|
|
|
2017-04-03 11:11:17 +02:00
|
|
|
void AvdModel::setAvdList(const AndroidDeviceInfoList &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();
|
2019-12-20 16:49:13 +02:00
|
|
|
|
|
|
|
|
const AndroidDeviceInfo currentRow = m_list.at(index.row());
|
2012-04-18 20:30:57 +03:00
|
|
|
switch (index.column()) {
|
|
|
|
|
case 0:
|
2019-12-20 16:49:13 +02:00
|
|
|
return currentRow.avdname;
|
2012-04-18 20:30:57 +03:00
|
|
|
case 1:
|
2019-12-20 16:49:13 +02:00
|
|
|
return currentRow.sdk;
|
2013-10-15 13:44:11 +02:00
|
|
|
case 2: {
|
2019-12-20 16:49:13 +02:00
|
|
|
QStringList cpuAbis = currentRow.cpuAbi;
|
2013-10-15 13:44:11 +02:00
|
|
|
return cpuAbis.isEmpty() ? QVariant() : QVariant(cpuAbis.first());
|
|
|
|
|
}
|
2019-12-20 16:49:13 +02:00
|
|
|
case 3:
|
2020-01-08 14:55:16 +02:00
|
|
|
return currentRow.avdDevice.isEmpty() ? QVariant("Custom")
|
|
|
|
|
: currentRow.avdDevice;
|
2019-12-20 16:49:13 +02:00
|
|
|
case 4:
|
|
|
|
|
return currentRow.avdTarget;
|
|
|
|
|
case 5:
|
|
|
|
|
return currentRow.avdSdcardSize;
|
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:
|
2019-12-20 16:49:13 +02:00
|
|
|
return tr("API");
|
2012-04-18 20:30:57 +03:00
|
|
|
case 2:
|
|
|
|
|
return tr("CPU/ABI");
|
2019-12-20 16:49:13 +02:00
|
|
|
case 3:
|
|
|
|
|
return tr("Device type");
|
|
|
|
|
case 4:
|
|
|
|
|
return tr("Target");
|
|
|
|
|
case 5:
|
|
|
|
|
return tr("SD-card size");
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2019-12-20 16:49:13 +02:00
|
|
|
return 6;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2019-12-23 16:13:23 +02:00
|
|
|
Utils::FilePath AndroidSettingsWidget::getDefaultSdkPath()
|
|
|
|
|
{
|
|
|
|
|
QString sdkFromEnvVar = QString::fromLocal8Bit(getenv("ANDROID_SDK_ROOT"));
|
|
|
|
|
if (!sdkFromEnvVar.isEmpty())
|
|
|
|
|
return Utils::FilePath::fromString(sdkFromEnvVar);
|
|
|
|
|
|
|
|
|
|
// Set default path of SDK as used by Android Studio
|
|
|
|
|
if (Utils::HostOsInfo::isMacHost()) {
|
|
|
|
|
return Utils::FilePath::fromString(
|
|
|
|
|
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
|
|
|
|
|
+ "/../Android/sdk");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
|
|
|
|
return Utils::FilePath::fromString(
|
|
|
|
|
QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Android/sdk");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Utils::FilePath::fromString(
|
2020-02-10 20:25:24 +02:00
|
|
|
QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Android/Sdk");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::showEvent(QShowEvent *event)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(event)
|
|
|
|
|
if (!m_isInitialReloadDone) {
|
|
|
|
|
// Reloading SDK packages (force) is still synchronous. Use zero timer
|
|
|
|
|
// to let settings dialog open first.
|
|
|
|
|
QTimer::singleShot(0, std::bind(&AndroidSdkManager::reloadPackages,
|
2020-02-26 09:54:06 +02:00
|
|
|
m_sdkManager.get(), false));
|
2020-02-28 19:27:03 +02:00
|
|
|
validateOpenSsl();
|
2020-02-10 20:25:24 +02:00
|
|
|
m_isInitialReloadDone = true;
|
|
|
|
|
}
|
2019-12-23 16:13:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::updateNdkList()
|
|
|
|
|
{
|
|
|
|
|
m_ui->ndkListComboBox->clear();
|
|
|
|
|
for (const Ndk *ndk : m_sdkManager->installedNdkPackages())
|
|
|
|
|
m_ui->ndkListComboBox->addItem(ndk->installedLocation().toString());
|
2020-02-24 11:19:02 +02:00
|
|
|
|
|
|
|
|
for (const QString &ndk : m_androidConfig.getCustomNdkList()) {
|
|
|
|
|
if (m_androidConfig.isValidNdk(ndk))
|
|
|
|
|
m_ui->ndkListComboBox->addItem(ndk);
|
|
|
|
|
else
|
|
|
|
|
m_androidConfig.removeCustomNdk(ndk);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::addCustomNdkItem()
|
|
|
|
|
{
|
|
|
|
|
const QString ndkPath = QDir::toNativeSeparators(m_ui->customNdkPathChooser->rawPath());
|
|
|
|
|
m_androidConfig.addCustomNdk(ndkPath);
|
|
|
|
|
if (m_ui->ndkListComboBox->findData(ndkPath) == -1)
|
|
|
|
|
m_ui->ndkListComboBox->addItem(ndkPath);
|
|
|
|
|
m_ui->ndkListComboBox->setCurrentText(ndkPath);
|
2019-12-23 16:13:23 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 13:54:07 +01:00
|
|
|
AndroidSettingsWidget::AndroidSettingsWidget()
|
|
|
|
|
: m_ui(new Ui_AndroidSettingsWidget),
|
2017-03-30 14:43:13 +02:00
|
|
|
m_androidConfig(AndroidConfigurations::currentConfig()),
|
2017-08-18 08:22:34 +02:00
|
|
|
m_avdManager(new AndroidAvdManager(m_androidConfig)),
|
|
|
|
|
m_sdkManager(new AndroidSdkManager(m_androidConfig))
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2013-12-16 20:19:07 +01:00
|
|
|
m_ui->setupUi(this);
|
2017-09-18 13:48:00 +02:00
|
|
|
m_sdkManagerWidget = new AndroidSdkManagerWidget(m_androidConfig, m_sdkManager.get(),
|
|
|
|
|
m_ui->sdkManagerTab);
|
|
|
|
|
auto sdkMangerLayout = new QVBoxLayout(m_ui->sdkManagerTab);
|
2019-08-29 10:36:01 +02:00
|
|
|
sdkMangerLayout->setContentsMargins(0, 0, 0, 0);
|
2017-09-18 13:48:00 +02:00
|
|
|
sdkMangerLayout->addWidget(m_sdkManagerWidget);
|
|
|
|
|
connect(m_sdkManagerWidget, &AndroidSdkManagerWidget::updatingSdk, [this]() {
|
|
|
|
|
m_ui->SDKLocationPathChooser->setEnabled(false);
|
|
|
|
|
// Disable the tab bar to restrict the user moving away from sdk manager tab untill
|
|
|
|
|
// operations finish.
|
|
|
|
|
m_ui->managerTabWidget->tabBar()->setEnabled(false);
|
|
|
|
|
});
|
|
|
|
|
connect(m_sdkManagerWidget, &AndroidSdkManagerWidget::updatingSdkFinished, [this]() {
|
|
|
|
|
m_ui->SDKLocationPathChooser->setEnabled(true);
|
|
|
|
|
m_ui->managerTabWidget->tabBar()->setEnabled(true);
|
|
|
|
|
});
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
QMap<int, QString> javaValidationPoints;
|
|
|
|
|
javaValidationPoints[JavaPathExistsRow] = tr("JDK path exists.");
|
|
|
|
|
javaValidationPoints[JavaJdkValidRow] = tr("JDK path is a valid JDK root folder.");
|
|
|
|
|
auto javaSummary = new SummaryWidget(javaValidationPoints, tr("Java Settings are OK."),
|
|
|
|
|
tr("Java settings have errors."), m_ui->javaDetailsWidget);
|
|
|
|
|
m_ui->javaDetailsWidget->setWidget(javaSummary);
|
|
|
|
|
|
|
|
|
|
QMap<int, QString> androidValidationPoints;
|
|
|
|
|
androidValidationPoints[SdkPathExistsRow] = tr("Android SDK path exists.");
|
2019-08-12 01:41:41 +02:00
|
|
|
androidValidationPoints[SdkPathWritableRow] = tr("Android SDK path writable.");
|
2017-09-14 13:29:46 +02:00
|
|
|
androidValidationPoints[SdkToolsInstalledRow] = tr("SDK tools installed.");
|
|
|
|
|
androidValidationPoints[PlatformToolsInstalledRow] = tr("Platform tools installed.");
|
2019-08-05 14:46:01 +02:00
|
|
|
androidValidationPoints[SdkManagerSuccessfulRow] = tr(
|
|
|
|
|
"SDK manager runs (requires exactly Java 1.8).");
|
2019-12-23 16:13:23 +02:00
|
|
|
androidValidationPoints[AllEssentialsInstalledRow] = tr(
|
|
|
|
|
"All essential packages installed for all installed Qt versions.");
|
2017-09-14 13:29:46 +02:00
|
|
|
androidValidationPoints[BuildToolsInstalledRow] = tr("Build tools installed.");
|
|
|
|
|
androidValidationPoints[PlatformSdkInstalledRow] = tr("Platform SDK installed.");
|
2019-12-23 16:13:23 +02:00
|
|
|
androidValidationPoints[NdkPathExistsRow] = tr("Default Android NDK path exists.");
|
|
|
|
|
androidValidationPoints[NdkDirStructureRow] = tr("Default Android NDK directory structure is correct.");
|
|
|
|
|
androidValidationPoints[NdkinstallDirOkRow] = tr("Default Android NDK installed into a path without "
|
2017-09-14 13:29:46 +02:00
|
|
|
"spaces.");
|
|
|
|
|
auto androidSummary = new SummaryWidget(androidValidationPoints, tr("Android settings are OK."),
|
|
|
|
|
tr("Android settings have errors."),
|
|
|
|
|
m_ui->androidDetailsWidget);
|
|
|
|
|
m_ui->androidDetailsWidget->setWidget(androidSummary);
|
|
|
|
|
|
2020-02-28 19:27:03 +02:00
|
|
|
QMap<int, QString> openSslValidationPoints;
|
|
|
|
|
openSslValidationPoints[OpenSslPathExistsRow] = tr("OpenSSL path exists.");
|
|
|
|
|
openSslValidationPoints[OpenSslPriPathExists] = tr(
|
|
|
|
|
"QMake include project (openssl.pri) exists.");
|
|
|
|
|
openSslValidationPoints[OpenSslCmakeListsPathExists] = tr(
|
|
|
|
|
"CMake include project (CMakeLists.txt) exists.");
|
|
|
|
|
auto openSslSummary = new SummaryWidget(openSslValidationPoints,
|
|
|
|
|
tr("OpenSSL Settings are OK."),
|
|
|
|
|
tr("OpenSSL settings have errors."),
|
|
|
|
|
m_ui->openSslDetailsWidget);
|
|
|
|
|
m_ui->openSslDetailsWidget->setWidget(openSslSummary);
|
|
|
|
|
|
2019-12-23 16:13:23 +02:00
|
|
|
connect(m_ui->OpenJDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
|
|
|
|
|
this, &AndroidSettingsWidget::validateJdk);
|
2020-01-13 15:18:35 +02:00
|
|
|
Utils::FilePath currentJdkPath = m_androidConfig.openJDKLocation();
|
|
|
|
|
if (currentJdkPath.isEmpty())
|
|
|
|
|
currentJdkPath = findJdkInCommonPaths();
|
|
|
|
|
m_ui->OpenJDKLocationPathChooser->setFileName(currentJdkPath);
|
2014-06-03 16:37:05 +02:00
|
|
|
m_ui->OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path"));
|
2019-12-23 16:13:23 +02:00
|
|
|
|
|
|
|
|
Utils::FilePath currentSDKPath = m_androidConfig.sdkLocation();
|
|
|
|
|
if (currentSDKPath.isEmpty())
|
|
|
|
|
currentSDKPath = getDefaultSdkPath();
|
|
|
|
|
|
|
|
|
|
m_ui->SDKLocationPathChooser->setFileName(currentSDKPath);
|
|
|
|
|
m_ui->SDKLocationPathChooser->setPromptDialogTitle(tr("Select Android SDK folder"));
|
|
|
|
|
|
2020-02-28 19:27:03 +02:00
|
|
|
m_ui->openSslPathChooser->setPromptDialogTitle(tr("Select OpenSSL Include Project File"));
|
|
|
|
|
Utils::FilePath currentOpenSslPath = m_androidConfig.openSslLocation();
|
|
|
|
|
if (currentOpenSslPath.isEmpty())
|
|
|
|
|
currentOpenSslPath = currentSDKPath.pathAppended("android_openssl");
|
|
|
|
|
m_ui->openSslPathChooser->setFileName(currentOpenSslPath);
|
|
|
|
|
|
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->downloadOpenJDKToolButton->setVisible(!Utils::HostOsInfo::isLinuxHost());
|
2013-12-16 20:19:07 +01:00
|
|
|
|
2019-08-23 19:13:51 +02:00
|
|
|
const QIcon downloadIcon = Utils::Icons::DOWNLOAD.icon();
|
|
|
|
|
m_ui->downloadSDKToolButton->setIcon(downloadIcon);
|
|
|
|
|
m_ui->downloadNDKToolButton->setIcon(downloadIcon);
|
|
|
|
|
m_ui->downloadOpenJDKToolButton->setIcon(downloadIcon);
|
2020-02-28 19:27:03 +02:00
|
|
|
m_ui->downloadOpenSSLPrebuiltLibs->setIcon(downloadIcon);
|
2019-12-23 16:13:23 +02:00
|
|
|
m_ui->sdkToolsAutoDownloadButton->setIcon(Utils::Icons::RELOAD.icon());
|
2019-08-23 19:13:51 +02:00
|
|
|
|
2020-02-10 20:25:24 +02:00
|
|
|
connect(m_ui->SDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
|
|
|
|
|
this, &AndroidSettingsWidget::onSdkPathChanged);
|
2020-02-24 11:19:02 +02:00
|
|
|
connect(m_ui->ndkListComboBox,
|
|
|
|
|
QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
|
|
|
|
|
[this](const QString &ndk) {
|
|
|
|
|
validateNdk();
|
|
|
|
|
m_ui->removeCustomNdkButton->setEnabled(m_androidConfig.getCustomNdkList().contains(ndk));
|
|
|
|
|
});
|
|
|
|
|
connect(m_ui->customNdkPathChooser, &Utils::PathChooser::rawPathChanged, this, [this]() {
|
|
|
|
|
const QString ndkPath = m_ui->customNdkPathChooser->rawPath();
|
|
|
|
|
m_ui->addCustomNdkButton->setEnabled(m_androidConfig.isValidNdk(ndkPath));
|
|
|
|
|
});
|
|
|
|
|
connect(m_ui->addCustomNdkButton, &QPushButton::clicked, this,
|
|
|
|
|
&AndroidSettingsWidget::addCustomNdkItem);
|
|
|
|
|
connect(m_ui->removeCustomNdkButton, &QPushButton::clicked, this, [this]() {
|
|
|
|
|
m_androidConfig.removeCustomNdk(m_ui->ndkListComboBox->currentText());
|
|
|
|
|
m_ui->ndkListComboBox->removeItem(m_ui->ndkListComboBox->currentIndex());
|
|
|
|
|
});
|
|
|
|
|
|
2020-02-28 19:27:03 +02:00
|
|
|
connect(m_ui->ndkListComboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
|
|
|
|
|
[this](const QString) { validateNdk(); });
|
|
|
|
|
connect(m_ui->openSslPathChooser, &Utils::PathChooser::rawPathChanged, this,
|
|
|
|
|
&AndroidSettingsWidget::validateOpenSsl);
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(&m_virtualDevicesWatcher, &QFutureWatcherBase::finished,
|
|
|
|
|
this, &AndroidSettingsWidget::updateAvds);
|
2019-12-20 16:41:25 +02:00
|
|
|
connect(m_ui->AVDRefreshPushButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::startUpdateAvd);
|
2019-12-23 16:13:23 +02:00
|
|
|
connect(&m_futureWatcher, &QFutureWatcherBase::finished, this, &AndroidSettingsWidget::avdAdded);
|
2016-06-26 22:52:59 +03:00
|
|
|
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);
|
2017-09-18 13:48:00 +02:00
|
|
|
connect(m_ui->nativeAvdManagerButton, &QAbstractButton::clicked,
|
2016-06-26 22:52:59 +03:00
|
|
|
this, &AndroidSettingsWidget::manageAVD);
|
|
|
|
|
connect(m_ui->CreateKitCheckBox, &QAbstractButton::toggled,
|
|
|
|
|
this, &AndroidSettingsWidget::createKitToggled);
|
|
|
|
|
connect(m_ui->downloadNDKToolButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::openNDKDownloadUrl);
|
2019-12-23 16:13:23 +02:00
|
|
|
connect(m_ui->downloadSDKToolButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::openSDKDownloadUrl);
|
2020-02-28 19:27:03 +02:00
|
|
|
connect(m_ui->downloadOpenSSLPrebuiltLibs, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::downloadOpenSslRepo);
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(m_ui->downloadOpenJDKToolButton, &QAbstractButton::clicked,
|
|
|
|
|
this, &AndroidSettingsWidget::openOpenJDKDownloadUrl);
|
2017-09-18 13:48:00 +02:00
|
|
|
// Validate SDK again after any change in SDK packages.
|
2019-12-23 16:13:23 +02:00
|
|
|
connect(m_sdkManager.get(),
|
|
|
|
|
&AndroidSdkManager::packageReloadFinished,
|
|
|
|
|
this,
|
|
|
|
|
&AndroidSettingsWidget::validateSdk);
|
|
|
|
|
connect(m_ui->sdkToolsAutoDownloadButton, &QAbstractButton::clicked, this, [this]() {
|
|
|
|
|
if (sdkToolsOk()) {
|
|
|
|
|
QMessageBox::warning(this, AndroidSdkDownloader::dialogTitle(),
|
|
|
|
|
tr("The selected path already has a valid SDK Tools package."));
|
|
|
|
|
validateSdk();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
downloadSdk();
|
|
|
|
|
});
|
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
|
|
|
{
|
2017-09-18 13:48:00 +02:00
|
|
|
// Deleting m_sdkManagerWidget will cancel all ongoing and pending sdkmanager operations.
|
|
|
|
|
delete m_sdkManagerWidget;
|
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
|
|
|
}
|
|
|
|
|
|
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();
|
2017-04-03 11:11:17 +02:00
|
|
|
m_virtualDevicesWatcher.setFuture(m_avdManager->avdList());
|
2015-01-08 17:05:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
void AndroidSettingsWidget::validateJdk()
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2019-05-28 13:49:26 +02:00
|
|
|
auto javaPath = Utils::FilePath::fromUserInput(m_ui->OpenJDKLocationPathChooser->rawPath());
|
2017-09-14 13:29:46 +02:00
|
|
|
m_androidConfig.setOpenJDKLocation(javaPath);
|
|
|
|
|
bool jdkPathExists = m_androidConfig.openJDKLocation().exists();
|
|
|
|
|
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->javaDetailsWidget->widget());
|
|
|
|
|
summaryWidget->setPointValid(JavaPathExistsRow, jdkPathExists);
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
const Utils::FilePath bin = m_androidConfig.openJDKLocation().pathAppended("bin/javac" QTC_HOST_EXE_SUFFIX);
|
2017-09-14 13:29:46 +02:00
|
|
|
summaryWidget->setPointValid(JavaJdkValidRow, jdkPathExists && bin.exists());
|
|
|
|
|
updateUI();
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2020-02-28 19:27:03 +02:00
|
|
|
void AndroidSettingsWidget::validateOpenSsl()
|
|
|
|
|
{
|
|
|
|
|
auto openSslPath = Utils::FilePath::fromUserInput(m_ui->openSslPathChooser->rawPath());
|
|
|
|
|
m_androidConfig.setOpenSslLocation(openSslPath);
|
|
|
|
|
|
|
|
|
|
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->openSslDetailsWidget->widget());
|
|
|
|
|
summaryWidget->setPointValid(OpenSslPathExistsRow, m_androidConfig.openSslLocation().exists());
|
|
|
|
|
|
|
|
|
|
const bool priFileExists = m_androidConfig.openSslLocation().pathAppended("openssl.pri").exists();
|
|
|
|
|
summaryWidget->setPointValid(OpenSslPriPathExists, priFileExists);
|
|
|
|
|
const bool cmakeListsExists
|
|
|
|
|
= m_androidConfig.openSslLocation().pathAppended("CMakeLists.txt").exists();
|
|
|
|
|
summaryWidget->setPointValid(OpenSslCmakeListsPathExists, cmakeListsExists);
|
|
|
|
|
updateUI();
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-13 15:18:35 +02:00
|
|
|
Utils::FilePath AndroidSettingsWidget::findJdkInCommonPaths()
|
|
|
|
|
{
|
|
|
|
|
QString jdkFromEnvVar = QString::fromLocal8Bit(getenv("JAVA_HOME"));
|
|
|
|
|
if (!jdkFromEnvVar.isEmpty())
|
2020-02-17 13:51:33 +01:00
|
|
|
return Utils::FilePath::fromUserInput(jdkFromEnvVar);
|
2020-01-13 15:18:35 +02:00
|
|
|
|
|
|
|
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
|
|
|
|
QString jdkRegisteryPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\JDK\\";
|
|
|
|
|
QSettings jdkSettings(jdkRegisteryPath, QSettings::NativeFormat);
|
|
|
|
|
|
|
|
|
|
QStringList jdkVersions = jdkSettings.childGroups();
|
|
|
|
|
Utils::FilePath jdkHome;
|
|
|
|
|
|
|
|
|
|
for (const QString &version : jdkVersions) {
|
|
|
|
|
jdkSettings.beginGroup(version);
|
2020-02-17 13:51:33 +01:00
|
|
|
jdkHome = Utils::FilePath::fromUserInput(jdkSettings.value("JavaHome").toString());
|
2020-01-13 15:18:35 +02:00
|
|
|
jdkSettings.endGroup();
|
|
|
|
|
if (version.startsWith("1.8"))
|
|
|
|
|
return jdkHome;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return jdkHome;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QProcess findJdkPathProc;
|
|
|
|
|
|
|
|
|
|
QString cmd;
|
|
|
|
|
QStringList args;
|
|
|
|
|
|
|
|
|
|
if (Utils::HostOsInfo::isMacHost()) {
|
|
|
|
|
cmd = "sh";
|
|
|
|
|
args << "-c" << "/usr/libexec/java_home";
|
|
|
|
|
} else {
|
|
|
|
|
cmd = "sh";
|
|
|
|
|
args << "-c" << "readlink -f $(which java)";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
findJdkPathProc.start(cmd, args);
|
|
|
|
|
findJdkPathProc.waitForFinished();
|
|
|
|
|
QByteArray jdkPath = findJdkPathProc.readAllStandardOutput().trimmed();
|
|
|
|
|
|
|
|
|
|
if (Utils::HostOsInfo::isMacHost())
|
|
|
|
|
return Utils::FilePath::fromUtf8(jdkPath);
|
|
|
|
|
else
|
|
|
|
|
return Utils::FilePath::fromUtf8(jdkPath.replace("jre/bin/java", ""));
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
void AndroidSettingsWidget::validateNdk()
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2020-02-17 13:51:33 +01:00
|
|
|
auto ndkPath = Utils::FilePath::fromUserInput(m_ui->ndkListComboBox->currentText());
|
2017-09-14 13:29:46 +02:00
|
|
|
|
|
|
|
|
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->androidDetailsWidget->widget());
|
2019-12-23 16:13:23 +02:00
|
|
|
summaryWidget->setPointValid(NdkPathExistsRow, ndkPath.exists());
|
2017-09-14 13:29:46 +02:00
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
const Utils::FilePath ndkPlatformsDir = ndkPath.pathAppended("platforms");
|
|
|
|
|
const Utils::FilePath ndkToolChainsDir = ndkPath.pathAppended("toolchains");
|
|
|
|
|
const Utils::FilePath ndkSourcesDir = ndkPath.pathAppended("sources/cxx-stl");
|
2017-09-14 13:29:46 +02:00
|
|
|
summaryWidget->setPointValid(NdkDirStructureRow,
|
|
|
|
|
ndkPlatformsDir.exists()
|
|
|
|
|
&& ndkToolChainsDir.exists()
|
|
|
|
|
&& ndkSourcesDir.exists());
|
|
|
|
|
summaryWidget->setPointValid(NdkinstallDirOkRow,
|
|
|
|
|
ndkPlatformsDir.exists() &&
|
|
|
|
|
!ndkPlatformsDir.toString().contains(' '));
|
|
|
|
|
updateUI();
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2017-09-26 11:24:16 +02:00
|
|
|
void AndroidSettingsWidget::onSdkPathChanged()
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2019-05-28 13:49:26 +02:00
|
|
|
auto sdkPath = Utils::FilePath::fromUserInput(m_ui->SDKLocationPathChooser->rawPath());
|
2017-09-14 13:29:46 +02:00
|
|
|
m_androidConfig.setSdkLocation(sdkPath);
|
2017-09-26 11:24:16 +02:00
|
|
|
// Package reload will trigger validateSdk.
|
|
|
|
|
m_sdkManager->reloadPackages();
|
|
|
|
|
}
|
2017-09-14 13:29:46 +02:00
|
|
|
|
2017-09-26 11:24:16 +02:00
|
|
|
void AndroidSettingsWidget::validateSdk()
|
|
|
|
|
{
|
2020-02-17 13:51:33 +01:00
|
|
|
auto sdkPath = Utils::FilePath::fromUserInput(m_ui->SDKLocationPathChooser->rawPath());
|
2019-12-23 16:13:23 +02:00
|
|
|
m_androidConfig.setSdkLocation(sdkPath);
|
|
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
auto summaryWidget = static_cast<SummaryWidget *>(m_ui->androidDetailsWidget->widget());
|
|
|
|
|
summaryWidget->setPointValid(SdkPathExistsRow, m_androidConfig.sdkLocation().exists());
|
2019-08-12 01:41:41 +02:00
|
|
|
summaryWidget->setPointValid(SdkPathWritableRow, m_androidConfig.sdkLocation().isWritablePath());
|
2017-09-14 13:29:46 +02:00
|
|
|
summaryWidget->setPointValid(SdkToolsInstalledRow,
|
|
|
|
|
!m_androidConfig.sdkToolsVersion().isNull());
|
|
|
|
|
summaryWidget->setPointValid(PlatformToolsInstalledRow,
|
|
|
|
|
m_androidConfig.adbToolPath().exists());
|
|
|
|
|
summaryWidget->setPointValid(BuildToolsInstalledRow,
|
|
|
|
|
!m_androidConfig.buildToolsVersion().isNull());
|
2019-08-05 14:46:01 +02:00
|
|
|
summaryWidget->setPointValid(SdkManagerSuccessfulRow, m_sdkManager->packageListingSuccessful());
|
2017-09-26 11:24:16 +02:00
|
|
|
// installedSdkPlatforms should not trigger a package reload as validate SDK is only called
|
|
|
|
|
// after AndroidSdkManager::packageReloadFinished.
|
2017-09-14 13:29:46 +02:00
|
|
|
summaryWidget->setPointValid(PlatformSdkInstalledRow,
|
2017-08-18 08:22:34 +02:00
|
|
|
!m_sdkManager->installedSdkPlatforms().isEmpty());
|
2019-12-23 16:13:23 +02:00
|
|
|
|
|
|
|
|
summaryWidget->setPointValid(AllEssentialsInstalledRow, allEssentialsInstalled());
|
2017-09-14 13:29:46 +02:00
|
|
|
updateUI();
|
2019-08-05 14:46:01 +02:00
|
|
|
bool sdkToolsOk = summaryWidget->rowsOk(
|
|
|
|
|
{SdkPathExistsRow, SdkPathWritableRow, SdkToolsInstalledRow, SdkManagerSuccessfulRow});
|
2017-09-26 11:24:16 +02:00
|
|
|
bool componentsOk = summaryWidget->rowsOk({PlatformToolsInstalledRow,
|
|
|
|
|
BuildToolsInstalledRow,
|
2019-12-23 16:13:23 +02:00
|
|
|
PlatformSdkInstalledRow,
|
|
|
|
|
AllEssentialsInstalledRow});
|
|
|
|
|
m_androidConfig.setSdkFullyConfigured(sdkToolsOk && componentsOk);
|
2017-09-26 11:24:16 +02:00
|
|
|
if (sdkToolsOk && !componentsOk && !m_androidConfig.useNativeUiTools()) {
|
|
|
|
|
// Ask user to install essential SDK components. Works only for sdk tools version >= 26.0.0
|
|
|
|
|
QString message = tr("Android SDK installation is missing necessary packages. Do you "
|
|
|
|
|
"want to install the missing packages?");
|
|
|
|
|
auto userInput = QMessageBox::information(this, tr("Missing Android SDK packages"),
|
|
|
|
|
message, QMessageBox::Yes | QMessageBox::No);
|
|
|
|
|
if (userInput == QMessageBox::Yes) {
|
|
|
|
|
m_ui->managerTabWidget->setCurrentWidget(m_ui->sdkManagerTab);
|
|
|
|
|
m_sdkManagerWidget->installEssentials();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-23 16:13:23 +02:00
|
|
|
|
2020-02-10 20:25:24 +02:00
|
|
|
startUpdateAvd();
|
2019-12-23 16:13:23 +02:00
|
|
|
updateNdkList();
|
|
|
|
|
validateNdk();
|
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::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
|
|
|
}
|
|
|
|
|
|
2020-02-28 19:27:03 +02:00
|
|
|
void AndroidSettingsWidget::downloadOpenSslRepo(const bool silent)
|
|
|
|
|
{
|
|
|
|
|
const Utils::FilePath openSslPath = m_ui->openSslPathChooser->fileName();
|
|
|
|
|
const QString openSslCloneTitle(tr("OpenSSL Cloning"));
|
|
|
|
|
|
|
|
|
|
auto openSslSummaryWidget = static_cast<SummaryWidget *>(m_ui->openSslDetailsWidget->widget());
|
|
|
|
|
if (openSslSummaryWidget->allRowsOk()) {
|
|
|
|
|
if (silent) {
|
|
|
|
|
QMessageBox::information(this, openSslCloneTitle,
|
|
|
|
|
tr("OpenSSL prebuilt libraries repository is already configured."));
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QString openSslRepo("https://github.com/KDAB/android_openssl.git");
|
|
|
|
|
Utils::QtcProcess *gitCloner = new Utils::QtcProcess(this);
|
|
|
|
|
gitCloner->setCommand(Utils::CommandLine("git", {"clone", openSslRepo, openSslPath.fileName()}));
|
|
|
|
|
gitCloner->setWorkingDirectory(openSslPath.parentDir().toString());
|
|
|
|
|
|
|
|
|
|
QDir openSslDir(openSslPath.toString());
|
|
|
|
|
if (openSslDir.exists()) {
|
|
|
|
|
auto userInput = QMessageBox::information(this, openSslCloneTitle,
|
|
|
|
|
tr("The selected download path (%1) for OpenSSL already exists, "
|
|
|
|
|
"do you want to remove and overwrite its content?")
|
|
|
|
|
.arg(QDir::toNativeSeparators(openSslPath.toString())),
|
|
|
|
|
QMessageBox::Yes | QMessageBox::No);
|
|
|
|
|
if (userInput == QMessageBox::Yes)
|
|
|
|
|
openSslDir.removeRecursively();
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QProgressDialog *openSslProgressDialog
|
|
|
|
|
= new QProgressDialog(tr("Cloning OpenSSL prebuilt libraries, please be patient..."),
|
|
|
|
|
tr("Cancel"), 0, 0);
|
|
|
|
|
openSslProgressDialog->setWindowModality(Qt::WindowModal);
|
|
|
|
|
openSslProgressDialog->setWindowTitle(openSslCloneTitle);
|
|
|
|
|
openSslProgressDialog->setFixedSize(openSslProgressDialog->sizeHint());
|
|
|
|
|
|
|
|
|
|
connect(openSslProgressDialog, &QProgressDialog::canceled, this, [gitCloner]() {
|
|
|
|
|
gitCloner->kill();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gitCloner->start();
|
|
|
|
|
openSslProgressDialog->show();
|
|
|
|
|
|
|
|
|
|
connect(gitCloner, QOverload<int, Utils::QtcProcess::ExitStatus>::of(&Utils::QtcProcess::finished),
|
|
|
|
|
[=](int exitCode, QProcess::ExitStatus exitStatus) {
|
|
|
|
|
openSslProgressDialog->close();
|
|
|
|
|
validateOpenSsl();
|
|
|
|
|
|
|
|
|
|
if (!openSslProgressDialog->wasCanceled() ||
|
|
|
|
|
(exitStatus == Utils::QtcProcess::NormalExit && exitCode != 0)) {
|
|
|
|
|
QMessageBox::information(this, openSslCloneTitle,
|
|
|
|
|
tr("OpenSSL prebuilt libraries cloning failed. "
|
|
|
|
|
"Opening OpenSSL URL for manual download..."));
|
|
|
|
|
QDesktopServices::openUrl(QUrl::fromUserInput(openSslRepo));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
void AndroidSettingsWidget::addAVD()
|
|
|
|
|
{
|
2015-01-08 17:05:09 +01:00
|
|
|
disableAvdControls();
|
2020-01-08 14:55:16 +02:00
|
|
|
CreateAvdInfo info = AvdDialog::gatherCreateAVDInfo(this, m_sdkManager.get(), m_androidConfig);
|
2014-04-11 13:31:01 +02:00
|
|
|
|
2017-08-18 08:22:34 +02:00
|
|
|
if (!info.isValid()) {
|
2015-01-08 17:05:09 +01:00
|
|
|
enableAvdControls();
|
2014-04-11 13:31:01 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-03 11:11:17 +02:00
|
|
|
m_futureWatcher.setFuture(m_avdManager->createAvd(info));
|
2014-04-11 13:31:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::avdAdded()
|
|
|
|
|
{
|
2017-08-18 08:22:34 +02:00
|
|
|
CreateAvdInfo info = m_futureWatcher.result();
|
2014-04-11 13:31:01 +02:00
|
|
|
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
|
|
|
|
2017-04-03 11:11:17 +02:00
|
|
|
m_avdManager->removeAvd(avdName);
|
2015-01-08 17:05:09 +01:00
|
|
|
startUpdateAvd();
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidSettingsWidget::startAVD()
|
|
|
|
|
{
|
2017-04-03 11:11:17 +02:00
|
|
|
m_avdManager->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
|
|
|
}
|
|
|
|
|
|
2017-09-14 13:29:46 +02:00
|
|
|
void AndroidSettingsWidget::updateUI()
|
|
|
|
|
{
|
|
|
|
|
auto javaSummaryWidget = static_cast<SummaryWidget *>(m_ui->javaDetailsWidget->widget());
|
|
|
|
|
auto androidSummaryWidget = static_cast<SummaryWidget *>(m_ui->androidDetailsWidget->widget());
|
2020-02-28 19:27:03 +02:00
|
|
|
auto openSslSummaryWidget = static_cast<SummaryWidget *>(m_ui->openSslDetailsWidget->widget());
|
|
|
|
|
const bool javaSetupOk = javaSummaryWidget->allRowsOk();
|
|
|
|
|
const bool sdkToolsOk = androidSummaryWidget->rowsOk({SdkPathExistsRow, SdkPathWritableRow, SdkToolsInstalledRow});
|
|
|
|
|
const bool androidSetupOk = androidSummaryWidget->allRowsOk();
|
|
|
|
|
const bool openSslOk = openSslSummaryWidget->allRowsOk();
|
2017-09-18 13:48:00 +02:00
|
|
|
|
|
|
|
|
m_ui->avdManagerTab->setEnabled(javaSetupOk && androidSetupOk);
|
|
|
|
|
m_ui->sdkManagerTab->setEnabled(sdkToolsOk);
|
|
|
|
|
m_sdkManagerWidget->setSdkManagerControlsEnabled(!m_androidConfig.useNativeUiTools());
|
|
|
|
|
|
2020-02-16 20:46:23 +02:00
|
|
|
Utils::FilePath currentNdk = Utils::FilePath::fromString(m_ui->ndkListComboBox->currentText());
|
2019-12-23 16:13:23 +02:00
|
|
|
auto infoText = tr("(SDK Version: %1, NDK Bundle Version: %2)")
|
2020-02-16 20:46:23 +02:00
|
|
|
.arg(m_androidConfig.sdkToolsVersion().toString())
|
|
|
|
|
.arg(currentNdk.isEmpty() ? "" : m_androidConfig.ndkVersion(currentNdk).toString());
|
2017-09-18 13:48:00 +02:00
|
|
|
androidSummaryWidget->setInfoText(androidSetupOk ? infoText : "");
|
|
|
|
|
|
|
|
|
|
m_ui->javaDetailsWidget->setState(javaSetupOk ? Utils::DetailsWidget::Collapsed :
|
|
|
|
|
Utils::DetailsWidget::Expanded);
|
|
|
|
|
m_ui->androidDetailsWidget->setState(androidSetupOk ? Utils::DetailsWidget::Collapsed :
|
|
|
|
|
Utils::DetailsWidget::Expanded);
|
2020-02-28 19:27:03 +02:00
|
|
|
m_ui->openSslDetailsWidget->setState(openSslOk ? Utils::DetailsWidget::Collapsed :
|
|
|
|
|
Utils::DetailsWidget::Expanded);
|
2017-09-14 13:29:46 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
void AndroidSettingsWidget::manageAVD()
|
|
|
|
|
{
|
2017-07-14 19:35:48 +02:00
|
|
|
if (m_androidConfig.useNativeUiTools()) {
|
2017-04-03 11:11:17 +02:00
|
|
|
m_avdManager->launchAvdManagerUiTool();
|
|
|
|
|
} else {
|
|
|
|
|
QMessageBox::warning(this, tr("AVD Manager Not Available"),
|
|
|
|
|
tr("AVD manager UI tool is not available in the installed SDK tools"
|
|
|
|
|
"(version %1). Use the command line tool \"avdmanager\" for "
|
|
|
|
|
"advanced AVD management.")
|
|
|
|
|
.arg(m_androidConfig.sdkToolsVersion().toString()));
|
|
|
|
|
}
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2019-12-23 16:13:23 +02:00
|
|
|
void AndroidSettingsWidget::downloadSdk()
|
|
|
|
|
{
|
2020-02-10 20:25:24 +02:00
|
|
|
QString message(tr("Do you want to download and install Android SDK Tools to: %1?")
|
|
|
|
|
.arg(QDir::toNativeSeparators(m_ui->SDKLocationPathChooser->rawPath())));
|
2019-12-23 16:13:23 +02:00
|
|
|
auto userInput = QMessageBox::information(this, AndroidSdkDownloader::dialogTitle(),
|
|
|
|
|
message, QMessageBox::Yes | QMessageBox::No);
|
|
|
|
|
if (userInput == QMessageBox::Yes) {
|
|
|
|
|
auto javaSummaryWidget = static_cast<SummaryWidget *>(m_ui->javaDetailsWidget->widget());
|
|
|
|
|
if (javaSummaryWidget->allRowsOk()) {
|
|
|
|
|
auto javaPath = Utils::FilePath::fromUserInput(m_ui->OpenJDKLocationPathChooser->rawPath());
|
|
|
|
|
AndroidSdkDownloader *sdkDownloader = new AndroidSdkDownloader(
|
|
|
|
|
m_androidConfig.sdkToolsUrl(),
|
|
|
|
|
m_androidConfig.getSdkToolsSha256());
|
|
|
|
|
sdkDownloader->downloadAndExtractSdk(javaPath.toString(),
|
|
|
|
|
m_ui->SDKLocationPathChooser->path());
|
|
|
|
|
|
|
|
|
|
connect(sdkDownloader, &AndroidSdkDownloader::sdkExtracted, this, [this]() {
|
|
|
|
|
m_sdkManager->reloadPackages(true);
|
2020-02-20 17:30:06 +02:00
|
|
|
updateUI();
|
2019-12-23 16:13:23 +02:00
|
|
|
apply();
|
2020-02-28 19:27:03 +02:00
|
|
|
|
|
|
|
|
QMetaObject::Connection *const openSslOneShot = new QMetaObject::Connection;
|
|
|
|
|
*openSslOneShot = connect(m_sdkManager.get(), &AndroidSdkManager::packageReloadFinished,
|
|
|
|
|
this, [this, openSslOneShot]() {
|
|
|
|
|
QObject::disconnect(*openSslOneShot);
|
|
|
|
|
downloadOpenSslRepo(true);
|
|
|
|
|
delete openSslOneShot;
|
|
|
|
|
});
|
2019-12-23 16:13:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
auto showErrorDialog = [this](const QString &error) {
|
|
|
|
|
QMessageBox::warning(this, AndroidSdkDownloader::dialogTitle(), error);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
connect(sdkDownloader, &AndroidSdkDownloader::sdkDownloaderError, this, showErrorDialog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AndroidSettingsWidget::allEssentialsInstalled()
|
|
|
|
|
{
|
|
|
|
|
QStringList essentialPkgs(m_androidConfig.allEssentials());
|
|
|
|
|
for (const AndroidSdkPackage *pkg : m_sdkManager->installedSdkPackages()) {
|
|
|
|
|
if (essentialPkgs.contains(pkg->sdkStylePath()))
|
|
|
|
|
essentialPkgs.removeOne(pkg->sdkStylePath());
|
|
|
|
|
if (essentialPkgs.isEmpty())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return essentialPkgs.isEmpty() ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AndroidSettingsWidget::sdkToolsOk() const
|
|
|
|
|
{
|
|
|
|
|
bool exists = m_androidConfig.sdkLocation().exists();
|
|
|
|
|
bool writable = m_androidConfig.sdkLocation().isWritablePath();
|
|
|
|
|
bool sdkToolsExist = !m_androidConfig.sdkToolsVersion().isNull();
|
|
|
|
|
return exists && writable && sdkToolsExist;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-10 12:53:28 +01:00
|
|
|
// AndroidSettingsPage
|
|
|
|
|
|
|
|
|
|
AndroidSettingsPage::AndroidSettingsPage()
|
|
|
|
|
{
|
|
|
|
|
setId(Constants::ANDROID_SETTINGS_ID);
|
|
|
|
|
setDisplayName(AndroidSettingsWidget::tr("Android"));
|
|
|
|
|
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
|
|
|
|
setWidgetCreator([] { return new AndroidSettingsWidget; });
|
|
|
|
|
}
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|