1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef OPTIONS_DIALOG_H 24 #define OPTIONS_DIALOG_H 25 26 #include "engines/metaengine.h" 27 28 #include "gui/dialog.h" 29 #include "common/str.h" 30 #include "audio/mididrv.h" 31 32 #ifdef GUI_ENABLE_KEYSDIALOG 33 #include "gui/KeysDialog.h" 34 #endif 35 36 #ifdef USE_FLUIDSYNTH 37 #include "gui/fluidsynth-dialog.h" 38 #endif 39 40 #ifdef USE_LIBCURL 41 #include "backends/cloud/storage.h" 42 #endif 43 44 namespace GUI { 45 class LauncherDialog; 46 47 class CheckboxWidget; 48 class EditTextWidget; 49 class PopUpWidget; 50 class SliderWidget; 51 class StaticTextWidget; 52 class TabWidget; 53 class ButtonWidget; 54 class CommandSender; 55 class GuiObject; 56 class RadiobuttonGroup; 57 class RadiobuttonWidget; 58 59 class OptionsDialog : public Dialog { 60 typedef Common::Array<CheckboxWidget *> CheckboxWidgetList; 61 62 public: 63 OptionsDialog(const Common::String &domain, int x, int y, int w, int h); 64 OptionsDialog(const Common::String &domain, const Common::String &name); 65 ~OptionsDialog(); 66 67 void init(); 68 69 void open(); 70 virtual void apply(); 71 void close(); 72 void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); getDomain()73 const Common::String& getDomain() const { return _domain; } 74 75 virtual void reflowLayout(); 76 77 protected: 78 /** Config domain this dialog is used to edit. */ 79 Common::String _domain; 80 81 ButtonWidget *_soundFontButton; 82 StaticTextWidget *_soundFont; 83 ButtonWidget *_soundFontClearButton; 84 85 virtual void build(); 86 virtual void clean(); 87 void rebuild(); 88 89 90 void addControlControls(GuiObject *boss, const Common::String &prefix); 91 void addGraphicControls(GuiObject *boss, const Common::String &prefix); 92 void addShaderControls(GuiObject *boss, const Common::String &prefix); 93 void addAudioControls(GuiObject *boss, const Common::String &prefix); 94 void addMIDIControls(GuiObject *boss, const Common::String &prefix); 95 void addMT32Controls(GuiObject *boss, const Common::String &prefix); 96 void addVolumeControls(GuiObject *boss, const Common::String &prefix); 97 // The default value is the launcher's non-scaled talkspeed value. When SCUMM uses the widget, 98 // it uses its own scale 99 void addSubtitleControls(GuiObject *boss, const Common::String &prefix, int maxSliderVal = 255); 100 void addEngineControls(GuiObject *boss, const Common::String &prefix, const ExtraGuiOptions &engineOptions); 101 102 void setGraphicSettingsState(bool enabled); 103 void setAudioSettingsState(bool enabled); 104 void setMIDISettingsState(bool enabled); 105 void setMT32SettingsState(bool enabled); 106 void setVolumeSettingsState(bool enabled); 107 void setSubtitleSettingsState(bool enabled); 108 109 virtual void setupGraphicsTab(); 110 111 bool loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicType preferredType = MT_AUTO); 112 void saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting); 113 114 TabWidget *_tabWidget; 115 int _graphicsTabId; 116 int _midiTabId; 117 int _pathsTabId; 118 119 private: 120 121 // 122 // Control controls 123 // 124 bool _enableControlSettings; 125 126 CheckboxWidget *_touchpadCheckbox; 127 CheckboxWidget *_onscreenCheckbox; 128 CheckboxWidget *_swapMenuAndBackBtnsCheckbox; 129 130 StaticTextWidget *_kbdMouseSpeedDesc; 131 SliderWidget *_kbdMouseSpeedSlider; 132 StaticTextWidget *_kbdMouseSpeedLabel; 133 StaticTextWidget *_joystickDeadzoneDesc; 134 SliderWidget *_joystickDeadzoneSlider; 135 StaticTextWidget *_joystickDeadzoneLabel; 136 137 // 138 // Graphics controls 139 // 140 bool _enableGraphicSettings; 141 StaticTextWidget *_gfxPopUpDesc; 142 PopUpWidget *_gfxPopUp; 143 StaticTextWidget *_stretchPopUpDesc; 144 PopUpWidget *_stretchPopUp; 145 CheckboxWidget *_fullscreenCheckbox; 146 CheckboxWidget *_filteringCheckbox; 147 CheckboxWidget *_aspectCheckbox; 148 StaticTextWidget *_renderModePopUpDesc; 149 PopUpWidget *_renderModePopUp; 150 151 // 152 // Shader controls 153 // 154 bool _enableShaderSettings; 155 StaticTextWidget *_shaderPopUpDesc; 156 PopUpWidget *_shaderPopUp; 157 158 // 159 // Audio controls 160 // 161 bool _enableAudioSettings; 162 StaticTextWidget *_midiPopUpDesc; 163 PopUpWidget *_midiPopUp; 164 StaticTextWidget *_oplPopUpDesc; 165 PopUpWidget *_oplPopUp; 166 167 StaticTextWidget *_mt32DevicePopUpDesc; 168 PopUpWidget *_mt32DevicePopUp; 169 StaticTextWidget *_gmDevicePopUpDesc; 170 PopUpWidget *_gmDevicePopUp; 171 172 // 173 // MIDI controls 174 // 175 bool _enableMIDISettings; 176 CheckboxWidget *_multiMidiCheckbox; 177 StaticTextWidget *_midiGainDesc; 178 SliderWidget *_midiGainSlider; 179 StaticTextWidget *_midiGainLabel; 180 181 // 182 // MT-32 controls 183 // 184 bool _enableMT32Settings; 185 CheckboxWidget *_mt32Checkbox; 186 CheckboxWidget *_enableGSCheckbox; 187 188 // 189 // Subtitle controls 190 // 191 int getSubtitleMode(bool subtitles, bool speech_mute); 192 bool _enableSubtitleSettings; 193 StaticTextWidget *_subToggleDesc; 194 RadiobuttonGroup *_subToggleGroup; 195 RadiobuttonWidget *_subToggleSubOnly; 196 RadiobuttonWidget *_subToggleSpeechOnly; 197 RadiobuttonWidget *_subToggleSubBoth; 198 static const char *_subModeDesc[]; 199 static const char *_lowresSubModeDesc[]; 200 StaticTextWidget *_subSpeedDesc; 201 SliderWidget *_subSpeedSlider; 202 StaticTextWidget *_subSpeedLabel; 203 204 // 205 // Volume controls 206 // 207 void updateMusicVolume(const int newValue) const; 208 void updateSfxVolume(const int newValue) const; 209 void updateSpeechVolume(const int newValue) const; 210 bool _enableVolumeSettings; 211 212 StaticTextWidget *_musicVolumeDesc; 213 SliderWidget *_musicVolumeSlider; 214 StaticTextWidget *_musicVolumeLabel; 215 216 StaticTextWidget *_sfxVolumeDesc; 217 SliderWidget *_sfxVolumeSlider; 218 StaticTextWidget *_sfxVolumeLabel; 219 220 StaticTextWidget *_speechVolumeDesc; 221 SliderWidget *_speechVolumeSlider; 222 StaticTextWidget *_speechVolumeLabel; 223 224 CheckboxWidget *_muteCheckbox; 225 226 protected: 227 // 228 // Game GUI options 229 // 230 Common::String _guioptions; 231 Common::String _guioptionsString; 232 233 // 234 // Engine-specific controls 235 // 236 CheckboxWidgetList _engineCheckboxes; 237 }; 238 239 240 class GlobalOptionsDialog : public OptionsDialog, public CommandSender { 241 public: 242 GlobalOptionsDialog(LauncherDialog *launcher); 243 ~GlobalOptionsDialog(); 244 245 virtual void apply(); 246 void close(); 247 void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); 248 void handleTickle(); 249 250 virtual void reflowLayout(); 251 252 protected: 253 virtual void build(); 254 virtual void clean(); 255 256 Common::String _newTheme; 257 LauncherDialog *_launcher; 258 #ifdef GUI_ENABLE_KEYSDIALOG 259 KeysDialog *_keysDialog; 260 #endif 261 #ifdef USE_FLUIDSYNTH 262 FluidSynthSettingsDialog *_fluidSynthSettingsDialog; 263 #endif 264 StaticTextWidget *_savePath; 265 ButtonWidget *_savePathClearButton; 266 StaticTextWidget *_themePath; 267 ButtonWidget *_themePathClearButton; 268 StaticTextWidget *_extraPath; 269 ButtonWidget *_extraPathClearButton; 270 #ifdef DYNAMIC_MODULES 271 StaticTextWidget *_pluginsPath; 272 #endif 273 274 // 275 // Misc controls 276 // 277 StaticTextWidget *_curTheme; 278 StaticTextWidget *_rendererPopUpDesc; 279 PopUpWidget *_rendererPopUp; 280 StaticTextWidget *_autosavePeriodPopUpDesc; 281 PopUpWidget *_autosavePeriodPopUp; 282 StaticTextWidget *_guiLanguagePopUpDesc; 283 PopUpWidget *_guiLanguagePopUp; 284 CheckboxWidget *_guiLanguageUseGameLanguageCheckbox; 285 CheckboxWidget *_useSystemDialogsCheckbox; 286 287 288 #ifdef USE_UPDATES 289 StaticTextWidget *_updatesPopUpDesc; 290 PopUpWidget *_updatesPopUp; 291 #endif 292 293 #ifdef USE_CLOUD 294 #ifdef USE_LIBCURL 295 // 296 // Cloud controls 297 // 298 uint32 _selectedStorageIndex; 299 StaticTextWidget *_storagePopUpDesc; 300 PopUpWidget *_storagePopUp; 301 StaticTextWidget *_storageDisabledHint; 302 ButtonWidget *_storageEnableButton; 303 StaticTextWidget *_storageUsernameDesc; 304 StaticTextWidget *_storageUsername; 305 StaticTextWidget *_storageUsedSpaceDesc; 306 StaticTextWidget *_storageUsedSpace; 307 StaticTextWidget *_storageSyncHint; 308 StaticTextWidget *_storageLastSyncDesc; 309 StaticTextWidget *_storageLastSync; 310 ButtonWidget *_storageSyncSavesButton; 311 StaticTextWidget *_storageDownloadHint; 312 ButtonWidget *_storageDownloadButton; 313 StaticTextWidget *_storageDisconnectHint; 314 ButtonWidget *_storageDisconnectButton; 315 316 bool _connectingStorage; 317 StaticTextWidget *_storageWizardNotConnectedHint; 318 StaticTextWidget *_storageWizardOpenLinkHint; 319 StaticTextWidget *_storageWizardLink; 320 StaticTextWidget *_storageWizardCodeHint; 321 EditTextWidget *_storageWizardCodeBox; 322 ButtonWidget *_storageWizardPasteButton; 323 ButtonWidget *_storageWizardConnectButton; 324 StaticTextWidget *_storageWizardConnectionStatusHint; 325 bool _redrawCloudTab; 326 327 void addCloudControls(GuiObject *boss, const Common::String &prefix, bool lowres); 328 void setupCloudTab(); 329 void shiftWidget(Widget *widget, const char *widgetName, int32 xOffset, int32 yOffset); 330 331 void storageConnectionCallback(Networking::ErrorResponse response); 332 void storageSavesSyncedCallback(Cloud::Storage::BoolResponse response); 333 void storageErrorCallback(Networking::ErrorResponse response); 334 #endif // USE_LIBCURL 335 336 #ifdef USE_SDL_NET 337 // 338 // LAN controls 339 // 340 ButtonWidget *_runServerButton; 341 StaticTextWidget *_serverInfoLabel; 342 ButtonWidget *_rootPathButton; 343 StaticTextWidget *_rootPath; 344 ButtonWidget *_rootPathClearButton; 345 StaticTextWidget *_serverPortDesc; 346 EditTextWidget *_serverPort; 347 ButtonWidget *_serverPortClearButton; 348 StaticTextWidget *_featureDescriptionLine1; 349 StaticTextWidget *_featureDescriptionLine2; 350 bool _serverWasRunning; 351 352 void addNetworkControls(GuiObject *boss, const Common::String &prefix, bool lowres); 353 void reflowNetworkTabLayout(); 354 #endif // USE_SDL_NET 355 356 #endif // USE_CLOUD 357 // 358 // Accessibility controls 359 // 360 #ifdef USE_TTS 361 bool _enableTTS; 362 CheckboxWidget *_ttsCheckbox; 363 PopUpWidget *_ttsVoiceSelectionPopUp; 364 #endif 365 }; 366 367 } // End of namespace GUI 368 369 #endif 370