new feature: support for custom prefix/suffix of now playing song
This commit is contained in:
@@ -107,7 +107,7 @@ void Display::SongsInColumns(const MPD::Song &s, void *, Menu<MPD::Song> *menu)
|
||||
|
||||
bool is_now_playing = menu == myPlaylist->Items && menu->CurrentlyDrawedPosition() == myPlaylist->NowPlaying;
|
||||
if (is_now_playing)
|
||||
*menu << fmtBold;
|
||||
*menu << Config.now_playing_prefix;
|
||||
|
||||
if (Config.columns.empty())
|
||||
return;
|
||||
@@ -209,7 +209,7 @@ void Display::SongsInColumns(const MPD::Song &s, void *, Menu<MPD::Song> *menu)
|
||||
if ((--it)->color != clDefault)
|
||||
*menu << clEnd;
|
||||
if (is_now_playing)
|
||||
*menu << fmtBoldEnd;
|
||||
*menu << Config.now_playing_suffix;
|
||||
}
|
||||
|
||||
void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
@@ -219,7 +219,7 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
|
||||
bool is_now_playing = menu == myPlaylist->Items && menu->CurrentlyDrawedPosition() == myPlaylist->NowPlaying;
|
||||
if (is_now_playing)
|
||||
*menu << fmtBold;
|
||||
*menu << Config.now_playing_prefix;
|
||||
|
||||
std::string line = s.toString(*static_cast<std::string *>(data));
|
||||
for (std::string::const_iterator it = line.begin(); it != line.end(); ++it)
|
||||
@@ -235,8 +235,10 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
basic_buffer<my_char_t> buf;
|
||||
buf << U(" ");
|
||||
String2Buffer(TO_WSTRING(line.substr(it-line.begin()+1)), buf);
|
||||
if (is_now_playing)
|
||||
buf << Config.now_playing_suffix;
|
||||
*menu << XY(menu->GetWidth()-buf.Str().length(), menu->Y()) << buf;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
else
|
||||
*menu << *it;
|
||||
@@ -245,7 +247,7 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
*menu << *it;
|
||||
}
|
||||
if (is_now_playing)
|
||||
*menu << fmtBoldEnd;
|
||||
*menu << Config.now_playing_suffix;
|
||||
}
|
||||
|
||||
void Display::Tags(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
|
||||
@@ -262,6 +262,8 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
||||
conf.pattern = "%n - %t";
|
||||
conf.selected_item_prefix << clMagenta;
|
||||
conf.selected_item_suffix << clEnd;
|
||||
conf.now_playing_prefix << fmtBold;
|
||||
conf.now_playing_suffix << fmtBoldEnd;
|
||||
conf.color1 = clWhite;
|
||||
conf.color2 = clGreen;
|
||||
conf.empty_tags_color = clCyan;
|
||||
@@ -670,6 +672,22 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
||||
String2Buffer(v, conf.selected_item_suffix);
|
||||
}
|
||||
}
|
||||
else if (cl.find("now_playing_prefix") != std::string::npos)
|
||||
{
|
||||
if (!v.empty())
|
||||
{
|
||||
conf.now_playing_prefix.Clear();
|
||||
String2Buffer(v, conf.now_playing_prefix);
|
||||
}
|
||||
}
|
||||
else if (cl.find("now_playing_suffix") != std::string::npos)
|
||||
{
|
||||
if (!v.empty())
|
||||
{
|
||||
conf.now_playing_suffix.Clear();
|
||||
String2Buffer(TO_WSTRING(v), conf.now_playing_suffix);
|
||||
}
|
||||
}
|
||||
else if (cl.find("color1") != std::string::npos)
|
||||
{
|
||||
if (!v.empty())
|
||||
|
||||
@@ -150,6 +150,8 @@ struct ncmpcpp_config
|
||||
Buffer browser_playlist_prefix;
|
||||
Buffer selected_item_prefix;
|
||||
Buffer selected_item_suffix;
|
||||
Buffer now_playing_prefix;
|
||||
basic_buffer<my_char_t> now_playing_suffix;
|
||||
|
||||
Color color1;
|
||||
Color color2;
|
||||
|
||||
Reference in New Issue
Block a user