jump from browser to playlist editor with GoToContainingDir key

master
Frank Blendinger 16 years ago
parent 6b5ed187a1
commit d139f2d8af
  1. 1
      src/help.cpp
  2. 14
      src/ncmpcpp.cpp
  3. 14
      src/playlist_editor.cpp
  4. 2
      src/playlist_editor.h

@ -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;

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

@ -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)

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

Loading…
Cancel
Save