Pretty up the v4l field names

This commit is contained in:
Isaac Connor 2021-11-07 11:28:34 -05:00
parent f737e3e945
commit 6609c154f2
1 changed files with 10 additions and 5 deletions

View File

@ -38,7 +38,7 @@ if ($zmuOutput) {
$ctls = shell_exec('v4l2-ctl -d '.$monitor->Device().' --list-ctrls'); $ctls = shell_exec('v4l2-ctl -d '.$monitor->Device().' --list-ctrls');
if (!$ctls) { if (!$ctls) {
ZM\Warning("Guessing v4l ctrls. We need v4l2-ctl please install it"); ZM\Warning('Guessing v4l ctrls. We need v4l2-ctl please install it');
$ctls = ' $ctls = '
brightness 0x00980900 (int) : min=-10 max=10 step=1 default=0 value=8 brightness 0x00980900 (int) : min=-10 max=10 step=1 default=0 value=8
contrast 0x00980901 (int) : min=0 max=20 step=1 default=10 value=12 contrast 0x00980901 (int) : min=0 max=20 step=1 default=10 value=12
@ -83,10 +83,15 @@ foreach ($ctls as $line) {
} }
} }
$label = translate($setting_uc);
if ($label == $setting_uc) {
$label = ucwords(str_replace('_', ' ', $label));
}
if ($setting == 'brightness' or $setting == 'colour' or $setting == 'contrast' or $setting == 'hue') { if ($setting == 'brightness' or $setting == 'colour' or $setting == 'contrast' or $setting == 'hue') {
echo ' echo '
<tr> <tr>
<th scope="row">'.translate($setting_uc).'</th> <th scope="row">'.$label.'</th>
<td>'.$min.'</td><td><input type="range" title="'.$value.'" min="'.$min.'" max="'.$max.'" step="'.$step.'" default="'.$default.'" value="'.$value.'" id="new'.$setting_uc.'" name="new'.$setting_uc.'" '.(canEdit('Control') ? '' : 'disabled="disabled"') .'/></td><td>'.$max.'</td> <td>'.$min.'</td><td><input type="range" title="'.$value.'" min="'.$min.'" max="'.$max.'" step="'.$step.'" default="'.$default.'" value="'.$value.'" id="new'.$setting_uc.'" name="new'.$setting_uc.'" '.(canEdit('Control') ? '' : 'disabled="disabled"') .'/></td><td>'.$max.'</td>
</tr> </tr>
'; ';
@ -94,7 +99,7 @@ foreach ($ctls as $line) {
if ($type == '(bool)') { if ($type == '(bool)') {
echo ' echo '
<tr> <tr>
<th scope="row">'.translate($setting_uc).'</th> <th scope="row">'.$label.'</th>
<td></td><td>'.html_radio('new'.$setting_uc, array('0'=>translate('True'), '1', translate('False')), $value, array('disabled'=>'disabled')).' <td></td><td>'.html_radio('new'.$setting_uc, array('0'=>translate('True'), '1', translate('False')), $value, array('disabled'=>'disabled')).'
</td><td></td> </td><td></td>
</tr> </tr>
@ -102,14 +107,14 @@ foreach ($ctls as $line) {
} else if ($type == '(int)') { } else if ($type == '(int)') {
echo ' echo '
<tr> <tr>
<th scope="row">'.translate($setting_uc).'</th> <th scope="row">'.$label.'</th>
<td></td><td><input type="range" '.$ctl[1].' disabled="disabled"/></td><td></td> <td></td><td><input type="range" '.$ctl[1].' disabled="disabled"/></td><td></td>
</tr> </tr>
'; ';
} else { } else {
echo ' echo '
<tr> <tr>
<th scope="row">'.translate($setting_uc).'</th> <th scope="row">'.$label.'</th>
<td></td><td>'.$value.'</td><td></td> <td></td><td>'.$value.'</td><td></td>
</tr> </tr>
'; ';