From cbc14c8a3c6614987d2331057e114d92336cbac0 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Sat, 19 Dec 2009 04:40:42 -0500 Subject: Added support for resources.xml from update server... Also added option to download music optionally I had to edit the XML wrapper a bit, basicilly its constructor can now take a optional thrid arguement which will tell it to use a resman or open the file directly Also I added fallback support for the old resouce2.txt so servers don't have to upgrade if they do not want to --- src/gui/setup_audio.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/gui/setup_audio.cpp') diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 990a3ce8..5b1a86b9 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -38,7 +38,9 @@ Setup_Audio::Setup_Audio(): mMusicVolume((int)config.getValue("musicVolume", 60)), mSfxVolume((int)config.getValue("sfxVolume", 100)), mSoundEnabled(config.getValue("sound", 0)), + mDownloadEnabled(config.getValue("download-music", false)), mSoundCheckBox(new CheckBox(_("Sound"), mSoundEnabled)), + mDownloadMusicCheckBox(new CheckBox(_("Download music"), mDownloadEnabled)), mSfxSlider(new Slider(0, sound.getMaxVolume())), mMusicSlider(new Slider(0, sound.getMaxVolume())) { @@ -71,6 +73,7 @@ Setup_Audio::Setup_Audio(): place(1, 1, sfxLabel); place(0, 2, mMusicSlider); place(1, 2, musicLabel); + place(0, 3, mDownloadMusicCheckBox); setDimension(gcn::Rectangle(0, 0, 365, 280)); } @@ -78,11 +81,20 @@ Setup_Audio::Setup_Audio(): void Setup_Audio::apply() { mSoundEnabled = mSoundCheckBox->isSelected(); + mDownloadEnabled = mDownloadMusicCheckBox->isSelected(); mSfxVolume = (int) config.getValue("sfxVolume", 100); mMusicVolume = (int) config.getValue("musicVolume", 60); config.setValue("sound", mSoundEnabled); + // Display a message if user has selected to download music, + // And if downloadmusic is not already enabled + if (mDownloadEnabled && !config.getValue("download-music", false)) + { + new OkDialog(_("Notice"),_("You may have to restart your client if you want to download new music")); + } + config.setValue("download-music", mDownloadEnabled); + if (mSoundEnabled) { try @@ -104,6 +116,7 @@ void Setup_Audio::apply() void Setup_Audio::cancel() { mSoundCheckBox->setSelected(mSoundEnabled); + mDownloadMusicCheckBox->setSelected(mDownloadEnabled); sound.setSfxVolume(mSfxVolume); mSfxSlider->setValue(mSfxVolume); @@ -112,6 +125,7 @@ void Setup_Audio::cancel() mMusicSlider->setValue(mMusicVolume); config.setValue("sound", mSoundEnabled); + config.setValue("download-music", mDownloadEnabled); config.setValue("sfxVolume", mSfxVolume); config.setValue("musicVolume", mMusicVolume); } -- cgit v1.2.3-70-g09d2