if volume < 0, display 'n/a' instead of '-1%'
This commit is contained in:
@@ -502,8 +502,14 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
if (changed.Volume && Config.header_visibility)
|
if (changed.Volume && Config.header_visibility)
|
||||||
{
|
{
|
||||||
VolumeState = " Volume: ";
|
VolumeState = " Volume: ";
|
||||||
VolumeState += IntoStr(Mpd->GetVolume());
|
int volume = Mpd->GetVolume();
|
||||||
VolumeState += "%";
|
if (volume < 0)
|
||||||
|
VolumeState += "n/a";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VolumeState += IntoStr(volume);
|
||||||
|
VolumeState += "%";
|
||||||
|
}
|
||||||
wHeader->SetColor(Config.volume_color);
|
wHeader->SetColor(Config.volume_color);
|
||||||
*wHeader << XY(wHeader->GetWidth()-VolumeState.length(), 0) << VolumeState;
|
*wHeader << XY(wHeader->GetWidth()-VolumeState.length(), 0) << VolumeState;
|
||||||
wHeader->SetColor(Config.header_color);
|
wHeader->SetColor(Config.header_color);
|
||||||
|
|||||||
Reference in New Issue
Block a user