forked from qt-creator/qt-creator
Debugger: Streamline common options page setup
A preliminary step to debugger options reorganization. Change-Id: Iac77d87acfe246eff3f5734bcf35e35c2d6909c1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -45,115 +45,130 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Debugger::Constants;
|
using namespace Debugger::Constants;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CommonOptionsPageWidget : public QWidget
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// CommonOptionsPage
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CommonOptionsPage::CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> &go) :
|
||||||
|
m_options(go)
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
setId(DEBUGGER_COMMON_SETTINGS_ID);
|
||||||
|
setDisplayName(QCoreApplication::translate("Debugger", "General"));
|
||||||
|
setCategory(DEBUGGER_SETTINGS_CATEGORY);
|
||||||
|
setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY));
|
||||||
|
setCategoryIcon(Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
void CommonOptionsPage::apply()
|
||||||
explicit CommonOptionsPageWidget(const QSharedPointer<Utils::SavedActionSet> &group);
|
|
||||||
|
|
||||||
GlobalDebuggerOptions globalOptions() const;
|
|
||||||
void setGlobalOptions(const GlobalDebuggerOptions &go);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QCheckBox *checkBoxUseAlternatingRowColors;
|
|
||||||
QCheckBox *checkBoxFontSizeFollowsEditor;
|
|
||||||
QCheckBox *checkBoxUseToolTipsInMainEditor;
|
|
||||||
QCheckBox *checkBoxCloseSourceBuffersOnExit;
|
|
||||||
QCheckBox *checkBoxCloseMemoryBuffersOnExit;
|
|
||||||
QCheckBox *checkBoxSwitchModeOnExit;
|
|
||||||
QCheckBox *checkBoxBringToForegroundOnInterrrupt;
|
|
||||||
QCheckBox *checkBoxShowQmlObjectTree;
|
|
||||||
QCheckBox *checkBoxBreakpointsFullPath;
|
|
||||||
QCheckBox *checkBoxRegisterForPostMortem;
|
|
||||||
QCheckBox *checkBoxWarnOnReleaseBuilds;
|
|
||||||
QCheckBox *checkBoxKeepEditorStationaryWhileStepping;
|
|
||||||
QLabel *labelMaximalStackDepth;
|
|
||||||
QSpinBox *spinBoxMaximalStackDepth;
|
|
||||||
|
|
||||||
DebuggerSourcePathMappingWidget *sourcesMappingWidget;
|
|
||||||
const QSharedPointer<Utils::SavedActionSet> m_group;
|
|
||||||
};
|
|
||||||
|
|
||||||
CommonOptionsPageWidget::CommonOptionsPageWidget
|
|
||||||
(const QSharedPointer<Utils::SavedActionSet> &group)
|
|
||||||
: m_group(group)
|
|
||||||
{
|
{
|
||||||
QGroupBox *behaviorBox = new QGroupBox(this);
|
m_group.apply(ICore::settings());
|
||||||
|
|
||||||
|
GlobalDebuggerOptions newOptions;
|
||||||
|
SourcePathMap allPathMap = m_sourceMappingWidget->sourcePathMap();
|
||||||
|
for (auto it = allPathMap.begin(), end = allPathMap.end(); it != end; ++it) {
|
||||||
|
const QString key = it.key();
|
||||||
|
if (key.startsWith(QLatin1Char('(')))
|
||||||
|
newOptions.sourcePathRegExpMap.append(qMakePair(QRegExp(key), it.value()));
|
||||||
|
else
|
||||||
|
newOptions.sourcePathMap.insert(key, it.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newOptions.sourcePathMap != m_options->sourcePathMap
|
||||||
|
|| newOptions.sourcePathRegExpMap != m_options->sourcePathRegExpMap) {
|
||||||
|
*m_options = newOptions;
|
||||||
|
m_options->toSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommonOptionsPage::finish()
|
||||||
|
{
|
||||||
|
m_group.finish();
|
||||||
|
delete m_widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *CommonOptionsPage::widget()
|
||||||
|
{
|
||||||
|
if (!m_widget) {
|
||||||
|
m_widget = new QWidget;
|
||||||
|
|
||||||
|
auto behaviorBox = new QGroupBox(m_widget);
|
||||||
behaviorBox->setTitle(tr("Behavior"));
|
behaviorBox->setTitle(tr("Behavior"));
|
||||||
|
|
||||||
checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox);
|
auto checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox);
|
||||||
checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views"));
|
checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views"));
|
||||||
|
|
||||||
checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox);
|
auto checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox);
|
||||||
checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes."));
|
checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes."));
|
||||||
checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor"));
|
checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor"));
|
||||||
|
|
||||||
checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox);
|
auto checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox);
|
||||||
checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging"));
|
checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging"));
|
||||||
|
|
||||||
QString t = tr("Stopping and stepping in the debugger "
|
QString t = tr("Stopping and stepping in the debugger "
|
||||||
"will automatically open views associated with the current location.") + QLatin1Char('\n');
|
"will automatically open views associated with the current location.") + QLatin1Char('\n');
|
||||||
checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox);
|
auto checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox);
|
||||||
checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit"));
|
checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit"));
|
||||||
checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close "
|
checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close "
|
||||||
"automatically opened source views when the debugger exits."));
|
"automatically opened source views when the debugger exits."));
|
||||||
|
|
||||||
checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox);
|
auto checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox);
|
||||||
checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit"));
|
checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit"));
|
||||||
checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Select this option to close "
|
checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Select this option to close "
|
||||||
"automatically opened memory views when the debugger exits."));
|
"automatically opened memory views when the debugger exits."));
|
||||||
|
|
||||||
checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox);
|
auto checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox);
|
||||||
checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit"));
|
checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit"));
|
||||||
|
|
||||||
checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox);
|
auto checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox);
|
||||||
checkBoxBringToForegroundOnInterrrupt->setText(tr("Bring Qt Creator to foreground when application interrupts"));
|
checkBoxBringToForegroundOnInterrrupt->setText(tr("Bring Qt Creator to foreground when application interrupts"));
|
||||||
|
|
||||||
checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox);
|
auto checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox);
|
||||||
checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping."));
|
checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping."));
|
||||||
checkBoxShowQmlObjectTree->setText(tr("Show QML object tree"));
|
checkBoxShowQmlObjectTree->setText(tr("Show QML object tree"));
|
||||||
|
|
||||||
checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox);
|
auto checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox);
|
||||||
checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB."));
|
checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB."));
|
||||||
checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path"));
|
checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path"));
|
||||||
|
|
||||||
checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox);
|
auto checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox);
|
||||||
checkBoxRegisterForPostMortem->setToolTip(tr("Registers Qt Creator for debugging crashed applications."));
|
checkBoxRegisterForPostMortem->setToolTip(tr("Registers Qt Creator for debugging crashed applications."));
|
||||||
checkBoxRegisterForPostMortem->setText(tr("Use Qt Creator for post-mortem debugging"));
|
checkBoxRegisterForPostMortem->setText(tr("Use Qt Creator for post-mortem debugging"));
|
||||||
|
|
||||||
checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox);
|
auto checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox);
|
||||||
checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds"));
|
checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds"));
|
||||||
checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger "
|
checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger "
|
||||||
"on a binary with insufficient debug information."));
|
"on a binary with insufficient debug information."));
|
||||||
|
|
||||||
checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox);
|
auto checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox);
|
||||||
checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping"));
|
checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping"));
|
||||||
checkBoxKeepEditorStationaryWhileStepping->setToolTip(tr("Scrolls the editor only when it is necessary "
|
checkBoxKeepEditorStationaryWhileStepping->setToolTip(tr("Scrolls the editor only when it is necessary "
|
||||||
"to keep the current line in view, "
|
"to keep the current line in view, "
|
||||||
"instead of keeping the next statement centered at "
|
"instead of keeping the next statement centered at "
|
||||||
"all times."));
|
"all times."));
|
||||||
|
|
||||||
labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox);
|
auto labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox);
|
||||||
|
|
||||||
spinBoxMaximalStackDepth = new QSpinBox(behaviorBox);
|
auto spinBoxMaximalStackDepth = new QSpinBox(behaviorBox);
|
||||||
spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>"));
|
spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>"));
|
||||||
spinBoxMaximalStackDepth->setMaximum(999);
|
spinBoxMaximalStackDepth->setMaximum(999);
|
||||||
spinBoxMaximalStackDepth->setSingleStep(5);
|
spinBoxMaximalStackDepth->setSingleStep(5);
|
||||||
spinBoxMaximalStackDepth->setValue(10);
|
spinBoxMaximalStackDepth->setValue(10);
|
||||||
|
|
||||||
sourcesMappingWidget = new DebuggerSourcePathMappingWidget(this);
|
m_sourceMappingWidget = new DebuggerSourcePathMappingWidget(m_widget);
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
auto horizontalLayout = new QHBoxLayout;
|
||||||
horizontalLayout->addWidget(labelMaximalStackDepth);
|
horizontalLayout->addWidget(labelMaximalStackDepth);
|
||||||
horizontalLayout->addWidget(spinBoxMaximalStackDepth);
|
horizontalLayout->addWidget(spinBoxMaximalStackDepth);
|
||||||
horizontalLayout->addStretch();
|
horizontalLayout->addStretch();
|
||||||
|
|
||||||
QGridLayout *gridLayout = new QGridLayout(behaviorBox);
|
auto gridLayout = new QGridLayout(behaviorBox);
|
||||||
gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1);
|
gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1);
|
gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1);
|
gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1);
|
||||||
@@ -169,132 +184,63 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
|||||||
gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1);
|
gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1);
|
gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1);
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
auto verticalLayout = new QVBoxLayout(m_widget);
|
||||||
verticalLayout->addWidget(behaviorBox);
|
verticalLayout->addWidget(behaviorBox);
|
||||||
verticalLayout->addWidget(sourcesMappingWidget);
|
verticalLayout->addWidget(m_sourceMappingWidget);
|
||||||
verticalLayout->addStretch();
|
verticalLayout->addStretch();
|
||||||
|
|
||||||
m_group->clear();
|
m_group.clear();
|
||||||
|
|
||||||
m_group->insert(action(UseAlternatingRowColors),
|
m_group.insert(action(UseAlternatingRowColors),
|
||||||
checkBoxUseAlternatingRowColors);
|
checkBoxUseAlternatingRowColors);
|
||||||
m_group->insert(action(UseToolTipsInMainEditor),
|
m_group.insert(action(UseToolTipsInMainEditor),
|
||||||
checkBoxUseToolTipsInMainEditor);
|
checkBoxUseToolTipsInMainEditor);
|
||||||
m_group->insert(action(CloseSourceBuffersOnExit),
|
m_group.insert(action(CloseSourceBuffersOnExit),
|
||||||
checkBoxCloseSourceBuffersOnExit);
|
checkBoxCloseSourceBuffersOnExit);
|
||||||
m_group->insert(action(CloseMemoryBuffersOnExit),
|
m_group.insert(action(CloseMemoryBuffersOnExit),
|
||||||
checkBoxCloseMemoryBuffersOnExit);
|
checkBoxCloseMemoryBuffersOnExit);
|
||||||
m_group->insert(action(SwitchModeOnExit),
|
m_group.insert(action(SwitchModeOnExit),
|
||||||
checkBoxSwitchModeOnExit);
|
checkBoxSwitchModeOnExit);
|
||||||
m_group->insert(action(BreakpointsFullPathByDefault),
|
m_group.insert(action(BreakpointsFullPathByDefault),
|
||||||
checkBoxBreakpointsFullPath);
|
checkBoxBreakpointsFullPath);
|
||||||
m_group->insert(action(RaiseOnInterrupt),
|
m_group.insert(action(RaiseOnInterrupt),
|
||||||
checkBoxBringToForegroundOnInterrrupt);
|
checkBoxBringToForegroundOnInterrrupt);
|
||||||
m_group->insert(action(ShowQmlObjectTree),
|
m_group.insert(action(ShowQmlObjectTree),
|
||||||
checkBoxShowQmlObjectTree);
|
checkBoxShowQmlObjectTree);
|
||||||
m_group->insert(action(WarnOnReleaseBuilds),
|
m_group.insert(action(WarnOnReleaseBuilds),
|
||||||
checkBoxWarnOnReleaseBuilds);
|
checkBoxWarnOnReleaseBuilds);
|
||||||
m_group->insert(action(StationaryEditorWhileStepping),
|
m_group.insert(action(StationaryEditorWhileStepping),
|
||||||
checkBoxKeepEditorStationaryWhileStepping);
|
checkBoxKeepEditorStationaryWhileStepping);
|
||||||
m_group->insert(action(FontSizeFollowsEditor),
|
m_group.insert(action(FontSizeFollowsEditor),
|
||||||
checkBoxFontSizeFollowsEditor);
|
checkBoxFontSizeFollowsEditor);
|
||||||
m_group->insert(action(AutoDerefPointers), 0);
|
m_group.insert(action(AutoDerefPointers), 0);
|
||||||
m_group->insert(action(UseToolTipsInLocalsView), 0);
|
m_group.insert(action(UseToolTipsInLocalsView), 0);
|
||||||
m_group->insert(action(AlwaysAdjustColumnWidths), 0);
|
m_group.insert(action(AlwaysAdjustColumnWidths), 0);
|
||||||
m_group->insert(action(UseToolTipsInBreakpointsView), 0);
|
m_group.insert(action(UseToolTipsInBreakpointsView), 0);
|
||||||
m_group->insert(action(UseToolTipsInStackView), 0);
|
m_group.insert(action(UseToolTipsInStackView), 0);
|
||||||
m_group->insert(action(UseAddressInBreakpointsView), 0);
|
m_group.insert(action(UseAddressInBreakpointsView), 0);
|
||||||
m_group->insert(action(UseAddressInStackView), 0);
|
m_group.insert(action(UseAddressInStackView), 0);
|
||||||
m_group->insert(action(MaximalStackDepth), spinBoxMaximalStackDepth);
|
m_group.insert(action(MaximalStackDepth), spinBoxMaximalStackDepth);
|
||||||
m_group->insert(action(ShowStdNamespace), 0);
|
m_group.insert(action(ShowStdNamespace), 0);
|
||||||
m_group->insert(action(ShowQtNamespace), 0);
|
m_group.insert(action(ShowQtNamespace), 0);
|
||||||
m_group->insert(action(ShowQObjectNames), 0);
|
m_group.insert(action(ShowQObjectNames), 0);
|
||||||
m_group->insert(action(SortStructMembers), 0);
|
m_group.insert(action(SortStructMembers), 0);
|
||||||
m_group->insert(action(LogTimeStamps), 0);
|
m_group.insert(action(LogTimeStamps), 0);
|
||||||
m_group->insert(action(BreakOnThrow), 0);
|
m_group.insert(action(BreakOnThrow), 0);
|
||||||
m_group->insert(action(BreakOnCatch), 0);
|
m_group.insert(action(BreakOnCatch), 0);
|
||||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isWindowsHost()) {
|
||||||
Utils::SavedAction *registerAction = action(RegisterForPostMortem);
|
SavedAction *registerAction = action(RegisterForPostMortem);
|
||||||
m_group->insert(registerAction,
|
m_group.insert(registerAction, checkBoxRegisterForPostMortem);
|
||||||
checkBoxRegisterForPostMortem);
|
|
||||||
connect(registerAction, &QAction::toggled,
|
connect(registerAction, &QAction::toggled,
|
||||||
checkBoxRegisterForPostMortem, &QAbstractButton::setChecked);
|
checkBoxRegisterForPostMortem, &QAbstractButton::setChecked);
|
||||||
} else {
|
} else {
|
||||||
checkBoxRegisterForPostMortem->setVisible(false);
|
checkBoxRegisterForPostMortem->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GlobalDebuggerOptions CommonOptionsPageWidget::globalOptions() const
|
SourcePathMap allPathMap = m_options->sourcePathMap;
|
||||||
{
|
foreach (auto regExpMap, m_options->sourcePathRegExpMap)
|
||||||
GlobalDebuggerOptions o;
|
|
||||||
SourcePathMap allPathMap = sourcesMappingWidget->sourcePathMap();
|
|
||||||
for (auto it = allPathMap.begin(), end = allPathMap.end(); it != end; ++it) {
|
|
||||||
const QString key = it.key();
|
|
||||||
if (key.startsWith(QLatin1Char('(')))
|
|
||||||
o.sourcePathRegExpMap.append(qMakePair(QRegExp(key), it.value()));
|
|
||||||
else
|
|
||||||
o.sourcePathMap.insert(key, it.value());
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommonOptionsPageWidget::setGlobalOptions(const GlobalDebuggerOptions &go)
|
|
||||||
{
|
|
||||||
SourcePathMap allPathMap = go.sourcePathMap;
|
|
||||||
foreach (auto regExpMap, go.sourcePathRegExpMap)
|
|
||||||
allPathMap.insert(regExpMap.first.pattern(), regExpMap.second);
|
allPathMap.insert(regExpMap.first.pattern(), regExpMap.second);
|
||||||
|
m_sourceMappingWidget->setSourcePathMap(allPathMap);
|
||||||
sourcesMappingWidget->setSourcePathMap(allPathMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// CommonOptionsPage
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
CommonOptionsPage::CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> &go) :
|
|
||||||
m_options(go)
|
|
||||||
{
|
|
||||||
setId(DEBUGGER_COMMON_SETTINGS_ID);
|
|
||||||
setDisplayName(QCoreApplication::translate("Debugger", "General"));
|
|
||||||
setCategory(DEBUGGER_SETTINGS_CATEGORY);
|
|
||||||
setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY));
|
|
||||||
setCategoryIcon(Utils::Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
|
|
||||||
}
|
|
||||||
|
|
||||||
CommonOptionsPage::~CommonOptionsPage()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommonOptionsPage::apply()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return);
|
|
||||||
|
|
||||||
m_group->apply(ICore::settings());
|
|
||||||
|
|
||||||
const GlobalDebuggerOptions newGlobalOptions = m_widget->globalOptions();
|
|
||||||
if (newGlobalOptions != *m_options) {
|
|
||||||
*m_options = newGlobalOptions;
|
|
||||||
m_options->toSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommonOptionsPage::finish()
|
|
||||||
{
|
|
||||||
if (!m_group.isNull())
|
|
||||||
m_group->finish();
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *CommonOptionsPage::widget()
|
|
||||||
{
|
|
||||||
if (m_group.isNull())
|
|
||||||
m_group = QSharedPointer<Utils::SavedActionSet>(new Utils::SavedActionSet);
|
|
||||||
|
|
||||||
if (!m_widget) {
|
|
||||||
m_widget = new CommonOptionsPageWidget(m_group);
|
|
||||||
m_widget->setGlobalOptions(*m_options);
|
|
||||||
}
|
}
|
||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
@@ -331,7 +277,7 @@ LocalsAndExpressionsOptionsPage::LocalsAndExpressionsOptionsPage()
|
|||||||
setDisplayName(QCoreApplication::translate("Debugger", "Locals && Expressions"));
|
setDisplayName(QCoreApplication::translate("Debugger", "Locals && Expressions"));
|
||||||
setCategory(DEBUGGER_SETTINGS_CATEGORY);
|
setCategory(DEBUGGER_SETTINGS_CATEGORY);
|
||||||
setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY));
|
setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY));
|
||||||
setCategoryIcon(Utils::Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
|
setCategoryIcon(Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalsAndExpressionsOptionsPage::apply()
|
void LocalsAndExpressionsOptionsPage::apply()
|
||||||
@@ -428,5 +374,3 @@ QWidget *LocalsAndExpressionsOptionsPage::widget()
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#include "commonoptionspage.moc"
|
|
||||||
|
|||||||
@@ -33,15 +33,11 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QSpinBox;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GlobalDebuggerOptions;
|
class GlobalDebuggerOptions;
|
||||||
class CommonOptionsPageWidget;
|
class DebuggerSourcePathMappingWidget;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -55,21 +51,21 @@ class CommonOptionsPage : public Core::IOptionsPage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> &go);
|
explicit CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> &go);
|
||||||
~CommonOptionsPage();
|
|
||||||
|
|
||||||
// IOptionsPage
|
// IOptionsPage
|
||||||
QWidget *widget();
|
QWidget *widget() final;
|
||||||
void apply();
|
void apply() final;
|
||||||
void finish();
|
void finish() final;
|
||||||
|
|
||||||
static QString msgSetBreakpointAtFunction(const char *function);
|
static QString msgSetBreakpointAtFunction(const char *function);
|
||||||
static QString msgSetBreakpointAtFunctionToolTip(const char *function,
|
static QString msgSetBreakpointAtFunctionToolTip(const char *function,
|
||||||
const QString &hint = QString());
|
const QString &hint = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QPointer<QWidget> m_widget;
|
||||||
|
Utils::SavedActionSet m_group;
|
||||||
const QSharedPointer<GlobalDebuggerOptions> m_options;
|
const QSharedPointer<GlobalDebuggerOptions> m_options;
|
||||||
QSharedPointer<Utils::SavedActionSet> m_group;
|
DebuggerSourcePathMappingWidget *m_sourceMappingWidget = nullptr;
|
||||||
QPointer<CommonOptionsPageWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -87,9 +83,9 @@ public:
|
|||||||
LocalsAndExpressionsOptionsPage();
|
LocalsAndExpressionsOptionsPage();
|
||||||
|
|
||||||
// IOptionsPage
|
// IOptionsPage
|
||||||
QWidget *widget();
|
QWidget *widget() final;
|
||||||
void apply();
|
void apply() final;
|
||||||
void finish();
|
void finish() final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<QWidget> m_widget;
|
QPointer<QWidget> m_widget;
|
||||||
|
|||||||
@@ -45,15 +45,6 @@ class GlobalDebuggerOptions
|
|||||||
public:
|
public:
|
||||||
void toSettings() const;
|
void toSettings() const;
|
||||||
void fromSettings();
|
void fromSettings();
|
||||||
bool operator==(const GlobalDebuggerOptions &rhs) const
|
|
||||||
{
|
|
||||||
return sourcePathMap == rhs.sourcePathMap
|
|
||||||
&& sourcePathRegExpMap == rhs.sourcePathRegExpMap;
|
|
||||||
}
|
|
||||||
bool operator!=(const GlobalDebuggerOptions &rhs) const
|
|
||||||
{
|
|
||||||
return !(*this == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
SourcePathMap sourcePathMap;
|
SourcePathMap sourcePathMap;
|
||||||
SourcePathRegExpMap sourcePathRegExpMap;
|
SourcePathRegExpMap sourcePathRegExpMap;
|
||||||
|
|||||||
Reference in New Issue
Block a user