From 2c812a6b7a0b24b9012379118867fb4f64f32c14 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Wed, 13 Nov 2019 21:09:21 +0100 Subject: GUI: Add DropdownButtonWidget and use it in the launcher for mass add DropdownButtonWidget is a button split in two parts vertically. Clicking the left part triggers a default action. Clicking the right part shows a list of other actions the user can choose from. Using this widget on the launcher lets 'Mass add' be a secondary action of the 'Add' button, removing the necessity of pressing the shift key to access the feature. --- gui/options.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'gui/options.cpp') diff --git a/gui/options.cpp b/gui/options.cpp index a324ef6338..161742d9bc 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -2154,22 +2154,24 @@ void GlobalOptionsDialog::apply() { } #ifdef USE_TTS Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); - if (newLang != oldLang) { - if (newLang == "C") - ttsMan->setLanguage("en"); - else { - ttsMan->setLanguage(newLang); + if (ttsMan) { + if (newLang != oldLang) { + if (newLang == "C") + ttsMan->setLanguage("en"); + else { + ttsMan->setLanguage(newLang); + } + _ttsVoiceSelectionPopUp->setSelectedTag(0); } - _ttsVoiceSelectionPopUp->setSelectedTag(0); + int volume = (ConfMan.getInt("speech_volume", "scummvm") * 100) / 256; + if (ConfMan.hasKey("mute", "scummvm") && ConfMan.getBool("mute", "scummvm")) + volume = 0; + ttsMan->setVolume(volume); + ConfMan.setBool("tts_enabled", _ttsCheckbox->getState(), _domain); + int selectedVoice = _ttsVoiceSelectionPopUp->getSelectedTag(); + ConfMan.setInt("tts_voice", selectedVoice, _domain); + ttsMan->setVoice(selectedVoice); } - int volume = (ConfMan.getInt("speech_volume", "scummvm") * 100) / 256; - if (ConfMan.hasKey("mute", "scummvm") && ConfMan.getBool("mute", "scummvm")) - volume = 0; - ttsMan->setVolume(volume); - ConfMan.setBool("tts_enabled", _ttsCheckbox->getState(), _domain); - int selectedVoice = _ttsVoiceSelectionPopUp->getSelectedTag(); - ConfMan.setInt("tts_voice", selectedVoice, _domain); - ttsMan->setVoice(selectedVoice); #endif if (isRebuildNeeded) { -- cgit v1.2.3