forked from qt-creator/qt-creator
Android: Use new settings page convenience
Following the pattern introduced in 809e62e373
.
Change-Id: I6556aa71f37c4d5fc929a28a0abb71ea7fec788a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -27,13 +27,8 @@
|
|||||||
|
|
||||||
#include "androidsettingswidget.h"
|
#include "androidsettingswidget.h"
|
||||||
#include "androidconstants.h"
|
#include "androidconstants.h"
|
||||||
#include "androidtoolchain.h"
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -43,24 +38,7 @@ AndroidSettingsPage::AndroidSettingsPage()
|
|||||||
setId(Constants::ANDROID_SETTINGS_ID);
|
setId(Constants::ANDROID_SETTINGS_ID);
|
||||||
setDisplayName(tr("Android"));
|
setDisplayName(tr("Android"));
|
||||||
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
||||||
}
|
setWidgetCreator([] { return new AndroidSettingsWidget; });
|
||||||
|
|
||||||
QWidget *AndroidSettingsPage::widget()
|
|
||||||
{
|
|
||||||
if (!m_widget)
|
|
||||||
m_widget = new AndroidSettingsWidget;
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidSettingsPage::apply()
|
|
||||||
{
|
|
||||||
if (m_widget)
|
|
||||||
m_widget->saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidSettingsPage::finish()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -27,26 +27,15 @@
|
|||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AndroidSettingsWidget;
|
|
||||||
|
|
||||||
class AndroidSettingsPage : public Core::IOptionsPage
|
class AndroidSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AndroidSettingsPage();
|
AndroidSettingsPage();
|
||||||
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPointer<AndroidSettingsWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -216,9 +216,8 @@ int AvdModel::columnCount(const QModelIndex &/*parent*/) const
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
|
AndroidSettingsWidget::AndroidSettingsWidget()
|
||||||
: QWidget(parent),
|
: m_ui(new Ui_AndroidSettingsWidget),
|
||||||
m_ui(new Ui_AndroidSettingsWidget),
|
|
||||||
m_androidConfig(AndroidConfigurations::currentConfig()),
|
m_androidConfig(AndroidConfigurations::currentConfig()),
|
||||||
m_avdManager(new AndroidAvdManager(m_androidConfig)),
|
m_avdManager(new AndroidAvdManager(m_androidConfig)),
|
||||||
m_sdkManager(new AndroidSdkManager(m_androidConfig))
|
m_sdkManager(new AndroidSdkManager(m_androidConfig))
|
||||||
|
@@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class Ui_AndroidSettingsWidget;
|
class Ui_AndroidSettingsWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -64,17 +66,19 @@ private:
|
|||||||
AndroidDeviceInfoList m_list;
|
AndroidDeviceInfoList m_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AndroidSettingsWidget : public QWidget
|
class AndroidSettingsWidget : public Core::IOptionsPageWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
|
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
|
||||||
AndroidSettingsWidget(QWidget *parent = nullptr);
|
AndroidSettingsWidget();
|
||||||
~AndroidSettingsWidget() override;
|
~AndroidSettingsWidget() final;
|
||||||
|
|
||||||
void saveSettings();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void apply() final { saveSettings(); }
|
||||||
|
void finish() final {}
|
||||||
|
|
||||||
|
void saveSettings();
|
||||||
void validateJdk();
|
void validateJdk();
|
||||||
void validateNdk();
|
void validateNdk();
|
||||||
void onSdkPathChanged();
|
void onSdkPathChanged();
|
||||||
@@ -94,7 +98,6 @@ private:
|
|||||||
void updateUI();
|
void updateUI();
|
||||||
void updateAvds();
|
void updateAvds();
|
||||||
|
|
||||||
private:
|
|
||||||
void startUpdateAvd();
|
void startUpdateAvd();
|
||||||
void enableAvdControls();
|
void enableAvdControls();
|
||||||
void disableAvdControls();
|
void disableAvdControls();
|
||||||
|
Reference in New Issue
Block a user