diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs index f4316c86ef..8784a958cb 100644 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -43,6 +43,7 @@ namespace MaaWpfGui.Constants public const string CustomStageCode = "GUI.CustomStageCode"; public const string InverseClearMode = "GUI.InverseClearMode"; public const string WindowTitlePrefix = "GUI.WindowTitlePrefix"; + public const string WindowTitleSelectShowList = "GUI.WindowTitleSelectShowList"; public const string SoberLanguage = "GUI.SoberLanguage"; public const string Cheers = "GUI.Cheers"; public const string Hangover = "GUI.Hangover"; diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index fe4e303f9c..8f283efe0b 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -303,6 +303,7 @@ Please do not check it when the stage OF-1 is not unlocked. System Notification Hide close button Window Title Scrolling + Title Bar Display Content Custom log date format Date format string Restart immediately to apply changes? diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index d9b3676c12..c36081effb 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -304,6 +304,7 @@ 重要な通知をポップアップする 「閉じる」ボタンを隠す タイトルのスクロール機能 + タイトルバー表示コンテンツ カスタムログ日付形式 日付書式文字列 変更を適用するためにすぐに再起動しますか? diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 1b98ac272c..00f6ef23dc 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -304,6 +304,7 @@ OF-1을 해금하지 않았다면 선택하지 말아 주세요. 중요 알림 팝업 닫기 버튼 숨기기 창 제목 스크롤 + 타이틀 바 표시 내용 사용자 정의 로그 날짜 형식 날짜 형식 문자열 변경 사항을 적용을 위해 즉시 다시 시작하시겠습니까? diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 67a9480e3b..3e777ba2f2 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -303,6 +303,7 @@ 重要信息弹出系统通知 隐藏关闭按钮 窗口标题滚动 + 标题栏显示内容 自选日志日期格式 日期格式字符串 是否立刻重启应用更改? diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index cdb5465b09..6636ca83fa 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -303,6 +303,7 @@ 重要訊息彈出系統通知 隱藏關閉按鈕 窗口標題滾動 + 標題欄顯示內容 自訂日誌日期格式 日期格式字串 是否立刻重啟應用更改? diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 411df8b111..14a8fda534 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -46,6 +46,7 @@ using MaaWpfGui.Utilities.ValueType; using Microsoft.Win32; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using ObservableCollections; using Serilog; using Stylet; using ComboBox = System.Windows.Controls.ComboBox; @@ -3470,11 +3471,6 @@ namespace MaaWpfGui.ViewModels.UI public void UpdateWindowTitle() { var rvm = (RootViewModel)this.Parent; - var connectConfigName = string.Empty; - foreach (var data in ConnectConfigList.Where(data => data.Value == ConnectConfig)) - { - connectConfigName = data.Display; - } string prefix = ConfigurationHelper.GetValue(ConfigurationKeys.WindowTitlePrefix, string.Empty); if (!string.IsNullOrEmpty(prefix)) @@ -3482,8 +3478,40 @@ namespace MaaWpfGui.ViewModels.UI prefix += " - "; } + List windowTitleSelectShowList = _windowTitleSelectShowList + .Where(x => _windowTitleAllShowDict.ContainsKey(x?.ToString() ?? string.Empty)) + .Select(x => _windowTitleAllShowDict[x?.ToString() ?? string.Empty]).ToList(); + + string currentConfiguration = string.Empty; + string connectConfigName = string.Empty; + string connectAddress = string.Empty; + string clientName = string.Empty; + + foreach (var select in windowTitleSelectShowList) + { + switch (select) + { + case "1": // 配置名 + currentConfiguration = $" ({CurrentConfiguration})"; + break; + case "2": // 连接模式 + foreach (var data in ConnectConfigList.Where(data => data.Value == ConnectConfig)) + { + connectConfigName = $" - {data.Display}"; + } + + break; + case "3": // 端口地址 + connectAddress = $" ({ConnectAddress})"; + break; + case "4": // 客户端类型 + clientName = $" - {ClientName}"; + break; + } + } + string resourceVersion = !string.IsNullOrEmpty(ResourceVersion) ? $" - {ResourceVersion}" : string.Empty; - rvm.WindowTitle = $"{prefix}MAA ({CurrentConfiguration}) - {CoreVersion}{resourceVersion} - {connectConfigName} ({ConnectAddress}) - {ClientName}"; + rvm.WindowTitle = $"{prefix}MAA{currentConfiguration} - {CoreVersion}{resourceVersion}{connectConfigName}{connectAddress}{clientName}"; } private readonly string _bluestacksConfig = GetBluestacksConfig(); @@ -3773,7 +3801,7 @@ namespace MaaWpfGui.ViewModels.UI } } - private bool _useLogItemDateFormat = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.UseLogItemDateFormat, bool.FalseString)); + private bool _useLogItemDateFormat = true; // Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.UseLogItemDateFormat, bool.FalseString)); public bool UseLogItemDateFormat { @@ -3993,6 +4021,36 @@ namespace MaaWpfGui.ViewModels.UI } } + private static readonly Dictionary _windowTitleAllShowDict = new() + { + { LocalizationHelper.GetString("ConfigurationName"), "1" }, + { LocalizationHelper.GetString("ConnectionPreset"), "2" }, + { LocalizationHelper.GetString("ConnectionAddress"), "3" }, + { LocalizationHelper.GetString("ClientType"), "4" }, + }; + + private List _windowTitleAllShowList = [.. _windowTitleAllShowDict.Keys]; + + public List WindowTitleAllShowList + { + get => _windowTitleAllShowList; + set => SetAndNotify(ref _windowTitleAllShowList, value); + } + + private object[] _windowTitleSelectShowList = ConfigurationHelper.GetValue(ConfigurationKeys.WindowTitleSelectShowList, "1 2 3 4").Split(' ').Select(s => _windowTitleAllShowDict.FirstOrDefault(pair => pair.Value == s).Key).ToArray(); + + public object[] WindowTitleSelectShowList + { + get => _windowTitleSelectShowList; + set + { + SetAndNotify(ref _windowTitleSelectShowList, value); + UpdateWindowTitle(); + var config = string.Join(' ', _windowTitleSelectShowList.Cast().Select(s => _windowTitleAllShowDict[s])); + ConfigurationHelper.SetValue(ConfigurationKeys.WindowTitleSelectShowList, config); + } + } + private string _soberLanguage = ConfigurationHelper.GetValue(ConfigurationKeys.SoberLanguage, LocalizationHelper.DefaultLanguage); public string SoberLanguage diff --git a/src/MaaWpfGui/Views/UserControl/GUISettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/GUISettingsUserControl.xaml index 514cd893ff..0f47d50cbf 100644 --- a/src/MaaWpfGui/Views/UserControl/GUISettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/GUISettingsUserControl.xaml @@ -23,13 +23,9 @@ VerticalAlignment="Center"> - - + - + - - - - - - - - - - --> + + + + + + + SelectedValuePath="Value" + Style="{StaticResource ComboBoxExtend}" /> + SelectedValuePath="Value" + Style="{StaticResource ComboBoxExtend}" /> + SelectedValuePath="Value" + Style="{StaticResource ComboBoxExtend}" /> - +