2012-04-18 20:30:57 +03:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (c) 2013 BogDan Vatra <bog_dan_ro@yahoo.com>
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2012-04-18 20:30:57 +03:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#ifndef ANDROIDCONFIGURATIONS_H
|
|
|
|
|
#define ANDROIDCONFIGURATIONS_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <projectexplorer/abi.h>
|
2013-03-25 17:13:18 +01:00
|
|
|
#include <utils/fileutils.h>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QSettings;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class AndroidConfig
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
AndroidConfig();
|
|
|
|
|
AndroidConfig(const QSettings &settings);
|
|
|
|
|
void save(QSettings &settings) const;
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
Utils::FileName sdkLocation;
|
|
|
|
|
Utils::FileName ndkLocation;
|
|
|
|
|
Utils::FileName antLocation;
|
|
|
|
|
Utils::FileName openJDKLocation;
|
|
|
|
|
Utils::FileName keystoreLocation;
|
2013-04-04 01:29:47 -07:00
|
|
|
QString toolchainHost;
|
2012-04-18 20:30:57 +03:00
|
|
|
unsigned partitionSize;
|
2013-02-14 15:51:59 +01:00
|
|
|
bool automaticKitCreation;
|
2012-04-18 20:30:57 +03:00
|
|
|
};
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
struct AndroidDeviceInfo
|
|
|
|
|
{
|
2012-04-18 20:30:57 +03:00
|
|
|
QString serialNumber;
|
|
|
|
|
QString cpuABI;
|
|
|
|
|
int sdk;
|
2013-02-24 18:04:36 +04:00
|
|
|
|
|
|
|
|
static QStringList adbSelector(const QString &serialNumber);
|
2012-04-18 20:30:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class AndroidConfigurations : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
public:
|
2012-04-18 20:30:57 +03:00
|
|
|
static AndroidConfigurations &instance(QObject *parent = 0);
|
|
|
|
|
AndroidConfig config() const { return m_config; }
|
|
|
|
|
void setConfig(const AndroidConfig &config);
|
|
|
|
|
QStringList sdkTargets(int minApiLevel = 0) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
Utils::FileName adbToolPath() const;
|
|
|
|
|
Utils::FileName androidToolPath() const;
|
|
|
|
|
Utils::FileName antToolPath() const;
|
|
|
|
|
Utils::FileName emulatorToolPath() const;
|
2013-04-04 01:29:47 -07:00
|
|
|
Utils::FileName gccPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
2013-01-25 16:49:22 +01:00
|
|
|
Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
Utils::FileName openJDKPath() const;
|
|
|
|
|
Utils::FileName keytoolPath() const;
|
|
|
|
|
Utils::FileName jarsignerPath() const;
|
2012-06-23 13:18:01 +03:00
|
|
|
Utils::FileName zipalignPath() const;
|
2013-01-25 16:49:22 +01:00
|
|
|
Utils::FileName stripPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
|
|
|
|
Utils::FileName readelfPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
2012-04-18 20:30:57 +03:00
|
|
|
QString getDeployDeviceSerialNumber(int *apiLevel) const;
|
|
|
|
|
bool createAVD(const QString &target, const QString &name, int sdcardSize) const;
|
|
|
|
|
bool removeAVD(const QString &name) const;
|
2012-07-03 16:57:44 +03:00
|
|
|
QVector<AndroidDeviceInfo> connectedDevices(int apiLevel = -1) const;
|
|
|
|
|
QVector<AndroidDeviceInfo> androidVirtualDevices() const;
|
2012-04-18 20:30:57 +03:00
|
|
|
QString startAVD(int *apiLevel, const QString &name = QString()) const;
|
|
|
|
|
QString bestMatch(const QString &targetAPI) const;
|
|
|
|
|
|
2013-01-25 16:49:22 +01:00
|
|
|
static ProjectExplorer::Abi::Architecture architectureForToolChainPrefix(const QString &toolchainprefix);
|
2012-04-18 20:30:57 +03:00
|
|
|
static QLatin1String toolchainPrefix(ProjectExplorer::Abi::Architecture architecture);
|
|
|
|
|
static QLatin1String toolsPrefix(ProjectExplorer::Abi::Architecture architecture);
|
|
|
|
|
|
2013-04-10 12:40:35 +02:00
|
|
|
// called from AndroidPlugin
|
|
|
|
|
void updateAndroidDevice();
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
signals:
|
|
|
|
|
void updated();
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
bool createAVD(int minApiLevel = 0) const;
|
2013-02-14 15:51:59 +01:00
|
|
|
void updateAutomaticKitList();
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
private:
|
2013-01-25 16:49:22 +01:00
|
|
|
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
Utils::FileName openJDKBinPath() const;
|
2013-04-04 01:29:47 -07:00
|
|
|
void detectToolchainHost();
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
AndroidConfigurations(QObject *parent);
|
|
|
|
|
void load();
|
|
|
|
|
void save();
|
|
|
|
|
|
|
|
|
|
int getSDKVersion(const QString &device) const;
|
|
|
|
|
void updateAvailablePlatforms();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static AndroidConfigurations *m_instance;
|
|
|
|
|
AndroidConfig m_config;
|
|
|
|
|
QVector<int> m_availablePlatforms;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|
|
|
|
|
|
|
|
|
|
#endif // ANDROIDCONFIGURATIONS_H
|