From 13d5c5fc6de53672d3c7780cad7c9097b35e6fee Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Aug 2025 20:19:07 +0800 Subject: [PATCH] feature: add a configuration in `Preferences` window to open `LOCAL CHANGES` pages by default (#1750) Signed-off-by: leo --- src/Resources/Locales/de_DE.axaml | 2 +- src/Resources/Locales/en_US.axaml | 3 ++- src/Resources/Locales/es_ES.axaml | 2 +- src/Resources/Locales/ru_RU.axaml | 2 +- src/Resources/Locales/zh_CN.axaml | 3 ++- src/Resources/Locales/zh_TW.axaml | 3 ++- src/ViewModels/Preferences.cs | 6 ++++++ src/ViewModels/Repository.cs | 13 +++++++++++-- src/Views/Preferences.axaml | 27 ++++++++++++++++----------- 9 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 689567a1..15d33b01 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -541,7 +541,6 @@ DARSTELLUNG Standardschriftart Editor Tab Breite - Aktiviere kompakte Ordner im Änderungsbaum Schriftgröße Standard Texteditor @@ -558,6 +557,7 @@ ALLGEMEIN Beim Starten nach Updates suchen Datumsformat + Aktiviere kompakte Ordner im Änderungsbaum Sprache Commit-Historie Zeige Autor Zeitpunkt anstatt Commit Zeitpunkt diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index e723a250..b06c7a49 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -536,7 +536,6 @@ APPEARANCE Default Font Editor Tab Width - Enable compact folders in changes tree Font Size Default Editor @@ -553,9 +552,11 @@ GENERAL Check for updates on startup Date Format + Enable compact folders in changes tree Language History Commits Show author time instead of commit time in graph + Show `LOCAL CHANGES` page by default Show children in the commit details 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 71cd212d..5b30894d 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -540,7 +540,6 @@ APARIENCIA Fuente por defecto Ancho de la Pestaña del Editor - Habilitar carpetas compactas en el árbol de cambios Tamaño de fuente Por defecto Editor @@ -557,6 +556,7 @@ GENERAL Buscar actualizaciones al iniciar Formato de Fecha + Habilitar carpetas compactas en el árbol de cambios Idioma Commits en el historial Mostrar hora del autor en lugar de la hora del commit en el gráfico diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 8a4f48a9..8c2d83cc 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -529,7 +529,6 @@ ВИД Шрифт по умолчанию Редактировать ширину вкладки - Включить компактные каталоги в дереве изменений Размер шрифта По умолчанию Редактор @@ -546,6 +545,7 @@ ОСНОВНЫЕ Проверить обновления при старте Формат даты + Включить компактные каталоги в дереве изменений Язык Максимальная длина истории Показывать время автора вместо времени ревизии на графике diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index adb7bd93..08da7a5e 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -540,7 +540,6 @@ 外观配置 缺省字体 编辑器制表符宽度 - 在变更列表树中启用紧凑文件夹模式 字体大小 默认 代码编辑器 @@ -557,9 +556,11 @@ 通用配置 启动时检测软件更新 日期时间格式 + 在变更列表树中启用紧凑文件夹模式 显示语言 最大历史提交数 在提交路线图中显示修改时间而非提交时间 + 默认显示【本地更改】页 在提交详情页中显示子提交列表 在提交路线图中显示标签 SUBJECT字数检测 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 31e115f5..7d229fb9 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -540,7 +540,6 @@ 外觀設定 預設字型 編輯器 Tab 寬度 - 在變更樹中啟用精簡文件夾顯示模式 字型大小 預設 程式碼 @@ -557,9 +556,11 @@ 一般設定 啟動時檢查軟體更新 日期時間格式 + 在變更樹中啟用精簡文件夾顯示模式 顯示語言 最大歷史提交數 在提交路線圖中顯示修改時間而非提交時間 + 預設顯示「本機變更」頁面 在提交詳細資訊中顯示後續提交 在路線圖中顯示標籤 提交標題字數偵測 diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index aaa7863d..13805ffd 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -119,6 +119,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _layout, value); } + public bool ShowLocalChangesByDefault + { + get; + set; + } = false; + public int MaxHistoryCommits { get => _maxHistoryCommits; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 7f5f0d22..bfa09808 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -549,8 +549,17 @@ namespace SourceGit.ViewModels _histories = new Histories(this); _workingCopy = new WorkingCopy(this) { CommitMessage = _settings.LastCommitMessage }; _stashesPage = new StashesPage(this); - _selectedView = _histories; - _selectedViewIndex = 0; + + if (Preferences.Instance.ShowLocalChangesByDefault) + { + _selectedView = _workingCopy; + _selectedViewIndex = 1; + } + else + { + _selectedView = _histories; + _selectedViewIndex = 0; + } _lastFetchTime = DateTime.Now; _autoFetchTimer = new Timer(FetchInBackground, null, 5000, 5000); diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml index ae7270ff..ddf63444 100644 --- a/src/Views/Preferences.axaml +++ b/src/Views/Preferences.axaml @@ -46,7 +46,7 @@ - + + + - - - + + - - + - -