aboutsummaryrefslogtreecommitdiff
path: root/gui/options.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-07-04 18:00:46 +0000
committerJohannes Schickel2010-07-04 18:00:46 +0000
commitda1a8535b4b06072ca99a253aff55da9287672e1 (patch)
tree6b3e1a1b07c548d651ba38b0160f82639adbc885 /gui/options.cpp
parent8f2c0c2ff0ab33315e04bb49cb98ece01fb4bd7f (diff)
downloadscummvm-rg350-da1a8535b4b06072ca99a253aff55da9287672e1.tar.gz
scummvm-rg350-da1a8535b4b06072ca99a253aff55da9287672e1.tar.bz2
scummvm-rg350-da1a8535b4b06072ca99a253aff55da9287672e1.zip
More cleanup / readability fixes.
svn-id: r50648
Diffstat (limited to 'gui/options.cpp')
-rw-r--r--gui/options.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index 65a79dedb8..fea1ba7d29 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -137,12 +137,15 @@ void OptionsDialog::init() {
}
bool musicDeviceSkipSettingDefault(MusicDevices::iterator d, Common::String dom, MusicPlugin::List::const_iterator &m, uint32 guio) {
- return (dom == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS) || (dom != Common::ConfigManager::kApplicationDomain && (!(guio & MidiDriver::musicType2GUIO((uint32)-1)) || (guio & (MidiDriver::musicType2GUIO(d->getMusicType()))))) || d->getMusicDriverId() == "auto" || d->getMusicDriverId() == "null" ? true : false;
+ return (dom == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS)
+ || (dom != Common::ConfigManager::kApplicationDomain && (!(guio & MidiDriver::musicType2GUIO((uint32)-1)) || (guio & (MidiDriver::musicType2GUIO(d->getMusicType())))))
+ || d->getMusicDriverId() == "auto"
+ || d->getMusicDriverId() == "null";
}
bool musicDeviceSkipSettingSpec(MusicDevices::iterator d, Common::String, MusicPlugin::List::const_iterator &m, uint32) {
if (d->getMusicDriverId() == "auto")
- m++;
+ ++m;
return ((d->getMusicType() >= MT_GM) || d->getMusicDriverId() == "auto") ? true : false;
}
@@ -209,7 +212,7 @@ void OptionsDialog::open() {
if (!loadMusicDeviceSetting(_mt32DevicePopUp, "mt32_device", musicDeviceSkipSettingSpec)) {
if (_domain.equals(Common::ConfigManager::kApplicationDomain)) {
- if (!loadMusicDeviceSetting(_mt32DevicePopUp, "", musicDeviceSkipSettingSpec, MT_MT32))
+ if (!loadMusicDeviceSetting(_mt32DevicePopUp, Common::String(), musicDeviceSkipSettingSpec, MT_MT32))
_mt32DevicePopUp->setSelected(0);
} else {
_mt32DevicePopUp->setSelected(0);
@@ -218,7 +221,7 @@ void OptionsDialog::open() {
if (!loadMusicDeviceSetting(_gmDevicePopUp, "gm_device", musicDeviceSkipSettingSpec)) {
if (_domain.equals(Common::ConfigManager::kApplicationDomain)) {
- if (!loadMusicDeviceSetting(_gmDevicePopUp, "", musicDeviceSkipSettingSpec, MT_GM))
+ if (!loadMusicDeviceSetting(_gmDevicePopUp, Common::String(), musicDeviceSkipSettingSpec, MT_GM))
_gmDevicePopUp->setSelected(0);
} else {
_gmDevicePopUp->setSelected(0);
@@ -294,7 +297,7 @@ void OptionsDialog::open() {
// Subtitle options
if (_subToggleGroup) {
- int speed;
+ int speed;
int sliderMaxValue = _subSpeedSlider->getMaxValue();
int subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute", _domain));
@@ -666,14 +669,15 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
const MusicPlugin::List p = MusicMan.getPlugins();
int musicId = 0;
int midiId = 0;
- for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); m++) {
+ for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {
MusicDevices i = (**m)->getDevices();
- for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
- if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS) || // global dialog - skip useless FM-Towns option there
- (_domain != Common::ConfigManager::kApplicationDomain && !(_guioptions & allFlags)) || // No flags are specified
- _guioptions & (MidiDriver::musicType2GUIO(d->getMusicType())) // flag is present
- || d->getMusicDriverId() == "auto" || d->getMusicDriverId() == "null") // always add default and null device
+ for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
+ if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS) // global dialog - skip useless FM-Towns option there
+ || (_domain != Common::ConfigManager::kApplicationDomain && !(_guioptions & allFlags)) // No flags are specified
+ || _guioptions & (MidiDriver::musicType2GUIO(d->getMusicType())) // flag is present
+ || d->getMusicDriverId() == "auto" || d->getMusicDriverId() == "null") // always add default and null device
_midiPopUp->appendEntry(d->getCompleteName(), musicId++);
+
if (d->getMusicType() >= MT_GM || m == p.begin()) {
_mt32DevicePopUp->appendEntry(d->getCompleteName(), midiId);
_gmDevicePopUp->appendEntry(d->getCompleteName(), midiId++);
@@ -802,10 +806,11 @@ bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String se
if (_domain != Common::ConfigManager::kApplicationDomain || ConfMan.hasKey(setting, _domain) || preferredType) {
const Common::String drv = ConfMan.get(setting, (_domain != Common::ConfigManager::kApplicationDomain && !ConfMan.hasKey(setting, _domain)) ? Common::ConfigManager::kApplicationDomain : _domain);
const MusicPlugin::List p = MusicMan.getPlugins();
+
int id = 0;
- for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end() && id != -1; m++) {
+ for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end() && id != -1; ++m) {
MusicDevices i = (**m)->getDevices();
- for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
+ for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
if (setting.empty() ? (preferredType == d->getMusicType()) : (drv == d->getCompleteId())) {
popup->setSelected(id);
id = -1;
@@ -815,6 +820,7 @@ bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String se
}
}
}
+
if (id != -1)
// midi device turned off or whatever
return false;
@@ -832,15 +838,15 @@ void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String se
const MusicPlugin::List p = MusicMan.getPlugins();
uint32 id = 0;
bool found = false;
- for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end() && !found; m++) {
+ for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end() && !found; ++m) {
MusicDevices i = (**m)->getDevices();
- for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
+ for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
if (id == popup->getSelectedTag()) {
ConfMan.set(setting, d->getCompleteId(), _domain);
found = true;
break;
} else if (skipfunc(d, _domain, m, _guioptions)) {
- id++;
+ ++id;
}
}
}