Add Keep Height (old behaiver) function

This commit is contained in:
DB p 2024-05-26 22:50:48 +09:00
parent 188c409eb4
commit ea4578f651
5 changed files with 36 additions and 7 deletions

View file

@ -232,6 +232,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
/// </summary>
public double CustomWindowTop { get; set; } = 0;
public bool KeepMaxResults { get; set; } = false;
public int MaxResultsToShow { get; set; } = 5;
public int ActivateTimes { get; set; }

View file

@ -56,6 +56,8 @@
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
<system:String x:Key="KeepMaxResults">Keeping Window Max Height</system:String>
<system:String x:Key="KeepMaxResultsToolTip">Window height will keep to fit the maximum number of results</system:String>
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>

View file

@ -120,14 +120,17 @@ namespace Flow.Launcher
shadowMargin = 32;
}
if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1)
{
_settings.MaxResultsToShow = 2;
}
else
{
_settings.MaxResultsToShow = System.Convert.ToInt32(Math.Truncate((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize));
if (!_settings.KeepMaxResults) {
if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1)
{
_settings.MaxResultsToShow = 2;
}
else
{
_settings.MaxResultsToShow = System.Convert.ToInt32(Math.Truncate((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize));
}
}
_settings.WindowSize = Width;
FlowMainWindow.SizeToContent = SizeToContent.Height;
}

View file

@ -151,6 +151,11 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public List<Language> Languages => InternationalizationManager.Instance.LoadAvailableLanguages();
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
public bool KeepMaxResults
{
get => Settings.KeepMaxResults;
set => Settings.KeepMaxResults = value;
}
public string AlwaysPreviewToolTip => string.Format(
InternationalizationManager.Instance.GetTranslation("AlwaysPreviewToolTip"),

View file

@ -153,6 +153,24 @@
</cc:Card>
</cc:CardGroup>
<cc:CardGroup Margin="0 30 0 0">
<cc:Card
Title="{DynamicResource KeepMaxResults}"
Icon="&#xe8fd;"
Sub="{DynamicResource KeepMaxResultsToolTip}">
<ui:ToggleSwitch IsOn="{Binding KeepMaxResults}" />
</cc:Card>
<cc:Card
Title="{DynamicResource maxShowResults}"
Sub="{DynamicResource maxShowResultsToolTip}"
Visibility="{Binding KeepMaxResults, Converter={StaticResource BoolToVisibilityConverter}}">
<ComboBox
Width="100"
ItemsSource="{Binding MaxResultsRange}"
SelectedItem="{Binding Settings.MaxResultsToShow}" />
</cc:Card>
</cc:CardGroup>
<cc:Card
Title="{DynamicResource defaultFileManager}"
Margin="0 30 0 0"