Add system plugin descriptions.

This commit is contained in:
qianlifeng 2014-06-30 21:31:13 +08:00
parent 4ee0731472
commit fad6a406a1
24 changed files with 111 additions and 119 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -13,7 +13,6 @@ namespace Wox.Plugin.BrowserBookmark
private PluginInitContext context;
private List<Bookmark> bookmarks = new List<Bookmark>();
public void Init(PluginInitContext context)
{
bookmarks.Clear();

View File

@ -64,9 +64,6 @@
<Content Include="Images\bookmark.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Images\plugin.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -8,5 +8,5 @@
"Language":"csharp",
"Website":"http://www.getwox.com/plugin",
"ExecuteFileName":"Wox.Plugin.browserBookmark.dll",
"IcoPath":"Images\\plugin.png"
"IcoPath":"Images\\bookmark.png"
}

View File

@ -62,12 +62,6 @@ namespace Wox.Infrastructure.Storage.UserSettings
[JsonProperty]
public bool StartWoxOnSystemStartup { get; set; }
[JsonProperty]
public bool EnablePythonPlugins { get; set; }
[JsonProperty]
public bool EnableBookmarkPlugin { get; set; }
[JsonProperty]
public double Opacity { get; set; }
@ -105,6 +99,16 @@ namespace Wox.Infrastructure.Storage.UserSettings
};
webSearches.Add(wikiWebSearch);
WebSearch findIcon = new WebSearch()
{
Title = "FindIcon",
ActionWord = "findicon",
IconPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\pictures.png",
Url = "http://findicons.com/search/{q}",
Enabled = true
};
webSearches.Add(findIcon);
return webSearches;
}
@ -139,8 +143,6 @@ namespace Wox.Infrastructure.Storage.UserSettings
protected override void LoadDefaultConfig()
{
EnablePythonPlugins = true;
EnableBookmarkPlugin = true;
Theme = "Dark";
ReplaceWinR = true;
WebSearches = LoadDefaultWebSearches();

View File

@ -160,7 +160,7 @@ namespace Wox.Plugin.SystemPlugins.CMD
public override string Description
{
get { return base.Description; }
get { return "Provide executing commands from Wox. Commands should start with >"; }
}
}
}

View File

@ -97,7 +97,10 @@ namespace Wox.Plugin.SystemPlugins
public override string Description
{
get { return base.Description; }
get
{
return "Provide mathematical calculations.(Try 5*3-2 in Wox)";
}
}
}
}

View File

@ -10,7 +10,7 @@ namespace Wox.Plugin.SystemPlugins
{
public sealed class ColorsPlugin : BaseSystemPlugin
{
private const string DIR_PATH = ".\\Plugins\\Colors\\";
private string DIR_PATH = Path.Combine(Path.GetTempPath(), @"Plugins\Colors\");
private const int IMG_SIZE = 32;
private DirectoryInfo ColorsDirectory { get; set; }
@ -82,7 +82,7 @@ namespace Wox.Plugin.SystemPlugins
return ColorsDirectory.GetFiles(file, SearchOption.TopDirectoryOnly);
}
public string CreateImage(string name)
private string CreateImage(string name)
{
using (var bitmap = new Bitmap(IMG_SIZE, IMG_SIZE))
using (var graphics = Graphics.FromImage(bitmap))
@ -108,7 +108,10 @@ namespace Wox.Plugin.SystemPlugins
public override string Description
{
get { return string.Empty; }
get
{
return "Provide hex color preview.(Try #000 in Wox)";
}
}
public override string IcoPath

View File

@ -7,17 +7,23 @@ using System.Windows.Forms;
using Wox.Infrastructure;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.SystemPlugins.FileSystem {
namespace Wox.Plugin.SystemPlugins.Folder {
public class FileSystemPlugin : BaseSystemPlugin, ISettingProvider {
public class FolderPlugin : BaseSystemPlugin, ISettingProvider {
#region Properties
private PluginInitContext context;
private static List<string> driverNames = null;
private static Dictionary<string, DirectoryInfo[]> parentDirectories = new Dictionary<string, DirectoryInfo[]>();
public override string Description { get { return base.Description; } }
public override string Name { get { return "File System"; } }
public override string Description {
get
{
return "Provide opening folder from wox directorily. You can add your favorite folders.";
}
}
public override string Name { get { return "Folder"; } }
public override string IcoPath { get { return @"Images\folder.png"; } }
#endregion Properties

View File

@ -1,4 +1,4 @@
<UserControl x:Class="Wox.Plugin.SystemPlugins.FileSystem.FileSystemSettings"
<UserControl x:Class="Wox.Plugin.SystemPlugins.Folder.FileSystemSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@ -1,18 +1,18 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.SystemPlugins.FileSystem {
namespace Wox.Plugin.SystemPlugins.Folder {
/// <summary>
/// Interaction logic for FileSystemSettings.xaml
/// </summary>
public partial class FileSystemSettings : UserControl {
public FileSystemSettings() {
InitializeComponent();
lbxFolders.ItemsSource = Wox.Infrastructure.Storage.UserSettings.UserSettingStorage.Instance.FolderLinks;
lbxFolders.ItemsSource = UserSettingStorage.Instance.FolderLinks;
}
private void btnDelete_Click(object sender, RoutedEventArgs e) {
@ -55,7 +55,7 @@ namespace Wox.Plugin.SystemPlugins.FileSystem {
private void btnAdd_Click(object sender, RoutedEventArgs e) {
var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
var newFolder = new Wox.Infrastructure.Storage.UserSettings.FolderLink() {
var newFolder = new FolderLink() {
Path = folderBrowserDialog.SelectedPath
};

View File

@ -147,12 +147,12 @@ namespace Wox.Plugin.SystemPlugins.Program
public override string IcoPath
{
get { return @"Images\app.png"; }
get { return @"Images\program.png"; }
}
public override string Description
{
get { return base.Description; }
get { return "Provide searching programs in your computer."; }
}
#region ISettingProvider Members

View File

@ -130,7 +130,7 @@ namespace Wox.Plugin.SystemPlugins
public override string Description
{
get { return base.Description; }
get { return "Provide System related commands. e.g. shutdown,lock,setting etc."; }
}
}
}

View File

@ -63,17 +63,17 @@ namespace Wox.Plugin.SystemPlugins
public override string Name
{
get { return "Plugins"; }
get { return "Third-party Plugin Indicator"; }
}
public override string IcoPath
{
get { return @"Images\work.png"; }
get { return @"Images\list.png"; }
}
public override string Description
{
get { return base.Description; }
get { return "Provide Third-party plugin actionword suggeestion."; }
}
}
}

View File

@ -32,7 +32,7 @@ namespace Wox.Plugin.SystemPlugins
}
public override string Name { get { return "URL handler"; } }
public override string Description { get { return "Open the typed URL..."; } }
public override string Description { get { return "Provide Opening the typed URL from Wox."; } }
public override string IcoPath { get { return "Images/url2.png"; } }
protected override void InitInternal(PluginInitContext context)

View File

@ -88,12 +88,12 @@ namespace Wox.Plugin.SystemPlugins
public override string IcoPath
{
get { return @"Images\app.png"; }
get { return @"Images\web_search.png"; }
}
public override string Description
{
get { return base.Description; }
get { return "Provide the web search ability."; }
}
#region ISettingProvider Members

View File

@ -1,16 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.SystemPlugins

View File

@ -56,8 +56,8 @@
<ItemGroup>
<Compile Include="CMD\CMDStorage.cs" />
<Compile Include="ColorsPlugin.cs" />
<Compile Include="FileSystem\FileSystemSettings.xaml.cs">
<DependentUpon>FileSystemSettings.xaml</DependentUpon>
<Compile Include="Folder\FolderPluginSettings.xaml.cs">
<DependentUpon>FolderPluginSettings.xaml</DependentUpon>
</Compile>
<Compile Include="Program\ProgramSetting.xaml.cs">
<DependentUpon>ProgramSetting.xaml</DependentUpon>
@ -79,7 +79,7 @@
</Compile>
<Compile Include="WebSearch\WebSearchPlugin.cs" />
<Compile Include="CMD\CMD.cs" />
<Compile Include="FileSystem\FileSystemPlugin.cs" />
<Compile Include="Folder\FolderPlugin.cs" />
<Compile Include="ISystemPlugin.cs" />
<Compile Include="Program\Programs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -102,7 +102,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="FileSystem\FileSystemSettings.xaml">
<Page Include="Folder\FolderPluginSettings.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>

BIN
Wox/Images/list.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
Wox/Images/program.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
Wox/Images/web_search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -25,10 +25,7 @@ namespace Wox.PluginLoader {
plugins.Clear();
BasePluginLoader.ParsePluginsConfig();
if (UserSettingStorage.Instance.EnablePythonPlugins) {
plugins.AddRange(new PythonPluginLoader().LoadPlugin());
}
plugins.AddRange(new PythonPluginLoader().LoadPlugin());
plugins.AddRange(new CSharpPluginLoader().LoadPlugin());
Forker forker = new Forker();
foreach (IPlugin plugin in plugins.Select(pluginPair => pluginPair.Plugin)) {

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
@ -27,6 +26,7 @@ namespace Wox
{
string woxLinkPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "wox.lnk");
public MainWindow MainWindow;
bool settingsLoaded = false;
private Dictionary<ISettingProvider, Control> featureControls = new Dictionary<ISettingProvider, Control>();
public SettingWindow()
@ -41,7 +41,6 @@ namespace Wox
Loaded += Setting_Loaded;
}
bool settingsLoaded = false;
private void Setting_Loaded(object sender, RoutedEventArgs ev)
{
ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged;
@ -80,7 +79,13 @@ namespace Wox
UserSettingStorage.Instance.Save();
};
#region Load Theme Data
cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR;
lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen;
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
#region Load Theme
if (!string.IsNullOrEmpty(UserSettingStorage.Instance.QueryBoxFont) &&
Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(UserSettingStorage.Instance.QueryBoxFont)) > 0)
@ -125,40 +130,37 @@ namespace Wox
Title = "Search web contents with shortcuts",
SubTitle = "e.g. search google with g keyword or youtube keyword)",
IcoPath = "Images/work.png",
PluginDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
},
new Result()
{
Title = "clipboard history ",
IcoPath = "Images/work.png",
PluginDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
},
new Result()
{
Title = "Themes support",
SubTitle = "get more themes from http://www.getwox.com/theme",
IcoPath = "Images/work.png",
PluginDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
},
new Result()
{
Title = "Plugins support",
SubTitle = "get more plugins from http://www.getwox.com/plugin",
IcoPath = "Images/work.png",
PluginDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
},
new Result()
{
Title = "Wox is an open-source software",
SubTitle = "Wox benefits from the open-source community a lot",
IcoPath = "Images/work.png",
PluginDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
}
});
#endregion
foreach (string theme in LoadAvailableThemes())
{
string themeName = System.IO.Path.GetFileNameWithoutExtension(theme);
@ -166,30 +168,6 @@ namespace Wox
}
themeComboBox.SelectedItem = UserSettingStorage.Instance.Theme;
cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR;
lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen;
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
var features = new CompositeCollection
{
new CollectionContainer()
{
Collection =
PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System)
.Select(o => o.Plugin)
.Cast<Wox.Plugin.SystemPlugins.ISystemPlugin>()
},
FindResource("FeatureBoxSeperator"),
new CollectionContainer()
{
Collection =
PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.ThirdParty)
}
};
lbPlugins.ItemsSource = features;
slOpacity.Value = UserSettingStorage.Instance.Opacity;
CbOpacityMode.SelectedItem = UserSettingStorage.Instance.OpacityMode;
@ -198,13 +176,37 @@ namespace Wox
{
var brush = new ImageBrush(new BitmapImage(new Uri(wallpaper)));
brush.Stretch = Stretch.UniformToFill;
this.PreviewPanel.Background = brush;
PreviewPanel.Background = brush;
}
else
{
var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor();
this.PreviewPanel.Background = new SolidColorBrush(wallpaperColor);
PreviewPanel.Background = new SolidColorBrush(wallpaperColor);
}
#endregion
#region Load Plugin
var plugins = new CompositeCollection
{
new CollectionContainer
{
Collection =
PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System)
.Select(o => o.Plugin)
.Cast<ISystemPlugin>()
},
FindResource("FeatureBoxSeperator"),
new CollectionContainer
{
Collection =
PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.ThirdParty)
}
};
lbPlugins.ItemsSource = plugins;
lbPlugins.SelectedIndex = 0;
#endregion
//PreviewPanel
settingsLoaded = true;
@ -213,7 +215,7 @@ namespace Wox
private List<string> LoadAvailableThemes()
{
string themePath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Themes");
string themePath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Themes");
return Directory.GetFiles(themePath).Where(filePath => filePath.EndsWith(".xaml") && !filePath.EndsWith("Default.xaml")).ToList();
}
@ -316,18 +318,6 @@ namespace Wox
#endregion
private void BtnEnableInstaller_OnClick(object sender, RoutedEventArgs e)
{
try
{
Process.Start("Wox.UAC.exe", "AssociatePluginInstaller");
}
catch (Exception)
{
//throw an exception when user click cancel in UAC prompt window.
}
}
#region Theme
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
@ -434,7 +424,11 @@ namespace Wox
var pair = lbPlugins.SelectedItem as PluginPair;
if (pair != null)
{
//third-party plugin
provider = pair.Plugin as ISettingProvider;
pluginAuthor.Visibility = Visibility.Visible;
pluginActionKeyword.Visibility = Visibility.Visible;
pluginWebsite.Visibility = Visibility.Visible;
pluginTitle.Text = pair.Metadata.Name;
pluginActionKeyword.Text = "ActionKeyword: " + pair.Metadata.ActionKeyword;
pluginAuthor.Text = "Author: " + pair.Metadata.Author;
@ -442,31 +436,33 @@ namespace Wox
pluginSubTitle.Text = pair.Metadata.Description;
SyntaxSugars.CallOrRescueDefault(
() =>
pluginIcon.Source =
(ImageSource)
new ImagePathConverter().Convert(
new object[] {pair.Metadata.IcoPath, pair.Metadata.PluginDirecotry}, null, null,
pluginIcon.Source = (ImageSource)new ImagePathConverter().Convert(
new object[]
{
pair.Metadata.IcoPath,
pair.Metadata.PluginDirecotry
}, null, null,
null));
}
else
{
//system plugin
provider = lbPlugins.SelectedItem as ISettingProvider;
var sys = lbPlugins.SelectedItem as BaseSystemPlugin;
if (sys != null)
{
pluginTitle.Text = sys.Name;
pluginSubTitle.Text = sys.Description;
pluginAuthor.Text = "Author: Wox";
pluginActionKeyword.Text = "ActionKeyword: auto trigger";
pluginWebsite.Text = "Website: http://www.getwox.com";
pluginAuthor.Visibility = Visibility.Collapsed;
pluginActionKeyword.Visibility = Visibility.Collapsed;
pluginWebsite.Visibility = Visibility.Collapsed;
SyntaxSugars.CallOrRescueDefault(
() =>
pluginIcon.Source =
(ImageSource)
new ImagePathConverter().Convert(
new object[] { sys.IcoPath, sys.PluginDirectory }, null, null,
null));
pluginIcon.Source = (ImageSource) new ImagePathConverter().Convert( new object[]
{
sys.IcoPath,
sys.PluginDirectory
}, null, null,null));
}
}