adjusting how programs are displayed. (#2369)

* Removing description from title

* adjusting subtitle

* removing accidently paste

* removing desc for uwp apps
This commit is contained in:
Clint Rutkas 2020-04-23 18:25:57 -07:00 committed by GitHub
parent 92daf156f5
commit 845c6be95f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 361 additions and 391 deletions

View File

@ -72,7 +72,8 @@ namespace Wox.Plugin.Program
UWP.Application[] uwps; UWP.Application[] uwps;
lock (IndexLock) lock (IndexLock)
{ // just take the reference inside the lock to eliminate query time issues. {
// just take the reference inside the lock to eliminate query time issues.
win32 = _win32s; win32 = _win32s;
uwps = _uwps; uwps = _uwps;
} }
@ -118,7 +119,6 @@ namespace Wox.Plugin.Program
public static void IndexPrograms() public static void IndexPrograms()
{ {
var t1 = Task.Run(() => IndexWin32Programs()); var t1 = Task.Run(() => IndexWin32Programs());
var t2 = Task.Run(() => IndexUWPPrograms()); var t2 = Task.Run(() => IndexUWPPrograms());
Task.WaitAll(t1, t2); Task.WaitAll(t1, t2);
@ -153,32 +153,8 @@ namespace Wox.Plugin.Program
return menuOptions; return menuOptions;
} }
private void DisableProgram(IProgram programToDelete)
{
if (_settings.DisabledProgramSources.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
return;
if (_uwps.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_uwps.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier).FirstOrDefault().Enabled = false;
if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_win32s.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier).FirstOrDefault().Enabled = false;
_settings.DisabledProgramSources
.Add(
new Settings.DisabledProgramSource
{
Name = programToDelete.Name,
Location = programToDelete.Location,
UniqueIdentifier = programToDelete.UniqueIdentifier,
Enabled = false
}
);
}
public static void StartProcess(Func<ProcessStartInfo, Process> runProcess, ProcessStartInfo info) public static void StartProcess(Func<ProcessStartInfo, Process> runProcess, ProcessStartInfo info)
{ {
bool hide;
try try
{ {
runProcess(info); runProcess(info);

View File

@ -282,7 +282,7 @@ namespace Wox.Plugin.Program.Programs
var result = new Result var result = new Result
{ {
SubTitle = Package.Location, SubTitle = "UWP Application",
Icon = Logo, Icon = Logo,
Score = score, Score = score,
ContextData = this, ContextData = this,
@ -299,12 +299,6 @@ namespace Wox.Plugin.Program.Programs
result.Title = Description; result.Title = Description;
result.TitleHighlightData = StringMatcher.FuzzySearch(query, Description).MatchData; result.TitleHighlightData = StringMatcher.FuzzySearch(query, Description).MatchData;
} }
else if (!string.IsNullOrEmpty(Description))
{
var title = $"{DisplayName}: {Description}";
result.Title = title;
result.TitleHighlightData = StringMatcher.FuzzySearch(query, title).MatchData;
}
else else
{ {
result.Title = DisplayName; result.Title = DisplayName;

View File

@ -11,7 +11,6 @@ using Microsoft.Win32;
using Shell; using Shell;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Plugin.Program.Logger; using Wox.Plugin.Program.Logger;
using Wox.Plugin.SharedCommands;
namespace Wox.Plugin.Program.Programs namespace Wox.Plugin.Program.Programs
{ {
@ -22,6 +21,7 @@ namespace Wox.Plugin.Program.Programs
public string UniqueIdentifier { get; set; } public string UniqueIdentifier { get; set; }
public string IcoPath { get; set; } public string IcoPath { get; set; }
public string FullPath { get; set; } public string FullPath { get; set; }
public string LnkResolvedPath { get; set; }
public string ParentDirectory { get; set; } public string ParentDirectory { get; set; }
public string ExecutableName { get; set; } public string ExecutableName { get; set; }
public string Description { get; set; } public string Description { get; set; }
@ -53,7 +53,7 @@ namespace Wox.Plugin.Program.Programs
var result = new Result var result = new Result
{ {
SubTitle = FullPath, SubTitle = "Win32 Application",
IcoPath = IcoPath, IcoPath = IcoPath,
Score = score, Score = score,
ContextData = this, ContextData = this,
@ -78,12 +78,6 @@ namespace Wox.Plugin.Program.Programs
result.Title = Description; result.Title = Description;
result.TitleHighlightData = StringMatcher.FuzzySearch(query, Description).MatchData; result.TitleHighlightData = StringMatcher.FuzzySearch(query, Description).MatchData;
} }
else if (!string.IsNullOrEmpty(Description))
{
var title = $"{Name}: {Description}";
result.Title = title;
result.TitleHighlightData = StringMatcher.FuzzySearch(query, title).MatchData;
}
else else
{ {
result.Title = Name; result.Title = Name;
@ -196,6 +190,9 @@ namespace Wox.Plugin.Program.Programs
var extension = Extension(target); var extension = Extension(target);
if (extension == ExeExtension && File.Exists(target)) if (extension == ExeExtension && File.Exists(target))
{ {
program.LnkResolvedPath = program.FullPath;
program.FullPath = target;
buffer = new StringBuilder(MAX_PATH); buffer = new StringBuilder(MAX_PATH);
link.GetDescription(buffer, MAX_PATH); link.GetDescription(buffer, MAX_PATH);
var description = buffer.ToString(); var description = buffer.ToString();
@ -356,8 +353,11 @@ namespace Wox.Plugin.Program.Programs
var programs1 = paths.AsParallel().Where(p => Extension(p) == ShortcutExtension).Select(LnkProgram); var programs1 = paths.AsParallel().Where(p => Extension(p) == ShortcutExtension).Select(LnkProgram);
var programs2 = paths.AsParallel().Where(p => Extension(p) == ApplicationReferenceExtension).Select(Win32Program); var programs2 = paths.AsParallel().Where(p => Extension(p) == ApplicationReferenceExtension).Select(Win32Program);
var programs = programs1.Concat(programs2).Where(p => p.Valid); var allValidPrograms = programs1.Concat(programs2).Where(p => p.Valid);
return programs; //var programsWithLnk = allValidPrograms.Where(x => !string.IsNullOrEmpty(x.LnkResolvedPath));
return allValidPrograms;
} }
private static ParallelQuery<Win32> AppPathsPrograms(string[] suffixes) private static ParallelQuery<Win32> AppPathsPrograms(string[] suffixes)