MAEMO: Migrate OSystem_SDL_Maemo to Maemo namespace

This commit is contained in:
Tarek Soliman 2011-10-11 18:17:30 -05:00
parent 52fae5524c
commit b56e9e2ef1
3 changed files with 15 additions and 9 deletions

View file

@ -35,6 +35,8 @@
#include <SDL/SDL_syswm.h> #include <SDL/SDL_syswm.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
namespace Maemo {
OSystem_SDL_Maemo::OSystem_SDL_Maemo() OSystem_SDL_Maemo::OSystem_SDL_Maemo()
: :
OSystem_POSIX() { OSystem_POSIX() {
@ -47,7 +49,7 @@ void OSystem_SDL_Maemo::initBackend() {
ConfMan.set("vkeybdpath", DATA_PATH); ConfMan.set("vkeybdpath", DATA_PATH);
_model = Maemo::Model(detectModel()); _model = Model(detectModel());
// Call parent implementation of this method // Call parent implementation of this method
OSystem_POSIX::initBackend(); OSystem_POSIX::initBackend();
@ -98,13 +100,14 @@ void OSystem_SDL_Maemo::setWindowCaption(const char *caption) {
const Maemo::Model OSystem_SDL_Maemo::detectModel() { const Maemo::Model OSystem_SDL_Maemo::detectModel() {
Common::String deviceHwId = Common::String(getenv("SCUMMVM_MAEMO_DEVICE")); Common::String deviceHwId = Common::String(getenv("SCUMMVM_MAEMO_DEVICE"));
const Maemo::Model *model; const Model *model;
for (model = Maemo::models; model->hwId; model++) { for (model = models; model->hwId; model++) {
if (deviceHwId.equals(model->hwId)) if (deviceHwId.equals(model->hwId))
return *model; return *model;
} }
return *model; return *model;
} }
} //namespace Maemo
#endif #endif

View file

@ -28,6 +28,7 @@
#include "backends/platform/sdl/posix/posix.h" #include "backends/platform/sdl/posix/posix.h"
#include "backends/platform/maemo/maemo-common.h" #include "backends/platform/maemo/maemo-common.h"
namespace Maemo {
class OSystem_SDL_Maemo : public OSystem_POSIX { class OSystem_SDL_Maemo : public OSystem_POSIX {
public: public:
@ -38,16 +39,18 @@ public:
virtual void fatalError(); virtual void fatalError();
virtual void setWindowCaption(const char *caption); virtual void setWindowCaption(const char *caption);
Maemo::Model getModel() { return _model; } Model getModel() { return _model; }
private: private:
virtual void setXWindowName(const char *caption); virtual void setXWindowName(const char *caption);
const Maemo::Model detectModel(); const Model detectModel();
Maemo::Model _model; Model _model;
}; };
} // namespace Maemo
#endif // ifndef PLATFORM_SDL_MAEMO_H #endif // ifndef PLATFORM_SDL_MAEMO_H
#endif // if defined(MAEMO) #endif // if defined(MAEMO)

View file

@ -31,10 +31,10 @@
#include <unistd.h> #include <unistd.h>
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
g_system = new OSystem_SDL_Maemo(); g_system = new Maemo::OSystem_SDL_Maemo();
assert(g_system); assert(g_system);
((OSystem_SDL_Maemo *)g_system)->init(); ((Maemo::OSystem_SDL_Maemo *)g_system)->init();
#ifdef DYNAMIC_MODULES #ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new SDLPluginProvider()); PluginManager::instance().addPluginProvider(new SDLPluginProvider());
@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
int res = scummvm_main(argc, argv); int res = scummvm_main(argc, argv);
// Free OSystem // Free OSystem
delete (OSystem_SDL_Maemo *)g_system; delete (Maemo::OSystem_SDL_Maemo *)g_system;
return res; return res;
} }