improve checking if song is in playlist in search engine
This commit is contained in:
@@ -132,7 +132,7 @@ void UpdateSongList(Menu<Song> *menu)
|
|||||||
menu->Refresh();
|
menu->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateFoundList(const SongList &v, Menu<string> *menu)
|
void UpdateFoundList(const SongList &v)
|
||||||
{
|
{
|
||||||
int i = search_engine_static_option;
|
int i = search_engine_static_option;
|
||||||
bool bold = 0;
|
bool bold = 0;
|
||||||
@@ -146,10 +146,9 @@ void UpdateFoundList(const SongList &v, Menu<string> *menu)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu->BoldOption(i, bold);
|
mSearcher->BoldOption(i, bold);
|
||||||
bold = 0;
|
bold = 0;
|
||||||
}
|
}
|
||||||
menu->Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string DisplayKeys(int *key, int size)
|
string DisplayKeys(int *key, int size)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class CaseInsensitiveSorting
|
|||||||
|
|
||||||
void UpdateItemList(Menu<Item> *);
|
void UpdateItemList(Menu<Item> *);
|
||||||
void UpdateSongList(Menu<Song> *);
|
void UpdateSongList(Menu<Song> *);
|
||||||
void UpdateFoundList(const SongList &, Menu<string> *);
|
void UpdateFoundList(const SongList &);
|
||||||
|
|
||||||
string DisplayKeys(int *, int = 2);
|
string DisplayKeys(int *, int = 2);
|
||||||
bool Keypressed(int, const int *);
|
bool Keypressed(int, const int *);
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ bool block_progressbar_update = 0;
|
|||||||
bool block_statusbar_update = 0;
|
bool block_statusbar_update = 0;
|
||||||
bool allow_statusbar_unblock = 1;
|
bool allow_statusbar_unblock = 1;
|
||||||
bool block_playlist_update = 0;
|
bool block_playlist_update = 0;
|
||||||
|
bool block_found_item_list_update = 0;
|
||||||
|
|
||||||
bool search_case_sensitive = 1;
|
bool search_case_sensitive = 1;
|
||||||
bool search_mode_match = 1;
|
bool search_mode_match = 1;
|
||||||
@@ -411,6 +412,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
|
|
||||||
|
block_found_item_list_update = 0;
|
||||||
block_playlist_update = 0;
|
block_playlist_update = 0;
|
||||||
messages_allowed = 1;
|
messages_allowed = 1;
|
||||||
|
|
||||||
@@ -1188,12 +1190,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
block_found_item_list_update = 1;
|
||||||
Song &s = *vSearched[mSearcher->GetRealChoice()-1];
|
Song &s = *vSearched[mSearcher->GetRealChoice()-1];
|
||||||
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));
|
||||||
|
mSearcher->BoldOption(mSearcher->GetChoice(), 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1502,10 +1506,13 @@ int main(int argc, char *argv[])
|
|||||||
int id = mSearcher->GetChoice()-search_engine_static_option;
|
int id = mSearcher->GetChoice()-search_engine_static_option;
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
continue;
|
continue;
|
||||||
|
block_found_item_list_update = 1;
|
||||||
Song &s = *vSearched[id];
|
Song &s = *vSearched[id];
|
||||||
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));
|
||||||
|
mSearcher->BoldOption(mSearcher->GetChoice(), 1);
|
||||||
|
}
|
||||||
mSearcher->Go(wDown);
|
mSearcher->Go(wDown);
|
||||||
}
|
}
|
||||||
else if (current_screen == csLibrary)
|
else if (current_screen == csLibrary)
|
||||||
@@ -2740,7 +2747,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!vSearched.empty())
|
if (!vSearched.empty())
|
||||||
{
|
{
|
||||||
wCurrent->WriteXY(0, 0, "Updating list...");
|
wCurrent->WriteXY(0, 0, "Updating list...");
|
||||||
UpdateFoundList(vSearched, mSearcher);
|
UpdateFoundList(vSearched);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ extern bool allow_statusbar_unblock;
|
|||||||
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 redraw_me;
|
extern bool redraw_me;
|
||||||
|
|
||||||
@@ -212,9 +213,9 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
|||||||
{
|
{
|
||||||
UpdateItemList(mBrowser);
|
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)
|
else if (current_screen == csLibrary)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user