mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 20:57:22 +02:00
Add Feature Tab in Settings. (Still WIP)
This commit is contained in:
@@ -7,5 +7,6 @@
|
|||||||
"Version":"1.0",
|
"Version":"1.0",
|
||||||
"Language":"csharp",
|
"Language":"csharp",
|
||||||
"Website":"http://www.getwox.com/plugin",
|
"Website":"http://www.getwox.com/plugin",
|
||||||
"ExecuteFileName":"Wox.Plugin.PluginManagement.dll"
|
"ExecuteFileName":"Wox.Plugin.PluginManagement.dll",
|
||||||
|
"IcoPath":"Images\\plugin.png"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Wox.Plugin.System
|
|||||||
InitInternal(context);
|
InitInternal(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public virtual string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -29,12 +29,22 @@ namespace Wox.Plugin.System
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Description
|
public virtual string Description
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "System workflow";
|
return "System workflow";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual string IcoPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string PluginDirectory { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,21 @@ namespace Wox.Plugin.System
|
|||||||
Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
|
Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
|
||||||
return reg.Replace(dataStr, m => ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString());
|
return reg.Replace(dataStr, m => ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "Bookmarks"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\bookmark.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Bookmark : IEquatable<Bookmark>, IEqualityComparer<Bookmark>
|
public class Bookmark : IEquatable<Bookmark>, IEqualityComparer<Bookmark>
|
||||||
|
|||||||
@@ -148,5 +148,19 @@ namespace Wox.Plugin.System.CMD
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "Shell"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\cmd.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,19 @@ namespace Wox.Plugin.System
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "Calculator"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\calculator.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,5 +157,19 @@ namespace Wox.Plugin.System
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "File System"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\folder.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,5 +145,21 @@ namespace Wox.Plugin.System
|
|||||||
if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall"))
|
if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall"))
|
||||||
p.Score -= 20;
|
p.Score -= 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "Programs"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\app.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Wox.Plugin.System
|
|
||||||
{
|
|
||||||
public class Setting : BaseSystemPlugin
|
|
||||||
{
|
|
||||||
private PluginInitContext context;
|
|
||||||
protected override List<Result> QueryInternal(Query query)
|
|
||||||
{
|
|
||||||
List<Result> results = new List<Result>();
|
|
||||||
if ("setting".Contains(query.RawQuery.ToLower()))
|
|
||||||
{
|
|
||||||
results.Add(new Result()
|
|
||||||
{
|
|
||||||
Title = "Wox Setting",
|
|
||||||
Score = 40,
|
|
||||||
IcoPath = "Images/app.png",
|
|
||||||
Action = (contenxt) =>
|
|
||||||
{
|
|
||||||
context.OpenSettingDialog();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void InitInternal(PluginInitContext context)
|
|
||||||
{
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -85,6 +85,34 @@ namespace Wox.Plugin.System
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
availableResults.Add(new Result
|
||||||
|
{
|
||||||
|
Title = "Setting",
|
||||||
|
SubTitle = "Tweak this app",
|
||||||
|
Score = 40,
|
||||||
|
IcoPath = "Images\\app.png",
|
||||||
|
Action = (c) =>
|
||||||
|
{
|
||||||
|
context.OpenSettingDialog();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "System Commands"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\lock.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,5 +62,19 @@ namespace Wox.Plugin.System
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "Plugins"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\work.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,5 +81,20 @@ namespace Wox.Plugin.System
|
|||||||
if (UserSettingStorage.Instance.WebSearches == null)
|
if (UserSettingStorage.Instance.WebSearches == null)
|
||||||
UserSettingStorage.Instance.WebSearches = UserSettingStorage.Instance.LoadDefaultWebSearches();
|
UserSettingStorage.Instance.WebSearches = UserSettingStorage.Instance.LoadDefaultWebSearches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return "Web Searches"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string IcoPath
|
||||||
|
{
|
||||||
|
get { return @"Images\app.png"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get { return base.Description; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@
|
|||||||
<Compile Include="ISystemPlugin.cs" />
|
<Compile Include="ISystemPlugin.cs" />
|
||||||
<Compile Include="Programs.cs" />
|
<Compile Include="Programs.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Setting.cs" />
|
|
||||||
<Compile Include="Sys.cs" />
|
<Compile Include="Sys.cs" />
|
||||||
<Compile Include="ThirdpartyPluginIndicator.cs" />
|
<Compile Include="ThirdpartyPluginIndicator.cs" />
|
||||||
<Compile Include="SuggestionSources\Google.cs" />
|
<Compile Include="SuggestionSources\Google.cs" />
|
||||||
|
|||||||
@@ -35,5 +35,7 @@ namespace Wox.Plugin
|
|||||||
public string PluginDirecotry { get; set; }
|
public string PluginDirecotry { get; set; }
|
||||||
public string ActionKeyword { get; set; }
|
public string ActionKeyword { get; set; }
|
||||||
public PluginType PluginType { get; set; }
|
public PluginType PluginType { get; set; }
|
||||||
|
|
||||||
|
public string IcoPath { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,13 @@ namespace Wox.PluginLoader
|
|||||||
Plugin = Activator.CreateInstance(type) as IPlugin,
|
Plugin = Activator.CreateInstance(type) as IPlugin,
|
||||||
Metadata = metadata
|
Metadata = metadata
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var sys = pair.Plugin as BaseSystemPlugin;
|
||||||
|
if (sys != null)
|
||||||
|
{
|
||||||
|
sys.PluginDirectory = metadata.PluginDirecotry;
|
||||||
|
}
|
||||||
|
|
||||||
plugins.Add(pair);
|
plugins.Add(pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,21 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:wox="clr-namespace:Wox"
|
xmlns:wox="clr-namespace:Wox"
|
||||||
xmlns:UserSettings="clr-namespace:Wox.Infrastructure.Storage.UserSettings;assembly=Wox.Infrastructure" x:Class="Wox.SettingWindow"
|
xmlns:UserSettings="clr-namespace:Wox.Infrastructure.Storage.UserSettings;assembly=Wox.Infrastructure" x:Class="Wox.SettingWindow"
|
||||||
|
xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin"
|
||||||
|
xmlns:system="clr-namespace:Wox.Plugin.System;assembly=Wox.Plugin.System"
|
||||||
Icon="Images\app.png"
|
Icon="Images\app.png"
|
||||||
Title="Wox Setting"
|
Title="Wox Setting"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Height="600" Width="800">
|
Height="600" Width="800">
|
||||||
|
<Window.Resources>
|
||||||
|
<wox:ImagePathConverter x:Key="ImagePathConverter"/>
|
||||||
|
<ListBoxItem HorizontalContentAlignment="Stretch"
|
||||||
|
IsEnabled="False"
|
||||||
|
IsHitTestVisible="False" x:Key="FeatureBoxSeperator">
|
||||||
|
<Separator Width="{Binding ElementName=featureBox, Path=ActualWidth}"/>
|
||||||
|
</ListBoxItem>
|
||||||
|
</Window.Resources>
|
||||||
<TabControl Height="auto" >
|
<TabControl Height="auto" >
|
||||||
<TabItem Header="Basic">
|
<TabItem Header="Basic">
|
||||||
<StackPanel Orientation="Vertical" Margin="10">
|
<StackPanel Orientation="Vertical" Margin="10">
|
||||||
@@ -255,5 +264,83 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Header="Features">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="250"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ListBox x:Name="featureBox" Grid.Column="0" Margin="0" SelectionChanged="featureBox_OnSelectionChanged" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Grid.IsSharedSizeScope="True" >
|
||||||
|
<ListBox.Resources>
|
||||||
|
<DataTemplate DataType="{x:Type system:BaseSystemPlugin}">
|
||||||
|
<Grid Height="36" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="3">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="32"></ColumnDefinition>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Image Width="32" Height="32" HorizontalAlignment="Left">
|
||||||
|
<Image.Source>
|
||||||
|
<MultiBinding Converter="{StaticResource ImagePathConverter}">
|
||||||
|
<MultiBinding.Bindings>
|
||||||
|
<Binding Path="IcoPath" />
|
||||||
|
<Binding Path="PluginDirectory" />
|
||||||
|
</MultiBinding.Bindings>
|
||||||
|
</MultiBinding>
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Grid Margin="3 0 3 0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock VerticalAlignment="Center" ToolTip="{Binding Name}" x:Name="tbTitle" Text="{Binding Name}"></TextBlock>
|
||||||
|
<TextBlock ToolTip="{Binding Description}" Visibility="{Binding Description, Converter={wox:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding Description}" Opacity="0.5"></TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type woxPlugin:PluginPair}">
|
||||||
|
<Grid Height="36" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="3">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="32"></ColumnDefinition>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Image Width="32" Height="32" HorizontalAlignment="Left">
|
||||||
|
<Image.Source>
|
||||||
|
<MultiBinding Converter="{StaticResource ImagePathConverter}">
|
||||||
|
<MultiBinding.Bindings>
|
||||||
|
<Binding Path="Metadata.IcoPath" />
|
||||||
|
<Binding Path="Metadata.PluginDirecotry" />
|
||||||
|
</MultiBinding.Bindings>
|
||||||
|
</MultiBinding>
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Grid Margin="3 0 3 0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock VerticalAlignment="Center" ToolTip="{Binding Metadata.Name}" x:Name="tbTitle" Text="{Binding Metadata.Name}"></TextBlock>
|
||||||
|
<TextBlock ToolTip="{Binding Metadata.Description}" Visibility="{Binding Metadata.Description, Converter={wox:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding Metadata.Description}" Opacity="0.5"></TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.Resources>
|
||||||
|
</ListBox>
|
||||||
|
<Grid Margin="0" Grid.Column="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="80"/>
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Margin="10" Orientation="Vertical">
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel x:Name="PluginContentPanel" Grid.ColumnSpan="1" Grid.Row="1" Margin="0">
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Wox.Helper;
|
|||||||
using Application = System.Windows.Forms.Application;
|
using Application = System.Windows.Forms.Application;
|
||||||
using File = System.IO.File;
|
using File = System.IO.File;
|
||||||
using MessageBox = System.Windows.MessageBox;
|
using MessageBox = System.Windows.MessageBox;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace Wox
|
namespace Wox
|
||||||
{
|
{
|
||||||
@@ -157,6 +158,24 @@ namespace Wox
|
|||||||
cbEnablePythonPlugins.IsChecked = UserSettingStorage.Instance.EnablePythonPlugins;
|
cbEnablePythonPlugins.IsChecked = UserSettingStorage.Instance.EnablePythonPlugins;
|
||||||
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
||||||
|
|
||||||
|
var features = new CompositeCollection
|
||||||
|
{
|
||||||
|
new CollectionContainer()
|
||||||
|
{
|
||||||
|
Collection =
|
||||||
|
PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System)
|
||||||
|
.Select(o => o.Plugin)
|
||||||
|
.Cast<Wox.Plugin.System.ISystemPlugin>()
|
||||||
|
},
|
||||||
|
FindResource("FeatureBoxSeperator"),
|
||||||
|
new CollectionContainer()
|
||||||
|
{
|
||||||
|
Collection =
|
||||||
|
PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.ThirdParty)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
featureBox.ItemsSource = features;
|
||||||
|
|
||||||
slOpacity.Value = UserSettingStorage.Instance.Opacity;
|
slOpacity.Value = UserSettingStorage.Instance.Opacity;
|
||||||
CbOpacityMode.SelectedItem = UserSettingStorage.Instance.OpacityMode;
|
CbOpacityMode.SelectedItem = UserSettingStorage.Instance.OpacityMode;
|
||||||
|
|
||||||
@@ -473,5 +492,10 @@ namespace Wox
|
|||||||
else
|
else
|
||||||
PreviewMainPanel.Opacity = 1;
|
PreviewMainPanel.Opacity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void featureBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
// throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user