misc: Fix small code formatting & styling issues

This commit is contained in:
Evan Husted 2024-11-10 19:58:02 -06:00
parent 10c8d73b60
commit 69f75f2df1
23 changed files with 58 additions and 62 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -32,7 +32,8 @@ namespace Ryujinx.Ava
internal static class Updater internal static class Updater
{ {
private const string GitHubApiUrl = "https://api.github.com"; 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()); private static readonly GithubReleasesJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());