2012-04-18 20:30:57 +03:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (c) 2014 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 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();
|
|
|
|
|
void avdActivated(QModelIndex);
|
|
|
|
|
void dataPartitionSizeEditingFinished();
|
|
|
|
|
void manageAVD();
|
2013-02-14 15:51:59 +01:00
|
|
|
void createKitToggled();
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2014-07-23 11:54:36 +02:00
|
|
|
void checkGdbFinished();
|
|
|
|
|
void showGdbWarningDialog();
|
|
|
|
|
|
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;
|
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-23 11:54:36 +02:00
|
|
|
QFutureWatcher<QPair<QString, bool>> m_checkGdbWatcher;
|
|
|
|
|
QString m_gdbCheckPath;
|
2012-04-18 20:30:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|
|
|
|
|
|
|
|
|
|
#endif // ANDROIDSETTINGSWIDGET_H
|