fix translations and settings

This commit is contained in:
Paddy Xu
2018-01-27 16:33:06 +02:00
parent 56af2311b9
commit 57f129bda3
3 changed files with 5 additions and 33 deletions

View File

@@ -17,8 +17,6 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Windows; using System.Windows;
using QuickLook.Common.Annotations; using QuickLook.Common.Annotations;
@@ -182,33 +180,6 @@ namespace QuickLook.Common
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Get a string from translation Xml document.
/// </summary>
[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());
}
/// <summary>
/// Get a setting from Xml document.
/// </summary>
[MethodImpl(MethodImplOptions.NoInlining)]
public T GetSetting<T>(string id, T failsafe = default(T))
{
return SettingHelper.Get(id, failsafe, Assembly.GetCallingAssembly());
}
/// <summary>
/// Set a setting from Xml document.
/// </summary>
[MethodImpl(MethodImplOptions.NoInlining)]
public void SetSetting(string id, object value)
{
SettingHelper.Set(id, value, Assembly.GetCallingAssembly());
}
/// <summary> /// <summary>
/// Set the size of viewer window, scale or shrink to fit (to screen resolution). /// Set the size of viewer window, scale or shrink to fit (to screen resolution).
/// The window can take maximum (maxRatio*resolution) space. /// The window can take maximum (maxRatio*resolution) space.

View File

@@ -22,6 +22,7 @@ using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Highlighting;
using QuickLook.Common; using QuickLook.Common;
using QuickLook.Common.Helpers;
using UtfUnknown; using UtfUnknown;
namespace QuickLook.Plugin.TextViewer namespace QuickLook.Plugin.TextViewer
@@ -41,8 +42,7 @@ namespace QuickLook.Plugin.TextViewer
viewer.PreviewMouseWheel += Viewer_MouseWheel; viewer.PreviewMouseWheel += Viewer_MouseWheel;
viewer.FontFamily = viewer.FontFamily = new FontFamily(TranslationHelper.Get("Editor_FontFamily"));
new FontFamily(context.GetString("Editor_FontFamily"));
LoadFile(path); LoadFile(path);
} }

View File

@@ -32,6 +32,7 @@ using Meta.Vlc.Interop.Media;
using QuickLook.Common; using QuickLook.Common;
using QuickLook.Common.Annotations; using QuickLook.Common.Annotations;
using QuickLook.Common.ExtensionMethods; using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using MediaState = Meta.Vlc.Interop.Media.MediaState; using MediaState = Meta.Vlc.Interop.Media.MediaState;
namespace QuickLook.Plugin.VideoViewer namespace QuickLook.Plugin.VideoViewer
@@ -169,7 +170,7 @@ namespace QuickLook.Plugin.VideoViewer
public void Dispose() public void Dispose()
{ {
_context.SetSetting("Volume", mediaElement.Volume); SettingHelper.Set("Volume", mediaElement.Volume);
try try
{ {
@@ -320,7 +321,7 @@ namespace QuickLook.Plugin.VideoViewer
public void LoadAndPlay(string path) public void LoadAndPlay(string path)
{ {
mediaElement.LoadMediaWithOptions(path, ":avcodec-hw=dxva2"); mediaElement.LoadMediaWithOptions(path, ":avcodec-hw=dxva2");
mediaElement.Volume = _context.GetSetting("Volume", 50); mediaElement.Volume = SettingHelper.Get("Volume", 50);
mediaElement.Play(); mediaElement.Play();
} }