|
|
|
|
@ -197,8 +197,30 @@ void DefaultConfiguration(ncmpcpp_config &conf) |
|
|
|
|
conf.message_delay_time = 4; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void GetKeys(string line, int *key) |
|
|
|
|
string GetLineValue(const string &line, char a, char b) |
|
|
|
|
{ |
|
|
|
|
int i = 0; |
|
|
|
|
int begin = -1, end = -1; |
|
|
|
|
for (string::const_iterator it = line.begin(); it != line.end(); i++, it++) |
|
|
|
|
{ |
|
|
|
|
if (*it == a || *it == b) |
|
|
|
|
{ |
|
|
|
|
if (begin < 0) |
|
|
|
|
begin = i+1; |
|
|
|
|
else |
|
|
|
|
end = i; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (begin >= 0 && end >= 0) |
|
|
|
|
return line.substr(begin, end-begin); |
|
|
|
|
else |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
void GetKeys(string line, int *key) |
|
|
|
|
{ |
|
|
|
|
int i = line.find("=")+1; |
|
|
|
|
line = line.substr(i, line.length()-i); |
|
|
|
|
i = 0; |
|
|
|
|
@ -218,30 +240,10 @@ void GetKeys(string line, int *key) |
|
|
|
|
one = line; |
|
|
|
|
key[0] = !one.empty() && one[0] == '\'' ? one[1] : (atoi(one.c_str()) == 0 ? null_key : atoi(one.c_str())); |
|
|
|
|
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string GetLineValue(const string &line, char a, char b) |
|
|
|
|
{ |
|
|
|
|
int i = 0; |
|
|
|
|
int begin = -1, end = -1; |
|
|
|
|
for (string::const_iterator it = line.begin(); it != line.end(); i++, it++) |
|
|
|
|
{ |
|
|
|
|
if (*it == a || *it == b) |
|
|
|
|
{ |
|
|
|
|
if (begin < 0) |
|
|
|
|
begin = i+1; |
|
|
|
|
else |
|
|
|
|
end = i; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (begin >= 0 && end >= 0) |
|
|
|
|
return line.substr(begin, end-begin); |
|
|
|
|
else |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string IntoStr(Color color) |
|
|
|
|
{ |
|
|
|
|
string IntoStr(Color color) |
|
|
|
|
{ |
|
|
|
|
string result; |
|
|
|
|
|
|
|
|
|
if (color == clDefault) |
|
|
|
|
@ -264,10 +266,10 @@ string IntoStr(Color color) |
|
|
|
|
result = "white"; |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Color IntoColor(const string &color) |
|
|
|
|
{ |
|
|
|
|
Color IntoColor(const string &color) |
|
|
|
|
{ |
|
|
|
|
Color result = clDefault; |
|
|
|
|
|
|
|
|
|
if (color == "black") |
|
|
|
|
@ -288,6 +290,7 @@ Color IntoColor(const string &color) |
|
|
|
|
result = clWhite; |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ReadKeys(ncmpcpp_keys &keys) |
|
|
|
|
|