-
-
Notifications
You must be signed in to change notification settings - Fork 455
Shortcuts to adjust width size, number of results shown and game mode #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
91c9397
2ca2fe9
16400ab
9cfb92b
e67e4fd
01c9be3
0baf04e
c7754e9
753e261
644c560
83262de
7839f0a
5164c18
833857d
5236279
eef6878
6592de9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,11 @@ | |
| using ISavable = Flow.Launcher.Plugin.ISavable; | ||
| using System.IO; | ||
| using System.Collections.Specialized; | ||
| using CommunityToolkit.Mvvm.Input; | ||
|
|
||
| namespace Flow.Launcher.ViewModel | ||
| { | ||
| public class MainViewModel : BaseModel, ISavable | ||
| public partial class MainViewModel : BaseModel, ISavable | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @taooceros why is this changed to partial class?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I would like to use the mvvm toolkit to simplify the code of creating RelayCommand, which requires partial to generate additional code. |
||
| { | ||
| #region Private Fields | ||
|
|
||
|
|
@@ -82,6 +83,7 @@ public MainViewModel(Settings settings) | |
| _selectedResults = Results; | ||
|
|
||
| InitializeKeyCommands(); | ||
|
|
||
| RegisterViewUpdate(); | ||
| RegisterResultsUpdatedEvent(); | ||
|
|
||
|
|
@@ -154,6 +156,8 @@ private void RegisterResultsUpdatedEvent() | |
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| private void InitializeKeyCommands() | ||
| { | ||
| EscCommand = new RelayCommand(_ => | ||
|
|
@@ -307,7 +311,7 @@ private void InitializeKeyCommands() | |
| Notification.Show( | ||
| InternationalizationManager.Instance.GetTranslation("success"), | ||
| InternationalizationManager.Instance.GetTranslation("completedSuccessfully") | ||
| ); | ||
| ); | ||
| }), TaskScheduler.Default) | ||
| .ConfigureAwait(false); | ||
| }); | ||
|
|
@@ -318,9 +322,9 @@ private void InitializeKeyCommands() | |
| #region ViewModel Properties | ||
|
|
||
| public ResultsViewModel Results { get; private set; } | ||
|
|
||
| public ResultsViewModel ContextMenu { get; private set; } | ||
|
|
||
| public ResultsViewModel History { get; private set; } | ||
|
|
||
| public bool GameModeStatus { get; set; } | ||
|
|
@@ -336,6 +340,74 @@ public string QueryText | |
| } | ||
| } | ||
|
|
||
|
|
||
| public double Top | ||
| { | ||
| get => _settings.WindowTop; | ||
| set | ||
| { | ||
| _settings.WindowTop = value; | ||
| OnPropertyChanged(); | ||
| } | ||
| } | ||
| public double Left | ||
| { | ||
| get => _settings.WindowLeft; | ||
| set | ||
| { | ||
| _settings.WindowLeft = value; | ||
| OnPropertyChanged(); | ||
| } | ||
| } | ||
|
|
||
| [RelayCommand] | ||
| private void IncreaseWidth() | ||
| { | ||
| if (MainWindowWidth + 100 > 1920 || _settings.WindowSize == 1920) | ||
| { | ||
| _settings.WindowSize = 1920; | ||
| } | ||
| else | ||
| { | ||
| _settings.WindowSize += 100; | ||
| Left -= 50; | ||
| } | ||
| OnPropertyChanged(); | ||
| } | ||
|
|
||
| [RelayCommand] | ||
| private void DecreaseWidth() | ||
| { | ||
| if (MainWindowWidth - 100 < 400 || _settings.WindowSize == 400) | ||
| { | ||
| _settings.WindowSize = 400; | ||
| } | ||
| else | ||
| { | ||
| Left += 50; | ||
| _settings.WindowSize -= 100; | ||
| } | ||
| OnPropertyChanged(); | ||
| } | ||
|
|
||
| [RelayCommand] | ||
| private void IncreaseMaxResult() | ||
| { | ||
| if (_settings.MaxResultsToShow == 17) | ||
| return; | ||
|
|
||
| _settings.MaxResultsToShow += 1; | ||
| } | ||
|
|
||
| [RelayCommand] | ||
| private void DecreaseMaxResult() | ||
| { | ||
| if (_settings.MaxResultsToShow == 2) | ||
| return; | ||
|
|
||
| _settings.MaxResultsToShow -= 1; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// we need move cursor to end when we manually changed query | ||
| /// but we don't want to move cursor to end when query is updated from TextBox | ||
|
|
@@ -411,7 +483,11 @@ private ResultsViewModel SelectedResults | |
|
|
||
| public Visibility SearchIconVisibility { get; set; } | ||
|
|
||
| public double MainWindowWidth => _settings.WindowSize; | ||
| public double MainWindowWidth | ||
| { | ||
| get => _settings.WindowSize; | ||
| set => _settings.WindowSize = value; | ||
| } | ||
|
|
||
| public string PluginIconPath { get; set; } = null; | ||
|
|
||
|
|
@@ -592,7 +668,7 @@ private async void QueryResults() | |
| PluginIconPath = null; | ||
| SearchIconVisibility = Visibility.Visible; | ||
| } | ||
|
|
||
|
|
||
| if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign) | ||
| { | ||
|
|
@@ -903,18 +979,18 @@ public void ResultCopy(string stringToCopy) | |
|
|
||
| Clipboard.SetFileDropList(paths); | ||
| App.API.ShowMsg( | ||
| App.API.GetTranslation("copy") | ||
| +" " | ||
| + (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), | ||
| App.API.GetTranslation("copy") | ||
| + " " | ||
| + (isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), | ||
| App.API.GetTranslation("completedSuccessfully")); | ||
| } | ||
| else | ||
| { | ||
| Clipboard.SetDataObject(copyText.ToString()); | ||
| App.API.ShowMsg( | ||
| App.API.GetTranslation("copy") | ||
| + " " | ||
| + App.API.GetTranslation("textTitle"), | ||
| App.API.GetTranslation("copy") | ||
| + " " | ||
| + App.API.GetTranslation("textTitle"), | ||
| App.API.GetTranslation("completedSuccessfully")); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "6.0.100", | ||
| "rollForward": "latestFeature" | ||
| "version": "6.0.*", | ||
| "rollForward": "latestPatch" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @taooceros what's this change for?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh it shouldn't be there (I am testing different version of dotnet and see which one can help with the bug. However it is not needed because workaround is found)...Though it makes sense to apply the latest patch since that generally includes some security fixes. |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taooceros What's this change for us specifically?