jump from browser to playlist editor with GoToContainingDir key
This commit is contained in:
@@ -249,6 +249,7 @@ void Help::GetKeybindings()
|
||||
*w << DisplayKeys(Key.GoToNowPlaying) << "Locate currently playing song\n";
|
||||
*w << DisplayKeys(Key.GoToParentDir) << "Go to parent directory\n";
|
||||
*w << DisplayKeys(Key.Delete) << "Delete playlist/file/directory\n";
|
||||
*w << DisplayKeys(Key.GoToContainingDir) << "Jump to playlist editor (playlists only)\n";
|
||||
|
||||
|
||||
*w << "\n\n " << fmtBold << "Keys - Search engine\n -----------------------------------------\n" << fmtBoldEnd;
|
||||
|
||||
@@ -1587,11 +1587,19 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
else if (Keypressed(input, Key.GoToContainingDir))
|
||||
{
|
||||
if (myScreen == myBrowser && myBrowser->Main()->Current().type == itPlaylist)
|
||||
{
|
||||
const std::string pl_name = myBrowser->Main()->Current().name;
|
||||
myPlaylistEditor->JumpTo(pl_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Song *s = myScreen->CurrentSong();
|
||||
if (s)
|
||||
myBrowser->LocateSong(*s);
|
||||
}
|
||||
}
|
||||
else if (Keypressed(input, Key.GoToMediaLibrary))
|
||||
{
|
||||
Song *s = myScreen->CurrentSong();
|
||||
|
||||
@@ -289,6 +289,20 @@ void PlaylistEditor::ApplyFilter(const std::string &s)
|
||||
GetList()->ApplyFilter(s, 0, REG_ICASE | Config.regex_type);
|
||||
}
|
||||
|
||||
void PlaylistEditor::JumpTo(const std::string &s)
|
||||
{
|
||||
SwitchTo();
|
||||
for (size_t i = 0; i < Playlists->Size(); ++i)
|
||||
{
|
||||
if (s == (*Playlists)[i])
|
||||
{
|
||||
Playlists->Highlight(i);
|
||||
Content->Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List *PlaylistEditor::GetList()
|
||||
{
|
||||
if (w == Playlists)
|
||||
|
||||
@@ -47,6 +47,8 @@ class PlaylistEditor : public Screen<Window>
|
||||
|
||||
virtual void ApplyFilter(const std::string &);
|
||||
|
||||
virtual void JumpTo(const std::string &);
|
||||
|
||||
virtual List *GetList();
|
||||
|
||||
void NextColumn();
|
||||
|
||||
Reference in New Issue
Block a user