From 8549e496c24fabf66edc8b4ba485943a0340d324 Mon Sep 17 00:00:00 2001 From: casey langen Date: Wed, 29 Apr 2020 00:19:16 -0700 Subject: [PATCH] Also support `PlayFromTop` in `TrackSearchLayout` --- src/musikcube/app/layout/LibraryLayout.cpp | 22 +++++++++++-------- .../app/layout/TrackSearchLayout.cpp | 4 ++++ src/musikcube/app/layout/TrackSearchLayout.h | 1 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/musikcube/app/layout/LibraryLayout.cpp b/src/musikcube/app/layout/LibraryLayout.cpp index a6a2477b4..7ac736990 100755 --- a/src/musikcube/app/layout/LibraryLayout.cpp +++ b/src/musikcube/app/layout/LibraryLayout.cpp @@ -439,17 +439,21 @@ bool LibraryLayout::KeyPress(const std::string& key) { }); return true; } - else if (Hotkeys::Is(Hotkeys::TrackListPlayFromTop, key)) { - if (this->visibleLayout == this->browseLayout) { - this->browseLayout->PlayFromTop(); - } - else if (this->visibleLayout == this->directoryLayout) { - this->directoryLayout->PlayFromTop(); - } - } } - if (Hotkeys::Is(Hotkeys::NavigateLibraryPlayQueue, key)) { + if (Hotkeys::Is(Hotkeys::TrackListPlayFromTop, key)) { + /* TODO: maybe have an IPlayFromTopLayout? meh... */ + if (this->visibleLayout == this->browseLayout) { + this->browseLayout->PlayFromTop(); + } + else if (this->visibleLayout == this->directoryLayout) { + this->directoryLayout->PlayFromTop(); + } + else if (this->visibleLayout == this->trackSearchLayout) { + this->trackSearchLayout->PlayFromTop(); + } + } + else if (Hotkeys::Is(Hotkeys::NavigateLibraryPlayQueue, key)) { this->ShowNowPlaying(); return true; } diff --git a/src/musikcube/app/layout/TrackSearchLayout.cpp b/src/musikcube/app/layout/TrackSearchLayout.cpp index b02fadb72..dbb3232c7 100755 --- a/src/musikcube/app/layout/TrackSearchLayout.cpp +++ b/src/musikcube/app/layout/TrackSearchLayout.cpp @@ -151,6 +151,10 @@ void TrackSearchLayout::Requery() { new SearchTrackListQuery(this->library, filter, sortOrder))); } +void TrackSearchLayout::PlayFromTop() { + playback::PlayFromTop(*this->trackList, this->playback); +} + void TrackSearchLayout::ProcessMessage(IMessage &message) { int type = message.Type(); diff --git a/src/musikcube/app/layout/TrackSearchLayout.h b/src/musikcube/app/layout/TrackSearchLayout.h index 735a8f6c5..af5e8bf90 100755 --- a/src/musikcube/app/layout/TrackSearchLayout.h +++ b/src/musikcube/app/layout/TrackSearchLayout.h @@ -61,6 +61,7 @@ namespace musik { virtual void OnVisibilityChanged(bool visible); virtual bool KeyPress(const std::string& key); + void PlayFromTop(); void FocusInput(); void LoadLastSession();