improve checking if song is in playlist in search engine

This commit is contained in:
unK
2008-09-09 10:01:56 +02:00
parent 52241fd36d
commit cad4d36807
4 changed files with 15 additions and 8 deletions

View File

@@ -132,7 +132,7 @@ void UpdateSongList(Menu<Song> *menu)
menu->Refresh();
}
void UpdateFoundList(const SongList &v, Menu<string> *menu)
void UpdateFoundList(const SongList &v)
{
int i = search_engine_static_option;
bool bold = 0;
@@ -146,10 +146,9 @@ void UpdateFoundList(const SongList &v, Menu<string> *menu)
break;
}
}
menu->BoldOption(i, bold);
mSearcher->BoldOption(i, bold);
bold = 0;
}
menu->Refresh();
}
string DisplayKeys(int *key, int size)

View File

@@ -40,7 +40,7 @@ class CaseInsensitiveSorting
void UpdateItemList(Menu<Item> *);
void UpdateSongList(Menu<Song> *);
void UpdateFoundList(const SongList &, Menu<string> *);
void UpdateFoundList(const SongList &);
string DisplayKeys(int *, int = 2);
bool Keypressed(int, const int *);

View File

@@ -146,6 +146,7 @@ bool block_progressbar_update = 0;
bool block_statusbar_update = 0;
bool allow_statusbar_unblock = 1;
bool block_playlist_update = 0;
bool block_found_item_list_update = 0;
bool search_case_sensitive = 1;
bool search_mode_match = 1;
@@ -411,6 +412,7 @@ int main(int argc, char *argv[])
TraceMpdStatus();
block_found_item_list_update = 0;
block_playlist_update = 0;
messages_allowed = 1;
@@ -1188,12 +1190,14 @@ int main(int argc, char *argv[])
}
default:
{
block_found_item_list_update = 1;
Song &s = *vSearched[mSearcher->GetRealChoice()-1];
int id = Mpd->AddSong(s);
if (id >= 0)
{
Mpd->PlayID(id);
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
mSearcher->BoldOption(mSearcher->GetChoice(), 1);
}
break;
}
@@ -1502,10 +1506,13 @@ int main(int argc, char *argv[])
int id = mSearcher->GetChoice()-search_engine_static_option;
if (id < 0)
continue;
block_found_item_list_update = 1;
Song &s = *vSearched[id];
if (Mpd->AddSong(s) != -1)
{
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
mSearcher->BoldOption(mSearcher->GetChoice(), 1);
}
mSearcher->Go(wDown);
}
else if (current_screen == csLibrary)
@@ -2740,7 +2747,7 @@ int main(int argc, char *argv[])
if (!vSearched.empty())
{
wCurrent->WriteXY(0, 0, "Updating list...");
UpdateFoundList(vSearched, mSearcher);
UpdateFoundList(vSearched);
}
}
}

View File

@@ -69,6 +69,7 @@ extern bool allow_statusbar_unblock;
extern bool block_progressbar_update;
extern bool block_statusbar_update;
extern bool block_playlist_update;
extern bool block_found_item_list_update;
extern bool redraw_me;
@@ -212,9 +213,9 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
{
UpdateItemList(mBrowser);
}
else if (current_screen == csSearcher)
else if (current_screen == csSearcher && !block_found_item_list_update)
{
UpdateFoundList(vSearched, mSearcher);
UpdateFoundList(vSearched);
}
else if (current_screen == csLibrary)
{