aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlubomyr2017-02-14 15:13:58 +0200
committerlubomyr2017-02-14 15:13:58 +0200
commit216f9c4f11cd95f9e4ed049c9ecc97304e83f837 (patch)
treed28adb26dca57181721d175e435b3140daba813d
parentf8c4274f1a0bdde91123f3cd493d14e5a1b1a91e (diff)
downloadscummvm-rg350-216f9c4f11cd95f9e4ed049c9ecc97304e83f837.tar.gz
scummvm-rg350-216f9c4f11cd95f9e4ed049c9ecc97304e83f837.tar.bz2
scummvm-rg350-216f9c4f11cd95f9e4ed049c9ecc97304e83f837.zip
ANDROIDSDL: backend related checking in options.cpp replaced with hasFeature... condition, renamed some fields and methods
-rw-r--r--backends/platform/androidsdl/androidsdl-sdl.cpp6
-rw-r--r--backends/platform/androidsdl/androidsdl-sdl.h1
-rw-r--r--common/system.h20
-rw-r--r--gui/options.cpp76
-rw-r--r--gui/options.h11
-rw-r--r--gui/themes/default.inc2
-rw-r--r--gui/themes/scummclassic.zipbin127377 -> 127371 bytes
-rw-r--r--gui/themes/scummclassic/classic_layout.stx2
-rw-r--r--gui/themes/scummclassic/classic_layout_lowres.stx2
-rw-r--r--gui/themes/scummmodern.zipbin1646917 -> 1646989 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx2
-rw-r--r--gui/themes/scummmodern/scummmodern_layout_lowres.stx2
12 files changed, 66 insertions, 58 deletions
diff --git a/backends/platform/androidsdl/androidsdl-sdl.cpp b/backends/platform/androidsdl/androidsdl-sdl.cpp
index 07bb23eba6..61b01920bb 100644
--- a/backends/platform/androidsdl/androidsdl-sdl.cpp
+++ b/backends/platform/androidsdl/androidsdl-sdl.cpp
@@ -113,3 +113,9 @@ bool OSystem_ANDROIDSDL::getFeatureState(Feature f) {
break;
}
}
+
+bool OSystem_ANDROIDSDL::hasFeature(Feature f) {
+ return (f == kFeatureTouchpadMode ||
+ f == kFeatureOnScreenControl ||
+ f == OSystem_POSIX::getFeatureState(f));
+}
diff --git a/backends/platform/androidsdl/androidsdl-sdl.h b/backends/platform/androidsdl/androidsdl-sdl.h
index 36925ec275..4976e320df 100644
--- a/backends/platform/androidsdl/androidsdl-sdl.h
+++ b/backends/platform/androidsdl/androidsdl-sdl.h
@@ -30,6 +30,7 @@ public:
virtual void initBackend();
virtual void setFeatureState(Feature f, bool enable);
virtual bool getFeatureState(Feature f);
+ virtual bool hasFeature(Feature f);
void touchpadMode(bool enable);
void switchToDirectMouseMode();
void switchToRelativeMouseMode();
diff --git a/common/system.h b/common/system.h
index a481884ea8..eda4ec6b10 100644
--- a/common/system.h
+++ b/common/system.h
@@ -336,19 +336,17 @@ public:
*
* This feature has no associated state.
*/
- kFeatureOpenUrl
-
-#ifdef ANDROIDSDL
- ,
- /**
- * show on-screen control
- */
+ kFeatureOpenUrl ,
+
+ /**
+ * show on-screen control
+ */
kFeatureOnScreenControl,
- /**
- * mouse emulation mode
- */
+
+ /**
+ * mouse emulation mode
+ */
kFeatureTouchpadMode
-#endif
};
/**
diff --git a/gui/options.cpp b/gui/options.cpp
index b7d9ddaec2..fdd5db4c32 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -136,11 +136,9 @@ OptionsDialog::~OptionsDialog() {
}
void OptionsDialog::init() {
-#ifdef ANDROIDSDL
- _enableAndroidSdlSettings = false;
+ _enableControlSettings = false;
_onscreenCheckbox = 0;
_touchpadCheckbox = 0;
-#endif
_enableGraphicSettings = false;
_gfxPopUp = 0;
_gfxPopUpDesc = 0;
@@ -208,19 +206,21 @@ void OptionsDialog::build() {
_guioptions = parseGameGUIOptions(_guioptionsString);
}
-#ifdef ANDROIDSDL
- // AndroidSDL options
- if (ConfMan.hasKey("onscreen_control", _domain)) {
- bool onscreenState = g_system->getFeatureState(OSystem::kFeatureOnScreenControl);
- if (_onscreenCheckbox != 0)
- _onscreenCheckbox->setState(onscreenState);
- }
- if (ConfMan.hasKey("touchpad_mouse_mode", _domain)) {
- bool touchpadState = g_system->getFeatureState(OSystem::kFeatureTouchpadMode);
- if (_touchpadCheckbox != 0)
- _touchpadCheckbox->setState(touchpadState);
+ // 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);
+ }
}
-#endif
// Graphic options
if (_fullscreenCheckbox) {
@@ -399,16 +399,20 @@ void OptionsDialog::open() {
}
void OptionsDialog::apply() {
-#ifdef ANDROIDSDL
- if (_enableAndroidSdlSettings) {
- if (ConfMan.getBool("onscreen_control", _domain) != _onscreenCheckbox->getState()) {
- g_system->setFeatureState(OSystem::kFeatureOnScreenControl, _onscreenCheckbox->getState());
+ // 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 (ConfMan.getBool("touchpad_mouse_mode", _domain) != _touchpadCheckbox->getState()) {
- g_system->setFeatureState(OSystem::kFeatureTouchpadMode, _touchpadCheckbox->getState());
+ if (g_system->hasFeature(OSystem::kFeatureTouchpadMode)) {
+ if (ConfMan.getBool("touchpad_mouse_mode", _domain) != _touchpadCheckbox->getState()) {
+ g_system->setFeatureState(OSystem::kFeatureTouchpadMode, _touchpadCheckbox->getState());
+ }
}
}
-#endif
+
// Graphic options
bool graphicsModeChanged = false;
if (_fullscreenCheckbox) {
@@ -828,16 +832,17 @@ void OptionsDialog::setSubtitleSettingsState(bool enabled) {
_subSpeedLabel->setEnabled(ena);
}
-#ifdef ANDROIDSDL
- void OptionsDialog::addAndroidSdlControls(GuiObject *boss, const Common::String &prefix) {
+ void OptionsDialog::addControlControls(GuiObject *boss, const Common::String &prefix) {
// Show On-Screen control
- _onscreenCheckbox = new CheckboxWidget(boss, prefix + "grOnScreenCheckbox", _("Show On-screen control"));
+ if (g_system->hasFeature(OSystem::kFeatureOnScreenControl))
+ _onscreenCheckbox = new CheckboxWidget(boss, prefix + "grOnScreenCheckbox", _("Show On-screen control"));
+
// Touchpad Mouse mode
- _touchpadCheckbox = new CheckboxWidget(boss, prefix + "grTouchpadCheckbox", _("Touchpad mouse mode"));
-
- _enableAndroidSdlSettings = true;
+ if (g_system->hasFeature(OSystem::kFeatureTouchpadMode))
+ _touchpadCheckbox = new CheckboxWidget(boss, prefix + "grTouchpadCheckbox", _("Touchpad mouse mode"));
+
+ _enableControlSettings = true;
}
-#endif
void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &prefix) {
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
@@ -1265,14 +1270,15 @@ GlobalOptionsDialog::~GlobalOptionsDialog() {
void GlobalOptionsDialog::build() {
// The tab widget
TabWidget *tab = new TabWidget(this, "GlobalOptions.TabWidget");
-
-#ifdef ANDROIDSDL
+
//
- // The control tab only for Android SDL platform
+ // The control tab (currently visible only for AndroidSDL platform, visibility checking by features
//
- tab->addTab(_("Control"));
- addAndroidSdlControls(tab, "GlobalOptions_AndroidSdl.");
-#endif
+ if (g_system->hasFeature(OSystem::kFeatureTouchpadMode) ||
+ g_system->hasFeature(OSystem::kFeatureOnScreenControl)) {
+ tab->addTab(_("Control"));
+ addControlControls(tab, "GlobalOptions_Control.");
+ }
//
// 1) The graphics tab
diff --git a/gui/options.h b/gui/options.h
index 3189c91982..cb86e265bb 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -86,9 +86,8 @@ protected:
virtual void clean();
void rebuild();
-#ifdef ANDROIDSDL
- void addAndroidSdlControls(GuiObject *boss, const Common::String &prefix);
-#endif
+
+ 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);
@@ -116,15 +115,13 @@ protected:
private:
-#ifdef ANDROIDSDL
//
- // AndroidSDL controls
+ // Control controls
//
- bool _enableAndroidSdlSettings;
+ bool _enableControlSettings;
CheckboxWidget *_touchpadCheckbox;
CheckboxWidget *_onscreenCheckbox;
-#endif
//
// Graphics controls
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 54c63703b0..9254e97f40 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -814,7 +814,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"</layout>"
"</dialog>"
-"<dialog name='GlobalOptions_AndroidSdl' overlays='Dialog.GlobalOptions.TabWidget'>"
+"<dialog name='GlobalOptions_Control' overlays='Dialog.GlobalOptions.TabWidget'>"
"<layout type='vertical' padding='16,16,16,16' spacing='8'>"
"<widget name='grOnScreenCheckbox' "
"type='Checkbox' "
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 733668e5d6..22eaa76fde 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index f85020824d..a1a148b0c7 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -238,7 +238,7 @@
</layout>
</dialog>
- <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'>
+ <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<widget name = 'grOnScreenCheckbox'
type = 'Checkbox'
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index b660b4a8f5..1627ee6ce2 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -235,7 +235,7 @@
</layout>
</dialog>
- <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'>
+ <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<widget name = 'grOnScreenCheckbox'
type = 'Checkbox'
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 1779d22d44..a42d6ed620 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 49fb4813a4..16e85a0761 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -252,7 +252,7 @@
</layout>
</dialog>
- <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'>
+ <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<widget name = 'grOnScreenCheckbox'
type = 'Checkbox'
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 4a74704c34..a2d51d9904 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -233,7 +233,7 @@
</layout>
</dialog>
- <dialog name = 'GlobalOptions_AndroidSdl' overlays = 'Dialog.GlobalOptions.TabWidget'>
+ <dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<widget name = 'grOnScreenCheckbox'
type = 'Checkbox'