Beispiel #1
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            normal.RemoveFilterIndex();

            if (Locked && e.KeyCode != KeyDefs.AdvanceScreen)
            {
                base.OnKeyDown(e);
                return;
            }
            if (e.Alt)
            {
                if (e.KeyCode == KeyDefs.Enter)
                {
                    if (Lib.FullScreen)
                    {
                        controller.RequestAction(QActionType.ReleaseFullScreen);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.SetFullScreen);
                    }
                    e.Handled = true;
                }
            }
            else
            {
                e.Handled = true;
                switch (e.KeyCode)
                {
                case KeyDefs.Enter:
                    if (e.Shift)
                    {
                        if (controller.AllowTagEditing)
                        {
                            controller.RequestAction(QActionType.EditTags);
                        }
                    }
                    else
                    {
                        controller.RequestAction(QActionType.PlaySelectedTracks);
                    }
                    break;

                case KeyDefs.Play:
                case KeyDefs.Play2:
                    controller.RequestAction(QActionType.Play);
                    break;

                case KeyDefs.Pause:
                    controller.RequestAction(QActionType.Pause);
                    break;

                case KeyDefs.PlayPause:
                    controller.RequestAction(QActionType.TogglePlayPause);
                    break;

                case KeyDefs.Stop:
                case KeyDefs.Stop2:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.StopAfterThisTrack);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.Stop);
                    }
                    break;

                case KeyDefs.Next:
                case KeyDefs.Next2:
                    controller.RequestAction(QActionType.Next);
                    break;

                case KeyDefs.Previous:
                case KeyDefs.Previous2:
                    controller.RequestAction(QActionType.Previous);
                    break;

                case KeyDefs.ScanFwd:
                    controller.RequestAction(QActionType.ScanFwd);
                    break;

                case KeyDefs.ScanBack:
                    controller.RequestAction(QActionType.ScanBack);
                    break;

                case KeyDefs.PlayThisAlbum:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.AddAlbumToNowPlaying);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.PlayThisAlbum);
                    }
                    break;

                case KeyDefs.FocusSearchBox:
                    controller.RequestAction(QActionType.FocusSearchBox);
                    break;

                case KeyDefs.ShowPlayingTrack:
                    controller.RequestAction(QActionType.FindPlayingTrack);
                    break;

                case KeyDefs.Podcasts:
                    controller.RequestAction(QActionType.TogglePodcastView);
                    break;

                case KeyDefs.Delete:
                    controller.RequestAction(QActionType.Delete);
                    break;

                case KeyDefs.SelectAllOrNone:
                    if (e.Control)
                    {
                        if (e.Shift)
                        {
                            controller.RequestAction(QActionType.SelectNone);
                        }
                        else
                        {
                            controller.RequestAction(QActionType.SelectAll);
                        }
                    }
                    else
                    {
                        e.Handled = false;
                    }
                    break;

                case KeyDefs.Shuffle:
                    if (e.Shift)
                    {
                        Lib.DoEvents();
                        controller.RequestAction(QActionType.PlayRandomAlbum);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.Shuffle);
                    }
                    break;

                case KeyDefs.AutoPlaylistAction:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.ConvertToStandardPlaylist);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.EditAutoPlaylist);
                    }
                    break;

                case KeyDefs.ClearAllFilters:
                    controller.RequestAction(QActionType.ReleaseAllFilters);
                    break;

                case KeyDefs.FilterSelected:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.FilterSelectedAlbum);
                    }
                    else if (e.Control)
                    {
                        controller.RequestAction(QActionType.FilterSelectedGenre);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.FilterSelectedArtist);
                    }
                    break;

                case KeyDefs.ShowInfoFromInternet:
                    if (e.Control)
                    {
                        controller.RequestAction(QActionType.LastFMShowAlbum);
                    }
                    else if (e.Shift)
                    {
                        controller.RequestAction(QActionType.LastFMShowArtist);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.ShowTrackAndAlbumDetails);
                    }
                    break;

                case KeyDefs.PlaySelectedNext:
                    controller.RequestAction(QActionType.PlaySelectedTrackNext);
                    break;

                case KeyDefs.PlaylistAction:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.ViewNowPlaying);
                    }
                    else if (e.Control)
                    {
                        if (controller.PlaylistExists(controller.TargetPlaylistName) && normal.HasSelectedTracks)
                        {
                            if (normal.SelectedTracks.Count == 1)
                            {
                                controller.RequestAction(QActionType.AddToTargetPlaylistAndAdvance);
                            }
                            else
                            {
                                controller.RequestAction(QActionType.AddToTargetPlaylist);
                            }
                        }
                    }
                    else
                    {
                        controller.RequestAction(QActionType.AddToNowPlayingAndAdvance);
                    }
                    break;

                case KeyDefs.FileInfo:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.RefreshSelectedTracks);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.ShowFileDetails);
                    }
                    break;

                case KeyDefs.ShowEqualizer:
                    if (e.Control)
                    {
                        controller.RequestAction(QActionType.ShowEqualizer);
                    }
                    else if (e.Shift)
                    {
                        controller.RequestAction(QActionType.SelectNextEqualizer);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.ToggleEqualizer);
                    }
                    break;

                case KeyDefs.MiniPlayer:
                    controller.RequestAction(QActionType.ShowMiniPlayer);
                    break;

                case KeyDefs.HTPCMode:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.ShowTagCloud);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.HTPCMode);
                    }
                    break;

                case KeyDefs.AdvanceScreen:
                    controller.RequestAction(QActionType.AdvanceScreenWithoutMouse);
                    break;

                case KeyDefs.GainUp:
                    controller.RequestAction(QActionType.SpectrumViewGainUp);
                    break;

                case KeyDefs.GainDown:
                    controller.RequestAction(QActionType.SpectrumViewGainDown);
                    break;

                case KeyDefs.VolUp:
                case KeyDefs.VolUp2:
                    controller.RequestAction(QActionType.VolumeUp);
                    break;

                case KeyDefs.VolDown:
                case KeyDefs.VolDown2:
                    controller.RequestAction(QActionType.VolumeDown);
                    break;

                case KeyDefs.Mute:
                    controller.RequestAction(QActionType.Mute);
                    break;

                case KeyDefs.Radio:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.RepeatToggle);
                    }
                    else
                    {
                        controller.RequestAction(QActionType.ToggleRadioMode);
                    }
                    break;

                case KeyDefs.Gain:
                    if (e.Shift)
                    {
                        controller.RequestAction(QActionType.ReplayGainAnalyzeSelectedTracks);
                    }
                    break;

                case KeyDefs.Exit:
                    if (e.Shift)
                    {
                        Controller.ShowMessage(Localization.Get(UI_Key.General_Exit));
                        controller.RequestAction(QActionType.Exit);
                    }
                    break;

                case KeyDefs.Cancel:
                    controller.RequestAction(QActionType.Cancel);
                    break;

                case KeyDefs.PreviousFilter:
                    controller.RequestAction(QActionType.PreviousFilter);
                    break;

                case KeyDefs.NextFilter:
                    controller.RequestAction(QActionType.NextFilter);
                    break;

                case KeyDefs.ReleaseCurrentFilter:
                    controller.RequestAction(QActionType.ReleaseCurrentFilter);
                    break;

                case KeyDefs.ReleaseAllFilters:
                    controller.RequestAction(QActionType.ReleaseAllFilters);
                    break;

                case KeyDefs.ShowFilterIndex:
                    controller.RequestAction(QActionType.ShowFilterIndex);
                    break;

                case KeyDefs.PageUp:
                    controller.RequestAction(QActionType.PageUp);
                    break;

                case KeyDefs.PageDown:
                    controller.RequestAction(QActionType.PageDown);
                    break;

                case KeyDefs.Home:
                    controller.RequestAction(QActionType.Home);
                    break;

                case KeyDefs.End:
                    controller.RequestAction(QActionType.End);
                    break;

                case KeyDefs.Playlists:
                    if (e.Shift)
                    {
                        System.Diagnostics.Debug.Assert(e.KeyCode == KeyDefs.One);
                        controller.SetRatingOfSelectedTracks(1);
                    }
                    else
                    {
                        normal.CurrentFilterType = FilterType.Playlist;
                    }
                    break;

                case KeyDefs.Genres:
                    if (e.Shift)
                    {
                        System.Diagnostics.Debug.Assert(e.KeyCode == KeyDefs.Two);
                        controller.SetRatingOfSelectedTracks(2);
                    }
                    else
                    {
                        normal.CurrentFilterType = FilterType.Genre;
                    }
                    break;

                case KeyDefs.Artists:
                    if (e.Shift)
                    {
                        System.Diagnostics.Debug.Assert(e.KeyCode == KeyDefs.Three);
                        controller.SetRatingOfSelectedTracks(3);
                    }
                    else
                    {
                        normal.CurrentFilterType = FilterType.Artist;
                    }
                    break;

                case KeyDefs.Albums:
                    if (e.Shift)
                    {
                        System.Diagnostics.Debug.Assert(e.KeyCode == KeyDefs.Four);
                        controller.SetRatingOfSelectedTracks(4);
                    }
                    else
                    {
                        normal.CurrentFilterType = FilterType.Album;
                    }
                    break;

                case KeyDefs.Years:
                    if (e.Shift)
                    {
                        System.Diagnostics.Debug.Assert(e.KeyCode == KeyDefs.Five);
                        controller.SetRatingOfSelectedTracks(5);
                    }
                    else
                    {
                        normal.CurrentFilterType = FilterType.Year;
                    }
                    break;

                case KeyDefs.Zero:
                    if (e.Shift)
                    {
                        controller.SetRatingOfSelectedTracks(0);
                    }
                    break;

                case KeyDefs.Groupings:
                    normal.CurrentFilterType = FilterType.Grouping;
                    break;

                default:
                    e.Handled = false;
                    break;
                }
            }
            base.OnKeyDown(e);
        }