merge master

This commit is contained in:
bao-qian
2015-11-26 06:57:12 +00:00
15 changed files with 67 additions and 81 deletions

View File

@@ -176,7 +176,8 @@ namespace Wox.Plugin.CMD
private void OnWinRPressed() private void OnWinRPressed()
{ {
context.API.ShowApp(); context.API.ShowApp();
context.API.ChangeQuery(">"); // todo don't hardcode action keywords.
context.API.ChangeQuery($">{Plugin.Query.TermSeperater}");
} }
public Control CreateSettingPanel() public Control CreateSettingPanel()

View File

@@ -227,8 +227,6 @@ namespace Wox.Plugin.Everything.Everything
yield break; yield break;
} }
Everything_SortResultsByPath();
const int bufferSize = 4096; const int bufferSize = 4096;
StringBuilder buffer = new StringBuilder(bufferSize); StringBuilder buffer = new StringBuilder(bufferSize);
for (int idx = 0; idx < Everything_GetNumResults(); ++idx) for (int idx = 0; idx < Everything_GetNumResults(); ++idx)

View File

@@ -47,12 +47,6 @@ namespace Wox.Plugin.Everything
try try
{ {
var searchList = api.Search(keyword, maxCount: ContextMenuStorage.Instance.MaxSearchCount).ToList(); var searchList = api.Search(keyword, maxCount: ContextMenuStorage.Instance.MaxSearchCount).ToList();
var fuzzyMather = FuzzyMatcher.Create(keyword);
searchList.Sort(
(x, y) =>
fuzzyMather.Evaluate(Path.GetFileName(y.FullPath)).Score -
fuzzyMather.Evaluate(Path.GetFileName(x.FullPath)).Score);
foreach (var s in searchList) foreach (var s in searchList)
{ {
var path = s.FullPath; var path = s.FullPath;

View File

@@ -30,24 +30,24 @@ namespace Wox.Plugin.Program
{ {
var fuzzyMather = FuzzyMatcher.Create(query.Search); var fuzzyMather = FuzzyMatcher.Create(query.Search);
List<Program> returnList = programs.Where(o => MatchProgram(o, fuzzyMather)).ToList(); var results = programs.Where(o => MatchProgram(o, fuzzyMather)).
returnList.ForEach(ScoreFilter); Select(ScoreFilter).
returnList = returnList.OrderByDescending(o => o.Score).ToList(); OrderByDescending(o => o.Score)
.Select(c => new Result()
return returnList.Select(c => new Result() {
{ Title = c.Title,
Title = c.Title, SubTitle = c.ExecutePath,
SubTitle = c.ExecutePath, IcoPath = c.IcoPath,
IcoPath = c.IcoPath, Score = c.Score,
Score = c.Score, ContextData = c,
ContextData = c, Action = (e) =>
Action = (e) => {
{ context.API.HideApp();
context.API.HideApp(); context.API.ShellRun(c.ExecutePath);
context.API.ShellRun(c.ExecutePath); return true;
return true; }
} }).ToList();
}).ToList(); return results;
} }
static string ResolveShortcut(string filePath) static string ResolveShortcut(string filePath)
@@ -60,12 +60,10 @@ namespace Wox.Plugin.Program
private bool MatchProgram(Program program, FuzzyMatcher matcher) private bool MatchProgram(Program program, FuzzyMatcher matcher)
{ {
if ((program.Score = matcher.Evaluate(program.Title).Score) > 0) return true; var scores = new List<string> { program.Title, program.PinyinTitle, program.AbbrTitle, program.ExecuteName };
if ((program.Score = matcher.Evaluate(program.PinyinTitle).Score) > 0) return true; program.Score = scores.Select(s => matcher.Evaluate(s ?? string.Empty).Score).Max();
if (program.AbbrTitle != null && (program.Score = matcher.Evaluate(program.AbbrTitle).Score) > 0) return true; if (program.Score > 0) return true;
if (program.ExecuteName != null && (program.Score = matcher.Evaluate(program.ExecuteName).Score) > 0) return true; else return false;
return false;
} }
public void Init(PluginInitContext context) public void Init(PluginInitContext context)
@@ -161,7 +159,7 @@ namespace Wox.Plugin.Program
return list; return list;
} }
private void ScoreFilter(Program p) private Program ScoreFilter(Program p)
{ {
p.Score += p.Source.BonusPoints; p.Score += p.Source.BonusPoints;
@@ -173,6 +171,7 @@ namespace Wox.Plugin.Program
if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall")) if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall"))
p.Score -= 20; p.Score -= 20;
return p;
} }
#region ISettingProvider Members #region ISettingProvider Members

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -11,7 +11,8 @@ namespace Wox.Plugin.WebSearch
{ {
public partial class WebSearchSetting : Window public partial class WebSearchSetting : Window
{ {
private string _defaultWebSearchImageDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images\\websearch"); private const string _imageDirectoryName = "Images";
private string _pluginDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
private readonly WebSearchesSetting _settingWindow; private readonly WebSearchesSetting _settingWindow;
private bool _isUpdate; private bool _isUpdate;
private WebSearch _updateWebSearch; private WebSearch _updateWebSearch;
@@ -50,7 +51,7 @@ namespace Wox.Plugin.WebSearch
private void ShowIcon(string path) private void ShowIcon(string path)
{ {
imgIcon.Source = new BitmapImage(new Uri($"{_defaultWebSearchImageDirectory}\\{path}", UriKind.Absolute)); imgIcon.Source = new BitmapImage(new Uri(Path.Combine(_pluginDirectory, path), UriKind.Absolute));
} }
private void BtnCancel_OnClick(object sender, RoutedEventArgs e) private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
@@ -126,15 +127,15 @@ namespace Wox.Plugin.WebSearch
private void BtnSelectIcon_OnClick(object sender, RoutedEventArgs e) private void BtnSelectIcon_OnClick(object sender, RoutedEventArgs e)
{ {
if (!Directory.Exists(_defaultWebSearchImageDirectory)) if (!Directory.Exists(_pluginDirectory))
{ {
_defaultWebSearchImageDirectory = _pluginDirectory =
Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
} }
var dlg = new OpenFileDialog var dlg = new OpenFileDialog
{ {
InitialDirectory = _defaultWebSearchImageDirectory, InitialDirectory = Path.Combine(_pluginDirectory, _imageDirectoryName),
Filter = "Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) |*.jpg; *.jpeg; *.gif; *.png; *.bmp" Filter = "Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) |*.jpg; *.jpeg; *.gif; *.png; *.bmp"
}; };
@@ -142,8 +143,11 @@ namespace Wox.Plugin.WebSearch
if (result == true) if (result == true)
{ {
string filename = dlg.FileName; string filename = dlg.FileName;
tbIconPath.Text = Path.GetFileName(filename); if (filename != null)
ShowIcon(tbIconPath.Text); {
tbIconPath.Text = Path.Combine(_imageDirectoryName, Path.GetFileName(filename));
ShowIcon(tbIconPath.Text);
}
} }
} }
} }

View File

@@ -41,7 +41,7 @@ namespace Wox.Plugin.WebSearch
{ {
Title = "Google", Title = "Google",
ActionKeyword = "g", ActionKeyword = "g",
IconPath = @"google.png", IconPath = @"Images\google.png",
Url = "https://www.google.com/search?q={q}", Url = "https://www.google.com/search?q={q}",
Enabled = true Enabled = true
}; };
@@ -52,7 +52,7 @@ namespace Wox.Plugin.WebSearch
{ {
Title = "Wikipedia", Title = "Wikipedia",
ActionKeyword = "wiki", ActionKeyword = "wiki",
IconPath = @"wiki.png", IconPath = @"Images\wiki.png",
Url = "http://en.wikipedia.org/wiki/{q}", Url = "http://en.wikipedia.org/wiki/{q}",
Enabled = true Enabled = true
}; };
@@ -62,7 +62,7 @@ namespace Wox.Plugin.WebSearch
{ {
Title = "FindIcon", Title = "FindIcon",
ActionKeyword = "findicon", ActionKeyword = "findicon",
IconPath = @"pictures.png", IconPath = @"Images\pictures.png",
Url = "http://findicons.com/search/{q}", Url = "http://findicons.com/search/{q}",
Enabled = true Enabled = true
}; };

View File

@@ -66,7 +66,13 @@
<Compile Include="WebSearchStorage.cs" /> <Compile Include="WebSearchStorage.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Images\websearch\pictures.png"> <None Include="Images\google.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Images\pictures.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Images\wiki.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<Content Include="Languages\en.xaml"> <Content Include="Languages\en.xaml">
@@ -114,16 +120,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Images\websearch\google.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\websearch\wiki.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -1,13 +1,13 @@
Wox [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/qianlifeng/wox) <a href="https://chocolatey.org/packages/wox"><img src="https://img.shields.io/badge/chocolatey-wox-b4884f.svg?style=flat" style="height:auto; width: 100%"></a> [![Bountysource](https://www.bountysource.com/badge/team?team_id=39433&style=raised)](https://www.bountysource.com/teams/wox?utm_source=Wox&utm_medium=shield&utm_campaign=raised) Wox [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/qianlifeng/wox) [![Bountysource](https://www.bountysource.com/badge/team?team_id=39433&style=raised)](https://www.bountysource.com/teams/wox?utm_source=Wox&utm_medium=shield&utm_campaign=raised)
========= =========
[Wox](http://www.getwox.com) is a launcher for windows, inspired by [Alfred](http://www.alfredapp.com/) and [Launchy](http://www.launchy.net/). Wox indexes your programs, your documents, project files, folders, and bookmarks. You can launch everything with just a few keystrokes!. [Wox](http://www.getwox.com) is a launcher for windows, inspired by [Alfred](http://www.alfredapp.com/) and [Launchy](http://www.launchy.net/). You can launch everything with just a few keystrokes!.
Features Features
========= =========
1. Search for applications, folders, files and in the browser bookmarks (using a plugin) 1. Search all applications, folders, files, [bookmarks](https://www.getwox.com/plugin/16).
2. Search the web using shortcuts (e.g. search google with `g keyword` or Youtube `youtube keyword`) 2. Search Web using keyword (e.g. search google with `g search_term`)
3. Themes support, get more themes from [http://www.getwox.com/theme/builder](http://www.getwox.com/theme/builder) 3. Build custom themes in [http://www.getwox.com/theme/builder](http://www.getwox.com/theme/builder)
4. Plugin support, get more plugins from [http://www.getwox.com/plugin](http://www.getwox.com/plugin) 4. Install plugins from [http://www.getwox.com/plugin](http://www.getwox.com/plugin)
Screenshot Screenshot
========= =========
@@ -35,18 +35,13 @@ Simple Usage
Contribute Contribute
========= =========
If you are a developer, feel free to send a pull request to the **Dev** branch. We still have a lot of features and bugs to resolve. Take a look at [issues page](https://github.com/qianlifeng/Wox/issues) if you want to contribute :) If you are a developer, please feel free to send a pull request to the **Dev** branch. We still have a lot of features and bugs to resolve. Take a look at [issues page](https://github.com/qianlifeng/Wox/issues) if you want to contribute :)
If you are not a developer, you can still contribute to the project. Install the beta version, test things and help us with new entries and corrections to the docs [Wox doc](http://doc.getwox.com). Feedback is always welcome! If you are not a developer, please install the [Latest build](https://ci.appveyor.com/project/qianlifeng/wox/history) and report bugs (how to: [English](https://github.com/Wox-launcher/Wox/wiki/FAQ-English) [中文](https://github.com/Wox-launcher/Wox/wiki/FAQ-%E4%B8%AD%E6%96%87)). Feedback is always welcome!
Docs Docs
========= =========
Full documentation can be found here [Wox Documentation](http://doc.getwox.com). This is a good place to start if you are installing Wox for the first time. Feel free to contribute if you want to improve, correct or translate the documentation. Full documentation can be found here [Wox doc](http://doc.getwox.com). This is a good place to start if you are installing Wox for the first time.
In the future, all of the documentation will be moved back to Github wiki. In the future, all of the documentation will be moved back to Github wiki.
Discussion
=========
Do you have a question or an idea for a killer feature? Discuss things with our community at the [Wox Fourms](http://discussion.getwox.com).

View File

@@ -257,6 +257,8 @@ namespace Wox.Core.Plugin
string msg = InternationalizationManager.Instance.GetTranslation("newActionKeywordsCannotBeEmpty"); string msg = InternationalizationManager.Instance.GetTranslation("newActionKeywordsCannotBeEmpty");
throw new WoxPluginException(plugin.Metadata.Name, msg); throw new WoxPluginException(plugin.Metadata.Name, msg);
} }
// do nothing if they are same
if (oldActionKeyword == newActionKeyword) return;
if (NonGlobalPlugins.ContainsKey(newActionKeyword)) if (NonGlobalPlugins.ContainsKey(newActionKeyword))
{ {
string msg = InternationalizationManager.Instance.GetTranslation("newActionKeywordsHasBeenAssigned"); string msg = InternationalizationManager.Instance.GetTranslation("newActionKeywordsHasBeenAssigned");

View File

@@ -47,7 +47,10 @@ namespace Wox.Plugin
Result r = obj as Result; Result r = obj as Result;
if (r != null) if (r != null)
{ {
return string.Equals(r.Title, Title) && string.Equals(r.SubTitle, SubTitle); var equality = string.Equals(r.Title, Title) &&
string.Equals(r.SubTitle, SubTitle) &&
r.Score == Score;
return equality;
} }
else else
{ {
@@ -57,7 +60,9 @@ namespace Wox.Plugin
public override int GetHashCode() public override int GetHashCode()
{ {
var hashcode = (Title?.GetHashCode() ?? 0) ^ (SubTitle?.GetHashCode() ?? 0); var hashcode = (Title?.GetHashCode() ?? 0) ^
(SubTitle?.GetHashCode() ?? 0) ^
(Score.GetHashCode());
return hashcode; return hashcode;
} }

View File

@@ -16,9 +16,6 @@
Icon="Images\app.png" Icon="Images\app.png"
AllowsTransparency="True" AllowsTransparency="True"
> >
<Window.Resources>
<ResourceDictionary Source="/PresentationFramework.Classic,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Classic.xaml"/>
</Window.Resources>
<Border Style="{DynamicResource WindowBorderStyle}" MouseDown="Border_OnMouseDown"> <Border Style="{DynamicResource WindowBorderStyle}" MouseDown="Border_OnMouseDown">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<TextBox Style="{DynamicResource QueryBoxStyle}" PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True" <TextBox Style="{DynamicResource QueryBoxStyle}" PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True"

View File

@@ -106,9 +106,7 @@
<CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick"> <CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">
<TextBlock Text="{DynamicResource disable}"></TextBlock> <TextBlock Text="{DynamicResource disable}"></TextBlock>
</CheckBox> </CheckBox>
<TextBlock x:Name="pluginActionKeywordsTitle" Margin="20 0 0 0"> <TextBlock x:Name="pluginActionKeywordsTitle" Margin="20 0 0 0" Text="{DynamicResource actionKeywords}" />
<TextBlock Text="{DynamicResource actionKeywords}"></TextBlock>
</TextBlock>
<TextBlock Margin="5 0 0 0" ToolTip="Change Action Keywords" Cursor="Hand" MouseUp="PluginActionKeywords_OnMouseUp" Foreground="Blue" Text="keys" x:Name="pluginActionKeywords"></TextBlock> <TextBlock Margin="5 0 0 0" ToolTip="Change Action Keywords" Cursor="Hand" MouseUp="PluginActionKeywords_OnMouseUp" Foreground="Blue" Text="keys" x:Name="pluginActionKeywords"></TextBlock>
<TextBlock Margin="10 0 0 0" Text="Init time: 0ms" x:Name="pluginInitTime"></TextBlock> <TextBlock Margin="10 0 0 0" Text="Init time: 0ms" x:Name="pluginInitTime"></TextBlock>
<TextBlock Margin="10 0 0 0" Text="Query time: 0ms" x:Name="pluginQueryTime"></TextBlock> <TextBlock Margin="10 0 0 0" Text="Query time: 0ms" x:Name="pluginQueryTime"></TextBlock>
@@ -144,9 +142,6 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel x:Name="PreviewPanel" Grid.Row="0" Margin="0"> <StackPanel x:Name="PreviewPanel" Grid.Row="0" Margin="0">
<StackPanel x:Name="PreviewMainPanel" Orientation="Horizontal" Margin="10" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel x:Name="PreviewMainPanel" Orientation="Horizontal" Margin="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel.Resources>
<ResourceDictionary Source="/PresentationFramework.Classic,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Classic.xaml"/>
</StackPanel.Resources>
<Border Width="500" Style="{DynamicResource WindowBorderStyle}"> <Border Width="500" Style="{DynamicResource WindowBorderStyle}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -231,7 +226,7 @@
</DataTemplate> </DataTemplate>
</GridViewColumn.CellTemplate> </GridViewColumn.CellTemplate>
</GridViewColumn> </GridViewColumn>
<GridViewColumn Header="{DynamicResource actionKeyword}" Width="500"> <GridViewColumn Header="{DynamicResource actionKeywords}" Width="500">
<GridViewColumn.CellTemplate> <GridViewColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding ActionKeywords}"/> <TextBlock Text="{Binding ActionKeywords}"/>