minor refactoring of AudioDialog

This commit is contained in:
thrust26 2018-01-28 00:16:31 +01:00
parent 28b31bd3bf
commit a0052e071f
3 changed files with 3 additions and 19 deletions

View File

@ -67,15 +67,9 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
// Volume // Volume
myVolumeSlider = new SliderWidget(this, font, xpos, ypos, myVolumeSlider = new SliderWidget(this, font, xpos, ypos,
"Volume ", lwidth, kVolumeChanged); "Volume ", lwidth, 0, 3 * fontWidth);
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100); myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
wid.push_back(myVolumeSlider); 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; ypos += lineHeight + 4;
// Fragment size // Fragment size
@ -120,8 +114,7 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
void AudioDialog::loadConfig() void AudioDialog::loadConfig()
{ {
// Volume // Volume
myVolumeSlider->setValue(instance().settings().getInt("volume")); myVolumeSlider->setValue(instance().settings().getInt("volume"));
myVolumeLabel->setLabel(instance().settings().getString("volume"));
// Fragsize // Fragsize
myFragsizePopup->setSelected(instance().settings().getString("fragsize"), "512"); myFragsizePopup->setSelected(instance().settings().getString("fragsize"), "512");
@ -165,8 +158,7 @@ void AudioDialog::saveConfig()
void AudioDialog::setDefaults() void AudioDialog::setDefaults()
{ {
myVolumeSlider->setValue(100); myVolumeSlider->setValue(100);
myVolumeLabel->setLabel("100");
myFragsizePopup->setSelected("512", ""); myFragsizePopup->setSelected("512", "");
myFreqPopup->setSelected("31400", ""); myFreqPopup->setSelected("31400", "");
@ -182,7 +174,6 @@ void AudioDialog::setDefaults()
void AudioDialog::handleSoundEnableChange(bool active) void AudioDialog::handleSoundEnableChange(bool active)
{ {
myVolumeSlider->setEnabled(active); myVolumeSlider->setEnabled(active);
myVolumeLabel->setEnabled(active);
myFragsizePopup->setEnabled(active); myFragsizePopup->setEnabled(active);
myFreqPopup->setEnabled(active); myFreqPopup->setEnabled(active);
} }
@ -202,10 +193,6 @@ void AudioDialog::handleCommand(CommandSender* sender, int cmd,
setDefaults(); setDefaults();
break; break;
case kVolumeChanged:
myVolumeLabel->setValue(myVolumeSlider->getValue());
break;
case kSoundEnableChanged: case kSoundEnableChanged:
handleSoundEnableChange(data == 1); handleSoundEnableChange(data == 1);
break; break;

View File

@ -45,12 +45,10 @@ class AudioDialog : public Dialog
private: private:
enum { enum {
kVolumeChanged = 'ADvc',
kSoundEnableChanged = 'ADse' kSoundEnableChanged = 'ADse'
}; };
SliderWidget* myVolumeSlider; SliderWidget* myVolumeSlider;
StaticTextWidget* myVolumeLabel;
PopUpWidget* myFragsizePopup; PopUpWidget* myFragsizePopup;
PopUpWidget* myFreqPopup; PopUpWidget* myFreqPopup;
CheckboxWidget* mySoundEnableCheckbox; CheckboxWidget* mySoundEnableCheckbox;

View File

@ -60,7 +60,6 @@ class SnapshotDialog : public Dialog
EditTextWidget* mySnapSavePath; EditTextWidget* mySnapSavePath;
EditTextWidget* mySnapLoadPath; EditTextWidget* mySnapLoadPath;
//PopUpWidget* mySnapName;
CheckboxWidget* mySnapName; CheckboxWidget* mySnapName;
PopUpWidget* mySnapInterval; PopUpWidget* mySnapInterval;