Skip to content

Commit

Permalink
macOS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Nov 7, 2024
1 parent 3a2ef3f commit a40420e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/PicView.Avalonia.MacOS/Views/MacMainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
MinHeight="{CompiledBinding WindowMinSize}"
MinWidth="{CompiledBinding WindowMinSize}"
SizeChanged="Control_OnSizeChanged"
SizeToContent="{Binding SizeToContent}"
Title="{Binding WindowTitle}"
SizeToContent="{CompiledBinding SizeToContent}"
Title="{CompiledBinding WindowTitle}"
mc:Ignorable="d"
x:Class="PicView.Avalonia.MacOS.Views.MacMainWindow"
x:DataType="viewModels:MainViewModel"
Expand Down Expand Up @@ -82,18 +82,21 @@
<NativeMenuItemSeparator />
<NativeMenuItem Command="{CompiledBinding CropCommand}" Header="{CompiledBinding Crop, Mode=OneWay}" />
<NativeMenuItemSeparator />
<!-- TODO Implement setting as wallpaper for macOS -->
<NativeMenuItem
Command="{CompiledBinding SetAsWallpaperCommand}"
CommandParameter="{CompiledBinding FileInfo.FullName,
FallbackValue=''}"
Header="{CompiledBinding SetAsWallpaper,
Mode=OneWay}" />
Mode=OneWay}"
IsEnabled="False" />
<NativeMenuItem
Command="{CompiledBinding SetAsLockScreenCommand}"
CommandParameter="{CompiledBinding FileInfo.FullName,
FallbackValue=''}"
Header="{CompiledBinding SetAsLockScreenImage,
Mode=OneWay}" />
Mode=OneWay}"
IsEnabled="False" />
<NativeMenuItemSeparator />
<NativeMenuItem Command="{CompiledBinding ShowExifWindowCommand}" Header="{CompiledBinding ImageInfo, Mode=OneWay}" />
<NativeMenuItem Header="{CompiledBinding FileProperties}" />
Expand Down
11 changes: 9 additions & 2 deletions src/PicView.Avalonia/Views/AboutView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Runtime.InteropServices;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Styling;
using PicView.Avalonia.Update;
using PicView.Avalonia.ViewModels;
using PicView.Core.Config;
using PicView.Core.ProcessHandling;

namespace PicView.Avalonia.Views;

Expand Down Expand Up @@ -40,10 +42,15 @@ public AboutView()
KofiImage.Source = drawingImage;
}
};
// TODO: replace with auto update service
UpdateButton.Click += async (_, _) =>
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// TODO: replace with auto update service
ProcessHelper.OpenLink("https://PicView.org/avalonia-download");
return;
}
//Set loading and prevent user from interacting with UI
ParentContainer.Opacity = .1;
ParentContainer.IsHitTestVisible = false;
Expand Down
6 changes: 5 additions & 1 deletion src/PicView.Avalonia/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,11 @@
<Separator />

<!-- Set as wallpaper -->
<MenuItem Header="{CompiledBinding SetAsWallpaper, Mode=OneWay}" PointerReleased="SetWallpaperClick">
<MenuItem
Header="{CompiledBinding SetAsWallpaper,
Mode=OneWay}"
PointerReleased="SetWallpaperClick"
x:Name="WallpaperMenuItem">
<MenuItem.Icon>
<Path
Data="{StaticResource PanoramaGeometry}"
Expand Down
8 changes: 7 additions & 1 deletion src/PicView.Avalonia/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
Expand Down Expand Up @@ -32,6 +33,12 @@ public MainView()
PointerPressed += PointerPressedBehavior;

MainContextMenu.Opened += OnMainContextMenuOpened;

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
// TODO Implement setting as wallpaper for macOS
WallpaperMenuItem.IsEnabled = false;
}

if (DataContext is not MainViewModel vm)
{
Expand All @@ -40,7 +47,6 @@ public MainView()
HideInterfaceLogic.AddHoverButtonEvents(AltButtonsPanel, vm);
PointerWheelChanged += async (_, e) => await vm.ImageViewer.PreviewOnPointerWheelChanged(this, e);
};

}

private void PointerPressedBehavior(object? sender, PointerPressedEventArgs e)
Expand Down

0 comments on commit a40420e

Please sign in to comment.