CC-4754: Replay gain modifier

- done
This commit is contained in:
james 2012-12-27 22:58:41 -05:00
parent c0665e4748
commit cf38e2c596
7 changed files with 42 additions and 43 deletions

View file

@ -66,7 +66,6 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetSoundCloudGenre($values["SoundCloudGenre"]); Application_Model_Preference::SetSoundCloudGenre($values["SoundCloudGenre"]);
Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]); Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]);
Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]); Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]);
Application_Model_Preference::setReplayGainModifier($values["replayGainModifier"]);
$this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>"; $this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>";
$this->view->form = $form; $this->view->form = $form;
@ -256,6 +255,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]); Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]); Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]); Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
Application_Model_Preference::setReplayGainModifier($values["replayGainModifier"]);
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) { if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"]; $master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];

View file

@ -74,13 +74,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay()); $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper')); $week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day); $this->addElement($week_start_day);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))
->setValue(Application_Model_Preference::getReplayGainModifier())
->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))
->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain);
} }
private function getTimezones() private function getTimezones()

View file

@ -58,6 +58,13 @@ class Application_Form_StreamSetting extends Zend_Form
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper')); $stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format); $this->addElement($stream_format);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))
->setValue(Application_Model_Preference::getReplayGainModifier())
->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))
->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain);
} }
public function isValid($data) public function isValid($data)

View file

@ -108,23 +108,5 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="replayGainModifier-label" class="block-display">
<label><?php echo $this->element->getElement('replayGainModifier')->getLabel() ?>:
</label>
<span id="rg_modifier_value" style="border: 0; color: #f6931f; font-weight: bold;">
<?php echo $this->element->getElement('replayGainModifier')->getValue() ?>
</span>
</dt>
<dd id="replayGainModifier-element" class="block-display">
<?php echo $this->element->getElement('replayGainModifier') ?>
<?php if($this->element->getElement('replayGainModifier')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('replayGainModifier')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div id="slider-range-max"></div>
</dd>
</dl> </dl>
</fieldset> </fieldset>

View file

@ -63,6 +63,24 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="replayGainModifier-label" class="block-display">
<label><?php echo $this->form->getElement('replayGainModifier')->getLabel() ?>:
</label>
<span id="rg_modifier_value" style="border: 0; color: #f6931f; font-weight: bold;">
<?php echo $this->form->getElement('replayGainModifier')->getValue() ?>
</span>
</dt>
<dd id="replayGainModifier-element" class="block-display">
<?php echo $this->form->getElement('replayGainModifier') ?>
<?php if($this->form->getElement('replayGainModifier')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->form->getElement('replayGainModifier')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div id="slider-range-max"></div>
</dd>
</dl> </dl>
</fieldset> </fieldset>
<?php echo $this->form->getSubform('live_stream_subform'); ?> <?php echo $this->form->getSubform('live_stream_subform'); ?>

View file

@ -80,20 +80,6 @@ function setMsAuthenticationFieldsReadonly(ele) {
} }
} }
function setSliderForReplayGain(){
$( "#slider-range-max" ).slider({
range: "max",
min: 0,
max: 10,
value: $("#rg_modifier_value").html(),
slide: function( event, ui ) {
$( "#replayGainModifier" ).val( ui.value );
$("#rg_modifier_value").html(ui.value);
}
});
$( "#replayGainModifier" ).val( $( "#slider-range-max" ).slider( "value" ) );
}
$(document).ready(function() { $(document).ready(function() {
$('.collapsible-header').live('click',function() { $('.collapsible-header').live('click',function() {
@ -111,7 +97,6 @@ $(document).ready(function() {
$('#content').empty().append(json.html); $('#content').empty().append(json.html);
setTimeout(removeSuccessMsg, 5000); setTimeout(removeSuccessMsg, 5000);
showErrorSections(); showErrorSections();
setSliderForReplayGain();
}); });
}); });
@ -121,6 +106,4 @@ $(document).ready(function() {
setSystemFromEmailReadonly(); setSystemFromEmailReadonly();
setConfigureMailServerListener(); setConfigureMailServerListener();
setEnableSystemEmailsListener(); setEnableSystemEmailsListener();
setSliderForReplayGain();
}); });

View file

@ -386,12 +386,28 @@ function setupEventListeners() {
var json = $.parseJSON(data); var json = $.parseJSON(data);
$('#content').empty().append(json.html); $('#content').empty().append(json.html);
setupEventListeners(); setupEventListeners();
setSliderForReplayGain();
}); });
} }
}); });
} }
function setSliderForReplayGain(){
$( "#slider-range-max" ).slider({
range: "max",
min: -10,
max: 10,
value: $("#rg_modifier_value").html(),
slide: function( event, ui ) {
$( "#replayGainModifier" ).val( ui.value );
$("#rg_modifier_value").html(ui.value);
}
});
$( "#replayGainModifier" ).val( $( "#slider-range-max" ).slider( "value" ) );
}
$(document).ready(function() { $(document).ready(function() {
setupEventListeners(); setupEventListeners();
setSliderForReplayGain();
}); });