diff options
author | Eugene Sandulenko | 2017-02-21 23:29:51 +0100 |
---|---|---|
committer | GitHub | 2017-02-21 23:29:51 +0100 |
commit | 8458e3deb7d76358b41f6e0b7f39cec9db358413 (patch) | |
tree | ba69d4b382270968305ffed8ff985d83d37fe2c5 /gui | |
parent | 98bbb92a8e04dfb31ca942805a8ac36e1aafbcf8 (diff) | |
parent | cdda943c8a3089551843be3dedaaddb6c5348555 (diff) | |
download | scummvm-rg350-8458e3deb7d76358b41f6e0b7f39cec9db358413.tar.gz scummvm-rg350-8458e3deb7d76358b41f6e0b7f39cec9db358413.tar.bz2 scummvm-rg350-8458e3deb7d76358b41f6e0b7f39cec9db358413.zip |
Merge pull request #905 from lubomyr/master
ANDROIDSDL: added tab Control in main Options menu for switching some features
Diffstat (limited to 'gui')
-rw-r--r-- | gui/options.cpp | 76 | ||||
-rw-r--r-- | gui/options.h | 12 | ||||
-rw-r--r-- | gui/themes/default.inc | 26 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 126739 -> 127529 bytes | |||
-rw-r--r-- | gui/themes/scummclassic/classic_layout.stx | 14 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout_lowres.stx | 14 | ||||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1646279 -> 1647069 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 14 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 14 |
9 files changed, 168 insertions, 2 deletions
diff --git a/gui/options.cpp b/gui/options.cpp index 8b459b2739..53fba2f371 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -136,6 +136,10 @@ OptionsDialog::~OptionsDialog() { } void OptionsDialog::init() { + _enableControlSettings = false; + _onscreenCheckbox = 0; + _touchpadCheckbox = 0; + _swapMenuAndBackBtnsCheckbox = 0; _enableGraphicSettings = false; _gfxPopUp = 0; _gfxPopUpDesc = 0; @@ -202,6 +206,29 @@ void OptionsDialog::build() { _guioptionsString = ConfMan.get("guioptions", _domain); _guioptions = parseGameGUIOptions(_guioptionsString); } + + // Control options + if (g_system->hasFeature(OSystem::kFeatureOnScreenControl)) { + if (ConfMan.hasKey("onscreen_control", _domain)) { + bool onscreenState = g_system->getFeatureState(OSystem::kFeatureOnScreenControl); + if (_onscreenCheckbox != 0) + _onscreenCheckbox->setState(onscreenState); + } + } + if (g_system->hasFeature(OSystem::kFeatureTouchpadMode)) { + if (ConfMan.hasKey("touchpad_mouse_mode", _domain)) { + bool touchpadState = g_system->getFeatureState(OSystem::kFeatureTouchpadMode); + if (_touchpadCheckbox != 0) + _touchpadCheckbox->setState(touchpadState); + } + } + if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) { + if (ConfMan.hasKey("swap_menu_and_back_buttons", _domain)) { + bool state = g_system->getFeatureState(OSystem::kFeatureSwapMenuAndBackButtons); + if (_swapMenuAndBackBtnsCheckbox != 0) + _swapMenuAndBackBtnsCheckbox->setState(state); + } + } // Graphic options if (_fullscreenCheckbox) { @@ -380,6 +407,25 @@ void OptionsDialog::open() { } void OptionsDialog::apply() { + // Control options + if (_enableControlSettings) { + if (g_system->hasFeature(OSystem::kFeatureOnScreenControl)) { + if (ConfMan.getBool("onscreen_control", _domain) != _onscreenCheckbox->getState()) { + g_system->setFeatureState(OSystem::kFeatureOnScreenControl, _onscreenCheckbox->getState()); + } + } + if (g_system->hasFeature(OSystem::kFeatureTouchpadMode)) { + if (ConfMan.getBool("touchpad_mouse_mode", _domain) != _touchpadCheckbox->getState()) { + g_system->setFeatureState(OSystem::kFeatureTouchpadMode, _touchpadCheckbox->getState()); + } + } + if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) { + if (ConfMan.getBool("swap_menu_and_back_buttons", _domain) != _swapMenuAndBackBtnsCheckbox->getState()) { + g_system->setFeatureState(OSystem::kFeatureSwapMenuAndBackButtons, _swapMenuAndBackBtnsCheckbox->getState()); + } + } + } + // Graphic options bool graphicsModeChanged = false; if (_fullscreenCheckbox) { @@ -705,7 +751,7 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data Dialog::handleCommand(sender, cmd, data); } } - + void OptionsDialog::setGraphicSettingsState(bool enabled) { _enableGraphicSettings = enabled; @@ -831,6 +877,22 @@ void OptionsDialog::setSubtitleSettingsState(bool enabled) { _subSpeedSlider->setEnabled(ena); _subSpeedLabel->setEnabled(ena); } + + void OptionsDialog::addControlControls(GuiObject *boss, const Common::String &prefix) { + // Show On-Screen control + if (g_system->hasFeature(OSystem::kFeatureOnScreenControl)) + _onscreenCheckbox = new CheckboxWidget(boss, prefix + "grOnScreenCheckbox", _("Show On-screen control")); + + // Touchpad Mouse mode + if (g_system->hasFeature(OSystem::kFeatureTouchpadMode)) + _touchpadCheckbox = new CheckboxWidget(boss, prefix + "grTouchpadCheckbox", _("Touchpad mouse mode")); + + // Swap menu and back buttons + if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) + _swapMenuAndBackBtnsCheckbox = new CheckboxWidget(boss, prefix + "grSwapMenuAndBackBtnsCheckbox", _("Swap Menu and Back buttons")); + + _enableControlSettings = true; + } void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &prefix) { const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); @@ -1279,7 +1341,17 @@ GlobalOptionsDialog::~GlobalOptionsDialog() { void GlobalOptionsDialog::build() { // The tab widget TabWidget *tab = new TabWidget(this, "GlobalOptions.TabWidget"); - + + // + // The control tab (currently visible only for AndroidSDL platform, visibility checking by features + // + if (g_system->hasFeature(OSystem::kFeatureTouchpadMode) || + g_system->hasFeature(OSystem::kFeatureOnScreenControl) || + g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) { + tab->addTab(_("Control")); + addControlControls(tab, "GlobalOptions_Control."); + } + // // 1) The graphics tab // diff --git a/gui/options.h b/gui/options.h index 1b15258ab5..6b6cb92378 100644 --- a/gui/options.h +++ b/gui/options.h @@ -86,6 +86,8 @@ protected: virtual void clean(); void rebuild(); + + void addControlControls(GuiObject *boss, const Common::String &prefix); void addGraphicControls(GuiObject *boss, const Common::String &prefix); void addAudioControls(GuiObject *boss, const Common::String &prefix); void addMIDIControls(GuiObject *boss, const Common::String &prefix); @@ -112,6 +114,16 @@ protected: int _pathsTabId; private: + + // + // Control controls + // + bool _enableControlSettings; + + CheckboxWidget *_touchpadCheckbox; + CheckboxWidget *_onscreenCheckbox; + CheckboxWidget *_swapMenuAndBackBtnsCheckbox; + // // Graphics controls // diff --git a/gui/themes/default.inc b/gui/themes/default.inc index a83fd788ad..d8baae8d0e 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -813,6 +813,19 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "</layout>" "</layout>" "</dialog>" +"<dialog name='GlobalOptions_Control' overlays='Dialog.GlobalOptions.TabWidget'>" +"<layout type='vertical' padding='16,16,16,16' spacing='8'>" +"<widget name='grOnScreenCheckbox' " +"type='Checkbox' " +"/>" +"<widget name='grTouchpadCheckbox' " +"type='Checkbox' " +"/>" +"<widget name='grSwapMenuAndBackBtnsCheckbox' " +"type='Checkbox' " +"/>" +"</layout>" +"</dialog>" "<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>" "<layout type='vertical' padding='16,16,16,16' spacing='8'>" "<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" @@ -2355,6 +2368,19 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "</layout>" "</layout>" "</dialog>" +"<dialog name='GlobalOptions_Control' overlays='Dialog.GlobalOptions.TabWidget'>" +"<layout type='vertical' padding='16,16,16,16' spacing='6'>" +"<widget name='grOnScreenCheckbox' " +"type='Checkbox' " +"/>" +"<widget name='grTouchpadCheckbox' " +"type='Checkbox' " +"/>" +"<widget name='grSwapMenuAndBackBtnsCheckbox' " +"type='Checkbox' " +"/>" +"</layout>" +"</dialog>" "<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>" "<layout type='vertical' padding='16,16,16,16' spacing='8'>" "<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 400b997b93..d90289a4be 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index b3100d4b92..aa91cdb35f 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -237,6 +237,20 @@ </layout> </layout> </dialog> + + <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> + <widget name = 'grTouchpadCheckbox' + type = 'Checkbox' + /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> + </layout> + </dialog> <dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 7879e05a97..c925a39d18 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -234,6 +234,20 @@ </layout> </layout> </dialog> + + <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> + <widget name = 'grTouchpadCheckbox' + type = 'Checkbox' + /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> + </layout> + </dialog> <dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex 673d67ed87..f10102503e 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 9cadc11e13..80b913a3a4 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -251,6 +251,20 @@ </layout> </layout> </dialog> + + <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> + <widget name = 'grTouchpadCheckbox' + type = 'Checkbox' + /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> + </layout> + </dialog> <dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 7ef5fc5ee1..308ba44b7e 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -232,6 +232,20 @@ </layout> </layout> </dialog> + + <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'grOnScreenCheckbox' + type = 'Checkbox' + /> + <widget name = 'grTouchpadCheckbox' + type = 'Checkbox' + /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> + </layout> + </dialog> <dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> |