Skip to content

Commit 8835e52

Browse files
committed
version info in bottom
configurable effects: rendering mode, shadows, theme instead ofb using only system theme, aliasing mode fix hand cursor was stuck when changing photo with single click new photos extensions by default debug WPF info by 4 clicks on version number (graphics info) version upgrade
1 parent 0d8dbd4 commit 8835e52

7 files changed

Lines changed: 108 additions & 7 deletions

File tree

QuickViewFile/Controls/ZoomableImage.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,24 @@ private void ResetTransforms()
4040

4141
public ZoomableImage()
4242
{
43+
_config = ConfigHelper.loadedConfig;
44+
45+
if (_config?.ShadowEffect == 1)
46+
{
47+
System.Windows.Media.Effects.DropShadowEffect dropShadow = new System.Windows.Media.Effects.DropShadowEffect
48+
{
49+
Color = Colors.Gray,
50+
RenderingBias = _config.ShadowQuality == 1 ? System.Windows.Media.Effects.RenderingBias.Quality : System.Windows.Media.Effects.RenderingBias.Performance,
51+
};
52+
Effect = dropShadow;
53+
}
54+
55+
4356
UseLayoutRounding = true;
4457
transformGroup.Children.Add(scaleTransform);
4558
transformGroup.Children.Add(translateTransform);
46-
ClipToBounds = true;
4759

48-
_config = ConfigHelper.loadedConfig;
60+
ClipToBounds = true;
4961

5062
RenderTransform = transformGroup;
5163

QuickViewFile/Helpers/ConfigHelper.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public static void SaveConfig(ConfigModel config)
4141
key.SetValue(nameof(ConfigModel.VideoExtensions), config.VideoExtensions);
4242
key.SetValue(nameof(ConfigModel.MusicExtensions), config.MusicExtensions);
4343
key.SetValue(nameof(ConfigModel.Utf8InsteadOfASCIITextPreview), config.Utf8InsteadOfASCIITextPreview);
44+
key.SetValue(nameof(ConfigModel.EdgeMode), config.EdgeMode);
45+
key.SetValue(nameof(ConfigModel.RenderMode), config.RenderMode);
46+
key.SetValue(nameof(ConfigModel.ShadowEffect), config.ShadowEffect);
47+
key.SetValue(nameof(ConfigModel.ThemeMode), config.ThemeMode);
48+
key.SetValue(nameof(ConfigModel.ShadowQuality), config.ShadowQuality);
49+
key.SetValue(nameof(ConfigModel.ShadowDepth), config.ShadowDepth);
50+
key.SetValue(nameof(ConfigModel.ShadowOpacity), config.ShadowOpacity);
51+
key.SetValue(nameof(ConfigModel.ShadowBlur), config.ShadowBlur);
4452
}
4553
catch (Exception ex)
4654
{
@@ -80,7 +88,15 @@ public static ConfigModel LoadConfig()
8088
config.ImageExtensions = (string)key.GetValue(nameof(ConfigModel.ImageExtensions).ToString(), config.ImageExtensions);
8189
config.VideoExtensions = (string)key.GetValue(nameof(ConfigModel.VideoExtensions).ToString(), config.VideoExtensions);
8290
config.MusicExtensions = (string)key.GetValue(nameof(ConfigModel.MusicExtensions).ToString(), config.MusicExtensions);
91+
config.EdgeMode = (int)key.GetValue(nameof(ConfigModel.EdgeMode), config.EdgeMode);
92+
config.RenderMode = (int)key.GetValue(nameof(ConfigModel.RenderMode), config.RenderMode);
93+
config.ShadowEffect = (int)key.GetValue(nameof(ConfigModel.ShadowEffect), config.ShadowEffect);
94+
config.ShadowQuality = (int)key.GetValue(nameof(ConfigModel.ShadowQuality), config.ShadowQuality);
95+
config.ThemeMode = (int)key.GetValue(nameof(ConfigModel.ThemeMode), config.ThemeMode);
8396
config.Utf8InsteadOfASCIITextPreview = (int)key.GetValue(nameof(ConfigModel.Utf8InsteadOfASCIITextPreview), config.Utf8InsteadOfASCIITextPreview);
97+
config.ShadowDepth = double.Parse((string)key.GetValue(nameof(ConfigModel.ShadowDepth).ToString(), config.ShadowDepth));
98+
config.ShadowOpacity = double.Parse((string)key.GetValue(nameof(ConfigModel.ShadowOpacity).ToString(), config.ShadowOpacity));
99+
config.ShadowBlur = double.Parse((string)key.GetValue(nameof(ConfigModel.ShadowBlur).ToString(), config.ShadowBlur));
84100
}
85101
catch (Exception ex)
86102
{

QuickViewFile/MainWindow.xaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<Grid.RowDefinitions>
2828
<RowDefinition Height="Auto"/>
2929
<RowDefinition Height="*"/>
30+
<RowDefinition Height="Auto"/>
3031
</Grid.RowDefinitions>
3132

3233
<Grid Grid.Row="0" x:Name="TopInfoPanel">
@@ -203,5 +204,15 @@
203204
</Grid>
204205
</Border>
205206
</Grid>
207+
<Grid Grid.Row="2" x:Name="StatusBar">
208+
<TextBlock x:Name="StatusBarTextBlock"
209+
FontSize="9"
210+
VerticalAlignment="Bottom"
211+
HorizontalAlignment="Left"
212+
Margin="0,0,0,0"
213+
MouseDown="StatusBarTextBlock_MouseDown"
214+
Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"
215+
Text="{Binding StatusBarText}"/>
216+
</Grid>
206217
</Grid>
207218
</Window>

QuickViewFile/MainWindow.xaml.cs

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
using QuickViewFile.Models;
44
using QuickViewFile.ViewModel;
55
using System.IO;
6+
using System.Reflection;
67
using System.Text;
78
using System.Windows;
89
using System.Windows.Controls;
910
using System.Windows.Input;
11+
using System.Windows.Media;
1012

1113
namespace QuickViewFile
1214
{
@@ -21,7 +23,31 @@ public MainWindow()
2123
try
2224
{
2325
_config = ConfigHelper.loadedConfig;
24-
26+
RenderOptions.ProcessRenderMode = _config.RenderMode == 0 ? System.Windows.Interop.RenderMode.Default : System.Windows.Interop.RenderMode.SoftwareOnly;
27+
RenderOptions.SetEdgeMode(this, _config.EdgeMode == 1 ? EdgeMode.Aliased : EdgeMode.Unspecified);
28+
if (_config.ShadowEffect == 1)
29+
{
30+
System.Windows.Media.Effects.DropShadowEffect dropShadow = new System.Windows.Media.Effects.DropShadowEffect
31+
{
32+
ShadowDepth = _config.ShadowDepth,
33+
Opacity = _config.ShadowOpacity,
34+
BlurRadius = _config.ShadowBlur,
35+
RenderingBias = _config.ShadowQuality == 1 ? System.Windows.Media.Effects.RenderingBias.Quality : System.Windows.Media.Effects.RenderingBias.Performance,
36+
};
37+
Effect = dropShadow;
38+
}
39+
if (_config.ThemeMode == 2)
40+
{
41+
#pragma warning disable WPF0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
42+
Application.Current.ThemeMode = ThemeMode.Dark;
43+
#pragma warning restore WPF0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
44+
}
45+
else if (_config.ThemeMode == 1)
46+
{
47+
#pragma warning disable WPF0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
48+
Application.Current.ThemeMode = ThemeMode.Light;
49+
#pragma warning restore WPF0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
50+
}
2551
InitializeComponent();
2652
FilesListView.Focus();
2753

@@ -221,7 +247,7 @@ private void HideUI()
221247
FilesListView.Visibility = Visibility.Collapsed;
222248
TopInfoPanel.Visibility = Visibility.Collapsed;
223249
MainWindowGridSplitter.Visibility = Visibility.Collapsed;
224-
250+
StatusBar.Visibility = Visibility.Collapsed;
225251
_filesListViewVisible = false;
226252
}
227253

@@ -232,6 +258,7 @@ private void ShowUI()
232258
TopInfoPanel.Visibility = Visibility.Visible;
233259
MainWindowGridSplitter.Visibility = Visibility.Visible;
234260
FilesListView.Visibility = Visibility.Visible;
261+
StatusBar.Visibility = Visibility.Visible;
235262
_filesListViewVisible = true;
236263
FilesListView.ScrollIntoView(FilesListView.SelectedItem);
237264
FilesListView.IsSynchronizedWithCurrentItem = true;
@@ -252,10 +279,20 @@ private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
252279
int previousFileIndex = FilesListView.SelectedIndex - 1;
253280

254281
if (mousePosition.X < previousItem)
282+
{
255283
FilesListView.SelectedIndex--;
284+
Mouse.SetCursor(Cursors.None);
285+
Mouse.OverrideCursor = null;
286+
Mouse.UpdateCursor();
287+
}
256288

257289
if (mousePosition.X > nextItem)
290+
{
258291
FilesListView.SelectedIndex++;
292+
Mouse.SetCursor(Cursors.None);
293+
Mouse.OverrideCursor = null;
294+
Mouse.UpdateCursor();
295+
}
259296

260297
if (FilesListView.SelectedIndex < 0)
261298
FilesListView.SelectedIndex = 0;
@@ -440,5 +477,18 @@ private void FilesListView_KeyDown(object sender, KeyEventArgs e)
440477
{
441478

442479
}
480+
481+
private void StatusBarTextBlock_MouseDown(object sender, MouseButtonEventArgs e)
482+
{
483+
if (e.ClickCount == 4)
484+
{
485+
var renderCapabilities = typeof(System.Windows.Media.RenderOptions).GetProperty("ProcessRenderMode", BindingFlags.Static | BindingFlags.NonPublic);
486+
//var tier = System.Windows.Media.RenderCapability.Tier;
487+
int renderingTier = (RenderCapability.Tier >> 16);
488+
string maxHardwareTextureSize = $"{RenderCapability.MaxHardwareTextureSize.Height.ToString()} Width: {RenderCapability.MaxHardwareTextureSize.Width.ToString()}";
489+
490+
MessageBox.Show($"Tier: {renderingTier}\r\nRenderCapabalities: {maxHardwareTextureSize}", "Current Configuration", MessageBoxButton.OK, MessageBoxImage.Information);
491+
}
492+
}
443493
}
444494
}

QuickViewFile/Models/ConfigModel.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ public class ConfigModel
1919
public string BitmapScalingMode { get; set; } = "Fant";
2020
public double FontSize { get; set; } = 13;
2121
public double CharsToPreview { get; set; } = 100000000;
22-
public string ImageExtensions { get; set; } = ".jpg,.jpeg,.png,.bmp,.gif,.tiff,.ico,.webp,.avif";
22+
public string ImageExtensions { get; set; } = ".jpg,.jpeg,.png,.bmp,.gif,.tiff,.ico,.webp,.avif,.heic,.jif";
2323
public string VideoExtensions { get; set; } = ".mp4,.avi,.mov,.wmv,.flv,.mkv,.webm,.mpg,.mpeg";
2424
public string MusicExtensions { get; set; } = ".mp3,.wav,.aac,.flac,.ogg,.wma,.m4a";
2525
[AllowedValues(new object[] { 0, 1 })]
2626
public int Utf8InsteadOfASCIITextPreview { get; set; } = 0;
27+
public int ShadowEffect { get; set; } = 1; // 0 - Disabled, 1 - Enabled
28+
public int ShadowQuality { get; set; } = 1; // 0 - Performance, 1 - Quality
29+
public int RenderMode { get; set; } = 0; // 0 - Default, 1 - SoftwareOnly
30+
public int EdgeMode { get; set; } = 1; // 0 - Unspecified, 1 - Aliased
31+
public int ThemeMode { get; set; } = 0; // 0 - System, 1 - Light, 2 - Dark
32+
public double ShadowDepth { get; set; } = 2;
33+
public double ShadowOpacity { get; set; } = 0.25;
34+
public double ShadowBlur { get; set; } = 25;
2735
}
2836
}

QuickViewFile/QuickViewFile.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<UseWPF>true</UseWPF>
9-
<Version>1.7.2.0</Version>
9+
<Version>1.7.2.1</Version>
1010
<ApplicationIcon>QuickViewFile.ico</ApplicationIcon>
1111
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
1212
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>

QuickViewFile/ViewModel/FilesListViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.ObjectModel;
44
using System.ComponentModel;
55
using System.IO;
6+
using System.Reflection;
67
using System.Text;
78
using System.Windows;
89
using System.Windows.Media.Imaging;
@@ -12,7 +13,7 @@ namespace QuickViewFile.ViewModel
1213
public class FilesListViewModel : INotifyPropertyChanged
1314
{
1415
public ObservableCollection<ItemList> ActiveListItems { get; set; } = [];
15-
16+
1617
public FilesListViewModel(string folderPath)
1718
{
1819
Config = ConfigHelper.loadedConfig;
@@ -27,6 +28,8 @@ public FilesListViewModel(string folderPath)
2728
{
2829
RefreshFiles(folderPath);
2930
}
31+
var appVersion = Assembly.GetExecutingAssembly().GetName().Version!.ToString();
32+
StatusBarText = $"QuickViewFile v {appVersion}";
3033
}
3134

3235
private ItemList? _selectedItem;
@@ -50,6 +53,7 @@ public double PreviewWidth
5053
set { _previewWidth = value; OnPropertyChanged(nameof(PreviewWidth)); }
5154
}
5255

56+
public string StatusBarText { get; set; }
5357

5458
public ItemList? SelectedItem
5559
{

0 commit comments

Comments
 (0)