mirror of https://github.com/stella-emu/stella.git
minor refactoring of AudioDialog
This commit is contained in:
parent
28b31bd3bf
commit
a0052e071f
|
@ -67,15 +67,9 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
|
|||
|
||||
// Volume
|
||||
myVolumeSlider = new SliderWidget(this, font, xpos, ypos,
|
||||
"Volume ", lwidth, kVolumeChanged);
|
||||
"Volume ", lwidth, 0, 3 * fontWidth);
|
||||
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
|
||||
wid.push_back(myVolumeSlider);
|
||||
myVolumeLabel = new StaticTextWidget(this, font,
|
||||
xpos + myVolumeSlider->getWidth() + 4,
|
||||
ypos + 1,
|
||||
3*fontWidth, fontHeight, "", TextAlign::Left);
|
||||
|
||||
myVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Fragment size
|
||||
|
@ -120,8 +114,7 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
|
|||
void AudioDialog::loadConfig()
|
||||
{
|
||||
// Volume
|
||||
myVolumeSlider->setValue(instance().settings().getInt("volume"));
|
||||
myVolumeLabel->setLabel(instance().settings().getString("volume"));
|
||||
myVolumeSlider->setValue(instance().settings().getInt("volume"));
|
||||
|
||||
// Fragsize
|
||||
myFragsizePopup->setSelected(instance().settings().getString("fragsize"), "512");
|
||||
|
@ -165,8 +158,7 @@ void AudioDialog::saveConfig()
|
|||
void AudioDialog::setDefaults()
|
||||
{
|
||||
myVolumeSlider->setValue(100);
|
||||
myVolumeLabel->setLabel("100");
|
||||
|
||||
|
||||
myFragsizePopup->setSelected("512", "");
|
||||
myFreqPopup->setSelected("31400", "");
|
||||
|
||||
|
@ -182,7 +174,6 @@ void AudioDialog::setDefaults()
|
|||
void AudioDialog::handleSoundEnableChange(bool active)
|
||||
{
|
||||
myVolumeSlider->setEnabled(active);
|
||||
myVolumeLabel->setEnabled(active);
|
||||
myFragsizePopup->setEnabled(active);
|
||||
myFreqPopup->setEnabled(active);
|
||||
}
|
||||
|
@ -202,10 +193,6 @@ void AudioDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
setDefaults();
|
||||
break;
|
||||
|
||||
case kVolumeChanged:
|
||||
myVolumeLabel->setValue(myVolumeSlider->getValue());
|
||||
break;
|
||||
|
||||
case kSoundEnableChanged:
|
||||
handleSoundEnableChange(data == 1);
|
||||
break;
|
||||
|
|
|
@ -45,12 +45,10 @@ class AudioDialog : public Dialog
|
|||
|
||||
private:
|
||||
enum {
|
||||
kVolumeChanged = 'ADvc',
|
||||
kSoundEnableChanged = 'ADse'
|
||||
};
|
||||
|
||||
SliderWidget* myVolumeSlider;
|
||||
StaticTextWidget* myVolumeLabel;
|
||||
PopUpWidget* myFragsizePopup;
|
||||
PopUpWidget* myFreqPopup;
|
||||
CheckboxWidget* mySoundEnableCheckbox;
|
||||
|
|
|
@ -60,7 +60,6 @@ class SnapshotDialog : public Dialog
|
|||
EditTextWidget* mySnapSavePath;
|
||||
EditTextWidget* mySnapLoadPath;
|
||||
|
||||
//PopUpWidget* mySnapName;
|
||||
CheckboxWidget* mySnapName;
|
||||
PopUpWidget* mySnapInterval;
|
||||
|
||||
|
|
Loading…
Reference in New Issue