diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/git/gitclient.cpp | 35 | ||||
-rw-r--r-- | src/plugins/texteditor/colorscheme.h | 2 | ||||
-rw-r--r-- | src/plugins/texteditor/texteditorconstants.cpp | 5 | ||||
-rw-r--r-- | src/plugins/texteditor/texteditorconstants.h | 5 | ||||
-rw-r--r-- | src/plugins/texteditor/texteditorsettings.cpp | 16 |
5 files changed, 48 insertions, 15 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 16337bf5b6..253b9d7473 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -570,6 +570,17 @@ static bool gitHasRgbColors() return gitVersion >= 0x020300U; } +static QString logColorName(TextEditor::TextStyle style) +{ + using namespace TextEditor; + + const ColorScheme &scheme = TextEditorSettings::fontSettings().colorScheme(); + QColor color = scheme.formatFor(style).foreground(); + if (!color.isValid()) + color = scheme.formatFor(C_TEXT).foreground(); + return color.name(); +}; + class GitLogArgumentsWidget : public BaseGitLogArgumentsWidget { Q_OBJECT @@ -603,12 +614,11 @@ public: QStringList graphArguments() const { - auto colorName = [](Theme::Color color) { return creatorTheme()->color(color).name(); }; - const QString authorName = colorName(Theme::Git_AuthorName_TextColor); - const QString commitDate = colorName(Theme::Git_CommitDate_TextColor); - const QString commitHash = colorName(Theme::Git_CommitHash_TextColor); - const QString commitSubject = colorName(Theme::Git_CommitSubject_TextColor); - const QString decoration = colorName(Theme::Git_Decoration_TextColor); + const QString authorName = logColorName(TextEditor::C_LOG_AUTHOR_NAME); + const QString commitDate = logColorName(TextEditor::C_LOG_COMMIT_DATE); + const QString commitHash = logColorName(TextEditor::C_LOG_COMMIT_HASH); + const QString commitSubject = logColorName(TextEditor::C_LOG_COMMIT_SUBJECT); + const QString decoration = logColorName(TextEditor::C_LOG_DECORATION); const QString formatArg = QStringLiteral( "--pretty=format:" @@ -1051,19 +1061,18 @@ static QStringList normalLogArguments() if (!gitHasRgbColors()) return {}; - auto colorName = [](Theme::Color color) { return creatorTheme()->color(color).name(); }; - const QString authorName = colorName(Theme::Git_AuthorName_TextColor); - const QString commitDate = colorName(Theme::Git_CommitDate_TextColor); - const QString commitHash = colorName(Theme::Git_CommitHash_TextColor); - const QString commitSubject = colorName(Theme::Git_CommitSubject_TextColor); - const QString decoration = colorName(Theme::Git_Decoration_TextColor); + const QString authorName = logColorName(TextEditor::C_LOG_AUTHOR_NAME); + const QString commitDate = logColorName(TextEditor::C_LOG_COMMIT_DATE); + const QString commitHash = logColorName(TextEditor::C_LOG_COMMIT_HASH); + const QString commitSubject = logColorName(TextEditor::C_LOG_COMMIT_SUBJECT); + const QString decoration = logColorName(TextEditor::C_LOG_DECORATION); const QString logArgs = QStringLiteral( "--pretty=format:" "commit %C(%1)%H%Creset %C(%2)%d%Creset%n" "Author: %C(%3)%an <%ae>%Creset%n" "Date: %C(%4)%cD%Creset%n%n" - "%C(%5)%s%Creset%n%n%b%n" + "%C(%5)%w(0,4,4)%s%Creset%n%n%b" ).arg(commitHash, decoration, authorName, commitDate, commitSubject); return {logArgs}; diff --git a/src/plugins/texteditor/colorscheme.h b/src/plugins/texteditor/colorscheme.h index ef7e59e87f..22b625ec24 100644 --- a/src/plugins/texteditor/colorscheme.h +++ b/src/plugins/texteditor/colorscheme.h @@ -101,7 +101,7 @@ inline bool operator!=(const Format &f1, const Format &f2) { return !f1.equals(f /*! A color scheme combines a set of formats for different highlighting categories. It also provides saving and loading of the scheme to a file. */ -class ColorScheme +class TEXTEDITOR_EXPORT ColorScheme { public: void setDisplayName(const QString &name) diff --git a/src/plugins/texteditor/texteditorconstants.cpp b/src/plugins/texteditor/texteditorconstants.cpp index 6c3c95c878..70ad3e6c04 100644 --- a/src/plugins/texteditor/texteditorconstants.cpp +++ b/src/plugins/texteditor/texteditorconstants.cpp @@ -97,6 +97,11 @@ const char *nameForStyle(TextStyle style) case C_DIFF_DEST_CHAR: return "DiffDestChar"; case C_LOG_CHANGE_LINE: return "LogChangeLine"; + case C_LOG_AUTHOR_NAME: return "LogAuthorName"; + case C_LOG_COMMIT_DATE: return "LogCommitDate"; + case C_LOG_COMMIT_HASH: return "LogCommitHash"; + case C_LOG_COMMIT_SUBJECT: return "LogCommitSubject"; + case C_LOG_DECORATION: return "LogDecoration"; case C_ERROR: return "Error"; case C_ERROR_CONTEXT: return "ErrorContext"; diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index c74bbfcde8..038c0913a5 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -97,6 +97,11 @@ enum TextStyle : quint8 { C_DIFF_DEST_CHAR, C_LOG_CHANGE_LINE, + C_LOG_AUTHOR_NAME, + C_LOG_COMMIT_DATE, + C_LOG_COMMIT_HASH, + C_LOG_COMMIT_SUBJECT, + C_LOG_DECORATION, C_WARNING, C_WARNING_CONTEXT, diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index eb75f8aeb9..92b722bf3e 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -303,7 +303,21 @@ FormatDescriptions TextEditorSettingsPrivate::initialFormats() formatDescr.emplace_back(C_LOG_CHANGE_LINE, tr("Log Change Line"), tr("Applied to lines describing changes in VCS log."), Format(QColor(192, 0, 0), QColor())); - + formatDescr.emplace_back(C_LOG_AUTHOR_NAME, tr("Log Author Name"), + tr("Applied to author names in VCS log."), + Format(QColor("#007af4"), QColor())); + formatDescr.emplace_back(C_LOG_COMMIT_DATE, tr("Log Commit Date"), + tr("Applied to commit dates in VCS log."), + Format(QColor("#006600"), QColor())); + formatDescr.emplace_back(C_LOG_COMMIT_HASH, tr("Log Commit Hash"), + tr("Applied to commit hashes in VCS log."), + Format(QColor("#ff0000"), QColor())); + formatDescr.emplace_back(C_LOG_DECORATION, tr("Log Decoration"), + tr("Applied to commit decorations in VCS log."), + Format(QColor("#ff00ff"), QColor())); + formatDescr.emplace_back(C_LOG_COMMIT_SUBJECT, tr("Log Commit Subject"), + tr("Applied to commit subjects in VCS log."), + Format{QColor{}, QColor{}}); // Mixin categories formatDescr.emplace_back(C_ERROR, |