Debugger: Use new IOptionBase convenience in DebuggerOptionsPage

Change-Id: I99663efacc5c91d71bfe693bb932e6bc0f10e182
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-01-08 13:27:57 +01:00
parent 0f30adcc8c
commit 5f719f8740

View File

@@ -444,7 +444,7 @@ void DebuggerItemConfigWidget::binaryPathHasChanged()
// DebuggerConfigWidget // DebuggerConfigWidget
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
class DebuggerConfigWidget : public QWidget class DebuggerConfigWidget : public IOptionsPageWidget
{ {
Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerOptionsPage) Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerOptionsPage)
public: public:
@@ -506,6 +506,17 @@ public:
updateButtons(); updateButtons();
} }
void apply() final
{
m_itemConfigWidget->store();
d->m_model->apply();
}
void finish() final
{
d->m_model->cancel();
}
void cloneDebugger(); void cloneDebugger();
void addDebugger(); void addDebugger();
void removeDebugger(); void removeDebugger();
@@ -585,43 +596,13 @@ class DebuggerOptionsPage : public Core::IOptionsPage
Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerOptionsPage) Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerOptionsPage)
public: public:
DebuggerOptionsPage(); DebuggerOptionsPage() {
QWidget *widget() final;
void apply() final;
void finish() final;
private:
QPointer<DebuggerConfigWidget> m_configWidget;
};
DebuggerOptionsPage::DebuggerOptionsPage()
{
setId(ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID); setId(ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID);
setDisplayName(tr("Debuggers")); setDisplayName(tr("Debuggers"));
setCategory(ProjectExplorer::Constants::KITS_SETTINGS_CATEGORY); setCategory(ProjectExplorer::Constants::KITS_SETTINGS_CATEGORY);
setWidgetCreator([] { return new DebuggerConfigWidget; });
} }
};
QWidget *DebuggerOptionsPage::widget()
{
if (!m_configWidget)
m_configWidget = new DebuggerConfigWidget;
return m_configWidget;
}
void DebuggerOptionsPage::apply()
{
QTC_ASSERT(m_configWidget, return);
m_configWidget->m_itemConfigWidget->store();
d->m_model->apply();
}
void DebuggerOptionsPage::finish()
{
delete m_configWidget;
m_configWidget = nullptr;
d->m_model->cancel();
}
void DebuggerItemManagerPrivate::autoDetectCdbDebuggers() void DebuggerItemManagerPrivate::autoDetectCdbDebuggers()
{ {