diff --git a/src/Converters/DoubleConverters.cs b/src/Converters/DoubleConverters.cs index 871a80b3e..11ac99e11 100644 --- a/src/Converters/DoubleConverters.cs +++ b/src/Converters/DoubleConverters.cs @@ -19,5 +19,8 @@ public static class DoubleConverters public static readonly FuncValueConverter ToLeftMargin = new FuncValueConverter(v => new Thickness(v, 0, 0, 0)); + + public static readonly FuncValueConverter ToContainingRefsMaxHeight = + new FuncValueConverter(v => v ? double.PositiveInfinity : 24.0); } } diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs index 17beedb82..b581f82b3 100644 --- a/src/Models/RepositorySettings.cs +++ b/src/Models/RepositorySettings.cs @@ -36,6 +36,18 @@ public bool AskBeforeAutoUpdatingSubmodules set; } = false; + public int ShowContainingRefsInCommitDetail + { + get; + set; + } = 0; + + public int ContainingRefsDefaultExpansion + { + get; + set; + } = 0; + public string PreferredOpenAIService { get; diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 049895775..a7e9e8cbc 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -173,6 +173,7 @@ COMMITTER Prüfe Refs, die diesen Commit enthalten COMMIT ENTHALTEN IN + ENTHALTEN IN E-Mail-Adresse kopieren Namen kopieren Namen & E-Mail-Adresse kopieren @@ -225,6 +226,14 @@ $1, $2, … Werte der Eingabe-Steuerelemente Auf Beenden der Aktion warten E-Mail-Adresse E-Mail-Adresse + ALLGEMEIN + Eingeklappt + Deaktiviert + Aktiviert + Ausgeklappt + Globale Einstellung übernehmen + Standardzustand der enthaltenen Referenzen + Referenzen anzeigen, die den ausgewählten Commit enthalten GIT Vor dem Auto-Aktualisieren von Submodulen fragen Remotes automatisch fetchen @@ -620,6 +629,8 @@ $1, $2, … Werte der Eingabe-Steuerelemente Standardmäßig ‚ÄNDERUNGEN‘-Ansicht anzeigen Standardmäßig Registerkarte ‚ÄNDERUNGEN‘ in Commit-Details anzeigen Zeige Nachfolger in den Commit-Details + Referenzen mit ausgewähltem Commit standardmäßig ausklappen + Referenzen mit ausgewähltem Commit in den Commit-Details anzeigen Zeige Tags im Commit-Verlauf Längenvorgabe für Commit-Nachrichten Standard-Avatar im GitHub-Stil generieren diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index a80b66c59..ebac2c580 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -184,6 +184,7 @@ COMMITTER Check refs that contains this commit COMMIT IS CONTAINED BY + CONTAINED BY Copy Email Copy Name Copy Name & Email @@ -242,6 +243,14 @@ Wait for action exit Email Address Email address + GENERAL + Collapsed + Disabled + Enabled + Expanded + Inherit global preference + Contained-by refs default state + Show refs containing selected commit GIT Ask before auto-updating submodules Fetch remotes automatically @@ -666,6 +675,8 @@ Show `LOCAL CHANGES` page by default Show `CHANGES` tab in commit detail by default Show children in the commit details + Expand refs containing selected commit by default + Show refs containing selected commit in commit detail Show relative time in commit graph Show tags in commit graph Subject Guide Length diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index fd31af8d6..cc8a079ed 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -187,6 +187,7 @@ COMMITTER Ver refs que contienen este commit COMMIT ESTÁ CONTENIDO EN + CONTENIDO EN Copiar Email Copiar Nombre Copiar Nombre y Email @@ -240,6 +241,14 @@ Esperar la acción de salida Dirección de Email Dirección de email + GENERAL + Contraído + Deshabilitado + Habilitado + Expandido + Heredar preferencia global + Estado predeterminado de refs contenedoras + Mostrar refs que contienen el commit seleccionado GIT Preguntar antes de actualizar automáticamente los submódulos Fetch remotos automáticamente @@ -652,6 +661,8 @@ Mostrar la página `CAMBIOS LOCALES` por defecto Mostrar pestaña de `CAMBIOS` en los detalles del commit por defecto Mostrar hijos en los detalles de commit + Expandir refs que contienen el commit seleccionado por defecto + Mostrar refs que contienen el commit seleccionado en los detalles del commit Mostrar etiquetas en el gráfico de commit Longitud de la guía del asunto 24-Horas diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index c59eefacc..0c71d44ca 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -163,6 +163,7 @@ COMMITTER Vérifier les références contenant ce commit LE COMMIT EST CONTENU PAR + CONTENU PAR Copier l'E-mail Copier le Nom Copier le Nom & l'E-mail @@ -214,6 +215,14 @@ Attendre la fin de l'action Adresse e-mail Adresse e-mail + GÉNÉRAL + Réduit + Désactivé + Activé + Développé + Hériter de la préférence globale + État par défaut des références contenant le commit + Afficher les références contenant le commit sélectionné GIT Fetch les dépôts distants automatiquement minute(s) @@ -576,6 +585,8 @@ Afficher la page 'CHANGEMENTS LOCAUX' par défaut Afficher l'onglet 'CHANGEMENTS' dans les détails du commit par défaut Afficher les enfants dans les détails du commit + Développer par défaut les références contenant le commit sélectionné + Afficher les références contenant le commit sélectionné dans les détails du commit Afficher les tags dans le graphique des commits Guide de longueur du sujet Générer un avatar par défaut de style GitHub diff --git a/src/Resources/Locales/id_ID.axaml b/src/Resources/Locales/id_ID.axaml index b3552b1f2..6567099e2 100644 --- a/src/Resources/Locales/id_ID.axaml +++ b/src/Resources/Locales/id_ID.axaml @@ -159,6 +159,7 @@ COMMITTER Periksa ref yang mengandung commit ini COMMIT TERKANDUNG DALAM + TERKANDUNG DALAM Salin Email Salin Nama Salin Nama & Email @@ -202,6 +203,14 @@ Tunggu aksi selesai Alamat Email Alamat email + UMUM + Diciutkan + Dinonaktifkan + Diaktifkan + Diperluas + Ikuti preferensi global + Status default ref yang memuat commit + Tampilkan ref yang memuat commit terpilih GIT Fetch remote secara otomatis Menit @@ -554,6 +563,8 @@ Tampilkan halaman `LOCAL CHANGES` secara default Tampilkan tab `CHANGES` di detail commit secara default Tampilkan children di detail commit + Perluas ref yang memuat commit terpilih secara default + Tampilkan ref yang memuat commit terpilih di detail commit Tampilkan tag di grafik commit Panjang Panduan Subjek Generate avatar default bergaya GitHub diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index 12102bebc..f9bcb3dcc 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -172,6 +172,7 @@ CHI HA COMMITTATO Controlla i riferimenti che contengono questo commit IL COMMIT È CONTENUTO DA + CONTENUTO IN Copia Email Copia Nome Copia Nome ed Email @@ -224,6 +225,14 @@ ${pure_files:N} Come ${files:N}, ma senza cartelle Attendi la fine dell'azione Indirizzo Email Indirizzo email + GENERALE + Compresso + Disabilitato + Abilitato + Espanso + Eredita preferenza globale + Stato predefinito dei ref contenenti il commit + Mostra i ref che contengono il commit selezionato GIT Chiedi prima di aggiornare automaticamente i sottomoduli Recupera automaticamente i remoti @@ -616,6 +625,8 @@ ${pure_files:N} Come ${files:N}, ma senza cartelle Mostra pagina `MODIFICHE LOCALI` per impostazione predefinita Mostra scheda `MODIFICHE` nei dettagli del commit per impostazione predefinita Mostra i figli nei dettagli del commit + Espandi di default i ref che contengono il commit selezionato + Mostra i ref che contengono il commit selezionato nei dettagli del commit Mostra i tag nel grafico dei commit Lunghezza Guida Oggetto Genera avatar predefinito stile GitHub diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml index c9eda571a..467a42a0a 100644 --- a/src/Resources/Locales/ja_JP.axaml +++ b/src/Resources/Locales/ja_JP.axaml @@ -173,6 +173,7 @@ コミッター このコミットが含まれる参照を確認 これらの参照にコミットが含まれています + 含まれる参照 メールアドレスをコピー 名前をコピー 名前 & メールアドレスをコピー @@ -226,6 +227,14 @@ アクションの終了を待機 メールアドレス E メールアドレス + 一般 + 折りたたみ + 無効 + 有効 + 展開 + グローバル設定を継承 + 含まれる参照の既定状態 + 選択したコミットを含む参照を表示 Git サブモジュールを自動更新する前に尋ねる リモートから @@ -622,6 +631,8 @@ 初めから `ローカルの変更` ページを表示 初めからコミットの詳細の `変更` タブを表示 コミットの詳細に子コミットを表示 + 選択したコミットを含む参照を既定で展開 + コミットの詳細に選択したコミットを含む参照を表示 コミットグラフにタグを表示 適切とするコミットタイトルの長さ GitHub のような既定のアバターを生成 diff --git a/src/Resources/Locales/ko_KR.axaml b/src/Resources/Locales/ko_KR.axaml index ce07c5975..53a63f39c 100644 --- a/src/Resources/Locales/ko_KR.axaml +++ b/src/Resources/Locales/ko_KR.axaml @@ -156,6 +156,7 @@ 커밋터 이 커밋을 포함하는 ref 확인 커밋 포함 REF + 포함된 REF 이메일 복사 이름 복사 이름 & 이메일 복사 @@ -200,6 +201,14 @@ 작업이 끝날 때까지 대기 이메일 주소 이메일 주소 + 일반 + 접힘 + 비활성화 + 활성화 + 펼침 + 전역 설정 상속 + 포함하는 ref의 기본 상태 + 선택한 커밋을 포함하는 ref 표시 GIT 원격 자동 Fetch @@ -551,6 +560,8 @@ 기본으로 `로컬 변경 사항` 페이지 표시 커밋 세부 정보에서 기본으로 `변경 사항` 탭 표시 커밋 세부 정보에 자식 커밋 표시 + 선택한 커밋을 포함하는 ref를 기본으로 펼침 + 커밋 세부 정보에 선택한 커밋을 포함하는 ref 표시 커밋 그래프에 태그 표시 제목 가이드 길이 GitHub 스타일 기본 아바타 생성 diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 0ed0cd47a..5deeb3f79 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -136,6 +136,7 @@ COMMITTER Verificar referências que contenham este commit COMMIT EXISTE EM + CONTIDO EM Mostra apenas as primeiras 100 alterações. Veja todas as alterações na aba ALTERAÇÕES. MENSAGEM PAIS @@ -156,6 +157,14 @@ Repositório Endereço de email Endereço de email + GERAL + Recolhido + Desativado + Ativado + Expandido + Herdar preferência global + Estado padrão das refs que contêm o commit + Mostrar refs que contêm o commit selecionado GIT Buscar remotos automaticamente Minuto(s) @@ -432,6 +441,8 @@ Idioma Commits do Histórico Exibir data do autor em vez da data do commit no gráfico + Expandir refs que contêm o commit selecionado por padrão + Mostrar refs que contêm o commit selecionado nos detalhes do commit Comprimento do Guia de Assunto GIT Habilitar Auto CRLF diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 5d3ed72ac..931b70ff7 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -188,6 +188,7 @@ РЕВИЗОР (ИСПОЛНИТЕЛЬ) Найти все ветки с этой ревизией ВЕТКИ С ЭТОЙ РЕВИЗИЕЙ + СОДЕРЖИТСЯ В Копировать адрес почты Копировать имя Копировать имя и адрес почты @@ -241,6 +242,14 @@ Ждать для выполения выхода Адрес электронной почты Адрес электронной почты + ОБЩИЕ + Свернуто + Отключено + Включено + Развернуто + Наследовать глобальную настройку + Состояние по умолчанию для содержащих ссылок + Показывать ссылки, содержащие выбранный коммит GIT Спрашивать перед автоматическим обновлением подмодулей. Автозагрузка изменений @@ -653,6 +662,8 @@ Показывать вкладку «ЛОКАЛЬНЫЕ ИЗМЕНЕНИЯ» по умолчанию Показывать вкладку «Изменения» в сведении ревизии по умолчанию Показать наследника в деталях комментария + Разворачивать ссылки, содержащие выбранный коммит, по умолчанию + Показывать ссылки, содержащие выбранный коммит, в деталях коммита Показывать метки на графике Длина темы ревизии 24-часовой diff --git a/src/Resources/Locales/ta_IN.axaml b/src/Resources/Locales/ta_IN.axaml index 53d92c3e1..cda7338f0 100644 --- a/src/Resources/Locales/ta_IN.axaml +++ b/src/Resources/Locales/ta_IN.axaml @@ -112,6 +112,7 @@ உறுதிமொழியாளர் இந்த உறுதிமொழிடைக் கொண்ட குறிப்புகளைச் சரிபார் உறுதிமொழி இதில் உள்ளது + இதில் உள்ளது முதல் 100 மாற்றங்களை மட்டும் காட்டுகிறது மாற்றங்கள் தாவலில் அனைத்து மாற்றங்களையும் காண்க. செய்தி பெற்றோர்கள் @@ -134,6 +135,14 @@ செயல்பாட்டிலிருந்து வெளியேற காத்திரு மின்னஞ்சல் முகவரி மின்னஞ்சல் முகவரி + பொது + சுருக்கப்பட்டது + முடக்கப்பட்டது + இயக்கப்பட்டது + விரிவாக்கப்பட்டது + உலகளாவிய விருப்பத்தைப் பெறு + உறுதிமொழியை கொண்டுள்ள refs-இன் இயல்புநிலை நிலை + தேர்ந்தெடுத்த உறுதிமொழியை கொண்டுள்ள refs-ஐ காட்டு அறிவிலி தொலைகளை தானாக எடு நிமையங்கள் @@ -432,6 +441,8 @@ வரலாற்று உறுதிமொழிகள் வரைபடத்தில் உறுதிமொழி நேரத்திற்குப் பதிலாக ஆசிரியர் நேரத்தைக் காட்டு உறுதிமொழி விவரங்களில் குழந்தைகளைக் காட்டு + தேர்ந்தெடுத்த உறுதிமொழியை கொண்டுள்ள refs-ஐ இயல்பாக விரிவாக்கு + உறுதிமொழி விவரங்களில் தேர்ந்தெடுத்த உறுதிமொழியை கொண்டுள்ள refs-ஐ காட்டு உறுதிமொழி வரைபடத்தில் குறிச்சொற்களைக் காட்டு பொருள் வழிகாட்டி நீளம் அறிவிலி diff --git a/src/Resources/Locales/uk_UA.axaml b/src/Resources/Locales/uk_UA.axaml index b80e6523d..2cf8a0e20 100644 --- a/src/Resources/Locales/uk_UA.axaml +++ b/src/Resources/Locales/uk_UA.axaml @@ -112,6 +112,7 @@ КОМІТЕР Перевірити посилання, що містять цей коміт КОМІТ МІСТИТЬСЯ В + МІСТИТЬСЯ В Показано лише перші 100 змін. Дивіться всі зміни на вкладці ЗМІНИ. ПОВІДОМЛЕННЯ БАТЬКІВСЬКІ @@ -134,6 +135,14 @@ Чекати завершення дії Адреса Email Адреса електронної пошти + ЗАГАЛЬНІ + Згорнуто + Вимкнено + Увімкнено + Розгорнуто + Успадкувати глобальне налаштування + Типовий стан посилань, що містять коміт + Показувати посилання, що містять вибраний коміт GIT Автоматично отримувати зміни з віддалених сховищ хвилин(и) @@ -436,6 +445,8 @@ Кількість комітів в історії Показувати час автора замість часу коміту в графі Показувати дочірні коміти в деталях + Типово розгортати посилання, що містять вибраний коміт + Показувати посилання, що містять вибраний коміт, у деталях коміту Показувати теги в графі комітів Довжина лінії-орієнтира для теми GIT diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 42fe27a76..05557674e 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -188,6 +188,7 @@ 提交者 查看包含此提交的分支/标签 本提交已被以下分支/标签包含 + 包含于 复制电子邮箱 复制用户名 复制用户名及邮箱 @@ -246,6 +247,14 @@ 等待操作执行完成 电子邮箱 邮箱地址 + 通用 + 折叠 + 禁用 + 启用 + 展开 + 继承全局偏好设置 + 包含引用的默认状态 + 显示包含选中提交的引用 GIT配置 在自动更新子模块前询问用户 启用定时自动拉取远程更新 @@ -670,6 +679,8 @@ 默认显示【本地更改】页 在提交详情页默认打开【变更对比】标签页 在提交详情页中显示子提交列表 + 默认展开包含选中提交的引用 + 在提交详情页中显示包含当前提交的分支/标签 在提交路线图中显示相对时间 在提交路线图中显示标签 SUBJECT字数检测 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 2002b40eb..23ae8920f 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -188,6 +188,7 @@ 提交者 檢視包含此提交的分支或標籤 本提交包含於以下分支或標籤 + 包含於 複製電子郵件 複製名稱 複製名稱及電子郵件 @@ -246,6 +247,14 @@ 等待自訂動作執行結束 電子郵件 電子郵件地址 + 一般 + 摺疊 + 停用 + 啟用 + 展開 + 繼承全域偏好設定 + 包含參照的預設狀態 + 顯示包含所選提交的參照 Git 設定 在自動更新子模組之前先詢問 啟用定時自動提取 (fetch) 遠端更新 @@ -670,6 +679,8 @@ 預設顯示 [本機變更] 頁面 在提交詳細資訊頁面預設顯示 [變更對比] 在提交詳細資訊中顯示後續提交 + 預設展開包含所選提交的參照 + 在提交詳細資訊中顯示包含所選提交的參照 在提交路線圖中顯示相對時間 在路線圖中顯示標籤 提交標題字數偵測 diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 5d543b65c..869b2b6bd 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -84,6 +84,44 @@ public List Children private set => SetProperty(ref _children, value); } + public List ContainingRefs + { + get => _containingRefs; + private set => SetProperty(ref _containingRefs, value); + } + + public bool IsContainingRefsLoading + { + get => _isContainingRefsLoading; + private set => SetProperty(ref _isContainingRefsLoading, value); + } + + public bool ShowContainingRefsInCommitDetail + { + get + { + return _repo.Settings.ShowContainingRefsInCommitDetail switch + { + 1 => false, + 2 => true, + _ => Preferences.Instance.ShowContainingRefsInCommitDetail, + }; + } + } + + public bool ContainingRefsExpandedByDefault + { + get + { + return _repo.Settings.ContainingRefsDefaultExpansion switch + { + 1 => false, + 2 => true, + _ => Preferences.Instance.ShowContainingRefsExpandedByDefault, + }; + } + } + public List Changes { get => _changes; @@ -172,6 +210,27 @@ public CommitDetail(Repository repo, CommitDetailSharedData sharedData) _repo = repo; _sharedData = sharedData ?? new CommitDetailSharedData(); WebLinks = Models.CommitLink.Get(repo.Remotes); + Preferences.Instance.PropertyChanged += (_, e) => + { + if (e.PropertyName == nameof(Preferences.ShowContainingRefsInCommitDetail)) + { + OnPropertyChanged(nameof(ShowContainingRefsInCommitDetail)); + Refresh(); + } + else if (e.PropertyName == nameof(Preferences.ShowContainingRefsExpandedByDefault)) + { + OnPropertyChanged(nameof(ContainingRefsExpandedByDefault)); + } + }; + + _repo.ContainingRefsSettingsChanged += OnContainingRefsSettingsChanged; + } + + private void OnContainingRefsSettingsChanged() + { + OnPropertyChanged(nameof(ShowContainingRefsInCommitDetail)); + OnPropertyChanged(nameof(ContainingRefsExpandedByDefault)); + Refresh(); } public CommitDetail Clone() @@ -471,6 +530,8 @@ private void Refresh() ViewRevisionFilePath = string.Empty; CanOpenRevisionFileWithDefaultEditor = false; Children = null; + ContainingRefs = null; + IsContainingRefsLoading = false; RevisionFileSearchFilter = string.Empty; RevisionFileSearchSuggestion = null; ScrollOffset = Vector.Zero; @@ -529,6 +590,25 @@ private void Refresh() }, token); } + if (ShowContainingRefsInCommitDetail) + { + IsContainingRefsLoading = true; + + Task.Run(async () => + { + var refs = await new Commands.QueryRefsContainsCommit(_repo.FullPath, _commit.SHA) + .GetResultAsync() + .ConfigureAwait(false); + + if (!token.IsCancellationRequested) + Dispatcher.UIThread.Post(() => + { + ContainingRefs = refs; + IsContainingRefsLoading = false; + }); + }, token); + } + Task.Run(async () => { var cmd = new Commands.CompareRevisions(_repo.FullPath, _commit.FirstParentToCompare, _commit.SHA) { CancellationToken = token }; @@ -764,6 +844,8 @@ private async Task SetViewingCommitAsync(Models.Object file) private Models.CommitFullMessage _fullMessage = null; private Models.CommitSignInfo _signInfo = null; private List _children = null; + private List _containingRefs = null; + private bool _isContainingRefsLoading = false; private List _changes = []; private List _visibleChanges = []; private List _selectedChanges = null; diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index da7fe3e5d..51fbc7970 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -205,6 +205,18 @@ public bool ShowChildren set => SetProperty(ref _showChildren, value); } + public bool ShowContainingRefsInCommitDetail + { + get => _showContainingRefsInCommitDetail; + set => SetProperty(ref _showContainingRefsInCommitDetail, value); + } + + public bool ShowContainingRefsExpandedByDefault + { + get => _showContainingRefsExpandedByDefault; + set => SetProperty(ref _showContainingRefsExpandedByDefault, value); + } + public string IgnoreUpdateTag { get => _ignoreUpdateTag; @@ -827,6 +839,8 @@ private bool RemoveInvalidRepositoriesRecursive(List collection) private bool _useGitHubStyleAvatar = true; private bool _showAuthorTimeInGraph = false; private bool _showChildren = false; + private bool _showContainingRefsInCommitDetail = false; + private bool _showContainingRefsExpandedByDefault = false; private bool _check4UpdatesOnStartup = true; private double _lastCheckUpdateTime = 0; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 289c0e12a..2905c9db7 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -34,6 +34,8 @@ public Models.RepositorySettings Settings get => _settings; } + public event Action ContainingRefsSettingsChanged; + public Models.RepositoryUIStates UIStates { get => _uiStates; @@ -457,6 +459,11 @@ public Repository(bool isBare, string path, string gitDir) _uiStates = Models.RepositoryUIStates.Load(GitDir); } + public void NotifyContainingRefsSettingsChanged() + { + ContainingRefsSettingsChanged?.Invoke(); + } + public void Open() { try diff --git a/src/ViewModels/RepositoryConfigure.cs b/src/ViewModels/RepositoryConfigure.cs index 06176f437..00bddfb10 100644 --- a/src/ViewModels/RepositoryConfigure.cs +++ b/src/ViewModels/RepositoryConfigure.cs @@ -101,6 +101,34 @@ public bool AskBeforeAutoUpdatingSubmodules set => _repo.Settings.AskBeforeAutoUpdatingSubmodules = value; } + public int ShowContainingRefsInCommitDetail + { + get => _repo.Settings.ShowContainingRefsInCommitDetail; + set + { + if (_repo.Settings.ShowContainingRefsInCommitDetail != value) + { + _repo.Settings.ShowContainingRefsInCommitDetail = value; + OnPropertyChanged(); + _repo.NotifyContainingRefsSettingsChanged(); + } + } + } + + public int ContainingRefsDefaultExpansion + { + get => _repo.Settings.ContainingRefsDefaultExpansion; + set + { + if (_repo.Settings.ContainingRefsDefaultExpansion != value) + { + _repo.Settings.ContainingRefsDefaultExpansion = value; + OnPropertyChanged(); + _repo.NotifyContainingRefsSettingsChanged(); + } + } + } + public AvaloniaList CommitTemplates { get => _repo.Settings.CommitTemplates; diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 6b059c5b9..b92679941 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -55,7 +55,7 @@ - + @@ -68,7 +68,13 @@ - @@ -203,9 +209,42 @@ PointerReleased="OnCommitRefsPresenterPointerReleased"/> + + + + + + + + + + + + + - - + WebLinks public static readonly StyledProperty> ChildrenProperty = AvaloniaProperty.Register>(nameof(Children)); + public static readonly StyledProperty> ContainingRefsProperty = + AvaloniaProperty.Register>(nameof(ContainingRefs)); + public static readonly StyledProperty ShowContainingRefsInCommitDetailProperty = + AvaloniaProperty.Register(nameof(ShowContainingRefsInCommitDetail)); + public static readonly StyledProperty IsContainingRefsLoadingProperty = + AvaloniaProperty.Register(nameof(IsContainingRefsLoading)); + public List Children { get => GetValue(ChildrenProperty); set => SetValue(ChildrenProperty, value); } + public List ContainingRefs + { + get => GetValue(ContainingRefsProperty); + set => SetValue(ContainingRefsProperty, value); + } + + public bool ShowContainingRefsInCommitDetail + { + get => GetValue(ShowContainingRefsInCommitDetailProperty); + set => SetValue(ShowContainingRefsInCommitDetailProperty, value); + } + + public bool IsContainingRefsLoading + { + get => GetValue(IsContainingRefsLoadingProperty); + set => SetValue(IsContainingRefsLoadingProperty, value); + } + + public static readonly StyledProperty IsContainingRefsExpandedProperty = + AvaloniaProperty.Register(nameof(IsContainingRefsExpanded)); + + public bool IsContainingRefsExpanded + { + get => GetValue(IsContainingRefsExpandedProperty); + set => SetValue(IsContainingRefsExpandedProperty, value); + } + + public static readonly StyledProperty ContainingRefsExpandedByDefaultProperty = + AvaloniaProperty.Register(nameof(ContainingRefsExpandedByDefault)); + + public bool ContainingRefsExpandedByDefault + { + get => GetValue(ContainingRefsExpandedByDefaultProperty); + set => SetValue(ContainingRefsExpandedByDefaultProperty, value); + } + public static readonly StyledProperty IsSHACopiedProperty = AvaloniaProperty.Register(nameof(IsSHACopied)); @@ -78,6 +121,15 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang { _iconResetTimer?.Dispose(); SetCurrentValue(IsSHACopiedProperty, false); + SetCurrentValue(IsContainingRefsExpandedProperty, ContainingRefsExpandedByDefault); + } + else if (change.Property == ContainingRefsProperty) + { + SetCurrentValue(IsContainingRefsExpandedProperty, ContainingRefsExpandedByDefault); + } + else if (change.Property == ContainingRefsExpandedByDefaultProperty) + { + SetCurrentValue(IsContainingRefsExpandedProperty, ContainingRefsExpandedByDefault); } } @@ -153,6 +205,12 @@ private async void OnOpenContainsIn(object sender, RoutedEventArgs e) e.Handled = true; } + private void OnToggleContainingRefsExpanded(object sender, RoutedEventArgs e) + { + IsContainingRefsExpanded = !IsContainingRefsExpanded; + e.Handled = true; + } + private async void OnSHAPointerEntered(object sender, PointerEventArgs e) { if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha } ctl) diff --git a/src/Views/CommitDetail.axaml b/src/Views/CommitDetail.axaml index e5bab30b8..54eaf8b68 100644 --- a/src/Views/CommitDetail.axaml +++ b/src/Views/CommitDetail.axaml @@ -31,6 +31,10 @@ SupportsContainsIn="True" WebLinks="{Binding WebLinks}" Children="{Binding Children}" + ContainingRefs="{Binding ContainingRefs}" + ShowContainingRefsInCommitDetail="{Binding ShowContainingRefsInCommitDetail}" + ContainingRefsExpandedByDefault="{Binding ContainingRefsExpandedByDefault}" + IsContainingRefsLoading="{Binding IsContainingRefsLoading}" Margin="0,0,12,0"/> diff --git a/src/Views/CommitRefsPresenter.cs b/src/Views/CommitRefsPresenter.cs index bf5c863f5..763d5c84f 100644 --- a/src/Views/CommitRefsPresenter.cs +++ b/src/Views/CommitRefsPresenter.cs @@ -83,6 +83,24 @@ public bool ShowTags set => SetValue(ShowTagsProperty, value); } + public static readonly StyledProperty> RefsProperty = + AvaloniaProperty.Register>(nameof(Refs)); + + public List Refs + { + get => GetValue(RefsProperty); + set => SetValue(RefsProperty, value); + } + + public static readonly DirectProperty HasOverflowProperty = + AvaloniaProperty.RegisterDirect(nameof(HasOverflow), o => o.HasOverflow); + + public bool HasOverflow + { + get => _hasOverflow; + private set => SetAndRaise(HasOverflowProperty, ref _hasOverflow, value); + } + static CommitRefsPresenter() { AffectsMeasure( @@ -91,7 +109,9 @@ static CommitRefsPresenter() ForegroundProperty, UseGraphColorProperty, BackgroundProperty, - ShowTagsProperty); + AllowWrapProperty, + ShowTagsProperty, + RefsProperty); } public Models.Decorator DecoratorAt(Point point) @@ -176,18 +196,18 @@ protected override Size MeasureOverride(Size availableSize) { _items.Clear(); - if (DataContext is not Models.Commit commit) - return new Size(0, 0); + var explicitRefs = Refs; + var commit = DataContext as Models.Commit; + var refs = explicitRefs ?? commit?.Decorators; - var refs = commit.Decorators; if (refs is { Count: > 0 }) { var typeface = new Typeface(FontFamily); var typefaceBold = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold); var fg = Foreground; - var normalBG = UseGraphColor ? Models.CommitGraph.Pens[commit.Color].Brush : Brushes.Gray; + var normalBG = UseGraphColor && commit != null ? Models.CommitGraph.Pens[commit.Color].Brush : Brushes.Gray; var labelSize = FontSize; - var requiredHeight = 16.0; + var requiredHeight = 17.0; var x = 0.0; var allowWrap = AllowWrap; var showTags = ShowTags; @@ -259,17 +279,21 @@ protected override Size MeasureOverride(Size availableSize) } } - var requiredWidth = allowWrap && requiredHeight > 16.0 + HasOverflow = allowWrap && requiredHeight > 17.0; + + var requiredWidth = allowWrap && requiredHeight > 17.0 ? (double.IsInfinity(availableSize.Width) ? x + 2 : availableSize.Width) : x + 2; InvalidateVisual(); return new Size(requiredWidth, requiredHeight); } + HasOverflow = false; InvalidateVisual(); return new Size(0, 0); } private List _items = new List(); + private bool _hasOverflow = false; } } diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml index 2de71b4d9..d951fc4f2 100644 --- a/src/Views/Preferences.axaml +++ b/src/Views/Preferences.axaml @@ -47,7 +47,7 @@ - + + + + + - - + + + + + + + + + + + + + + + + + + + + + +