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); setId(Constants::IOS_SETTINGS_ID);
setDisplayName(tr("iOS")); setDisplayName(tr("iOS"));
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY); setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
} setWidgetCreator([] { return new IosSettingsWidget; });
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;
} }
} // namespace Internal } // namespace Internal

View File

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

View File

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

View File

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