mirror of
https://github.com/aaru-dps/RedBookPlayer.git
synced 2025-12-16 19:24:41 +00:00
Move hardcoded key values to settings
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
| Key | Action |
|
| Key | Action |
|
||||||
| --- | ------ |
|
| --- | ------ |
|
||||||
| `F1` | Open Settings Window |
|
| `F1` | Open Settings Window |
|
||||||
| `F2` / `Enter` | Load New Image |
|
| `F2` | Load New Image |
|
||||||
| `Space` | Toggle Play / Pause |
|
| `Space` | Toggle Play / Pause |
|
||||||
| `Esc` | Stop Playback |
|
| `Esc` | Stop Playback |
|
||||||
| `→` | Next Track |
|
| `→` | Next Track |
|
||||||
|
|||||||
@@ -118,68 +118,68 @@ namespace RedBookPlayer.GUI
|
|||||||
PlayerView playerView = ContentControl.Content as PlayerView;
|
PlayerView playerView = ContentControl.Content as PlayerView;
|
||||||
|
|
||||||
// Open settings window
|
// Open settings window
|
||||||
if(e.Key == Key.F1)
|
if(e.Key == App.Settings.OpenSettingsKey)
|
||||||
{
|
{
|
||||||
settingsWindow = new SettingsWindow(App.Settings);
|
settingsWindow = new SettingsWindow(App.Settings);
|
||||||
settingsWindow.Show();
|
settingsWindow.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load image
|
// Load image
|
||||||
else if (e.Key == Key.F2 || e.Key == Key.Enter)
|
else if (e.Key == App.Settings.LoadImageKey)
|
||||||
{
|
{
|
||||||
playerView?.LoadButton_Click(this, null);
|
playerView?.LoadButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle playback
|
// Toggle playback
|
||||||
else if(e.Key == Key.Space || e.Key == Key.MediaPlayPause)
|
else if(e.Key == App.Settings.TogglePlaybackKey || e.Key == Key.MediaPlayPause)
|
||||||
{
|
{
|
||||||
playerView?.PlayPauseButton_Click(this, null);
|
playerView?.PlayPauseButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop playback
|
// Stop playback
|
||||||
else if(e.Key == Key.Escape || e.Key == Key.MediaStop)
|
else if(e.Key == App.Settings.StopPlaybackKey || e.Key == Key.MediaStop)
|
||||||
{
|
{
|
||||||
playerView?.StopButton_Click(this, null);
|
playerView?.StopButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next Track
|
// Next Track
|
||||||
else if(e.Key == Key.Right || e.Key == Key.MediaNextTrack)
|
else if(e.Key == App.Settings.NextTrackKey || e.Key == Key.MediaNextTrack)
|
||||||
{
|
{
|
||||||
playerView?.NextTrackButton_Click(this, null);
|
playerView?.NextTrackButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Previous Track
|
// Previous Track
|
||||||
else if(e.Key == Key.Left || e.Key == Key.MediaPreviousTrack)
|
else if(e.Key == App.Settings.PreviousTrackKey || e.Key == Key.MediaPreviousTrack)
|
||||||
{
|
{
|
||||||
playerView?.PreviousTrackButton_Click(this, null);
|
playerView?.PreviousTrackButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next Index
|
// Next Index
|
||||||
else if(e.Key == Key.OemCloseBrackets)
|
else if(e.Key == App.Settings.NextIndexKey)
|
||||||
{
|
{
|
||||||
playerView?.NextIndexButton_Click(this, null);
|
playerView?.NextIndexButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Previous Index
|
// Previous Index
|
||||||
else if(e.Key == Key.OemOpenBrackets)
|
else if(e.Key == App.Settings.PreviousIndexKey)
|
||||||
{
|
{
|
||||||
playerView?.PreviousIndexButton_Click(this, null);
|
playerView?.PreviousIndexButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fast Foward
|
// Fast Foward
|
||||||
else if(e.Key == Key.OemPeriod)
|
else if(e.Key == App.Settings.FastForwardPlaybackKey)
|
||||||
{
|
{
|
||||||
playerView?.FastForwardButton_Click(this, null);
|
playerView?.FastForwardButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewind
|
// Rewind
|
||||||
else if(e.Key == Key.OemComma)
|
else if(e.Key == App.Settings.RewindPlaybackKey)
|
||||||
{
|
{
|
||||||
playerView?.RewindButton_Click(this, null);
|
playerView?.RewindButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emphasis Toggle
|
// Emphasis Toggle
|
||||||
else if(e.Key == Key.E)
|
else if(e.Key == App.Settings.ToggleDeEmphasisKey)
|
||||||
{
|
{
|
||||||
playerView?.EnableDisableDeEmphasisButton_Click(this, null);
|
playerView?.EnableDisableDeEmphasisButton_Click(this, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Avalonia.Input;
|
||||||
using RedBookPlayer.GUI;
|
using RedBookPlayer.GUI;
|
||||||
|
|
||||||
namespace RedBookPlayer
|
namespace RedBookPlayer
|
||||||
{
|
{
|
||||||
public class Settings
|
public class Settings
|
||||||
{
|
{
|
||||||
|
#region Player Settings
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if discs should start playing on load
|
/// Indicates if discs should start playing on load
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -42,6 +45,67 @@ namespace RedBookPlayer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string SelectedTheme { get; set; } = "default";
|
public string SelectedTheme { get; set; } = "default";
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Key Mappings
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to open settings
|
||||||
|
/// </summary>
|
||||||
|
public Key OpenSettingsKey { get; set; } = Key.F1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to load a new image
|
||||||
|
/// </summary>
|
||||||
|
public Key LoadImageKey { get; set; } = Key.F2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to toggle play and pause
|
||||||
|
/// </summary>
|
||||||
|
public Key TogglePlaybackKey { get; set; } = Key.Space;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to stop playback
|
||||||
|
/// </summary>
|
||||||
|
public Key StopPlaybackKey { get; set; } = Key.Escape;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to move to the next track
|
||||||
|
/// </summary>
|
||||||
|
public Key NextTrackKey { get; set; } = Key.Right;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to move to the previous track
|
||||||
|
/// </summary>
|
||||||
|
public Key PreviousTrackKey { get; set; } = Key.Left;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to move to the next index
|
||||||
|
/// </summary>
|
||||||
|
public Key NextIndexKey { get; set; } = Key.OemCloseBrackets;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to move to the previous index
|
||||||
|
/// </summary>
|
||||||
|
public Key PreviousIndexKey { get; set; } = Key.OemOpenBrackets;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to fast forward playback
|
||||||
|
/// </summary>
|
||||||
|
public Key FastForwardPlaybackKey { get; set; } = Key.OemPeriod;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to rewind playback
|
||||||
|
/// </summary>
|
||||||
|
public Key RewindPlaybackKey { get; set; } = Key.OemComma;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key assigned to toggle de-emphasis
|
||||||
|
/// </summary>
|
||||||
|
public Key ToggleDeEmphasisKey { get; set; } = Key.E;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path to the settings file
|
/// Path to the settings file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user