Index: Slim/Control/Jive.pm =================================================================== --- Slim/Control/Jive.pm (revision 22531) +++ Slim/Control/Jive.pm (working copy) @@ -112,9 +112,12 @@ Slim::Control::Request::addDispatch(['jivefavorites', '_cmd' ], [1, 0, 1, \&jiveFavoritesCommand]); - Slim::Control::Request::addDispatch(['jiveplayerbrightnesssettings'], - [1, 0, 0, \&playerBrightnessMenu]); + Slim::Control::Request::addDispatch(['jiveplayerbrightnesssettings', '_index', '_quantity'], + [1, 1, 1, \&brightnessSettingsQuery]); + Slim::Control::Request::addDispatch(['jiveplayerbrightnessadjust'], + [1, 0, 1, \&brightnessAdjustCommand]); + Slim::Control::Request::addDispatch(['jiveunmixable'], [1, 1, 1, \&jiveUnmixableMessage]); @@ -1247,6 +1250,69 @@ $request->setStatusDone(); } +sub brightnessSettingsQuery { + + $log->info("Begin function"); + my $request = shift; + my $client = $request->client(); + my $mode = $request->getParam('cmd'); + + my $val = preferences('server')->client($client)->get($mode); + + my @menu = (); + my $slider = { + slider => 1, + min => 0, + max => 5, # TODO use proper $client->maxBrightness + adjust => 1, # slider currently doesn't like a slider starting at or below 0 + initial => $val, + #help => NO_HELP_STRING_YET, + actions => { + do => { + player => 0, + cmd => [ 'jiveplayerbrightnessadjust' ], + params => { + mode => $mode, + valtag => 'value', + }, + }, + }, + }; + + push @menu, $slider; + + sliceAndShip($request, $client, \@menu); + + $request->setStatusDone(); +} + +sub brightnessAdjustCommand { + + my $request = shift; + my $client = $request->client(); + my $mode = $request->getParam('mode'); + my $delta = $request->getParam('delta'); + my $newVal = $request->getParam('value'); + + my $val = preferences('server')->client($client)->get($mode); + + if (!defined $newVal) { + $newVal = $val + $delta; + } + + $val = preferences('server')->client($client)->set($mode,$newVal); + + my $string = $client->string("SETUP_" . $mode) . ": " . $val; + $client->showBriefly({ + 'jive' => { + type => 'popupplay', + text => [ $string ], + } + }); + + $request->setStatusDone(); +} + sub toneSettingsQuery { $log->info("Begin function"); @@ -1696,20 +1762,65 @@ # brightness settings for players with displays if ( $client->isPlayer() && !$client->display->isa('Slim::Display::NoDisplay') ) { push @menu, { - text => $client->string("PLAYER_BRIGHTNESS"), + text => $client->string('PLAYER_BRIGHTNESS'), id => 'settingsPlayerBrightness', node => 'advancedSettings', + isANode => 1, + window => { titleStyle => 'settings', }, + }; + + push @menu, { + text => $client->string("SETUP_POWERONBRIGHTNESS"), + id => 'settingsPlayerBrightnessWhenOn', + node => 'settingsPlayerBrightness', + weight => 10, actions => { - do => { + go => { cmd => ['jiveplayerbrightnesssettings'], player => 0, - }, + params => { + 'cmd' => 'powerOnBrightness', + }, + }, }, window => { titleStyle => 'settings' }, }; + + push @menu, { + text => $client->string("SETUP_IDLEBRIGHTNESS"), + id => 'settingsPlayerBrightnessIdle', + node => 'settingsPlayerBrightness', + weight => 30, + actions => { + go => { + cmd => ['jiveplayerbrightnesssettings'], + player => 0, + params => { + 'cmd' => 'idleBrightness', + }, + }, + }, + window => { titleStyle => 'settings' }, + }; + + push @menu, { + text => $client->string("SETUP_POWEROFFBRIGHTNESS"), + id => 'settingsPlayerBrightnessWhenOff', + node => 'settingsPlayerBrightness', + weight => 20, + actions => { + go => { + cmd => ['jiveplayerbrightnesssettings'], + player => 0, + params => { + 'cmd' => 'powerOffBrightness', + }, + }, + }, + window => { titleStyle => 'settings' }, + }; } - if ($batch) { return \@menu; } else { @@ -1717,25 +1828,6 @@ } } -sub playerBrightnessMenu { - - my $request = shift; - my $client = $request->client(); - - Slim::Hardware::IR::executeButton($client, 'brightness_toggle', undef, undef, 1); - - my $newBrightness = $client->brightness(); - $client->showBriefly({ - 'jive' => { - 'type' => 'popupplay', - 'text' => [ $client->string('SETTING_PLAYER_BRIGHTNESS_TO', $client->name(), $newBrightness) ], - } - }); - - $request->setStatusDone(); - -} - sub browseMusicFolder { $log->info("Begin function"); my $client = shift;