Debugger: Adapt to latest settings access style

Change-Id: I14f737612b4fe6a37e650190b587ef0b04e559ea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-07-13 15:23:29 +02:00
parent 9b2075e7ea
commit a5e773aeee
25 changed files with 202 additions and 214 deletions

View File

@@ -265,7 +265,7 @@ public:
m_logWindow = new LogWindow(m_engine); // Needed before start()
m_logWindow->setObjectName("Debugger.Dock.Output");
connect(&debuggerSettings()->enableReverseDebugging, &BaseAspect::changed, this, [this] {
connect(&settings().enableReverseDebugging, &BaseAspect::changed, this, [this] {
updateState();
if (m_companionEngine)
m_companionEngine->d->updateState();
@@ -406,7 +406,7 @@ public:
m_watchHandler.cleanup();
m_engine->showMessage(Tr::tr("Debugger finished."), StatusBar);
m_engine->setState(DebuggerFinished); // Also destroys views.
if (debuggerSettings()->switchModeOnExit.value())
if (settings().switchModeOnExit())
EngineManager::deactivateDebugMode();
}
@@ -805,10 +805,10 @@ void DebuggerEnginePrivate::setupViews()
m_perspective->addToolBarWidget(m_threadsHandler.threadSwitcher());
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
this, [this](const FontSettings &settings) {
if (!debuggerSettings()->fontSizeFollowsEditor.value())
this, [this](const FontSettings &fs) {
if (!Internal::settings().fontSizeFollowsEditor())
return;
const qreal size = settings.fontZoom() * settings.fontSize() / 100.;
const qreal size = fs.fontZoom() * fs.fontSize() / 100.;
QFont font = m_breakWindow->font();
font.setPointSizeF(size);
m_breakWindow->setFont(font);
@@ -1085,7 +1085,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
&newEditor);
QTC_ASSERT(editor, return); // Unreadable file?
editor->gotoLine(line, 0, !debuggerSettings()->stationaryEditorWhileStepping.value());
editor->gotoLine(line, 0, !settings().stationaryEditorWhileStepping());
if (newEditor)
editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true);
@@ -1348,7 +1348,7 @@ void DebuggerEngine::notifyInferiorSpontaneousStop()
d->m_perspective->select();
showMessage(Tr::tr("Stopped."), StatusBar);
setState(InferiorStopOk);
if (debuggerSettings()->raiseOnInterrupt.value())
if (settings().raiseOnInterrupt())
ICore::raiseWindow(DebuggerMainWindow::instance());
}
@@ -1408,8 +1408,8 @@ void DebuggerEnginePrivate::setInitialActionStates()
m_jumpToLineAction.setVisible(false);
m_stepOverAction.setEnabled(true);
debuggerSettings()->autoDerefPointers.setEnabled(true);
debuggerSettings()->expandStack.setEnabled(false);
settings().autoDerefPointers.setEnabled(true);
settings().expandStack.setEnabled(false);
if (m_threadLabel)
m_threadLabel->setEnabled(false);
@@ -1549,9 +1549,9 @@ void DebuggerEnginePrivate::updateState()
const bool actionsEnabled = m_engine->debuggerActionsEnabled();
const bool canDeref = actionsEnabled && m_engine->hasCapability(AutoDerefPointersCapability);
debuggerSettings()->autoDerefPointers.setEnabled(canDeref);
debuggerSettings()->autoDerefPointers.setEnabled(true);
debuggerSettings()->expandStack.setEnabled(actionsEnabled);
settings().autoDerefPointers.setEnabled(canDeref);
settings().autoDerefPointers.setEnabled(true);
settings().expandStack.setEnabled(actionsEnabled);
const bool notbusy = state == InferiorStopOk
|| state == DebuggerNotReady
@@ -1563,7 +1563,7 @@ void DebuggerEnginePrivate::updateState()
void DebuggerEnginePrivate::updateReverseActions()
{
const bool stopped = m_state == InferiorStopOk;
const bool reverseEnabled = debuggerSettings()->enableReverseDebugging.value();
const bool reverseEnabled = settings().enableReverseDebugging();
const bool canReverse = reverseEnabled && m_engine->hasCapability(ReverseSteppingCapability);
const bool doesRecord = m_recordForReverseOperationAction.isChecked();
@@ -1581,8 +1581,8 @@ void DebuggerEnginePrivate::updateReverseActions()
void DebuggerEnginePrivate::cleanupViews()
{
const bool closeSource = debuggerSettings()->closeSourceBuffersOnExit.value();
const bool closeMemory = debuggerSettings()->closeMemoryBuffersOnExit.value();
const bool closeSource = settings().closeSourceBuffersOnExit();
const bool closeMemory = settings().closeMemoryBuffersOnExit();
QList<IDocument *> toClose;
const QList<IDocument *> documents = DocumentModel::openedDocuments();
@@ -1869,7 +1869,7 @@ QString DebuggerEngine::expand(const QString &string) const
QString DebuggerEngine::nativeStartupCommands() const
{
QStringList lines = debuggerSettings()->gdbStartupCommands.value().split('\n');
QStringList lines = settings().gdbStartupCommands().split('\n');
lines += runParameters().additionalStartupCommands.split('\n');
lines = Utils::filtered(lines, [](const QString line) {
@@ -2717,7 +2717,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
{
static const QString warnOnInappropriateDebuggerKey = "DebuggerWarnOnInappropriateDebugger";
const bool warnOnRelease = debuggerSettings()->warnOnReleaseBuilds.value()
const bool warnOnRelease = settings().warnOnReleaseBuilds()
&& rp.toolChainAbi.osFlavor() != Abi::AndroidLinuxFlavor;
bool warnOnInappropriateDebugger = false;
QString detailedWarning;
@@ -2818,7 +2818,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
bool hasEmbeddedInfo = elfData.indexOf(".debug_info") >= 0;
bool hasLink = elfData.indexOf(".gnu_debuglink") >= 0;
if (hasEmbeddedInfo) {
const SourcePathMap sourcePathMap = debuggerSettings()->sourcePathMap.value();
const SourcePathMap sourcePathMap = settings().sourcePathMap();
QList<QPair<QRegularExpression, QString>> globalRegExpSourceMap;
globalRegExpSourceMap.reserve(sourcePathMap.size());
for (auto it = sourcePathMap.begin(), end = sourcePathMap.end(); it != end; ++it) {