added units to AudioDialog params

This commit is contained in:
thrust26 2018-07-31 22:24:00 +02:00
parent 6cafbba3e4
commit 766b6cd566
2 changed files with 26 additions and 10 deletions

View File

@ -52,7 +52,7 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
VariantList items;
// Set real dimensions
_w = 45 * fontWidth + HBORDER * 2;
_w = 46 * fontWidth + HBORDER * 2;
_h = 11 * (lineHeight + 4) + VBORDER + _th;
xpos = HBORDER; ypos = VBORDER + _th;
@ -125,25 +125,24 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
// Param 1
int swidth = pwidth+23;
myHeadroomSlider = new SliderWidget(this, font, xpos, ypos, swidth, lineHeight,
"Headroom ", 0, 0, 2 * fontWidth);
"Headroom ", 0, kHeadroomChanged, 10 * fontWidth);
myHeadroomSlider->setMinValue(1); myHeadroomSlider->setMaxValue(AudioSettings::MAX_HEADROOM);
myHeadroomSlider->setTickmarkInterval(5);
myHeadroomSlider->setTickmarkInterval(3);
wid.push_back(myHeadroomSlider);
ypos += lineHeight + 4;
// Param 2
myBufferSizeSlider = new SliderWidget(this, font, xpos, ypos, swidth, lineHeight,
"Buffer size ", 0, 0, 2 * fontWidth);
"Buffer size ", 0, kBufferSizeChanged, 10 * fontWidth);
myBufferSizeSlider->setMinValue(1); myBufferSizeSlider->setMaxValue(AudioSettings::MAX_BUFFER_SIZE);
myBufferSizeSlider->setTickmarkInterval(5);
myBufferSizeSlider->setTickmarkInterval(3);
wid.push_back(myBufferSizeSlider);
// Add message concerning usage
ypos = _h - fontHeight * 2 - 24;
const GUI::Font& infofont = instance().frameBuffer().infoFont();
new StaticTextWidget(this, infofont, HBORDER, ypos, "(*) Requires application restart");/* ,
font.getStringWidth("(*) Requires application restart"), fontHeight,
"(*) Requires application restart", TextAlign::Left);*/
new StaticTextWidget(this, infofont, HBORDER, ypos, "(*) Requires application restart");
// Add Defaults, OK and Cancel buttons
addDefaultsOKCancelBGroup(wid, font);
@ -295,6 +294,21 @@ void AudioDialog::handleCommand(CommandSender* sender, int cmd,
updateEnabledState();
break;
case kHeadroomChanged:
{
std::ostringstream ss;
ss << std::fixed << std::setprecision(1) << (0.5 * myHeadroomSlider->getValue()) << " frames";
myHeadroomSlider->setValueLabel(ss.str());
break;
}
case kBufferSizeChanged:
{
std::ostringstream ss;
ss << std::fixed << std::setprecision(1) << (0.5 * myBufferSizeSlider->getValue()) << " frames";
myBufferSizeSlider->setValueLabel(ss.str());
break;
}
default:
Dialog::handleCommand(sender, cmd, data, 0);
break;

View File

@ -49,7 +49,9 @@ class AudioDialog : public Dialog
private:
enum {
kSoundEnableChanged = 'ADse',
kModeChanged = 'ADmc'
kModeChanged = 'ADmc',
kHeadroomChanged = 'ADhc',
kBufferSizeChanged = 'ADbc'
};
CheckboxWidget* mySoundEnableCheckbox;