Skip to content

Commit 7e3158d

Browse files
lampenlampenyaira2
authored andcommitted
QuickLook Icon + QuickLook in PhotoView (#355)
* QuickLook Icon * Enable QuickLook in PhotoView
1 parent 9a8ed35 commit 7e3158d

File tree

7 files changed

+48
-13
lines changed

7 files changed

+48
-13
lines changed
22.2 KB
Loading

Files/BaseLayout.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Runtime.InteropServices.WindowsRuntime;
88
using Windows.Foundation;
99
using Windows.Foundation.Collections;
10+
using Windows.Storage;
1011
using Windows.UI.Core;
1112
using Windows.UI.Xaml;
1213
using Windows.UI.Xaml.Controls;
@@ -24,6 +25,8 @@ namespace Files
2425
/// </summary>
2526
public class BaseLayout : Page
2627
{
28+
protected bool IsQuickLookEnabled { get; set; } = false;
29+
2730
public ItemViewModel AssociatedViewModel = null;
2831
public Interaction AssociatedInteractions = null;
2932
public bool isRenamingItem = false;
@@ -68,6 +71,15 @@ public BaseLayout()
6871
{
6972
this.Loaded += Page_Loaded;
7073
Page_Loaded(null, null);
74+
75+
// QuickLook Integration
76+
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
77+
var isQuickLookIntegrationEnabled = localSettings.Values["quicklook_enabled"];
78+
79+
if (isQuickLookIntegrationEnabled != null && isQuickLookIntegrationEnabled.Equals(true))
80+
{
81+
IsQuickLookEnabled = true;
82+
}
7183
}
7284

7385
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)

Files/Files.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@
233233
<Content Include="Assets\FilesDrive.png" />
234234
<Content Include="Assets\logo.bmp" />
235235
<None Include="Package.StoreAssociation.xml" />
236+
<Content Include="Assets\QuickLook\quicklook_icon_black.png" />
236237
<Content Include="Assets\StoreLogo.png" />
237238
<Content Include="Assets\WSL\alpine.svg" />
238239
<Content Include="Assets\WSL\alpinepng.png" />

Files/GenericFileBrowser.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@
147147
<FontIcon Glyph="&#xE946;"/>
148148
</MenuFlyoutItem.Icon>
149149
</MenuFlyoutItem>
150-
<MenuFlyoutItem Click="{x:Bind AssociatedInteractions.ToggleQuickLook_Click}" Text="QuickLook" x:Name="QuickLook" Visibility="{x:Bind _isQuickLookEnabled}">
150+
<MenuFlyoutItem Click="{x:Bind AssociatedInteractions.ToggleQuickLook_Click}" Text="QuickLook" x:Name="QuickLook" Visibility="{x:Bind IsQuickLookEnabled}">
151+
<MenuFlyoutItem.Icon>
152+
<BitmapIcon UriSource="ms-appx:///Assets/QuickLook/quicklook_icon_black.png"/>
153+
</MenuFlyoutItem.Icon>
151154
<MenuFlyoutItem.KeyboardAccelerators>
152155
<KeyboardAccelerator Key="Space"/>
153156
</MenuFlyoutItem.KeyboardAccelerators>
@@ -220,4 +223,4 @@
220223

221224

222225
</Grid>
223-
</local:BaseLayout>
226+
</local:BaseLayout>

Files/GenericFileBrowser.xaml.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ namespace Files
1616
{
1717
public sealed partial class GenericFileBrowser : BaseLayout
1818
{
19-
private bool _isQuickLookEnabled { get; set; } = false;
2019
public string previousFileName;
2120
private DataGridColumn _sortedColumn;
2221
public DataGridColumn SortedColumn
@@ -70,15 +69,6 @@ public GenericFileBrowser()
7069
}
7170

7271
App.OccupiedInstance.instanceViewModel.PropertyChanged += ViewModel_PropertyChanged;
73-
74-
// QuickLook Integration
75-
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
76-
var isQuickLookIntegrationEnabled = localSettings.Values["quicklook_enabled"];
77-
78-
if (isQuickLookIntegrationEnabled != null && isQuickLookIntegrationEnabled.Equals(true))
79-
{
80-
_isQuickLookEnabled = true;
81-
}
8272
}
8373

8474
private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)

Files/PhotoAlbum.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@
149149
<FontIcon Glyph="&#xE946;"/>
150150
</MenuFlyoutItem.Icon>
151151
</MenuFlyoutItem>
152+
<MenuFlyoutItem Click="{x:Bind AssociatedInteractions.ToggleQuickLook_Click}" Text="QuickLook" x:Name="QuickLook" Visibility="{x:Bind IsQuickLookEnabled}">
153+
<MenuFlyoutItem.Icon>
154+
<BitmapIcon UriSource="ms-appx:///Assets/QuickLook/quicklook_icon_black.png"/>
155+
</MenuFlyoutItem.Icon>
156+
<MenuFlyoutItem.KeyboardAccelerators>
157+
<KeyboardAccelerator Key="Space"/>
158+
</MenuFlyoutItem.KeyboardAccelerators>
159+
</MenuFlyoutItem>
152160
</MenuFlyout>
153161
</local:BaseLayout.Resources>
154162

Files/SettingsPages/About.xaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<Grid Margin="24,14">
1212
<Grid.RowDefinitions>
1313
<RowDefinition Height="Auto"/>
14-
<RowDefinition Height="*"/>
14+
<RowDefinition Height="Auto"/>
15+
<RowDefinition />
1516
</Grid.RowDefinitions>
1617
<StackPanel Spacing="24" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
1718
<Grid Height="150" Width="150">
@@ -45,5 +46,25 @@
4546
</ListView>
4647
</StackPanel>
4748

49+
<StackPanel Grid.Row="2">
50+
<TextBlock Text="Third Party Licenses" FontSize="18" Margin="0,16,0,0"/>
51+
<ListView>
52+
<ListViewItem>
53+
<StackPanel>
54+
<StackPanel Orientation="Horizontal">
55+
<BitmapIcon UriSource="ms-appx:///Assets/QuickLook/quicklook_icon_black.png" Width="16" VerticalAlignment="Center"/>
56+
<TextBlock Text="QuickLook" FontSize="16" VerticalAlignment="Bottom" Margin="2,0,16,0"/>
57+
<TextBlock TextWrapping="WrapWholeWords" VerticalAlignment="Bottom" Margin="0,0,8,0">
58+
<Span xml:space="preserve"><Run>Website: </Run><Hyperlink NavigateUri="https://github.com/QL-Win/QuickLook">Link</Hyperlink></Span>
59+
</TextBlock>
60+
<TextBlock TextWrapping="WrapWholeWords" VerticalAlignment="Bottom">
61+
<Span xml:space="preserve"><Run>License: </Run><Hyperlink NavigateUri="https://github.com/QL-Win/QuickLook/blob/master/LICENSE-GPL.txt">Link</Hyperlink></Span>
62+
</TextBlock>
63+
</StackPanel>
64+
</StackPanel>
65+
</ListViewItem>
66+
</ListView>
67+
</StackPanel>
68+
4869
</Grid>
4970
</Page>

0 commit comments

Comments
 (0)