forked from qt-creator/qt-creator
Debugger: Use new IOptionsPage apply convenience
Change-Id: I2954bec762fb3f5d3426663108ff493f140f1b5e Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -29,7 +29,6 @@
|
|||||||
#include <debugger/debuggerconstants.h>
|
#include <debugger/debuggerconstants.h>
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
|
|
||||||
#include <utils/layoutbuilder.h>
|
#include <utils/layoutbuilder.h>
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ namespace Internal {
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// GdbOptionsPageWidget - harmless options
|
// GdbOptionsPage - harmless options
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -50,24 +49,14 @@ class GdbOptionsPage : public Core::IOptionsPage
|
|||||||
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::GdbOptionsPage)
|
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::GdbOptionsPage)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GdbOptionsPage();
|
GdbOptionsPage()
|
||||||
};
|
{
|
||||||
|
setId("M.Gdb");
|
||||||
|
setDisplayName(tr("GDB"));
|
||||||
|
setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
|
||||||
|
setSettings(&debuggerSettings()->page2);
|
||||||
|
|
||||||
class GdbOptionsPageWidget : public IOptionsPageWidget
|
setLayouter([](QWidget *w) {
|
||||||
{
|
|
||||||
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::GdbOptionsPage)
|
|
||||||
|
|
||||||
public:
|
|
||||||
GdbOptionsPageWidget();
|
|
||||||
|
|
||||||
void apply() final { group.apply(); group.writeSettings(ICore::settings()); }
|
|
||||||
void finish() final { group.finish(); }
|
|
||||||
|
|
||||||
AspectContainer &group = debuggerSettings()->page2;
|
|
||||||
};
|
|
||||||
|
|
||||||
GdbOptionsPageWidget::GdbOptionsPageWidget()
|
|
||||||
{
|
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
DebuggerSettings &s = *debuggerSettings();
|
DebuggerSettings &s = *debuggerSettings();
|
||||||
|
|
||||||
@@ -91,36 +80,29 @@ GdbOptionsPageWidget::GdbOptionsPageWidget()
|
|||||||
Stretch()
|
Stretch()
|
||||||
};
|
};
|
||||||
|
|
||||||
Row { general, commands }.attachTo(this);
|
Row { general, commands }.attachTo(w);
|
||||||
}
|
});
|
||||||
|
}
|
||||||
GdbOptionsPage::GdbOptionsPage()
|
|
||||||
{
|
|
||||||
setId("M.Gdb");
|
|
||||||
setDisplayName(tr("GDB"));
|
|
||||||
setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
|
|
||||||
setWidgetCreator([] { return new GdbOptionsPageWidget; });
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// GdbOptionsPageWidget2 - dangerous options
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class GdbOptionsPageWidget2 : public IOptionsPageWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GdbOptionsPageWidget2();
|
|
||||||
|
|
||||||
void apply() final { group.apply(); group.writeSettings(ICore::settings()); }
|
|
||||||
void finish() final { group.finish(); }
|
|
||||||
|
|
||||||
AspectContainer &group = debuggerSettings()->page3;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GdbOptionsPageWidget2::GdbOptionsPageWidget2()
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// GdbOptionsPage2 - dangerous options
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// The "Dangerous" options.
|
||||||
|
class GdbOptionsPage2 : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
GdbOptionsPage2()
|
||||||
|
{
|
||||||
|
setId("M.Gdb2");
|
||||||
|
setDisplayName(GdbOptionsPage::tr("GDB Extended"));
|
||||||
|
setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
|
||||||
|
setSettings(&debuggerSettings()->page3);
|
||||||
|
|
||||||
|
setLayouter([](QWidget *w) {
|
||||||
auto labelDangerous = new QLabel("<html><head/><body><i>" +
|
auto labelDangerous = new QLabel("<html><head/><body><i>" +
|
||||||
GdbOptionsPage::tr("The options below give access to advanced "
|
GdbOptionsPage::tr("The options below give access to advanced "
|
||||||
"or experimental functions of GDB.<br>Enabling them may negatively "
|
"or experimental functions of GDB.<br>Enabling them may negatively "
|
||||||
@@ -141,19 +123,8 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2()
|
|||||||
s.multiInferior,
|
s.multiInferior,
|
||||||
};
|
};
|
||||||
|
|
||||||
Column { extended, Stretch() }.attachTo(this);
|
Column { extended, Stretch() }.attachTo(w);
|
||||||
}
|
});
|
||||||
|
|
||||||
// The "Dangerous" options.
|
|
||||||
class GdbOptionsPage2 : public Core::IOptionsPage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GdbOptionsPage2()
|
|
||||||
{
|
|
||||||
setId("M.Gdb2");
|
|
||||||
setDisplayName(GdbOptionsPage::tr("GDB Extended"));
|
|
||||||
setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY);
|
|
||||||
setWidgetCreator([] { return new GdbOptionsPageWidget2; });
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user