Index: Slim/Player/Player.pm =================================================================== --- Slim/Player/Player.pm (revision 5292) +++ Slim/Player/Player.pm (working copy) @@ -43,6 +43,7 @@ ,'offDisplaySize' => 0 ,'pitch' => 100 ,'playingDisplayMode' => 0 + ,'playingDisplayModes' => [0..5] ,'power' => 1 ,'powerOffBrightness' => 1 ,'powerOnBrightness' => 4 @@ -1528,16 +1529,15 @@ sub playingModeOptions { my $client = shift; my %options = ( - '0' => $client->string('BLANK') - ,'1' => $client->string('ELAPSED') - ,'2' => $client->string('REMAINING') - ,'3' => $client->string('PROGRESS_BAR') - ,'4' => $client->string('ELAPSED') . ' ' . $client->string('AND') . ' ' . $client->string('PROGRESS_BAR') - ,'5' => $client->string('REMAINING') . ' ' . $client->string('AND') . ' ' . $client->string('PROGRESS_BAR') + '0' => $client->string('BLANK'), + '1' => $client->string('ELAPSED'), + '2' => $client->string('REMAINING'), + '3' => $client->string('PROGRESS_BAR'), + '4' => $client->string('ELAPSED') . ' ' . $client->string('AND') . ' ' . $client->string('PROGRESS_BAR'), + '5' => $client->string('REMAINING') . ' ' . $client->string('AND') . ' ' . $client->string('PROGRESS_BAR'), + '6' => $client->string('SETUP_SHOWBUFFERFULLNESS'), ); - $options{'6'} = $client->string('SETUP_SHOWBUFFERFULLNESS') if $client->prefGet('showbufferfullness'); - return \%options; } Index: Slim/Player/Squeezebox2.pm =================================================================== --- Slim/Player/Squeezebox2.pm (revision 5292) +++ Slim/Player/Squeezebox2.pm (working copy) @@ -26,15 +26,16 @@ use Slim::Utils::Unicode; our $defaultPrefs = { - 'activeFont' => [qw(light standard full)], - 'activeFont_curr' => 1, - 'idleFont' => [qw(light standard full)], - 'idleFont_curr' => 1, - 'idleBrightness' => 2, + 'activeFont' => [qw(light standard full)], + 'activeFont_curr' => 1, + 'idleFont' => [qw(light standard full)], + 'idleFont_curr' => 1, + 'idleBrightness' => 2, 'transitionType' => 0, - 'transitionDuration' => 0, + 'transitionDuration' => 0, 'replayGainMode' => '3', - 'playingDisplayMode' => 6, + 'playingDisplayMode' => 5, + 'playingDisplayModes' => [0..11] }; # Parameters for the vumeter: @@ -151,11 +152,8 @@ '9' => $client->string('VISUALIZER_SPECTRUM_ANALYZER'), '10' => $client->string('VISUALIZER_SPECTRUM_ANALYZER'). ' ' . $client->string('AND') . ' ' . $client->string('ELAPSED'), '11' => $client->string('VISUALIZER_SPECTRUM_ANALYZER'). ' ' . $client->string('AND') . ' ' . $client->string('REMAINING'), + '12' => $client->string('SETUP_SHOWBUFFERFULLNESS'), ); - - if ($client->prefGet('showbufferfullness')) { - $options{'12'} = $client->string('SETUP_SHOWBUFFERFULLNESS'); - } return \%options; } @@ -183,13 +181,8 @@ sub nowPlayingModes { my $client = shift; - my $count = scalar(@modes); - if (!$client->prefGet('showbufferfullness')) { - $count--; - } - - return $count; + return scalar(keys %{$client->playingModeOptions()}); } sub showVisualizer { Index: Slim/Web/Setup.pm =================================================================== --- Slim/Web/Setup.pm (revision 5292) +++ Slim/Web/Setup.pm (working copy) @@ -124,8 +124,11 @@ $pageref->{'Prefs'}{'idlesaver'}{'options'} = Slim::Buttons::Common::hash_of_savers(); $pageref->{'Prefs'}{'offsaver'}{'options'} = Slim::Buttons::Common::hash_of_savers(); } - $pageref->{'Prefs'}{'playingDisplayMode'}{'options'} = $client->playingModeOptions(); - $pageref->{'Prefs'}{'playingDisplayMode'}{'validateArgs'} = [0,scalar($pageref->{'Prefs'}{'playingDisplayMode'}{'options'}),1,1]; } else { + + my $displayHash = $client->playingModeOptions(); + $displayHash->{-1} = ' ' ; + $pageref->{'Prefs'}{'playingDisplayModes'}{'options'} = $displayHash; + $pageref->{'Prefs'}{'playingDisplayModes'}{'validateArgs'} = [$pageref->{'Prefs'}{'playingDisplayModes'}{'options'}]; } else { $pageref->{'GroupOrder'} = ['Default','TitleFormats']; } @@ -148,11 +151,6 @@ $paramref->{'macaddress'} = $client->macaddress; $paramref->{'signalstrength'} = $client->signalStrength; - if ($client->isPlayer()) { - $pageref->{'Prefs'}{'playingDisplayMode'}{'options'} = $client->playingModeOptions(); - $pageref->{'Prefs'}{'playingDisplayMode'}{'validateArgs'} = [0,scalar($pageref->{'Prefs'}{'playingDisplayMode'}{'options'}),1,1]; - } - $client->update(); } #,'template' => 'setup_player.html' @@ -173,13 +171,18 @@ ,'GroupLine' => 1 } ,'Display' => { - 'PrefOrder' => ['playingDisplayMode','showbufferfullness'] + 'PrefOrder' => ['playingDisplayModes'] + ,'PrefsInTable' => 1 ,'Suppress_PrefHead' => 1 ,'Suppress_PrefDesc' => 1 ,'Suppress_PrefLine' => 1 + ,'Suppress_PrefSub' => 1 ,'GroupHead' => string('SETUP_PLAYINGDISPLAYMODE') ,'GroupDesc' => string('SETUP_PLAYINGDISPLAYMODE_DESC') + ,'GroupPrefHead' => '' . string('SETUP_CURRENT') . + '' . string('DISPLAY_SETTINGS') . '' ,'GroupLine' => 1 + ,'GroupSub' => 1 } ,'ScreenSaver' => { 'PrefOrder' => ['screensaver','idlesaver','offsaver','screensavertimeout'] @@ -204,21 +207,31 @@ 'validate' => \&validateInt ,'validateArgs' => [] #will be set by preEval } - ,'playingDisplayMode' => { + ,'playingDisplayMode' => { 'validate' => \&validateInt - ,'validateArgs' => undef - ,'options' => undef + ,'validateArgs' => [] # will be set by preEval + } + ,'playingDisplayModes' => { + 'isArray' => 1 + ,'arrayAddExtra' => 1 + ,'arrayDeleteNull' => 1 + ,'arrayDeleteValue' => -1 + ,'arrayBasicValue' => 0 + ,'arrayCurrentPref' => 'playingDisplayMode' + ,'inputTemplate' => 'setup_input_array_sel.html' + ,'validate' => \&validateInHash + ,'validateArgs' => [] #filled by initSetup + ,'options' => {} #filled by initSetup using hash_of_prefs('titleFormat') ,'optionSort' => 'NK' - ,'PrefChoose' => string('SETUP_PLAYINGDISPLAYMODE').string('COLON') - ,'onChange' => sub { shift->update(); } + ,'onChange' => sub { + my ($client,$changeref,$paramref,$pageref) = @_; + if (exists($changeref->{'playingDisplayModes'}{'Processed'})) { + return; + } + processArrayChange($client,'playingDisplayModes',$paramref,$pageref); + $changeref->{'playingDisplayModes'}{'Processed'} = 1; + } } - ,'showbufferfullness' => { - 'validate' => \&validateTrueFalse - ,'options' => { - '0' => string('DISABLED') - ,'1' => string('ENABLED') - } - } ,'titleFormat' => { 'isArray' => 1 ,'arrayAddExtra' => 1 Index: Slim/Buttons/Playlist.pm =================================================================== --- Slim/Buttons/Playlist.pm (revision 5292) +++ Slim/Buttons/Playlist.pm (working copy) @@ -29,29 +29,34 @@ my $button = shift; my $buttonarg = shift; my $pdm = $client->prefGet("playingDisplayMode"); + my $index = -1; + + #find index of the existing display mode in the pref array + for ($client->prefGetArray('playingDisplayModes')) { + $index++; + last if $pdm == $_; + } + $pdm = $index unless $index == -1; + unless (defined $pdm) { $pdm = 1; }; unless (defined $buttonarg) { $buttonarg = 'toggle'; }; if ($button eq 'playdisp_toggle') { my $playlistlen = Slim::Player::Playlist::count($client); - # playingDisplayModes are - # 0 show nothing - # 1 show elapsed time - # 2 show remaining time - # 3 show progress bar - # 4 show elapsed time and progress bar - # 5 show remaining time and progress bar + if (($playlistlen > 0) && (showingNowPlaying($client))) { - $pdm = ($pdm + 1) % $client->nowPlayingModes(); + $pdm = ($pdm + 1) % ($client->prefGetArrayMax('playingDisplayModes') +1); } elsif ($playlistlen > 0) { browseplaylistindex($client,Slim::Player::Source::playingSongIndex($client)); } } else { - if ($buttonarg && $buttonarg < $client->nowPlayingModes()) { + if ($buttonarg && $buttonarg < ($client->prefGetArrayMax('playingDisplayModes') +1)) { $pdm = $buttonarg; } } - $client->param('animateTop',$pdm); - $client->prefSet("playingDisplayMode", $pdm); + + #find mode number at the new index, and save to the prefs + $client->param('animateTop',${[$client->prefGetArray('playingDisplayModes')]}[$pdm]); + $client->prefSet("playingDisplayMode", ${[$client->prefGetArray('playingDisplayModes')]}[$pdm]); $client->update(); }, 'up' => sub {