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)
return false;
else
return this.Path == obj.Path;
return this.Path == obj.Path;
}
public override int GetHashCode()

View File

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

View File

@ -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",

View File

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

View File

@ -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",

View File

@ -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",

View File

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

View File

@ -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",

View File

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

View File

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

View File

@ -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",

View File

@ -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",

View File

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

View File

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

View File

@ -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",

View File

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

View File

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

View File

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

View File

@ -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; }

View File

@ -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);

View File

@ -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 = check.IsPointerOver switch
{
_changeSlider = (float)check.Value;
}
else if (!(bool)check.IsPointerOver)
{
_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;

View File

@ -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;
}
}

View File

@ -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());