From 1298a22b000f35947015e8b44887ee5f72f9e070 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 14 Nov 2024 20:53:59 +0800 Subject: [PATCH] ux: use dynamic icon for filter tips. Signed-off-by: leo --- src/Resources/Locales/de_DE.axaml | 1 - src/Resources/Locales/en_US.axaml | 1 - src/Resources/Locales/es_ES.axaml | 1 - src/Resources/Locales/fr_FR.axaml | 1 - src/Resources/Locales/pt_BR.axaml | 1 - src/Resources/Locales/ru_RU.axaml | 1 - src/Resources/Locales/zh_CN.axaml | 1 - src/Resources/Locales/zh_TW.axaml | 1 - src/Views/Repository.axaml | 10 ++++++--- src/Views/Repository.axaml.cs | 35 +++++++++++++++++++++++++++++++ 10 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 4e94bb67..68310dee 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -543,7 +543,6 @@ Aktiviere '--reflog' Option Öffne im Datei-Browser Suche Branches/Tags/Submodule - GEFILTERT: LOKALE BRANCHES Zum HEAD wechseln Aktiviere '--first-parent' Option diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index da860d05..75bcc77e 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -543,7 +543,6 @@ Unset (Default) Hide in commit graph Filter in commit graph - FILTERED BY: LOCAL BRANCHES Navigate to HEAD Enable '--first-parent' Option diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 5e3ed9a9..f69fc934 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -541,7 +541,6 @@ Habilitar Opción '--reflog' Abrir en el Explorador Buscar Ramas/Etiquetas/Submódulos - FILTRAR POR: RAMAS LOCALES Navegar a HEAD Habilitar Opción '--first-parent' diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index c07a6ee5..babe3106 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -542,7 +542,6 @@ Activer l'option '--reflog' Ouvrir dans l'explorateur de fichiers Rechercher Branches/Tags/Submodules - FILTRE PAR : BRANCHES LOCALES Naviguer vers le HEAD Activer l'option '--first-parent' diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 987b3398..8a1866f6 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -565,7 +565,6 @@ Habilitar opção '--reflog' Abrir no Navegador de Arquivos Pesquisar Branches/Tags/Submódulos - FILTRADO POR: Habilitar opção '--first-parent' BRANCHES LOCAIS Navegar para HEAD diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index e86dbbe7..dbc797e0 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -544,7 +544,6 @@ Разрешить опцию --reflog Открыть в файловом менеджере Поиск веток, меток и подмодулей - ОТФИЛЬТРОВАНО: ЛОКАЛЬНЫЕ ВЕТКИ Навигация по заголовку Включить опцию --first-parent diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 4fd32a37..ded03053 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -547,7 +547,6 @@ 未指定(默认行为) 在提交列表中隐藏 使用其对提交列表过滤 - 过滤规则 : 本地分支 定位HEAD 启用 --first-parent 过滤选项 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index b5d9aea8..6461665c 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -546,7 +546,6 @@ 未指定 (預設) 在提交清單中隱藏 使用其來篩選提交清單 - 篩選規則: 本機分支 回到 HEAD 啟用 [--first-parent] 選項 diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 8c31f61f..d32bfa1f 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -574,9 +574,13 @@ - - - + + + diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index dec3d447..cbc654ae 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -395,5 +395,40 @@ namespace SourceGit.Views } e.Handled = true; } + + private void OnHistoriesFiltersLayoutUpdated(object sender, EventArgs e) + { + var repo = DataContext as ViewModels.Repository; + if (repo == null) + return; + + var filters = repo.Settings.HistoriesFilters; + if (filters.Count == 0) + return; + + var mode = filters[0].Mode; + if (mode == _lastFilterMode) + return; + + _lastFilterMode = mode; + + var icon = null as StreamGeometry; + switch (mode) + { + case Models.FilterMode.Included: + icon = this.FindResource("Icons.Filter") as StreamGeometry; + break; + case Models.FilterMode.Excluded: + icon = this.FindResource("Icons.EyeClose") as StreamGeometry; + break; + default: + break; + } + + if (icon != null) + HistoriesFilterModeIcon.Data = icon; + } + + private Models.FilterMode _lastFilterMode = Models.FilterMode.None; } }