From 8c4a37e3a6ca3cbd65c0fc74dc8f55772408969b Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Wed, 18 Apr 2018 22:23:28 +0300 Subject: [PATCH] Global dark theme --- QuickLook.Common/Plugin/ContextObject.cs | 10 +++---- QuickLook.Common/Plugin/Themes.cs | 26 ++++++++++++++++++ QuickLook.Common/QuickLook.Common.csproj | 16 ++++++++++- .../Styles/MainWindowStyles.Dark.xaml | 0 .../Styles/MainWindowStyles.xaml | 0 .../Styles/ScrollBarStyleDictionary.xaml | 4 +-- .../ArchiveFileListView.xaml | 8 +++--- .../ArchiveInfoPanel.xaml | 12 ++++----- .../ImagePanel.xaml | 4 +-- .../QuickLook.Plugin.ImageViewer/Plugin.cs | 2 +- .../PdfViewerControl.xaml | 11 ++++---- .../PdfViewerControl.xaml.cs | 3 +++ .../QuickLook.Plugin.TextViewer/Plugin.cs | 2 ++ .../QuickLook.Plugin.VideoViewer/Plugin.cs | 2 +- .../QuickLook.Plugin.VideoViewer/Styles.xaml | 2 +- .../ViewerPanel.xaml.cs | 5 +--- QuickLook/App.xaml | 2 +- QuickLook/Plugin/InfoPanel/InfoPanel.xaml | 2 +- QuickLook/QuickLook.csproj | 12 --------- QuickLook/ViewerWindow.Properties.cs | 27 +++++++++++++++---- QuickLook/ViewerWindow.xaml | 2 +- 21 files changed, 100 insertions(+), 52 deletions(-) create mode 100644 QuickLook.Common/Plugin/Themes.cs rename {QuickLook => QuickLook.Common}/Styles/MainWindowStyles.Dark.xaml (100%) rename {QuickLook => QuickLook.Common}/Styles/MainWindowStyles.xaml (100%) rename {QuickLook => QuickLook.Common}/Styles/ScrollBarStyleDictionary.xaml (99%) diff --git a/QuickLook.Common/Plugin/ContextObject.cs b/QuickLook.Common/Plugin/ContextObject.cs index df3e308..3fd0a30 100644 --- a/QuickLook.Common/Plugin/ContextObject.cs +++ b/QuickLook.Common/Plugin/ContextObject.cs @@ -37,7 +37,7 @@ namespace QuickLook.Common.Plugin private bool _titlebarBlurVisibility; private bool _titlebarColourVisibility = true; private bool _titlebarOverlap; - private bool _useDarkTheme; + private Themes _theme = Themes.None; private object _viewerContent; /// @@ -168,12 +168,12 @@ namespace QuickLook.Common.Plugin /// /// Switch to dark theme? /// - public bool UseDarkTheme + public Themes Theme { - get => _useDarkTheme; + get => _theme; set { - _useDarkTheme = value; + _theme = value; OnPropertyChanged(); } } @@ -213,7 +213,7 @@ namespace QuickLook.Common.Plugin CanResize = true; FullWindowDragging = false; - UseDarkTheme = false; + Theme = Themes.None; TitlebarOverlap = false; TitlebarAutoHide = false; TitlebarBlurVisibility = false; diff --git a/QuickLook.Common/Plugin/Themes.cs b/QuickLook.Common/Plugin/Themes.cs new file mode 100644 index 0000000..50971a1 --- /dev/null +++ b/QuickLook.Common/Plugin/Themes.cs @@ -0,0 +1,26 @@ +// Copyright © 2018 Paddy Xu +// +// This file is part of QuickLook program. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +namespace QuickLook.Common.Plugin +{ + public enum Themes + { + None, + Dark, + Light + } +} \ No newline at end of file diff --git a/QuickLook.Common/QuickLook.Common.csproj b/QuickLook.Common/QuickLook.Common.csproj index e73d3dc..e100f7b 100644 --- a/QuickLook.Common/QuickLook.Common.csproj +++ b/QuickLook.Common/QuickLook.Common.csproj @@ -57,6 +57,7 @@ + @@ -64,6 +65,19 @@ - + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + \ No newline at end of file diff --git a/QuickLook/Styles/MainWindowStyles.Dark.xaml b/QuickLook.Common/Styles/MainWindowStyles.Dark.xaml similarity index 100% rename from QuickLook/Styles/MainWindowStyles.Dark.xaml rename to QuickLook.Common/Styles/MainWindowStyles.Dark.xaml diff --git a/QuickLook/Styles/MainWindowStyles.xaml b/QuickLook.Common/Styles/MainWindowStyles.xaml similarity index 100% rename from QuickLook/Styles/MainWindowStyles.xaml rename to QuickLook.Common/Styles/MainWindowStyles.xaml diff --git a/QuickLook/Styles/ScrollBarStyleDictionary.xaml b/QuickLook.Common/Styles/ScrollBarStyleDictionary.xaml similarity index 99% rename from QuickLook/Styles/ScrollBarStyleDictionary.xaml rename to QuickLook.Common/Styles/ScrollBarStyleDictionary.xaml index 6568b60..4674848 100644 --- a/QuickLook/Styles/ScrollBarStyleDictionary.xaml +++ b/QuickLook.Common/Styles/ScrollBarStyleDictionary.xaml @@ -98,7 +98,7 @@ - + @@ -124,7 +124,7 @@ + Background="Transparent" /> - + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml index cdcfd86..f26a632 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml @@ -11,7 +11,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -32,16 +32,16 @@ - + - - - + + + diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml index c716fb7..c18db8a 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml @@ -12,8 +12,8 @@ - - + + diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs index ece7a20..8b5d027 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs @@ -64,7 +64,7 @@ namespace QuickLook.Plugin.ImageViewer else context.PreferredSize = new Size(800, 600); - context.UseDarkTheme = true; + context.Theme = Themes.Dark; } public void View(string path, ContextObject context) diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml index a7673fb..4a5488c 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml @@ -13,6 +13,7 @@ + @@ -26,9 +27,9 @@ VirtualizingPanel.IsVirtualizing="True" Width="150" SelectedIndex="0" Focusable="False" - Background="Transparent" + Background="Transparent" BorderThickness="0" ItemsSource="{Binding PageThumbnails, ElementName=thisPdfViewer}" - ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0,0,1,0" + ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{Binding Mode=OneWay, Source={StaticResource ListBoxItemStyleNoFocusedBorder}}"> @@ -44,7 +45,7 @@ - + - +