diff --git a/Ryujinx.Ava/UI/ViewModels/AboutWindowViewModel.cs b/Ryujinx.Ava/UI/ViewModels/AboutWindowViewModel.cs new file mode 100644 index 000000000..5faad33fb --- /dev/null +++ b/Ryujinx.Ava/UI/ViewModels/AboutWindowViewModel.cs @@ -0,0 +1,136 @@ +using Avalonia; +using Avalonia.Media.Imaging; +using Avalonia.Threading; +using Ryujinx.Ava.Common.Locale; +using Ryujinx.Common.Utilities; +using Ryujinx.Ui.Common.Configuration; +using System; +using System.Net.Http; +using System.Net.NetworkInformation; +using System.Threading.Tasks; + +namespace Ryujinx.Ava.UI.ViewModels +{ + public class AboutWindowViewModel : BaseModel + { + private Bitmap _githubLogo; + private Bitmap _discordLogo; + private Bitmap _patreonLogo; + private Bitmap _twitterLogo; + + private string _version; + private string _supporters; + + public Bitmap GithubLogo + { + get => _githubLogo; + set + { + _githubLogo = value; + OnPropertyChanged(); + } + } + + public Bitmap DiscordLogo + { + get => _discordLogo; + set + { + _discordLogo = value; + OnPropertyChanged(); + } + } + + public Bitmap PatreonLogo + { + get => _patreonLogo; + set + { + _patreonLogo = value; + OnPropertyChanged(); + } + } + + public Bitmap TwitterLogo + { + get => _twitterLogo; + set + { + _twitterLogo = value; + OnPropertyChanged(); + } + } + + public string Supporters + { + get => _supporters; + set + { + _supporters = value; + OnPropertyChanged(); + } + } + + public string Version + { + get => _version; + set + { + _version = value; + OnPropertyChanged(); + } + } + + public string Developers + { + get => string.Format(LocaleManager.Instance[LocaleKeys.AboutPageDeveloperListMore], "gdkchan, Ac_K, marysaka, rip in peri peri, LDj3SNuD, emmaus, Thealexbarney, GoffyDude, TSRBerry, IsaacMarovitz"); + } + + public AboutWindowViewModel() + { + Version = Program.Version; + + var assets = AvaloniaLocator.Current.GetService(); + + if (ConfigurationState.Instance.Ui.BaseStyle.Value == "Light") + { + GithubLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_GitHub_Light.png?assembly=Ryujinx.Ui.Common"))); + DiscordLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Discord_Light.png?assembly=Ryujinx.Ui.Common"))); + PatreonLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Patreon_Light.png?assembly=Ryujinx.Ui.Common"))); + TwitterLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Twitter_Light.png?assembly=Ryujinx.Ui.Common"))); + } + else + { + GithubLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_GitHub_Dark.png?assembly=Ryujinx.Ui.Common"))); + DiscordLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Discord_Dark.png?assembly=Ryujinx.Ui.Common"))); + PatreonLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Patreon_Dark.png?assembly=Ryujinx.Ui.Common"))); + TwitterLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Twitter_Dark.png?assembly=Ryujinx.Ui.Common"))); + } + + Dispatcher.UIThread.InvokeAsync(DownloadPatronsJson); + } + + private async Task DownloadPatronsJson() + { + if (!NetworkInterface.GetIsNetworkAvailable()) + { + Supporters = LocaleManager.Instance[LocaleKeys.ConnectionError]; + + return; + } + + HttpClient httpClient = new(); + + try + { + string patreonJsonString = await httpClient.GetStringAsync("https://patreon.ryujinx.org/"); + + Supporters = string.Join(", ", JsonHelper.Deserialize(patreonJsonString)) + "\n\n"; + } + catch + { + Supporters = LocaleManager.Instance[LocaleKeys.ApiError]; + } + } + } +} \ No newline at end of file diff --git a/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs b/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs index 953f8562c..888e227c0 100644 --- a/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs +++ b/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs @@ -1018,7 +1018,7 @@ namespace Ryujinx.Ava.UI.ViewModels public async void OpenAboutWindow() { - await new AboutWindow().ShowDialog(_owner); + await AboutWindow.Show(); } public void ChangeLanguage(object obj) diff --git a/Ryujinx.Ava/UI/Windows/AboutWindow.axaml b/Ryujinx.Ava/UI/Windows/AboutWindow.axaml index 08d28740b..f446890cc 100644 --- a/Ryujinx.Ava/UI/Windows/AboutWindow.axaml +++ b/Ryujinx.Ava/UI/Windows/AboutWindow.axaml @@ -1,282 +1,253 @@ - + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - + Grid.Row="0" + Spacing="10" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch"> + + + + + + + + + + + + + + + + + + - - - - - - + - - + BorderBrush="{DynamicResource ThemeControlBorderColor}" + BorderThickness="1,0,0,0" + Margin="20 0"/> - - - - - - - - - - - + FontWeight="Bold" + FontSize="15" + Text="{locale:Locale AboutRyujinxAboutTitle}" /> - + FontSize="10" + TextWrapping="Wrap" + Text="{locale:Locale AboutRyujinxAboutContent}" /> + + + + + + + + + + + + - + \ No newline at end of file diff --git a/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs b/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs index 99280b870..5dbbbcdd7 100644 --- a/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs +++ b/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs @@ -1,38 +1,48 @@ using Avalonia.Controls; using Avalonia.Input; using Avalonia.Interactivity; -using Avalonia.Threading; +using Avalonia.Styling; +using FluentAvalonia.UI.Controls; using Ryujinx.Ava.Common.Locale; -using Ryujinx.Common.Utilities; +using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Ui.Common.Helper; -using System.Net.Http; -using System.Net.NetworkInformation; using System.Threading.Tasks; +using Button = Avalonia.Controls.Button; namespace Ryujinx.Ava.UI.Windows { - public partial class AboutWindow : StyleableWindow + public partial class AboutWindow : UserControl { public AboutWindow() { - if (Program.PreviewerDetached) - { - Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.MenuBarHelpAbout]; - } - - Version = Program.Version; - - DataContext = this; + DataContext = new AboutWindowViewModel(); InitializeComponent(); - - _ = DownloadPatronsJson(); } - public string Supporters { get; set; } - public string Version { get; set; } + public static async Task Show() + { + var content = new AboutWindow(); - public string Developers => string.Format(LocaleManager.Instance[LocaleKeys.AboutPageDeveloperListMore], "gdkchan, Ac_K, Thog, rip in peri peri, LDj3SNuD, emmaus, Thealexbarney, Xpl0itR, GoffyDude, »jD«"); + ContentDialog contentDialog = new() + { + PrimaryButtonText = "", + SecondaryButtonText = "", + CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose], + Content = content + }; + + Style closeButton = new(x => x.Name("CloseButton")); + closeButton.Setters.Add(new Setter(WidthProperty, 80d)); + + Style closeButtonParent = new(x => x.Name("CommandSpace")); + closeButtonParent.Setters.Add(new Setter(HorizontalAlignmentProperty, Avalonia.Layout.HorizontalAlignment.Right)); + + contentDialog.Styles.Add(closeButton); + contentDialog.Styles.Add(closeButtonParent); + + await contentDialog.ShowAsync(); + } private void Button_OnClick(object sender, RoutedEventArgs e) { @@ -42,31 +52,6 @@ namespace Ryujinx.Ava.UI.Windows } } - private async Task DownloadPatronsJson() - { - if (!NetworkInterface.GetIsNetworkAvailable()) - { - Supporters = LocaleManager.Instance[LocaleKeys.ConnectionError]; - - return; - } - - HttpClient httpClient = new(); - - try - { - string patreonJsonString = await httpClient.GetStringAsync("https://patreon.ryujinx.org/"); - - Supporters = string.Join(", ", JsonHelper.Deserialize(patreonJsonString)); - } - catch - { - Supporters = LocaleManager.Instance[LocaleKeys.ApiError]; - } - - await Dispatcher.UIThread.InvokeAsync(() => SupportersTextBlock.Text = Supporters); - } - private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e) { if (sender is TextBlock) diff --git a/Ryujinx.Ui.Common/Resources/Logo_Discord.png b/Ryujinx.Ui.Common/Resources/Logo_Discord.png deleted file mode 100644 index 9eabebf8d..000000000 Binary files a/Ryujinx.Ui.Common/Resources/Logo_Discord.png and /dev/null differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Discord_Dark.png b/Ryujinx.Ui.Common/Resources/Logo_Discord_Dark.png new file mode 100644 index 000000000..baececa90 Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_Discord_Dark.png differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Discord_Light.png b/Ryujinx.Ui.Common/Resources/Logo_Discord_Light.png new file mode 100644 index 000000000..25fc892d6 Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_Discord_Light.png differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_GitHub.png b/Ryujinx.Ui.Common/Resources/Logo_GitHub.png deleted file mode 100644 index 55f4d4e63..000000000 Binary files a/Ryujinx.Ui.Common/Resources/Logo_GitHub.png and /dev/null differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_GitHub_Dark.png b/Ryujinx.Ui.Common/Resources/Logo_GitHub_Dark.png new file mode 100644 index 000000000..50b817522 Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_GitHub_Dark.png differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_GitHub_Light.png b/Ryujinx.Ui.Common/Resources/Logo_GitHub_Light.png new file mode 100644 index 000000000..95bc742bb Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_GitHub_Light.png differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Patreon.png b/Ryujinx.Ui.Common/Resources/Logo_Patreon.png deleted file mode 100644 index ba2da7975..000000000 Binary files a/Ryujinx.Ui.Common/Resources/Logo_Patreon.png and /dev/null differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Patreon_Dark.png b/Ryujinx.Ui.Common/Resources/Logo_Patreon_Dark.png new file mode 100644 index 000000000..9a521e3fd Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_Patreon_Dark.png differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Patreon_Light.png b/Ryujinx.Ui.Common/Resources/Logo_Patreon_Light.png new file mode 100644 index 000000000..44da0ac45 Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_Patreon_Light.png differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Twitter.png b/Ryujinx.Ui.Common/Resources/Logo_Twitter.png deleted file mode 100644 index 759b5e1aa..000000000 Binary files a/Ryujinx.Ui.Common/Resources/Logo_Twitter.png and /dev/null differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Twitter_Dark.png b/Ryujinx.Ui.Common/Resources/Logo_Twitter_Dark.png new file mode 100644 index 000000000..66962e7d3 Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_Twitter_Dark.png differ diff --git a/Ryujinx.Ui.Common/Resources/Logo_Twitter_Light.png b/Ryujinx.Ui.Common/Resources/Logo_Twitter_Light.png new file mode 100644 index 000000000..040ca1699 Binary files /dev/null and b/Ryujinx.Ui.Common/Resources/Logo_Twitter_Light.png differ diff --git a/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj b/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj index 3a1cd1250..511a03897 100644 --- a/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj +++ b/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj @@ -34,11 +34,15 @@ - - - - + + + + + + + + diff --git a/Ryujinx/Ui/Windows/AboutWindow.Designer.cs b/Ryujinx/Ui/Windows/AboutWindow.Designer.cs index 8117cf36b..fa1a06578 100644 --- a/Ryujinx/Ui/Windows/AboutWindow.Designer.cs +++ b/Ryujinx/Ui/Windows/AboutWindow.Designer.cs @@ -206,7 +206,7 @@ namespace Ryujinx.Ui.Windows // // _patreonLogo // - _patreonLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Patreon.png", 30, 30)) + _patreonLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Patreon_Light.png", 30, 30)) { Margin = 10 }; @@ -236,7 +236,7 @@ namespace Ryujinx.Ui.Windows // // _githubLogo // - _githubLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_GitHub.png", 30, 30)) + _githubLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_GitHub_Light.png", 30, 30)) { Margin = 10 }; @@ -266,7 +266,7 @@ namespace Ryujinx.Ui.Windows // // _discordLogo // - _discordLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Discord.png", 30, 30)) + _discordLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Discord_Light.png", 30, 30)) { Margin = 10 }; @@ -296,7 +296,7 @@ namespace Ryujinx.Ui.Windows // // _twitterLogo // - _twitterLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Twitter.png", 30, 30)) + _twitterLogo = new Image(new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Twitter_Light.png", 30, 30)) { Margin = 10 };