Git: InstantBlame: Add commit subject to annotation

Change-Id: I6bcb8d74ae5d380506f0a98d845b002c76bb9ecb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2024-08-04 17:23:39 +02:00
committed by André Hartmann
parent a3177a4583
commit a76e23434b
3 changed files with 19 additions and 2 deletions

View File

@@ -102,6 +102,11 @@ GitSettings::GitSettings()
instantBlameIgnoreLineMoves.setLabelText(trIgnoreLineMoves());
instantBlameIgnoreLineMoves.setToolTip(
Tr::tr("Finds the commit that introduced the line before it was moved."));
instantBlameShowSubject.setSettingsKey("GitInstantShowSubject");
instantBlameShowSubject.setDefaultValue(false);
instantBlameShowSubject.setLabelText(Tr::tr("Show commit subject"));
instantBlameShowSubject.setToolTip(
Tr::tr("Adds the commit subject directly to the annotation."));
graphLog.setSettingsKey("GraphLog");
@@ -152,7 +157,12 @@ GitSettings::GitSettings()
Group {
title(Tr::tr("Instant Blame")),
groupChecker(instantBlame.groupChecker()),
Row { instantBlameIgnoreSpaceChanges, instantBlameIgnoreLineMoves, st },
Row {
instantBlameIgnoreSpaceChanges,
instantBlameIgnoreLineMoves,
instantBlameShowSubject,
st
},
},
st

View File

@@ -40,6 +40,7 @@ public:
Utils::BoolAspect instantBlame{this};
Utils::BoolAspect instantBlameIgnoreSpaceChanges{this};
Utils::BoolAspect instantBlameIgnoreLineMoves{this};
Utils::BoolAspect instantBlameShowSubject{this};
mutable Utils::FilePath resolvedBinPath;
mutable bool tryResolve = true;

View File

@@ -45,7 +45,9 @@ BlameMark::BlameMark(const FilePath &fileName, int lineNumber, const CommitInfo
{Tr::tr("Git Blame"), Constants::TEXT_MARK_CATEGORY_BLAME})
, m_info(info)
{
const QString text = info.shortAuthor + " " + info.authorTime.toString("yyyy-MM-dd");
QString text = info.shortAuthor + " " + info.authorTime.toString("yyyy-MM-dd");
if (settings().instantBlameShowSubject())
text += "" + info.summary;
setPriority(TextEditor::TextMark::LowPriority);
setToolTip(toolTipText(info));
@@ -198,6 +200,10 @@ void InstantBlame::setup()
setupBlameForEditor(EditorManager::currentEditor());
});
connect(&settings().instantBlameShowSubject, &BaseAspect::changed, this, [setupBlameForEditor] {
setupBlameForEditor(EditorManager::currentEditor());
});
connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
this, setupBlameForEditor);
connect(EditorManager::instance(), &EditorManager::documentClosed,