Просмотр исходного кода

misc: Fix small code formatting & styling issues

Evan Husted 1 год назад
Родитель
Сommit
69f75f2df1

+ 2 - 2
src/Ryujinx.UI.Common/Models/XCITrimmerFileModel.cs

@@ -43,8 +43,8 @@ namespace Ryujinx.UI.Common.Models
         {
             if (obj == null)
                 return false;
-            else
-                return this.Path == obj.Path;            
+            
+            return this.Path == obj.Path;
         }
         
         public override int GetHashCode()

+ 1 - 0
src/Ryujinx/Assets/Locales/ar_SA.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "تعيين لون الخلفية",
   "AvatarClose": "إغلاق",
   "ControllerSettingsLoadProfileToolTip": "تحميل الملف الشخصي",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "إضافة ملف شخصي",
   "ControllerSettingsRemoveProfileToolTip": "إزالة الملف الشخصي",
   "ControllerSettingsSaveProfileToolTip": "حفظ الملف الشخصي",

+ 1 - 0
src/Ryujinx/Assets/Locales/de_DE.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Hintergrundfarbe auswählen",
   "AvatarClose": "Schließen",
   "ControllerSettingsLoadProfileToolTip": "Lädt ein Profil",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Fügt ein Profil hinzu",
   "ControllerSettingsRemoveProfileToolTip": "Entfernt ein Profil",
   "ControllerSettingsSaveProfileToolTip": "Speichert ein Profil",

+ 1 - 0
src/Ryujinx/Assets/Locales/el_GR.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Ορισμός Χρώματος Φόντου",
   "AvatarClose": "Κλείσιμο",
   "ControllerSettingsLoadProfileToolTip": "Φόρτωση Προφίλ",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Προσθήκη Προφίλ",
   "ControllerSettingsRemoveProfileToolTip": "Κατάργηση Προφίλ",
   "ControllerSettingsSaveProfileToolTip": "Αποθήκευση Προφίλ",

+ 1 - 0
src/Ryujinx/Assets/Locales/es_ES.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Establecer color de fondo",
   "AvatarClose": "Cerrar",
   "ControllerSettingsLoadProfileToolTip": "Cargar perfil",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Agregar perfil",
   "ControllerSettingsRemoveProfileToolTip": "Eliminar perfil",
   "ControllerSettingsSaveProfileToolTip": "Guardar perfil",

+ 1 - 0
src/Ryujinx/Assets/Locales/fr_FR.json

@@ -408,6 +408,7 @@
   "AvatarClose": "Fermer",
   "ControllerSettingsLoadProfileToolTip": "Charger un profil",
   "ControllerSettingsAddProfileToolTip": "Ajouter un profil",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsRemoveProfileToolTip": "Supprimer un profil",
   "ControllerSettingsSaveProfileToolTip": "Enregistrer un profil",
   "MenuBarFileToolsTakeScreenshot": "Prendre une capture d'écran",

+ 1 - 0
src/Ryujinx/Assets/Locales/he_IL.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "הגדר צבע רקע",
   "AvatarClose": "סגור",
   "ControllerSettingsLoadProfileToolTip": "טען פרופיל",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "הוסף פרופיל",
   "ControllerSettingsRemoveProfileToolTip": "הסר פרופיל",
   "ControllerSettingsSaveProfileToolTip": "שמור פרופיל",

+ 1 - 0
src/Ryujinx/Assets/Locales/it_IT.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Imposta colore di sfondo",
   "AvatarClose": "Chiudi",
   "ControllerSettingsLoadProfileToolTip": "Carica profilo",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Aggiungi profilo",
   "ControllerSettingsRemoveProfileToolTip": "Rimuovi profilo",
   "ControllerSettingsSaveProfileToolTip": "Salva profilo",

+ 1 - 0
src/Ryujinx/Assets/Locales/ja_JP.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "背景色を指定",
   "AvatarClose": "閉じる",
   "ControllerSettingsLoadProfileToolTip": "プロファイルをロード",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "プロファイルを追加",
   "ControllerSettingsRemoveProfileToolTip": "プロファイルを削除",
   "ControllerSettingsSaveProfileToolTip": "プロファイルをセーブ",

+ 1 - 0
src/Ryujinx/Assets/Locales/ko_KR.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "배경색 설정",
   "AvatarClose": "닫기",
   "ControllerSettingsLoadProfileToolTip": "프로필 불러오기",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "프로필 추가",
   "ControllerSettingsRemoveProfileToolTip": "프로필 제거",
   "ControllerSettingsSaveProfileToolTip": "프로필 저장",

+ 1 - 0
src/Ryujinx/Assets/Locales/pl_PL.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Ustaw kolor tła",
   "AvatarClose": "Zamknij",
   "ControllerSettingsLoadProfileToolTip": "Wczytaj profil",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Dodaj profil",
   "ControllerSettingsRemoveProfileToolTip": "Usuń profil",
   "ControllerSettingsSaveProfileToolTip": "Zapisz profil",

+ 1 - 0
src/Ryujinx/Assets/Locales/pt_BR.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Definir cor de fundo",
   "AvatarClose": "Fechar",
   "ControllerSettingsLoadProfileToolTip": "Carregar perfil",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Adicionar perfil",
   "ControllerSettingsRemoveProfileToolTip": "Remover perfil",
   "ControllerSettingsSaveProfileToolTip": "Salvar perfil",

+ 1 - 0
src/Ryujinx/Assets/Locales/ru_RU.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Установить цвет фона",
   "AvatarClose": "Закрыть",
   "ControllerSettingsLoadProfileToolTip": "Загрузить профиль",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Добавить профиль",
   "ControllerSettingsRemoveProfileToolTip": "Удалить профиль",
   "ControllerSettingsSaveProfileToolTip": "Сохранить профиль",

+ 1 - 0
src/Ryujinx/Assets/Locales/th_TH.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "ตั้งค่าสีพื้นหลัง",
   "AvatarClose": "ปิด",
   "ControllerSettingsLoadProfileToolTip": "โหลด โปรไฟล์",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "เพิ่ม โปรไฟล์",
   "ControllerSettingsRemoveProfileToolTip": "ลบ โปรไฟล์",
   "ControllerSettingsSaveProfileToolTip": "บันทึก โปรไฟล์",

+ 1 - 0
src/Ryujinx/Assets/Locales/tr_TR.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Arka Plan Rengi Ayarla",
   "AvatarClose": "Kapat",
   "ControllerSettingsLoadProfileToolTip": "Profil Yükle",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Profil Ekle",
   "ControllerSettingsRemoveProfileToolTip": "Profili Kaldır",
   "ControllerSettingsSaveProfileToolTip": "Profili Kaydet",

+ 1 - 0
src/Ryujinx/Assets/Locales/uk_UA.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "Встановити колір фону",
   "AvatarClose": "Закрити",
   "ControllerSettingsLoadProfileToolTip": "Завантажити профіль",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "Додати профіль",
   "ControllerSettingsRemoveProfileToolTip": "Видалити профіль",
   "ControllerSettingsSaveProfileToolTip": "Зберегти профіль",

+ 1 - 0
src/Ryujinx/Assets/Locales/zh_CN.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "设置背景色",
   "AvatarClose": "关闭",
   "ControllerSettingsLoadProfileToolTip": "加载配置文件",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "新增配置文件",
   "ControllerSettingsRemoveProfileToolTip": "删除配置文件",
   "ControllerSettingsSaveProfileToolTip": "保存配置文件",

+ 1 - 0
src/Ryujinx/Assets/Locales/zh_TW.json

@@ -407,6 +407,7 @@
   "AvatarSetBackgroundColor": "設定背景顏色",
   "AvatarClose": "關閉",
   "ControllerSettingsLoadProfileToolTip": "載入設定檔",
+  "ControllerSettingsViewProfileToolTip": "View Profile",
   "ControllerSettingsAddProfileToolTip": "新增設定檔",
   "ControllerSettingsRemoveProfileToolTip": "刪除設定檔",
   "ControllerSettingsSaveProfileToolTip": "儲存設定檔",

+ 0 - 1
src/Ryujinx/Program.cs

@@ -30,7 +30,6 @@ namespace Ryujinx.Ava
 {
     internal partial class Program
     {
-        //
         public static double WindowScaleFactor { get; set; }
         public static double DesktopScaleFactor { get; set; } = 1.0;
         public static string Version { get; private set; }

+ 3 - 3
src/Ryujinx/UI/Helpers/ContentDialogHelper.cs

@@ -226,11 +226,11 @@ namespace Ryujinx.Ava.UI.Helpers
                 (int)Symbol.Help,
                 primaryButtonResult);
 
-        internal static async Task<UserResult> CreateConfirmationDialogExtended(
+        internal static async Task<UserResult> CreateDeniableConfirmationDialog(
             string primaryText,
             string secondaryText,
             string acceptButtonText,
-            string noacceptButtonText,
+            string noAcceptButtonText,
             string cancelButtonText,
             string title,
             UserResult primaryButtonResult = UserResult.Yes)
@@ -239,7 +239,7 @@ namespace Ryujinx.Ava.UI.Helpers
                 primaryText,
                 secondaryText,
                 acceptButtonText,
-                noacceptButtonText,
+                noAcceptButtonText,
                 cancelButtonText,
                 (int)Symbol.Help,
                 primaryButtonResult);

+ 27 - 39
src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs

@@ -26,19 +26,17 @@ namespace Ryujinx.Ava.UI.Views.Input
 
             foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
             {
-                if (visual is ToggleButton button and not CheckBox)
+                switch (visual)
                 {
-                    button.IsCheckedChanged += Button_IsCheckedChanged;
-                }
-
-                if (visual is CheckBox check)
-                {
-                    check.IsCheckedChanged += CheckBox_IsCheckedChanged;
-                }
-
-                if (visual is Slider slider)
-                {
-                    slider.PropertyChanged += Slider_IsCheckedChanged;
+                    case ToggleButton button and not CheckBox:
+                        button.IsCheckedChanged += Button_IsCheckedChanged;
+                        break;
+                    case CheckBox check:
+                        check.IsCheckedChanged += CheckBox_IsCheckedChanged;
+                        break;
+                    case Slider slider:
+                        slider.PropertyChanged += Slider_ValueChanged;
+                        break;
                 }
             }
         }
@@ -47,33 +45,28 @@ namespace Ryujinx.Ava.UI.Views.Input
         {
             base.OnPointerReleased(e);
 
-            if (_currentAssigner != null && _currentAssigner.ToggledButton != null && !_currentAssigner.ToggledButton.IsPointerOver)
+            if (_currentAssigner is { ToggledButton.IsPointerOver: false })
             {
                 _currentAssigner.Cancel();
             }
         }
 
-        private float _changeSlider = -1.0f;
+        private float _changeSlider = float.NaN;
 
-        private void Slider_IsCheckedChanged(object sender, AvaloniaPropertyChangedEventArgs e)
+        private void Slider_ValueChanged(object sender, AvaloniaPropertyChangedEventArgs e)
         {
             if (sender is Slider check)
             {
-                if ((bool)check.IsPointerOver && _changeSlider == -1.0f)
-                {
-                    _changeSlider = (float)check.Value;
-                    
-                }
-                else if (!(bool)check.IsPointerOver)
+                _changeSlider = check.IsPointerOver switch
                 {
-                    _changeSlider = -1.0f;
-                }
+                    true when float.IsNaN(_changeSlider) => (float)check.Value,
+                    false => float.NaN,
+                    _ => _changeSlider
+                };
 
-                if (_changeSlider != -1.0f && _changeSlider != (float)check.Value)
+                if (!float.IsNaN(_changeSlider) && _changeSlider != (float)check.Value)
                 {
-
-                     var viewModel = (DataContext as ControllerInputViewModel);
-                     viewModel.ParentModel.IsModified = true;
+                    (DataContext as ControllerInputViewModel)!.ParentModel.IsModified = true;
                     _changeSlider = (float)check.Value;
                 }
             }
@@ -81,25 +74,20 @@ namespace Ryujinx.Ava.UI.Views.Input
 
         private void CheckBox_IsCheckedChanged(object sender, RoutedEventArgs e)
         {
-            if (sender is CheckBox check)
+            if (sender is CheckBox { IsPointerOver: true })
             {
-                if ((bool)check.IsPointerOver)
-                {
-
-                    var viewModel = (DataContext as ControllerInputViewModel);
-                    viewModel.ParentModel.IsModified = true;
-                    _currentAssigner?.Cancel();
-                    _currentAssigner = null;
-                }
+                (DataContext as ControllerInputViewModel)!.ParentModel.IsModified = true;
+                _currentAssigner?.Cancel();
+                _currentAssigner = null;
             }
         }
 
 
         private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
         {
-            if (sender is ToggleButton button ) 
+            if (sender is ToggleButton button) 
             {
-                if ((bool)button.IsChecked)
+                if (button.IsChecked is true)
                 {
                     if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
                     {
@@ -204,7 +192,7 @@ namespace Ryujinx.Ava.UI.Views.Input
                     }
                     else
                     {
-                        if (_currentAssigner != null )
+                        if (_currentAssigner != null)
                         {
                             _currentAssigner.Cancel();
                             _currentAssigner = null;

+ 7 - 16
src/Ryujinx/UI/Views/Input/InputView.axaml.cs

@@ -37,7 +37,7 @@ namespace Ryujinx.Ava.UI.Views.Input
             {
                 _dialogOpen = true;
 
-                var result = await ContentDialogHelper.CreateConfirmationDialogExtended(
+                var result = await ContentDialogHelper.CreateDeniableConfirmationDialog(
                     LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage],
                     LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage],
                     LocaleManager.Instance[LocaleKeys.InputDialogYes],
@@ -53,28 +53,19 @@ namespace Ryujinx.Ava.UI.Views.Input
 
                 _dialogOpen = false;
 
-                if (result == UserResult.Cancel)
-                {
-                 
-                    return;
-                }
-
-                ViewModel.IsModified = false;
-
-                if (result != UserResult.Cancel)
-                {
-                    ViewModel.PlayerId = ViewModel.PlayerIdChoose;
-                }
-
                 if (result == UserResult.Cancel)
                 {
                     if (e.AddedItems.Count > 0)
                     {
                         ViewModel.IsModified = true;
-                        var player = (PlayerModel)e.AddedItems[0];
-                        ViewModel.PlayerId = player.Id;
+                        ViewModel.PlayerId = ((PlayerModel)e.AddedItems[0])!.Id;
                     }
+                    return;
                 }
+                
+                ViewModel.PlayerId = ViewModel.PlayerIdChoose;
+
+                ViewModel.IsModified = false;
             }
             
         }

+ 2 - 1
src/Ryujinx/Updater.cs

@@ -32,7 +32,8 @@ namespace Ryujinx.Ava
     internal static class Updater
     {
         private const string GitHubApiUrl = "https://api.github.com";
-        private const string LatestReleaseUrl = $"{GitHubApiUrl}/repos/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}/releases/latest";
+        private const string LatestReleaseUrl = 
+            $"{GitHubApiUrl}/repos/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}/releases/latest";
         
         private static readonly GithubReleasesJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());