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()
{
context.API.ShowApp();
context.API.ChangeQuery(">");
// todo don't hardcode action keywords.
context.API.ChangeQuery($">{Plugin.Query.TermSeperater}");
}
public Control CreateSettingPanel()

View File

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

View File

@@ -47,12 +47,6 @@ namespace Wox.Plugin.Everything
try
{
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)
{
var path = s.FullPath;

View File

@@ -30,24 +30,24 @@ namespace Wox.Plugin.Program
{
var fuzzyMather = FuzzyMatcher.Create(query.Search);
List<Program> returnList = programs.Where(o => MatchProgram(o, fuzzyMather)).ToList();
returnList.ForEach(ScoreFilter);
returnList = returnList.OrderByDescending(o => o.Score).ToList();
return returnList.Select(c => new Result()
{
Title = c.Title,
SubTitle = c.ExecutePath,
IcoPath = c.IcoPath,
Score = c.Score,
ContextData = c,
Action = (e) =>
{
context.API.HideApp();
context.API.ShellRun(c.ExecutePath);
return true;
}
}).ToList();
var results = programs.Where(o => MatchProgram(o, fuzzyMather)).
Select(ScoreFilter).
OrderByDescending(o => o.Score)
.Select(c => new Result()
{
Title = c.Title,
SubTitle = c.ExecutePath,
IcoPath = c.IcoPath,
Score = c.Score,
ContextData = c,
Action = (e) =>
{
context.API.HideApp();
context.API.ShellRun(c.ExecutePath);
return true;
}
}).ToList();
return results;
}
static string ResolveShortcut(string filePath)
@@ -60,12 +60,10 @@ namespace Wox.Plugin.Program
private bool MatchProgram(Program program, FuzzyMatcher matcher)
{
if ((program.Score = matcher.Evaluate(program.Title).Score) > 0) return true;
if ((program.Score = matcher.Evaluate(program.PinyinTitle).Score) > 0) return true;
if (program.AbbrTitle != null && (program.Score = matcher.Evaluate(program.AbbrTitle).Score) > 0) return true;
if (program.ExecuteName != null && (program.Score = matcher.Evaluate(program.ExecuteName).Score) > 0) return true;
return false;
var scores = new List<string> { program.Title, program.PinyinTitle, program.AbbrTitle, program.ExecuteName };
program.Score = scores.Select(s => matcher.Evaluate(s ?? string.Empty).Score).Max();
if (program.Score > 0) return true;
else return false;
}
public void Init(PluginInitContext context)
@@ -161,7 +159,7 @@ namespace Wox.Plugin.Program
return list;
}
private void ScoreFilter(Program p)
private Program ScoreFilter(Program p)
{
p.Score += p.Source.BonusPoints;
@@ -173,6 +171,7 @@ namespace Wox.Plugin.Program
if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall"))
p.Score -= 20;
return p;
}
#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
{
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 bool _isUpdate;
private WebSearch _updateWebSearch;
@@ -50,7 +51,7 @@ namespace Wox.Plugin.WebSearch
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)
@@ -126,15 +127,15 @@ namespace Wox.Plugin.WebSearch
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));
}
var dlg = new OpenFileDialog
{
InitialDirectory = _defaultWebSearchImageDirectory,
InitialDirectory = Path.Combine(_pluginDirectory, _imageDirectoryName),
Filter = "Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) |*.jpg; *.jpeg; *.gif; *.png; *.bmp"
};
@@ -142,8 +143,11 @@ namespace Wox.Plugin.WebSearch
if (result == true)
{
string filename = dlg.FileName;
tbIconPath.Text = Path.GetFileName(filename);
ShowIcon(tbIconPath.Text);
if (filename != null)
{
tbIconPath.Text = Path.Combine(_imageDirectoryName, Path.GetFileName(filename));
ShowIcon(tbIconPath.Text);
}
}
}
}

View File

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

View File

@@ -66,7 +66,13 @@
<Compile Include="WebSearchStorage.cs" />
</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>
</None>
<Content Include="Languages\en.xaml">
@@ -114,16 +120,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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" />
<!-- 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.

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
=========
1. Search for applications, folders, files and in the browser bookmarks (using a plugin)
2. Search the web using shortcuts (e.g. search google with `g keyword` or Youtube `youtube keyword`)
3. Themes support, get more themes from [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)
1. Search all applications, folders, files, [bookmarks](https://www.getwox.com/plugin/16).
2. Search Web using keyword (e.g. search google with `g search_term`)
3. Build custom themes in [http://www.getwox.com/theme/builder](http://www.getwox.com/theme/builder)
4. Install plugins from [http://www.getwox.com/plugin](http://www.getwox.com/plugin)
Screenshot
=========
@@ -35,18 +35,13 @@ Simple Usage
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
=========
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.
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");
throw new WoxPluginException(plugin.Metadata.Name, msg);
}
// do nothing if they are same
if (oldActionKeyword == newActionKeyword) return;
if (NonGlobalPlugins.ContainsKey(newActionKeyword))
{
string msg = InternationalizationManager.Instance.GetTranslation("newActionKeywordsHasBeenAssigned");

View File

@@ -47,7 +47,10 @@ namespace Wox.Plugin
Result r = obj as Result;
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
{
@@ -57,7 +60,9 @@ namespace Wox.Plugin
public override int GetHashCode()
{
var hashcode = (Title?.GetHashCode() ?? 0) ^ (SubTitle?.GetHashCode() ?? 0);
var hashcode = (Title?.GetHashCode() ?? 0) ^
(SubTitle?.GetHashCode() ?? 0) ^
(Score.GetHashCode());
return hashcode;
}

View File

@@ -16,9 +16,6 @@
Icon="Images\app.png"
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">
<StackPanel Orientation="Vertical">
<TextBox Style="{DynamicResource QueryBoxStyle}" PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True"

View File

@@ -106,9 +106,7 @@
<CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">
<TextBlock Text="{DynamicResource disable}"></TextBlock>
</CheckBox>
<TextBlock x:Name="pluginActionKeywordsTitle" Margin="20 0 0 0">
<TextBlock Text="{DynamicResource actionKeywords}"></TextBlock>
</TextBlock>
<TextBlock x:Name="pluginActionKeywordsTitle" Margin="20 0 0 0" Text="{DynamicResource actionKeywords}" />
<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="Query time: 0ms" x:Name="pluginQueryTime"></TextBlock>
@@ -144,9 +142,6 @@
</Grid.ColumnDefinitions>
<StackPanel x:Name="PreviewPanel" Grid.Row="0" Margin="0">
<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}">
<Grid>
<Grid.RowDefinitions>
@@ -231,7 +226,7 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{DynamicResource actionKeyword}" Width="500">
<GridViewColumn Header="{DynamicResource actionKeywords}" Width="500">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ActionKeywords}"/>