forked from qt-creator/qt-creator
Android: Merge androidsettings{page,widget}.{h,cpp}
du -s .obj: 106256 -> 103628 Change-Id: I960ad42e1f73d2cd11aadcf5e2eaa0d840e3e9af Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -37,7 +37,6 @@ add_qtc_plugin(Android
|
||||
androidsdkmanagerwidget.cpp androidsdkmanagerwidget.h androidsdkmanagerwidget.ui
|
||||
androidsdkmodel.cpp androidsdkmodel.h
|
||||
androidsdkpackage.cpp androidsdkpackage.h
|
||||
androidsettingspage.cpp androidsettingspage.h
|
||||
androidsettingswidget.cpp androidsettingswidget.h androidsettingswidget.ui
|
||||
androidsignaloperation.cpp androidsignaloperation.h
|
||||
androidtoolchain.cpp androidtoolchain.h
|
||||
|
||||
@@ -11,7 +11,6 @@ HEADERS += \
|
||||
androidmanager.h \
|
||||
androidrunconfiguration.h \
|
||||
androidruncontrol.h \
|
||||
androidsettingspage.h \
|
||||
androidsettingswidget.h \
|
||||
androidtoolchain.h \
|
||||
androiderrormessage.h \
|
||||
@@ -56,7 +55,6 @@ SOURCES += \
|
||||
androidmanager.cpp \
|
||||
androidrunconfiguration.cpp \
|
||||
androidruncontrol.cpp \
|
||||
androidsettingspage.cpp \
|
||||
androidsettingswidget.cpp \
|
||||
androidtoolchain.cpp \
|
||||
androiderrormessage.cpp \
|
||||
|
||||
@@ -87,8 +87,6 @@ Project {
|
||||
"androidsdkmodel.h",
|
||||
"androidsdkpackage.cpp",
|
||||
"androidsdkpackage.h",
|
||||
"androidsettingspage.cpp",
|
||||
"androidsettingspage.h",
|
||||
"androidsettingswidget.cpp",
|
||||
"androidsettingswidget.h",
|
||||
"androidsettingswidget.ui",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "androidqtversion.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidruncontrol.h"
|
||||
#include "androidsettingspage.h"
|
||||
#include "androidsettingswidget.h"
|
||||
#include "androidtoolchain.h"
|
||||
#include "javaeditor.h"
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "androidsettingspage.h"
|
||||
|
||||
#include "androidsettingswidget.h"
|
||||
#include "androidconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
AndroidSettingsPage::AndroidSettingsPage()
|
||||
{
|
||||
setId(Constants::ANDROID_SETTINGS_ID);
|
||||
setDisplayName(tr("Android"));
|
||||
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
||||
setWidgetCreator([] { return new AndroidSettingsWidget; });
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
@@ -1,42 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AndroidSettingsPage();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
@@ -49,22 +49,94 @@
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QFutureWatcher>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QModelIndex>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QWidget>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
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:
|
||||
void apply() final { saveSettings(); }
|
||||
void finish() final {}
|
||||
|
||||
void saveSettings();
|
||||
void validateJdk();
|
||||
void validateNdk();
|
||||
void onSdkPathChanged();
|
||||
void validateSdk();
|
||||
void openSDKDownloadUrl();
|
||||
void openNDKDownloadUrl();
|
||||
void openOpenJDKDownloadUrl();
|
||||
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();
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
enum JavaValidation {
|
||||
JavaPathExistsRow,
|
||||
JavaJdkValidRow
|
||||
@@ -82,7 +154,6 @@ enum AndroidValidation {
|
||||
NdkDirStructureRow,
|
||||
NdkinstallDirOkRow
|
||||
};
|
||||
}
|
||||
|
||||
class SummaryWidget : public QWidget
|
||||
{
|
||||
@@ -581,6 +652,15 @@ void AndroidSettingsWidget::manageAVD()
|
||||
}
|
||||
}
|
||||
|
||||
// AndroidSettingsPage
|
||||
|
||||
AndroidSettingsPage::AndroidSettingsPage()
|
||||
{
|
||||
setId(Constants::ANDROID_SETTINGS_ID);
|
||||
setDisplayName(AndroidSettingsWidget::tr("Android"));
|
||||
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
||||
setWidgetCreator([] { return new AndroidSettingsWidget; });
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
@@ -25,93 +25,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QAbstractTableModel>
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class Ui_AndroidSettingsWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidSdkManagerWidget;
|
||||
|
||||
class AndroidAvdManager;
|
||||
|
||||
class AvdModel: public QAbstractTableModel
|
||||
class AndroidSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
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 override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
private:
|
||||
AndroidDeviceInfoList m_list;
|
||||
};
|
||||
|
||||
class AndroidSettingsWidget : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
|
||||
AndroidSettingsWidget();
|
||||
~AndroidSettingsWidget() final;
|
||||
|
||||
private:
|
||||
void apply() final { saveSettings(); }
|
||||
void finish() final {}
|
||||
|
||||
void saveSettings();
|
||||
void validateJdk();
|
||||
void validateNdk();
|
||||
void onSdkPathChanged();
|
||||
void validateSdk();
|
||||
void openSDKDownloadUrl();
|
||||
void openNDKDownloadUrl();
|
||||
void openOpenJDKDownloadUrl();
|
||||
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();
|
||||
|
||||
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;
|
||||
AndroidSettingsPage();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user