Skip to content

Commit

Permalink
UI: Add program icon to windows other than the main
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Oct 25, 2024
1 parent 570c7cf commit 7d88dfa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 33 deletions.
27 changes: 4 additions & 23 deletions src/Ryujinx/UI/Windows/DownloadableContentManagerWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
<UserControl.Resources>
<helpers:DownloadableContentLabelConverter x:Key="DownloadableContentLabel" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,Auto,*,Auto">
<StackPanel
Grid.Row="0"
Margin="0 0 0 10"
Expand All @@ -44,12 +38,7 @@
<Panel
Margin="0 0 0 10"
Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid ColumnDefinitions="Auto,Auto,*">
<TextBlock
Grid.Column="0"
Text="{Binding UpdateCount}" />
Expand Down Expand Up @@ -101,17 +90,9 @@
<DataTemplate
DataType="models:DownloadableContentModel">
<Panel Margin="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid ColumnDefinitions="*,Auto">
<Grid
Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
Grid.Column="0" ColumnDefinitions="*,Auto">
<TextBlock
Grid.Column="0"
HorizontalAlignment="Left"
Expand Down
1 change: 0 additions & 1 deletion src/Ryujinx/UI/Windows/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
x:DataType="viewModels:MainWindowViewModel"
mc:Ignorable="d"
WindowStartupLocation="Manual"
Icon="resm:Ryujinx.UI.Common.Resources.Logo_Ryujinx.png?assembly=Ryujinx.UI.Common"
Focusable="True">
<Window.Styles>
<Style Selector="TitleBar:fullscreen">
Expand Down
12 changes: 3 additions & 9 deletions src/Ryujinx/UI/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public MainWindow()
TitleBar.ExtendsContentIntoTitleBar = true;
TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;


// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
StatusBarHeight = StatusBarView.StatusBar.MinHeight;
MenuBarHeight = MenuBar.MinHeight;
Expand All @@ -98,15 +97,15 @@ public MainWindow()
{
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());

this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
_ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it);
this.ScalingChanged += OnScalingChanged;
}
}

/// <summary>
/// Event handler for detecting OS theme change when using "Follow OS theme" option
/// </summary>
private void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
private static void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
{
if (Application.Current is App app)
app.ApplyConfiguredTheme();
Expand All @@ -128,11 +127,6 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
NotificationHelper.SetNotificationManager(this);
}

private void IsActiveChanged(bool obj)
{
ViewModel.IsActive = obj;
}

private void OnScalingChanged(object sender, EventArgs e)
{
Program.DesktopScaleFactor = this.RenderScaling;
Expand Down Expand Up @@ -355,7 +349,7 @@ private async Task CheckLaunchState()
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 =>
{
Expand Down
5 changes: 5 additions & 0 deletions src/Ryujinx/UI/Windows/StyleableWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Avalonia.Platform;
using FluentAvalonia.UI.Windowing;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.ViewModels;

namespace Ryujinx.Ava.UI.Windows
{
Expand All @@ -16,6 +17,8 @@ public StyleableAppWindow()

LocaleManager.Instance.LocaleChanged += LocaleChanged;
LocaleChanged();

Icon = MainWindowViewModel.IconBitmap;
}

private void LocaleChanged()
Expand All @@ -40,6 +43,8 @@ public StyleableWindow()

LocaleManager.Instance.LocaleChanged += LocaleChanged;
LocaleChanged();

Icon = new WindowIcon(MainWindowViewModel.IconBitmap);
}

private void LocaleChanged()
Expand Down

0 comments on commit 7d88dfa

Please sign in to comment.