diff options
| author | Mary Guillemard <mary@mary.zone> | 2024-03-02 12:51:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-02 12:51:05 +0100 |
| commit | ec6cb0abb4b7669895b6e96fd7581c93b5abd691 (patch) | |
| tree | 128c862ff5faea0b219467656d4023bee7faefb5 /src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs | |
| parent | 53b5985da6b9d7b281d9fc25b93bfd1d1918a107 (diff) | |
infra: Make Avalonia the default UI (#6375)
* misc: Move Ryujinx project to Ryujinx.Gtk3
This breaks release CI for now but that's fine.
Signed-off-by: Mary Guillemard <mary@mary.zone>
* misc: Move Ryujinx.Ava project to Ryujinx
This breaks CI for now, but it's fine.
Signed-off-by: Mary Guillemard <mary@mary.zone>
* infra: Make Avalonia the default UI
Should fix CI after the previous changes.
GTK3 isn't build by the release job anymore, only by PR CI.
This also ensure that the test-ava update package is still generated to
allow update from the old testing channel.
Signed-off-by: Mary Guillemard <mary@mary.zone>
* Fix missing copy in create_app_bundle.sh
Signed-off-by: Mary Guillemard <mary@mary.zone>
* Fix syntax error
Signed-off-by: Mary Guillemard <mary@mary.zone>
---------
Signed-off-by: Mary Guillemard <mary@mary.zone>
Diffstat (limited to 'src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs')
| -rw-r--r-- | src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs b/src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs deleted file mode 100644 index fabfaa4e..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Platform.Storage; -using Avalonia.VisualTree; -using FluentAvalonia.UI.Controls; -using FluentAvalonia.UI.Navigation; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Controls; -using Ryujinx.Ava.UI.Models; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.HLE.FileSystem; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.Processing; -using System.Collections.Generic; -using System.IO; -using Image = SixLabors.ImageSharp.Image; - -namespace Ryujinx.Ava.UI.Views.User -{ - public partial class UserProfileImageSelectorView : UserControl - { - private ContentManager _contentManager; - private NavigationDialogHost _parent; - private TempProfile _profile; - - internal UserProfileImageSelectorViewModel ViewModel { get; private set; } - - public UserProfileImageSelectorView() - { - InitializeComponent(); - AddHandler(Frame.NavigatedToEvent, (s, e) => - { - NavigatedTo(e); - }, RoutingStrategies.Direct); - } - - private void NavigatedTo(NavigationEventArgs arg) - { - if (Program.PreviewerDetached) - { - switch (arg.NavigationMode) - { - case NavigationMode.New: - (_parent, _profile) = ((NavigationDialogHost, TempProfile))arg.Parameter; - _contentManager = _parent.ContentManager; - - ((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.ProfileImageSelectionHeader]}"; - - if (Program.PreviewerDetached) - { - DataContext = ViewModel = new UserProfileImageSelectorViewModel(); - ViewModel.FirmwareFound = _contentManager.GetCurrentFirmwareVersion() != null; - } - - break; - case NavigationMode.Back: - if (_profile.Image != null) - { - _parent.GoBack(); - } - break; - } - } - } - - private async void Import_OnClick(object sender, RoutedEventArgs e) - { - var window = this.GetVisualRoot() as Window; - var result = await window.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions - { - AllowMultiple = false, - FileTypeFilter = new List<FilePickerFileType> - { - new(LocaleManager.Instance[LocaleKeys.AllSupportedFormats]) - { - Patterns = new[] { "*.jpg", "*.jpeg", "*.png", "*.bmp" }, - AppleUniformTypeIdentifiers = new[] { "public.jpeg", "public.png", "com.microsoft.bmp" }, - MimeTypes = new[] { "image/jpeg", "image/png", "image/bmp" }, - }, - }, - }); - - if (result.Count > 0) - { - _profile.Image = ProcessProfileImage(File.ReadAllBytes(result[0].Path.LocalPath)); - _parent.GoBack(); - } - } - - private void GoBack(object sender, RoutedEventArgs e) - { - _parent.GoBack(); - } - - private void SelectFirmwareImage_OnClick(object sender, RoutedEventArgs e) - { - if (ViewModel.FirmwareFound) - { - _parent.Navigate(typeof(UserFirmwareAvatarSelectorView), (_parent, _profile)); - } - } - - private static byte[] ProcessProfileImage(byte[] buffer) - { - using Image image = Image.Load(buffer); - - image.Mutate(x => x.Resize(256, 256)); - - using MemoryStream streamJpg = new(); - - image.SaveAsJpeg(streamJpg); - - return streamJpg.ToArray(); - } - } -} |
