-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Added shortcuts to switch between Preview & Detail panes (#1…
- Loading branch information
Showing
9 changed files
with
117 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal class ToggleDetailsPaneAction : ObservableObject, IToggleAction | ||
{ | ||
private readonly PreviewPaneViewModel viewModel; | ||
private readonly IPreviewPaneSettingsService previewSettingsService = Ioc.Default.GetRequiredService<IPreviewPaneSettingsService>(); | ||
|
||
public string Label | ||
=> "ToggleDetailsPane".GetLocalizedResource(); | ||
|
||
public string Description | ||
=> "ToggleDetailsPaneDescription".GetLocalizedResource(); | ||
|
||
public RichGlyph Glyph | ||
=> new(opacityStyle: "ColorIconRightPane"); | ||
|
||
public HotKey HotKey | ||
=> new(Keys.D, KeyModifiers.MenuCtrl); | ||
|
||
public bool IsOn | ||
=> viewModel.IsEnabled; | ||
|
||
public ToggleDetailsPaneAction() | ||
{ | ||
viewModel = Ioc.Default.GetRequiredService<PreviewPaneViewModel>(); | ||
viewModel.PropertyChanged += ViewModel_PropertyChanged; | ||
} | ||
|
||
public Task ExecuteAsync() | ||
{ | ||
viewModel.IsEnabled = true; | ||
previewSettingsService.ShowPreviewOnly = false; | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName is nameof(PreviewPaneViewModel.IsEnabled)) | ||
OnPropertyChanged(nameof(IsOn)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal class ToggleInfoPaneAction : ObservableObject, IToggleAction | ||
{ | ||
private readonly PreviewPaneViewModel viewModel; | ||
|
||
public string Label | ||
=> "ToggleInfoPane".GetLocalizedResource(); | ||
|
||
public string Description | ||
=> "ToggleInfoPaneDescription".GetLocalizedResource(); | ||
|
||
public RichGlyph Glyph | ||
=> new(opacityStyle: "ColorIconRightPane"); | ||
|
||
public bool IsOn | ||
=> viewModel.IsEnabled; | ||
|
||
public ToggleInfoPaneAction() | ||
{ | ||
viewModel = Ioc.Default.GetRequiredService<PreviewPaneViewModel>(); | ||
viewModel.PropertyChanged += ViewModel_PropertyChanged; | ||
} | ||
|
||
public Task ExecuteAsync() | ||
{ | ||
viewModel.IsEnabled = !IsOn; | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName is nameof(PreviewPaneViewModel.IsEnabled)) | ||
OnPropertyChanged(nameof(IsOn)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters