From 57f129bda34928f304e204aa8126a77007f6875d Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Sat, 27 Jan 2018 16:33:06 +0200 Subject: [PATCH] fix translations and settings --- .../ContextObject.cs | 29 ------------------- .../TextViewerPanel.xaml.cs | 4 +-- .../ViewerPanel.xaml.cs | 5 ++-- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/QuickLook.Plugin.IViewerPlugin/ContextObject.cs b/QuickLook.Plugin.IViewerPlugin/ContextObject.cs index bad7a26..9bb2597 100644 --- a/QuickLook.Plugin.IViewerPlugin/ContextObject.cs +++ b/QuickLook.Plugin.IViewerPlugin/ContextObject.cs @@ -17,8 +17,6 @@ using System; using System.ComponentModel; -using System.Globalization; -using System.Reflection; using System.Runtime.CompilerServices; using System.Windows; using QuickLook.Common.Annotations; @@ -182,33 +180,6 @@ namespace QuickLook.Common public event PropertyChangedEventHandler PropertyChanged; - /// - /// Get a string from translation Xml document. - /// - [MethodImpl(MethodImplOptions.NoInlining)] - public string GetString(string id, string file = null, CultureInfo locale = null, string failsafe = null) - { - return TranslationHelper.Get(id, file, locale, failsafe, Assembly.GetCallingAssembly()); - } - - /// - /// Get a setting from Xml document. - /// - [MethodImpl(MethodImplOptions.NoInlining)] - public T GetSetting(string id, T failsafe = default(T)) - { - return SettingHelper.Get(id, failsafe, Assembly.GetCallingAssembly()); - } - - /// - /// Set a setting from Xml document. - /// - [MethodImpl(MethodImplOptions.NoInlining)] - public void SetSetting(string id, object value) - { - SettingHelper.Set(id, value, Assembly.GetCallingAssembly()); - } - /// /// Set the size of viewer window, scale or shrink to fit (to screen resolution). /// The window can take maximum (maxRatio*resolution) space. diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs index a810593..d9db107 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs @@ -22,6 +22,7 @@ using System.Windows.Input; using System.Windows.Media; using ICSharpCode.AvalonEdit.Highlighting; using QuickLook.Common; +using QuickLook.Common.Helpers; using UtfUnknown; namespace QuickLook.Plugin.TextViewer @@ -41,8 +42,7 @@ namespace QuickLook.Plugin.TextViewer viewer.PreviewMouseWheel += Viewer_MouseWheel; - viewer.FontFamily = - new FontFamily(context.GetString("Editor_FontFamily")); + viewer.FontFamily = new FontFamily(TranslationHelper.Get("Editor_FontFamily")); LoadFile(path); } diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs index 3a58851..ee508fa 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs @@ -32,6 +32,7 @@ using Meta.Vlc.Interop.Media; using QuickLook.Common; using QuickLook.Common.Annotations; using QuickLook.Common.ExtensionMethods; +using QuickLook.Common.Helpers; using MediaState = Meta.Vlc.Interop.Media.MediaState; namespace QuickLook.Plugin.VideoViewer @@ -169,7 +170,7 @@ namespace QuickLook.Plugin.VideoViewer public void Dispose() { - _context.SetSetting("Volume", mediaElement.Volume); + SettingHelper.Set("Volume", mediaElement.Volume); try { @@ -320,7 +321,7 @@ namespace QuickLook.Plugin.VideoViewer public void LoadAndPlay(string path) { mediaElement.LoadMediaWithOptions(path, ":avcodec-hw=dxva2"); - mediaElement.Volume = _context.GetSetting("Volume", 50); + mediaElement.Volume = SettingHelper.Get("Volume", 50); mediaElement.Play(); }