improve bolding songs added to playlist

This commit is contained in:
unK
2008-09-15 15:11:13 +02:00
parent 9795fc4488
commit 90b975f04d
2 changed files with 32 additions and 20 deletions

View File

@@ -111,7 +111,7 @@ bool block_progressbar_update = 0;
bool block_statusbar_update = 0; bool block_statusbar_update = 0;
bool allow_statusbar_unlock = 1; bool allow_statusbar_unlock = 1;
bool block_playlist_update = 0; bool block_playlist_update = 0;
bool block_found_item_list_update = 0; bool block_item_list_update = 0;
bool messages_allowed = 0; bool messages_allowed = 0;
bool redraw_screen = 0; bool redraw_screen = 0;
@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
TraceMpdStatus(); TraceMpdStatus();
block_found_item_list_update = 0; block_item_list_update = 0;
block_playlist_update = 0; block_playlist_update = 0;
messages_allowed = 1; messages_allowed = 1;
@@ -892,14 +892,15 @@ int main(int argc, char *argv[])
} }
case itSong: case itSong:
{ {
block_item_list_update = 1;
Song &s = *item.song; Song &s = *item.song;
int id = Mpd->AddSong(s); int id = Mpd->AddSong(s);
if (id >= 0) if (id >= 0)
{ {
Mpd->PlayID(id); Mpd->PlayID(id);
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format)); ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
mBrowser->BoldOption(mBrowser->GetChoice(), 1);
} }
mBrowser->Refresh();
break; break;
} }
case itPlaylist: case itPlaylist:
@@ -1175,7 +1176,7 @@ int main(int argc, char *argv[])
} }
default: default:
{ {
block_found_item_list_update = 1; block_item_list_update = 1;
const Song &s = mSearcher->Current().second; const Song &s = mSearcher->Current().second;
int id = Mpd->AddSong(s); int id = Mpd->AddSong(s);
if (id >= 0) if (id >= 0)
@@ -1240,6 +1241,7 @@ int main(int argc, char *argv[])
{ {
if (!mLibSongs->Empty()) if (!mLibSongs->Empty())
{ {
block_item_list_update = 1;
Song &s = mLibSongs->Current(); Song &s = mLibSongs->Current();
int id = Mpd->AddSong(s); int id = Mpd->AddSong(s);
if (id >= 0) if (id >= 0)
@@ -1247,6 +1249,7 @@ int main(int argc, char *argv[])
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format)); ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
if (Keypressed(input, Key.Enter)) if (Keypressed(input, Key.Enter))
Mpd->PlayID(id); Mpd->PlayID(id);
mLibSongs->BoldOption(mLibSongs->GetChoice(), 1);
} }
} }
} }
@@ -1293,6 +1296,7 @@ int main(int argc, char *argv[])
{ {
if (!mPlaylistEditor->Empty()) if (!mPlaylistEditor->Empty())
{ {
block_item_list_update = 1;
Song &s = mPlaylistEditor->at(mPlaylistEditor->GetChoice()); Song &s = mPlaylistEditor->at(mPlaylistEditor->GetChoice());
int id = Mpd->AddSong(s); int id = Mpd->AddSong(s);
if (id >= 0) if (id >= 0)
@@ -1300,6 +1304,7 @@ int main(int argc, char *argv[])
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format)); ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
if (Keypressed(input, Key.Enter)) if (Keypressed(input, Key.Enter))
Mpd->PlayID(id); Mpd->PlayID(id);
mPlaylistEditor->BoldOption(mPlaylistEditor->GetChoice(), 1);
} }
} }
} }
@@ -1525,9 +1530,13 @@ int main(int argc, char *argv[])
} }
case itSong: case itSong:
{ {
block_item_list_update = 1;
Song &s = *item.song; Song &s = *item.song;
if (Mpd->AddSong(s) != -1) if (Mpd->AddSong(s) != -1)
{
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format)); ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
mBrowser->BoldOption(mBrowser->GetChoice(), 1);
}
break; break;
} }
case itPlaylist: case itPlaylist:
@@ -1551,7 +1560,7 @@ int main(int argc, char *argv[])
} }
else if (current_screen == csSearcher && mSearcher->Current().first == ".") else if (current_screen == csSearcher && mSearcher->Current().first == ".")
{ {
block_found_item_list_update = 1; block_item_list_update = 1;
Song &s = mSearcher->Current().second; Song &s = mSearcher->Current().second;
if (Mpd->AddSong(s) != -1) if (Mpd->AddSong(s) != -1)
{ {

View File

@@ -67,7 +67,7 @@ extern bool allow_statusbar_unlock;
extern bool block_progressbar_update; extern bool block_progressbar_update;
extern bool block_statusbar_update; extern bool block_statusbar_update;
extern bool block_playlist_update; extern bool block_playlist_update;
extern bool block_found_item_list_update; extern bool block_item_list_update;
extern bool redraw_screen; extern bool redraw_screen;
extern bool redraw_header; extern bool redraw_header;
@@ -214,21 +214,24 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
else else
playlist_stats = "(" + IntoStr(mPlaylist->Size()) + (mPlaylist->Size() == 1 ? " item" : " items") + TotalPlaylistLength() + ")"; playlist_stats = "(" + IntoStr(mPlaylist->Size()) + (mPlaylist->Size() == 1 ? " item" : " items") + TotalPlaylistLength() + ")";
if (current_screen == csBrowser) if (!block_item_list_update)
{ {
UpdateItemList(mBrowser); if (current_screen == csBrowser)
} {
else if (current_screen == csSearcher && !block_found_item_list_update) UpdateItemList(mBrowser);
{ }
UpdateFoundList(); else if (current_screen == csSearcher)
} {
else if (current_screen == csLibrary) UpdateFoundList();
{ }
UpdateSongList(mLibSongs); else if (current_screen == csLibrary)
} {
else if (current_screen == csPlaylistEditor) UpdateSongList(mLibSongs);
{ }
UpdateSongList(mPlaylistEditor); else if (current_screen == csPlaylistEditor)
{
UpdateSongList(mPlaylistEditor);
}
} }
} }
if (changed.Database) if (changed.Database)