settings: add volume_change_step configuration option
This commit is contained in:
@@ -615,12 +615,14 @@ void SlaveScreen::run()
|
||||
|
||||
void VolumeUp::run()
|
||||
{
|
||||
Mpd.SetVolume(Mpd.GetVolume()+1);
|
||||
int volume = std::min(Mpd.GetVolume()+Config.volume_change_step, 100);
|
||||
Mpd.SetVolume(volume);
|
||||
}
|
||||
|
||||
void VolumeDown::run()
|
||||
{
|
||||
Mpd.SetVolume(Mpd.GetVolume()-1);
|
||||
int volume = std::max(Mpd.GetVolume()-Config.volume_change_step, 0);
|
||||
Mpd.SetVolume(volume);
|
||||
}
|
||||
|
||||
bool DeletePlaylistItems::canBeRun() const
|
||||
|
||||
@@ -224,6 +224,7 @@ void Configuration::SetDefaults()
|
||||
mpd_connection_timeout = 15;
|
||||
crossfade_time = 5;
|
||||
seek_time = 1;
|
||||
volume_change_step = 1;
|
||||
playlist_disable_highlight_delay = 5;
|
||||
message_delay_time = 4;
|
||||
lyrics_db = 0;
|
||||
@@ -367,6 +368,11 @@ void Configuration::Read()
|
||||
if (boost::lexical_cast<int>(v) > 0)
|
||||
seek_time = boost::lexical_cast<int>(v);
|
||||
}
|
||||
else if (name == "volume_change_step")
|
||||
{
|
||||
if (boost::lexical_cast<int>(v) > 0)
|
||||
volume_change_step = boost::lexical_cast<int>(v);
|
||||
}
|
||||
else if (name == "playlist_disable_highlight_delay")
|
||||
{
|
||||
if (boost::lexical_cast<int>(v) >= 0)
|
||||
|
||||
@@ -189,6 +189,7 @@ struct Configuration
|
||||
int mpd_connection_timeout;
|
||||
int crossfade_time;
|
||||
int seek_time;
|
||||
int volume_change_step;
|
||||
int playlist_disable_highlight_delay;
|
||||
int message_delay_time;
|
||||
int lyrics_db;
|
||||
|
||||
Reference in New Issue
Block a user