mdp: remove GetCurrentlyPlayingSongPos

This commit is contained in:
Andrzej Rybczak
2012-09-18 21:34:14 +02:00
parent e108604641
commit b57428db90
7 changed files with 10 additions and 16 deletions

View File

@@ -1200,7 +1200,7 @@ void TogglePlayingSongCentering::Run()
Config.autocenter_mode = !Config.autocenter_mode;
Statusbar::msg("Centering playing song: %s", Config.autocenter_mode ? "On" : "Off");
if (Config.autocenter_mode && Mpd.isPlaying() && !myPlaylist->main().isFiltered())
myPlaylist->main().highlight(Mpd.GetCurrentlyPlayingSongPos());
myPlaylist->main().highlight(Mpd.GetCurrentSongPos());
}
void UpdateDatabase::Run()
@@ -1226,7 +1226,7 @@ bool JumpToPlayingSong::canBeRun() const
void JumpToPlayingSong::Run()
{
if (myScreen == myPlaylist)
myPlaylist->main().highlight(Mpd.GetCurrentlyPlayingSongPos());
myPlaylist->main().highlight(Mpd.GetCurrentSongPos());
else if (myScreen == myBrowser)
{
myBrowser->LocateSong(myPlaylist->nowPlayingSong());

View File

@@ -95,8 +95,8 @@ void setProperties(NC::Menu<T> &menu, const MPD::Song &s, const ProxySongList &p
discard_colors = Config.discard_colors_if_item_is_selected && is_selected;
int song_pos = menu.isFiltered() ? s.getPosition() : drawn_pos;
is_now_playing = &menu == myPlaylist->activeWindow()
&& song_pos == Mpd.GetCurrentlyPlayingSongPos();
is_now_playing = Mpd.isPlaying() && myPlaylist->isActiveWindow(menu)
&& song_pos == Mpd.GetCurrentSongPos();
if (is_now_playing)
menu << Config.now_playing_prefix;
}

View File

@@ -551,12 +551,12 @@ void Connection::Seek(unsigned where)
if (!isCommandsListEnabled)
{
GoBusy();
mpd_run_seek_pos(itsConnection, Mpd.GetCurrentlyPlayingSongPos(), where);
mpd_run_seek_pos(itsConnection, Mpd.GetCurrentSongPos(), where);
}
else
{
assert(!isIdle);
mpd_send_seek_pos(itsConnection, Mpd.GetCurrentlyPlayingSongPos(), where);
mpd_send_seek_pos(itsConnection, Mpd.GetCurrentSongPos(), where);
}
}
@@ -695,11 +695,6 @@ int Connection::GetCurrentSongPos() const
return itsCurrentStatus ? mpd_status_get_song_pos(itsCurrentStatus) : -1;
}
int Connection::GetCurrentlyPlayingSongPos() const
{
return isPlaying() ? GetCurrentSongPos() : -1;
}
Song Connection::GetCurrentlyPlayingSong()
{
assert(!isCommandsListEnabled);

View File

@@ -173,7 +173,6 @@ public:
const std::string &GetErrorMessage() const { return itsErrorMessage; }
Song GetCurrentlyPlayingSong();
int GetCurrentlyPlayingSongPos() const;
int GetCurrentSongPos() const;
Song GetSong(const std::string &);
SongList GetPlaylistContent(const std::string &);

View File

@@ -258,7 +258,7 @@ std::string Playlist::TotalLength()
if (Config.playlist_show_remaining_time && ReloadRemaining && !w.isFiltered())
{
itsRemainingTime = 0;
for (size_t i = Mpd.GetCurrentlyPlayingSongPos(); i < w.size(); ++i)
for (size_t i = Mpd.GetCurrentSongPos(); i < w.size(); ++i)
itsRemainingTime += w[i].value().getDuration();
ReloadRemaining = false;
}

View File

@@ -261,7 +261,7 @@ void SelectedItemsAdder::addAfterCurrentSong() const
{
if (!Mpd.isPlaying())
return;
size_t pos = Mpd.GetCurrentlyPlayingSongPos();
size_t pos = Mpd.GetCurrentSongPos();
++pos;
bool success = addSongsToPlaylist(m_selected_items, false, pos);
if (success)
@@ -273,7 +273,7 @@ void SelectedItemsAdder::addAfterCurrentAlbum() const
if (!Mpd.isPlaying())
return;
auto &pl = myPlaylist->main();
size_t pos = Mpd.GetCurrentlyPlayingSongPos();
size_t pos = Mpd.GetCurrentSongPos();
withUnfilteredMenu(pl, [&pos, &pl]() {
std::string album = pl[pos].value().getAlbum();
while (pos < pl.size() && pl[pos].value().getAlbum() == album)

View File

@@ -288,7 +288,7 @@ void Status::Changes::songID()
drawTitle(myPlaylist->nowPlayingSong());
if (Config.autocenter_mode && !myPlaylist->main().isFiltered())
myPlaylist->main().highlight(Mpd.GetCurrentlyPlayingSongPos());
myPlaylist->main().highlight(Mpd.GetCurrentSongPos());
if (Config.now_playing_lyrics && isVisible(myLyrics) && myLyrics->previousScreen() == myPlaylist)
myLyrics->ReloadNP = 1;