another fix

master
unknown 18 years ago
parent 591776d932
commit 332c539528
  1. 20
      src/ncmpcpp.cpp
  2. 6
      src/song.cpp
  3. 8
      src/status_checker.cpp

@ -1228,6 +1228,15 @@ int main(int argc, char *argv[])
mPlaylist->BoldOption(pos, 1); mPlaylist->BoldOption(pos, 1);
mPlaylist->BoldOption(pos+1, 0); mPlaylist->BoldOption(pos+1, 0);
} }
else
{
if (pos-1 == now_playing)
{
now_playing++;
mPlaylist->BoldOption(pos, 0);
mPlaylist->BoldOption(pos+1, 1);
}
}
mPlaylist->UpdateOption(pos, DisplaySong(*vPlaylist[pos-1])); mPlaylist->UpdateOption(pos, DisplaySong(*vPlaylist[pos-1]));
mPlaylist->UpdateOption(pos+1, DisplaySong(*vPlaylist[pos])); mPlaylist->UpdateOption(pos+1, DisplaySong(*vPlaylist[pos]));
mpd_playlist_move_pos(conn, pos, pos-1); mpd_playlist_move_pos(conn, pos, pos-1);
@ -1245,8 +1254,17 @@ int main(int argc, char *argv[])
if (pos == now_playing) if (pos == now_playing)
{ {
now_playing++; now_playing++;
mPlaylist->BoldOption(pos+2, 1);
mPlaylist->BoldOption(pos+1, 0); mPlaylist->BoldOption(pos+1, 0);
mPlaylist->BoldOption(pos+2, 1);
}
else
{
if (pos+1 == now_playing)
{
now_playing--;
mPlaylist->BoldOption(pos+1, 1);
mPlaylist->BoldOption(pos+2, 0);
}
} }
mPlaylist->UpdateOption(pos+2, DisplaySong(*vPlaylist[pos+1])); mPlaylist->UpdateOption(pos+2, DisplaySong(*vPlaylist[pos+1]));
mPlaylist->UpdateOption(pos+1, DisplaySong(*vPlaylist[pos])); mPlaylist->UpdateOption(pos+1, DisplaySong(*vPlaylist[pos]));

@ -111,9 +111,9 @@ void Song::Clear()
//itsPerformer.clear(); //itsPerformer.clear();
//itsDisc.clear(); //itsDisc.clear();
itsComment.clear(); itsComment.clear();
itsMinutesLength = 0;; itsMinutesLength = 0;
itsSecondsLength = 0;; itsSecondsLength = 0;
itsPosition = 0;; itsPosition = 0;
itsID = 0; itsID = 0;
} }

@ -131,7 +131,7 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
wFooter->Bold(1); wFooter->Bold(1);
wFooter->GetXY(sx, sy); wFooter->GetXY(sx, sy);
if (now_playing != mpd_player_get_current_song_pos(conn) && !block_playlist_update) if (now_playing != mpd_player_get_current_song_pos(conn) && what & MPD_CST_SONGID)
{ {
old_playing = now_playing; old_playing = now_playing;
now_playing = mpd_player_get_current_song_pos(conn); now_playing = mpd_player_get_current_song_pos(conn);
@ -194,6 +194,7 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
(*it)->GetEmptyFields(1); (*it)->GetEmptyFields(1);
if (**it != ss) if (**it != ss)
{ {
(*it)->GetEmptyFields(0);
ss.GetEmptyFields(0); ss.GetEmptyFields(0);
**it = ss; **it = ss;
mPlaylist->UpdateOption(i, DisplaySong(ss)); mPlaylist->UpdateOption(i, DisplaySong(ss));
@ -394,10 +395,9 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
} }
if (what & MPD_CST_SONGID) if (what & MPD_CST_SONGID)
{ {
int id = mpd_player_get_current_song_pos(conn); if (!vPlaylist.empty() && now_playing >= 0)
if (!vPlaylist.empty() && id >= 0)
{ {
Song &s = *vPlaylist[id]; Song &s = *vPlaylist[now_playing];
if (!mPlaylist->Empty()) if (!mPlaylist->Empty())
{ {
if (old_playing >= 0) if (old_playing >= 0)

Loading…
Cancel
Save