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
|
|
|
|
|
|
|
|
#ifndef ANDROIDSETTINGSWIDGET_H
|
|
|
|
|
#define ANDROIDSETTINGSWIDGET_H
|
|
|
|
|
|
|
|
|
|
#include "androidconfigurations.h"
|
|
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QAbstractTableModel>
|
2014-04-11 13:31:01 +02:00
|
|
|
#include <QFutureWatcher>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class Ui_AndroidSettingsWidget;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
class AvdModel: public QAbstractTableModel
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2012-08-24 12:12:15 +02:00
|
|
|
Q_OBJECT
|
2012-04-18 20:30:57 +03:00
|
|
|
public:
|
2012-08-09 01:56:51 +02:00
|
|
|
void setAvdList(const QVector<AndroidDeviceInfo> &list);
|
2014-04-11 13:30:26 +02:00
|
|
|
QString avdName(const QModelIndex &index) const;
|
2014-04-11 13:31:01 +02:00
|
|
|
QModelIndex indexForAvdName(const QString &avdName) const;
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
2012-08-09 01:56:51 +02:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
2012-04-18 20:30:57 +03:00
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
|
|
|
|
|
|
private:
|
2012-07-03 16:57:44 +03:00
|
|
|
QVector<AndroidDeviceInfo> m_list;
|
2012-04-18 20:30:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class AndroidSettingsWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2012-04-24 15:49:09 +02:00
|
|
|
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
|
2013-12-03 14:17:03 +01:00
|
|
|
AndroidSettingsWidget(QWidget *parent = 0);
|
2012-04-18 20:30:57 +03:00
|
|
|
~AndroidSettingsWidget();
|
|
|
|
|
|
2013-12-16 20:19:07 +01:00
|
|
|
void saveSettings();
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void sdkLocationEditingFinished();
|
|
|
|
|
void ndkLocationEditingFinished();
|
2013-12-16 20:19:07 +01:00
|
|
|
void searchForAnt(const Utils::FileName &location);
|
2012-04-18 20:30:57 +03:00
|
|
|
void antLocationEditingFinished();
|
|
|
|
|
void openJDKLocationEditingFinished();
|
2014-02-18 20:20:32 +01:00
|
|
|
void openSDKDownloadUrl();
|
|
|
|
|
void openNDKDownloadUrl();
|
|
|
|
|
void openAntDownloadUrl();
|
|
|
|
|
void openOpenJDKDownloadUrl();
|
2012-04-18 20:30:57 +03:00
|
|
|
void addAVD();
|
2014-04-11 13:31:01 +02:00
|
|
|
void avdAdded();
|
2012-04-18 20:30:57 +03:00
|
|
|
void removeAVD();
|
|
|
|
|
void startAVD();
|
2014-05-19 23:31:01 +03:00
|
|
|
void avdActivated(const QModelIndex &);
|
2012-04-18 20:30:57 +03:00
|
|
|
void dataPartitionSizeEditingFinished();
|
|
|
|
|
void manageAVD();
|
2013-02-14 15:51:59 +01:00
|
|
|
void createKitToggled();
|
2014-09-22 16:20:51 +03:00
|
|
|
void useGradleToggled();
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2014-07-23 11:54:36 +02:00
|
|
|
void checkGdbFinished();
|
|
|
|
|
void showGdbWarningDialog();
|
2015-01-08 17:05:09 +01:00
|
|
|
void updateAvds();
|
2014-07-23 11:54:36 +02:00
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
private:
|
2013-12-16 20:19:07 +01:00
|
|
|
enum Mode { Sdk = 1, Ndk = 2, Java = 4, All = Sdk | Ndk | Java };
|
|
|
|
|
enum State { NotSet = 0, Okay = 1, Error = 2 };
|
|
|
|
|
void check(Mode mode);
|
|
|
|
|
void applyToUi(Mode mode);
|
2014-03-04 23:38:21 +01:00
|
|
|
bool sdkLocationIsValid() const;
|
|
|
|
|
bool sdkPlatformToolsInstalled() const;
|
2015-01-08 17:05:09 +01:00
|
|
|
void startUpdateAvd();
|
|
|
|
|
void enableAvdControls();
|
|
|
|
|
void disableAvdControls();
|
2013-12-16 20:19:07 +01:00
|
|
|
|
|
|
|
|
State m_sdkState;
|
|
|
|
|
State m_ndkState;
|
2014-03-18 15:55:22 +01:00
|
|
|
QString m_ndkErrorMessage;
|
2013-12-16 20:19:07 +01:00
|
|
|
int m_ndkCompilerCount;
|
|
|
|
|
QString m_ndkMissingQtArchs;
|
|
|
|
|
State m_javaState;
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
Ui_AndroidSettingsWidget *m_ui;
|
|
|
|
|
AndroidConfig m_androidConfig;
|
2012-08-09 01:56:51 +02:00
|
|
|
AvdModel m_AVDModel;
|
2014-04-11 13:31:01 +02:00
|
|
|
QFutureWatcher<AndroidConfig::CreateAvdInfo> m_futureWatcher;
|
2014-07-29 13:32:24 +02:00
|
|
|
QFutureWatcher<QPair<QStringList, bool>> m_checkGdbWatcher;
|
|
|
|
|
QStringList m_gdbCheckPaths;
|
2015-01-08 17:05:09 +01:00
|
|
|
|
|
|
|
|
QFutureWatcher<QVector<AndroidDeviceInfo>> m_virtualDevicesWatcher;
|
|
|
|
|
QString m_lastAddedAvd;
|
2012-04-18 20:30:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|
|
|
|
|
|
|
|
|
|
#endif // ANDROIDSETTINGSWIDGET_H
|