update example configuration file and ReadConfiguration() function
This commit is contained in:
36
doc/config
36
doc/config
@@ -51,21 +51,25 @@
|
|||||||
## value with { }|{ } eg. {%a - %t}|{%f}
|
## value with { }|{ } eg. {%a - %t}|{%f}
|
||||||
##
|
##
|
||||||
## text can also have different color than the main window has,
|
## text can also have different color than the main window has,
|
||||||
## eg. if you want length to have other color, write [.color]%t[/color]
|
## eg. if you want length to be green, write $3%l$9
|
||||||
##
|
##
|
||||||
## available colors:
|
## available values:
|
||||||
##
|
##
|
||||||
## - black
|
## - 0 - default window color
|
||||||
## - red
|
## - 1 - black
|
||||||
## - green
|
## - 2 - red
|
||||||
## - yellow
|
## - 3 - green
|
||||||
## - blue
|
## - 4 - yellow
|
||||||
## - magenta
|
## - 5 - blue
|
||||||
## - cyan
|
## - 6 - magenta
|
||||||
## - white
|
## - 7 - cyan
|
||||||
|
## - 8 - white
|
||||||
|
## - 9 - end of current color
|
||||||
|
##
|
||||||
|
## Note: colors can be nested.
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
#song_list_format = "{[.green](%l)[/green] }{%a - }{%t}|{[.white]%f[/white]}"
|
#song_list_format = "{%a - }{%t}|{$8%f$9}%r{$3(%l)$9}"
|
||||||
#
|
#
|
||||||
#song_library_format = "{%n - }{%t}|{%f}"
|
#song_library_format = "{%n - }{%t}|{%f}"
|
||||||
#
|
#
|
||||||
@@ -73,11 +77,11 @@
|
|||||||
#
|
#
|
||||||
#tag_editor_album_format = "{(%y) }%b"
|
#tag_editor_album_format = "{(%y) }%b"
|
||||||
#
|
#
|
||||||
#browser_playlist_prefix = "[.red]playlist[/red] "
|
#browser_playlist_prefix = "$2playlist$9 "
|
||||||
#
|
#
|
||||||
#selected_item_prefix = "[.magenta]"
|
#selected_item_prefix = "$6"
|
||||||
#
|
#
|
||||||
#selected_item_suffix = "[/magenta]"
|
#selected_item_suffix = "$9"
|
||||||
#
|
#
|
||||||
## colors are not supported for below veriables
|
## colors are not supported for below veriables
|
||||||
#
|
#
|
||||||
@@ -93,10 +97,10 @@
|
|||||||
##
|
##
|
||||||
## (width of column in %)[column's color]{displayed tag}
|
## (width of column in %)[column's color]{displayed tag}
|
||||||
##
|
##
|
||||||
## - color is optional (if it's not present, default window color will be used)
|
## - color is optional (if you want the default one, type [])
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
#song_columns_list_format = "(8)[green]{l} (28)[cyan]{a} (28){b} (50)[red]{t}"
|
#song_columns_list_format = "(7)[green]{l} (28)[cyan]{a} (28)[]{b} (50)[red]{t}"
|
||||||
#
|
#
|
||||||
##### various settings #####
|
##### various settings #####
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -53,6 +53,17 @@ namespace
|
|||||||
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
|
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void String2Buffer(const string &s, Buffer &buf)
|
||||||
|
{
|
||||||
|
for (string::const_iterator it = s.begin(); it != s.end(); it++)
|
||||||
|
{
|
||||||
|
if (*it != '$')
|
||||||
|
buf << *it;
|
||||||
|
else
|
||||||
|
buf << Color(*++it-'0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Border IntoBorder(const string &color)
|
Border IntoBorder(const string &color)
|
||||||
{
|
{
|
||||||
return (Border) IntoColor(color);
|
return (Border) IntoColor(color);
|
||||||
@@ -563,7 +574,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
else if (cl.find("browser_playlist_prefix") != string::npos)
|
else if (cl.find("browser_playlist_prefix") != string::npos)
|
||||||
{
|
{
|
||||||
if (!v.empty())
|
if (!v.empty())
|
||||||
conf.browser_playlist_prefix << v;
|
{
|
||||||
|
conf.browser_playlist_prefix.Clear();
|
||||||
|
String2Buffer(v, conf.browser_playlist_prefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (cl.find("default_tag_editor_pattern") != string::npos)
|
else if (cl.find("default_tag_editor_pattern") != string::npos)
|
||||||
{
|
{
|
||||||
@@ -573,12 +587,18 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
else if (cl.find("selected_item_prefix") != string::npos)
|
else if (cl.find("selected_item_prefix") != string::npos)
|
||||||
{
|
{
|
||||||
if (!v.empty())
|
if (!v.empty())
|
||||||
conf.selected_item_prefix << v;
|
{
|
||||||
|
conf.selected_item_prefix.Clear();
|
||||||
|
String2Buffer(v, conf.selected_item_prefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (cl.find("selected_item_suffix") != string::npos)
|
else if (cl.find("selected_item_suffix") != string::npos)
|
||||||
{
|
{
|
||||||
if (!v.empty())
|
if (!v.empty())
|
||||||
conf.selected_item_suffix << v;
|
{
|
||||||
|
conf.selected_item_suffix.Clear();
|
||||||
|
String2Buffer(v, conf.selected_item_suffix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (cl.find("color1") != string::npos)
|
else if (cl.find("color1") != string::npos)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user