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 <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2024-08-23 11:36:46 +02:00
committed by André Hartmann
parent cf71314c34
commit 772aa9062f

View File

@@ -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);