mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #3144 from Jack251970/dev4
Add options for setting result on top & keeping result order
This commit is contained in:
commit
3d8cf29c8e
2 changed files with 15 additions and 3 deletions
|
|
@ -263,6 +263,16 @@ namespace Flow.Launcher.Plugin
|
|||
/// </summary>
|
||||
public PreviewInfo Preview { get; set; } = PreviewInfo.Default;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the user selection count should be added to the score. This can be useful when set to false to allow the result sequence order to be the same everytime instead of changing based on selection.
|
||||
/// </summary>
|
||||
public bool AddSelectedCount { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum score. This can be useful when set one result to the top by default. This is the score for the results set to the topmost by users.
|
||||
/// </summary>
|
||||
public const int MaxScore = int.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// Info of the preview section of a <see cref="Result"/>
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1471,12 +1471,14 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
if (_topMostRecord.IsTopMost(result))
|
||||
{
|
||||
result.Score = int.MaxValue;
|
||||
result.Score = Result.MaxScore;
|
||||
}
|
||||
else
|
||||
else if (result.Score != Result.MaxScore)
|
||||
{
|
||||
var priorityScore = metaResults.Metadata.Priority * 150;
|
||||
result.Score += _userSelectedRecord.GetSelectedCount(result) + priorityScore;
|
||||
result.Score += result.AddSelectedCount ?
|
||||
_userSelectedRecord.GetSelectedCount(result) + priorityScore :
|
||||
priorityScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue