From 772aa9062ff8ae527455386c139dd812b14c2384 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Fri, 23 Aug 2024 11:36:46 +0200 Subject: [PATCH] Git: InstantBlame: Simplify slot for editor setup The slot parameter `editor` can either be an active editor or nullptr. nullptr could either mean no parameter was supplied or we have no current editor. Therefore, we would have to query the current editor again anyway, and so its easier to remove the parameter right away and always query the current editor. Change-Id: Ib0495ca37863017719734bcea9bb6f61835bde95 Reviewed-by: Orgad Shaneh --- src/plugins/git/instantblame.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/plugins/git/instantblame.cpp b/src/plugins/git/instantblame.cpp index c76f0802c0c..d2366c73048 100644 --- a/src/plugins/git/instantblame.cpp +++ b/src/plugins/git/instantblame.cpp @@ -144,7 +144,8 @@ void InstantBlame::setup() { qCDebug(log) << "Setup"; - auto setupBlameForEditor = [this](Core::IEditor *editor) { + auto setupBlameForEditor = [this] { + Core::IEditor *editor = EditorManager::currentEditor(); if (!editor) { stop(); return; @@ -188,21 +189,10 @@ void InstantBlame::setup() force(); }; - connect(&settings().instantBlame, &BaseAspect::changed, this, [setupBlameForEditor] { - setupBlameForEditor(EditorManager::currentEditor()); - }); - - connect(&settings().instantBlameIgnoreSpaceChanges, &BaseAspect::changed, this, [setupBlameForEditor] { - setupBlameForEditor(EditorManager::currentEditor()); - }); - - connect(&settings().instantBlameIgnoreLineMoves, &BaseAspect::changed, this, [setupBlameForEditor] { - setupBlameForEditor(EditorManager::currentEditor()); - }); - - connect(&settings().instantBlameShowSubject, &BaseAspect::changed, this, [setupBlameForEditor] { - setupBlameForEditor(EditorManager::currentEditor()); - }); + connect(&settings().instantBlame, &BaseAspect::changed, this, setupBlameForEditor); + connect(&settings().instantBlameIgnoreSpaceChanges, &BaseAspect::changed, this, setupBlameForEditor); + connect(&settings().instantBlameIgnoreLineMoves, &BaseAspect::changed, this, setupBlameForEditor); + connect(&settings().instantBlameShowSubject, &BaseAspect::changed, this, setupBlameForEditor); connect(EditorManager::instance(), &EditorManager::currentEditorChanged, this, setupBlameForEditor);