jump from browser to playlist editor with GoToContainingDir key

This commit is contained in:
Frank Blendinger
2010-03-04 15:13:11 +01:00
parent 6b5ed187a1
commit d139f2d8af
4 changed files with 28 additions and 3 deletions

View File

@@ -249,6 +249,7 @@ void Help::GetKeybindings()
*w << DisplayKeys(Key.GoToNowPlaying) << "Locate currently playing song\n"; *w << DisplayKeys(Key.GoToNowPlaying) << "Locate currently playing song\n";
*w << DisplayKeys(Key.GoToParentDir) << "Go to parent directory\n"; *w << DisplayKeys(Key.GoToParentDir) << "Go to parent directory\n";
*w << DisplayKeys(Key.Delete) << "Delete playlist/file/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; *w << "\n\n " << fmtBold << "Keys - Search engine\n -----------------------------------------\n" << fmtBoldEnd;

View File

@@ -1587,11 +1587,19 @@ int main(int argc, char *argv[])
} }
} }
else if (Keypressed(input, Key.GoToContainingDir)) 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(); Song *s = myScreen->CurrentSong();
if (s) if (s)
myBrowser->LocateSong(*s); myBrowser->LocateSong(*s);
} }
}
else if (Keypressed(input, Key.GoToMediaLibrary)) else if (Keypressed(input, Key.GoToMediaLibrary))
{ {
Song *s = myScreen->CurrentSong(); Song *s = myScreen->CurrentSong();

View File

@@ -289,6 +289,20 @@ void PlaylistEditor::ApplyFilter(const std::string &s)
GetList()->ApplyFilter(s, 0, REG_ICASE | Config.regex_type); 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() List *PlaylistEditor::GetList()
{ {
if (w == Playlists) if (w == Playlists)

View File

@@ -47,6 +47,8 @@ class PlaylistEditor : public Screen<Window>
virtual void ApplyFilter(const std::string &); virtual void ApplyFilter(const std::string &);
virtual void JumpTo(const std::string &);
virtual List *GetList(); virtual List *GetList();
void NextColumn(); void NextColumn();