iOS: use new settings page convenience

Change-Id: I307fea9a1243df981547f11c4f5d7cd231c185c0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-01-07 16:51:01 +01:00
parent 0424420e3c
commit 60a1acc0cf
4 changed files with 15 additions and 33 deletions

View File

@@ -40,24 +40,7 @@ IosSettingsPage::IosSettingsPage()
setId(Constants::IOS_SETTINGS_ID);
setDisplayName(tr("iOS"));
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
}
QWidget *IosSettingsPage::widget()
{
if (!m_widget)
m_widget = new IosSettingsWidget;
return m_widget;
}
void IosSettingsPage::apply()
{
m_widget->saveSettings();
IosConfigurations::updateAutomaticKitList();
}
void IosSettingsPage::finish()
{
delete m_widget;
setWidgetCreator([] { return new IosSettingsWidget; });
}
} // namespace Internal

View File

@@ -27,26 +27,15 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QPointer>
namespace Ios {
namespace Internal {
class IosSettingsWidget;
class IosSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
IosSettingsPage();
QWidget *widget() override;
void apply() override;
void finish() override;
private:
QPointer<IosSettingsWidget> m_widget;
};
} // namespace Internal

View File

@@ -94,6 +94,12 @@ IosSettingsWidget::~IosSettingsWidget()
delete m_ui;
}
void IosSettingsWidget::apply()
{
saveSettings();
IosConfigurations::updateAutomaticKitList();
}
/*!
Called on start button click. Selected simulator devices are started. Multiple devices can be
started simultaneously provided they in shutdown state.

View File

@@ -27,24 +27,28 @@
#include "iosconfigurations.h"
#include "simulatorcontrol.h"
#include <QWidget>
#include <coreplugin/dialogs/ioptionspage.h>
namespace Ios {
namespace Internal {
namespace Ui { class IosSettingsWidget; }
class IosSettingsWidget : public QWidget
class IosSettingsWidget : public Core::IOptionsPageWidget
{
Q_OBJECT
public:
IosSettingsWidget();
~IosSettingsWidget() override;
~IosSettingsWidget() final;
private:
void apply() final;
void finish() final {}
void saveSettings();
private:
void onStart();
void onCreate();
void onReset();