forked from qt-creator/qt-creator
Debugger: Use new settings page convenience for CDB settings
Following the pattern introduced in 809e62e373
.
Change-Id: I35430648da410d05dccce868c930b9e139e1f478
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -24,7 +24,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "cdboptionspage.h"
|
#include "cdboptionspage.h"
|
||||||
|
|
||||||
#include "cdbengine.h"
|
#include "cdbengine.h"
|
||||||
|
#include "ui_cdboptionspagewidget.h"
|
||||||
#include <debugger/commonoptionspage.h>
|
#include <debugger/commonoptionspage.h>
|
||||||
#include <debugger/debuggeractions.h>
|
#include <debugger/debuggeractions.h>
|
||||||
#include <debugger/debuggercore.h>
|
#include <debugger/debuggercore.h>
|
||||||
@@ -73,6 +75,29 @@ static inline int indexOfEvent(const QString &abbrev)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- CdbOptionsPage
|
||||||
|
|
||||||
|
// Widget displaying a list of break events for the 'sxe' command
|
||||||
|
// with a checkbox to enable 'break' and optionally a QLineEdit for
|
||||||
|
// events with parameters (like 'out:Needle').
|
||||||
|
class CdbBreakEventWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CdbBreakEventWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
void setBreakEvents(const QStringList &l);
|
||||||
|
QStringList breakEvents() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString filterText(int i) const;
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
QList<QCheckBox*> m_checkBoxes;
|
||||||
|
QList<QLineEdit*> m_lineEdits;
|
||||||
|
};
|
||||||
|
|
||||||
CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent)
|
CdbBreakEventWidget::CdbBreakEventWidget(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
// 1 column with checkboxes only,
|
// 1 column with checkboxes only,
|
||||||
@@ -154,6 +179,22 @@ QStringList CdbBreakEventWidget::breakEvents() const
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CdbOptionsPageWidget : public Core::IOptionsPageWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CdbOptionsPageWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void apply() final;
|
||||||
|
void finish() final;
|
||||||
|
|
||||||
|
Utils::SavedActionSet m_group;
|
||||||
|
Ui::CdbOptionsPageWidget m_ui;
|
||||||
|
CdbBreakEventWidget *m_breakEventWidget;
|
||||||
|
};
|
||||||
|
|
||||||
CdbOptionsPageWidget::CdbOptionsPageWidget()
|
CdbOptionsPageWidget::CdbOptionsPageWidget()
|
||||||
: m_breakEventWidget(new CdbBreakEventWidget)
|
: m_breakEventWidget(new CdbBreakEventWidget)
|
||||||
{
|
{
|
||||||
@@ -178,128 +219,83 @@ CdbOptionsPageWidget::CdbOptionsPageWidget()
|
|||||||
m_ui.breakCrtDbgReportCheckBox
|
m_ui.breakCrtDbgReportCheckBox
|
||||||
->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptionsPage::crtDbgReport, hint));
|
->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptionsPage::crtDbgReport, hint));
|
||||||
|
|
||||||
group.insert(action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit);
|
m_group.insert(action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit);
|
||||||
group.insert(action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox);
|
m_group.insert(action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox);
|
||||||
group.insert(action(UseCdbConsole), m_ui.consoleCheckBox);
|
m_group.insert(action(UseCdbConsole), m_ui.consoleCheckBox);
|
||||||
group.insert(action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox);
|
m_group.insert(action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox);
|
||||||
group.insert(action(CdbUsePythonDumper), m_ui.usePythonDumper);
|
m_group.insert(action(CdbUsePythonDumper), m_ui.usePythonDumper);
|
||||||
group.insert(action(FirstChanceExceptionTaskEntry), m_ui.firstChance);
|
m_group.insert(action(FirstChanceExceptionTaskEntry), m_ui.firstChance);
|
||||||
group.insert(action(SecondChanceExceptionTaskEntry), m_ui.secondChance);
|
m_group.insert(action(SecondChanceExceptionTaskEntry), m_ui.secondChance);
|
||||||
group.insert(action(IgnoreFirstChanceAccessViolation),
|
m_group.insert(action(IgnoreFirstChanceAccessViolation),
|
||||||
m_ui.ignoreFirstChanceAccessViolationCheckBox);
|
m_ui.ignoreFirstChanceAccessViolationCheckBox);
|
||||||
|
|
||||||
m_breakEventWidget->setBreakEvents(stringListSetting(CdbBreakEvents));
|
m_breakEventWidget->setBreakEvents(stringListSetting(CdbBreakEvents));
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CdbOptionsPageWidget::breakEvents() const
|
void CdbOptionsPageWidget::apply()
|
||||||
{
|
{
|
||||||
return m_breakEventWidget->breakEvents();
|
m_group.apply(Core::ICore::settings());
|
||||||
|
action(CdbBreakEvents)->setValue(m_breakEventWidget->breakEvents());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- CdbOptionsPage
|
void CdbOptionsPageWidget::finish()
|
||||||
|
{
|
||||||
|
m_group.finish();
|
||||||
|
}
|
||||||
|
|
||||||
CdbOptionsPage::CdbOptionsPage()
|
CdbOptionsPage::CdbOptionsPage()
|
||||||
{
|
{
|
||||||
setId("F.Debugger.Cda");
|
setId("F.Debugger.Cda");
|
||||||
setDisplayName(tr("CDB"));
|
setDisplayName(tr("CDB"));
|
||||||
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
||||||
|
setWidgetCreator([] { return new CdbOptionsPageWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
CdbOptionsPage::~CdbOptionsPage() = default;
|
|
||||||
|
|
||||||
QWidget *CdbOptionsPage::widget()
|
|
||||||
{
|
|
||||||
if (!m_widget)
|
|
||||||
m_widget = new CdbOptionsPageWidget;
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbOptionsPage::apply()
|
|
||||||
{
|
|
||||||
if (!m_widget)
|
|
||||||
return;
|
|
||||||
m_widget->group.apply(Core::ICore::settings());
|
|
||||||
action(CdbBreakEvents)->setValue(m_widget->breakEvents());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbOptionsPage::finish()
|
|
||||||
{
|
|
||||||
if (m_widget) {
|
|
||||||
m_widget->group.finish();
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- CdbPathsPage
|
// ---------- CdbPathsPage
|
||||||
|
|
||||||
class CdbPathsPageWidget : public QWidget
|
class CdbPathsPageWidget : public Core::IOptionsPageWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::SavedActionSet group;
|
CdbPathsPageWidget();
|
||||||
|
|
||||||
// CdbPaths m_paths;
|
void apply() final { m_group.apply(Core::ICore::settings()); }
|
||||||
CdbSymbolPathListEditor *m_symbolPathListEditor;
|
void finish() final { m_group.finish(); }
|
||||||
Utils::PathListEditor *m_sourcePathListEditor;
|
|
||||||
|
|
||||||
CdbPathsPageWidget(QWidget *parent = nullptr);
|
Utils::SavedActionSet m_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
|
CdbPathsPageWidget::CdbPathsPageWidget()
|
||||||
QWidget(parent)
|
|
||||||
{
|
{
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QString title = tr("Symbol Paths");
|
auto gbSymbolPath = new QGroupBox(tr("Symbol Paths"), this);
|
||||||
auto gbSymbolPath = new QGroupBox(this);
|
|
||||||
gbSymbolPath->setTitle(title);
|
|
||||||
auto gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath);
|
auto gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath);
|
||||||
m_symbolPathListEditor = new CdbSymbolPathListEditor(gbSymbolPath);
|
|
||||||
gbSymbolPathLayout->addWidget(m_symbolPathListEditor);
|
|
||||||
|
|
||||||
title = tr("Source Paths");
|
auto symbolPathListEditor = new CdbSymbolPathListEditor(gbSymbolPath);
|
||||||
auto gbSourcePath = new QGroupBox(this);
|
gbSymbolPathLayout->addWidget(symbolPathListEditor);
|
||||||
gbSourcePath->setTitle(title);
|
|
||||||
|
auto gbSourcePath = new QGroupBox(tr("Source Paths"), this);
|
||||||
|
|
||||||
auto gbSourcePathLayout = new QVBoxLayout(gbSourcePath);
|
auto gbSourcePathLayout = new QVBoxLayout(gbSourcePath);
|
||||||
m_sourcePathListEditor = new Utils::PathListEditor(gbSourcePath);
|
auto sourcePathListEditor = new Utils::PathListEditor(gbSourcePath);
|
||||||
gbSourcePathLayout->addWidget(m_sourcePathListEditor);
|
gbSourcePathLayout->addWidget(sourcePathListEditor);
|
||||||
|
|
||||||
layout->addWidget(gbSymbolPath);
|
layout->addWidget(gbSymbolPath);
|
||||||
layout->addWidget(gbSourcePath);
|
layout->addWidget(gbSourcePath);
|
||||||
|
|
||||||
group.insert(action(CdbSymbolPaths), m_symbolPathListEditor);
|
m_group.insert(action(CdbSymbolPaths), symbolPathListEditor);
|
||||||
group.insert(action(CdbSourcePaths), m_sourcePathListEditor);
|
m_group.insert(action(CdbSourcePaths), sourcePathListEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CdbPathsPage::CdbPathsPage()
|
CdbPathsPage::CdbPathsPage()
|
||||||
: m_widget(nullptr)
|
|
||||||
{
|
{
|
||||||
setId("F.Debugger.Cdb");
|
setId("F.Debugger.Cdb");
|
||||||
setDisplayName(tr("CDB Paths"));
|
setDisplayName(tr("CDB Paths"));
|
||||||
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
||||||
}
|
setWidgetCreator([] { return new CdbPathsPageWidget; });
|
||||||
|
|
||||||
CdbPathsPage::~CdbPathsPage() = default;
|
|
||||||
|
|
||||||
QWidget *CdbPathsPage::widget()
|
|
||||||
{
|
|
||||||
if (!m_widget)
|
|
||||||
m_widget = new CdbPathsPageWidget;
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbPathsPage::apply()
|
|
||||||
{
|
|
||||||
if (m_widget)
|
|
||||||
m_widget->group.apply(Core::ICore::settings());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbPathsPage::finish()
|
|
||||||
{
|
|
||||||
if (m_widget) {
|
|
||||||
m_widget->group.finish();
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -26,13 +26,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <utils/savedaction.h>
|
|
||||||
#include "ui_cdboptionspagewidget.h"
|
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
#include <QSharedPointer>
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
@@ -45,66 +38,14 @@ namespace Internal {
|
|||||||
class CdbSymbolPathListEditor;
|
class CdbSymbolPathListEditor;
|
||||||
class CdbPathsPageWidget;
|
class CdbPathsPageWidget;
|
||||||
|
|
||||||
// Widget displaying a list of break events for the 'sxe' command
|
|
||||||
// with a checkbox to enable 'break' and optionally a QLineEdit for
|
|
||||||
// events with parameters (like 'out:Needle').
|
|
||||||
class CdbBreakEventWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit CdbBreakEventWidget(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
void setBreakEvents(const QStringList &l);
|
|
||||||
QStringList breakEvents() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString filterText(int i) const;
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
QList<QCheckBox*> m_checkBoxes;
|
|
||||||
QList<QLineEdit*> m_lineEdits;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CdbOptionsPageWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CdbOptionsPageWidget();
|
|
||||||
|
|
||||||
QStringList breakEvents() const;
|
|
||||||
|
|
||||||
Utils::SavedActionSet group;
|
|
||||||
|
|
||||||
private:
|
|
||||||
inline QString path() const;
|
|
||||||
|
|
||||||
|
|
||||||
Ui::CdbOptionsPageWidget m_ui;
|
|
||||||
CdbBreakEventWidget *m_breakEventWidget;
|
|
||||||
CdbSymbolPathListEditor *m_symbolPathListEditor;
|
|
||||||
Utils::PathListEditor *m_sourcePathListEditor;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CdbOptionsPage : public Core::IOptionsPage
|
class CdbOptionsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CdbOptionsPage();
|
CdbOptionsPage();
|
||||||
~CdbOptionsPage() override;
|
|
||||||
|
|
||||||
// IOptionsPage
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
static const char *crtDbgReport;
|
static const char *crtDbgReport;
|
||||||
|
|
||||||
private:
|
|
||||||
Utils::SavedActionSet group;
|
|
||||||
QPointer<CdbOptionsPageWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CdbPathsPage : public Core::IOptionsPage
|
class CdbPathsPage : public Core::IOptionsPage
|
||||||
@@ -113,17 +54,6 @@ class CdbPathsPage : public Core::IOptionsPage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CdbPathsPage();
|
CdbPathsPage();
|
||||||
~CdbPathsPage() override;
|
|
||||||
|
|
||||||
static CdbPathsPage *instance();
|
|
||||||
|
|
||||||
// IOptionsPage
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPointer<CdbPathsPageWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user