UI: Add program icon to windows other than the main

This commit is contained in:
Evan Husted 2024-10-25 08:36:04 -05:00
parent 570c7cfaa2
commit 7d88dfa00d
4 changed files with 12 additions and 33 deletions

View File

@ -17,13 +17,7 @@
<UserControl.Resources> <UserControl.Resources>
<helpers:DownloadableContentLabelConverter x:Key="DownloadableContentLabel" /> <helpers:DownloadableContentLabelConverter x:Key="DownloadableContentLabel" />
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid RowDefinitions="Auto,Auto,*,Auto">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel <StackPanel
Grid.Row="0" Grid.Row="0"
Margin="0 0 0 10" Margin="0 0 0 10"
@ -44,12 +38,7 @@
<Panel <Panel
Margin="0 0 0 10" Margin="0 0 0 10"
Grid.Row="1"> Grid.Row="1">
<Grid> <Grid ColumnDefinitions="Auto,Auto,*">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
Text="{Binding UpdateCount}" /> Text="{Binding UpdateCount}" />
@ -101,17 +90,9 @@
<DataTemplate <DataTemplate
DataType="models:DownloadableContentModel"> DataType="models:DownloadableContentModel">
<Panel Margin="10"> <Panel Margin="10">
<Grid> <Grid ColumnDefinitions="*,Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid <Grid
Grid.Column="0"> Grid.Column="0" ColumnDefinitions="*,Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
HorizontalAlignment="Left" HorizontalAlignment="Left"

View File

@ -21,7 +21,6 @@
x:DataType="viewModels:MainWindowViewModel" x:DataType="viewModels:MainWindowViewModel"
mc:Ignorable="d" mc:Ignorable="d"
WindowStartupLocation="Manual" WindowStartupLocation="Manual"
Icon="resm:Ryujinx.UI.Common.Resources.Logo_Ryujinx.png?assembly=Ryujinx.UI.Common"
Focusable="True"> Focusable="True">
<Window.Styles> <Window.Styles>
<Style Selector="TitleBar:fullscreen"> <Style Selector="TitleBar:fullscreen">

View File

@ -84,7 +84,6 @@ namespace Ryujinx.Ava.UI.Windows
TitleBar.ExtendsContentIntoTitleBar = true; TitleBar.ExtendsContentIntoTitleBar = true;
TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex; TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;
// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point. // NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
StatusBarHeight = StatusBarView.StatusBar.MinHeight; StatusBarHeight = StatusBarView.StatusBar.MinHeight;
MenuBarHeight = MenuBar.MinHeight; MenuBarHeight = MenuBar.MinHeight;
@ -98,7 +97,7 @@ namespace Ryujinx.Ava.UI.Windows
{ {
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver()); InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged); _ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it);
this.ScalingChanged += OnScalingChanged; this.ScalingChanged += OnScalingChanged;
} }
} }
@ -106,7 +105,7 @@ namespace Ryujinx.Ava.UI.Windows
/// <summary> /// <summary>
/// Event handler for detecting OS theme change when using "Follow OS theme" option /// Event handler for detecting OS theme change when using "Follow OS theme" option
/// </summary> /// </summary>
private void OnPlatformColorValuesChanged(object sender, PlatformColorValues e) private static void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
{ {
if (Application.Current is App app) if (Application.Current is App app)
app.ApplyConfiguredTheme(); app.ApplyConfiguredTheme();
@ -128,11 +127,6 @@ namespace Ryujinx.Ava.UI.Windows
NotificationHelper.SetNotificationManager(this); NotificationHelper.SetNotificationManager(this);
} }
private void IsActiveChanged(bool obj)
{
ViewModel.IsActive = obj;
}
private void OnScalingChanged(object sender, EventArgs e) private void OnScalingChanged(object sender, EventArgs e)
{ {
Program.DesktopScaleFactor = this.RenderScaling; Program.DesktopScaleFactor = this.RenderScaling;
@ -355,7 +349,7 @@ namespace Ryujinx.Ava.UI.Windows
await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys)); await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys));
} }
if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false)) if (ConfigurationState.Instance.CheckUpdatesOnStart && Updater.CanUpdate(false))
{ {
await Updater.BeginParse(this, false).ContinueWith(task => await Updater.BeginParse(this, false).ContinueWith(task =>
{ {

View File

@ -4,6 +4,7 @@ using Avalonia.Media;
using Avalonia.Platform; using Avalonia.Platform;
using FluentAvalonia.UI.Windowing; using FluentAvalonia.UI.Windowing;
using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.ViewModels;
namespace Ryujinx.Ava.UI.Windows namespace Ryujinx.Ava.UI.Windows
{ {
@ -16,6 +17,8 @@ namespace Ryujinx.Ava.UI.Windows
LocaleManager.Instance.LocaleChanged += LocaleChanged; LocaleManager.Instance.LocaleChanged += LocaleChanged;
LocaleChanged(); LocaleChanged();
Icon = MainWindowViewModel.IconBitmap;
} }
private void LocaleChanged() private void LocaleChanged()
@ -40,6 +43,8 @@ namespace Ryujinx.Ava.UI.Windows
LocaleManager.Instance.LocaleChanged += LocaleChanged; LocaleManager.Instance.LocaleChanged += LocaleChanged;
LocaleChanged(); LocaleChanged();
Icon = new WindowIcon(MainWindowViewModel.IconBitmap);
} }
private void LocaleChanged() private void LocaleChanged()