From 1790bd8b7ef1318abccc4d92ad5b89464d42fd0e Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Wed, 4 Sep 2013 11:28:19 +0200 Subject: [PATCH] Replace System_GetName with System_GetProperty so we can return more info --- android/app-android.cpp | 12 ++++++++++-- base/BlackberryMain.cpp | 11 +++++++++-- base/NativeApp.h | 8 +++++++- base/PCMain.cpp | 14 +++++++++----- base/QtMain.cpp | 21 ++++++++++++++------- native.vcxproj | 12 ++++++++++++ native.vcxproj.filters | 2 ++ 7 files changed, 63 insertions(+), 17 deletions(-) diff --git a/android/app-android.cpp b/android/app-android.cpp index 94e4bf9efc..696e8005d0 100644 --- a/android/app-android.cpp +++ b/android/app-android.cpp @@ -32,6 +32,7 @@ std::string frameCommand; std::string frameCommandParam; std::string systemName; +std::string langRegion; const bool extraLog = true; @@ -86,8 +87,15 @@ void System_InputBox(const char *title, const char *defaultValue) { frameCommandParam = title; } -std::string System_GetName() { - return systemName; +std::string System_GetProperty(SystemProperty prop) { + switch (prop) { + case SYSPROP_NAME: + return systemName; + case SYSPROP_LANGREGION: // "en_US" + return langRegion; + default: + return ""; + } } // Remember that all of these need initialization on init! The process diff --git a/base/BlackberryMain.cpp b/base/BlackberryMain.cpp index 6263fa3498..65b74f5cff 100644 --- a/base/BlackberryMain.cpp +++ b/base/BlackberryMain.cpp @@ -13,8 +13,15 @@ // Simple implementations of System functions -std::string System_GetName() { - return "Blackberry10"; +std::string System_GetProperty(SystemProperty prop) { + switch (prop) { + case SYSPROP_NAME: + return "Blackberry10"; + case SYSPROP_LANGREGION: + return "en_US"; + default: + return ""; + } } void SystemToast(const char *text) { diff --git a/base/NativeApp.h b/base/NativeApp.h index ca7bdad320..5c4f6522ca 100644 --- a/base/NativeApp.h +++ b/base/NativeApp.h @@ -97,4 +97,10 @@ void LaunchBrowser(const char *url); void LaunchMarket(const char *url); void LaunchEmail(const char *email_address); void System_InputBox(const char *title, const char *defaultValue); -std::string System_GetName(); \ No newline at end of file + +enum SystemProperty { + SYSPROP_NAME, + SYSPROP_LANGREGION, +}; + +std::string System_GetProperty(SystemProperty prop); \ No newline at end of file diff --git a/base/PCMain.cpp b/base/PCMain.cpp index c0b82c2148..544f6b5938 100644 --- a/base/PCMain.cpp +++ b/base/PCMain.cpp @@ -251,13 +251,17 @@ void LaunchEmail(const char *email_address) #endif } -std::string System_GetName() { - // TODO - return "SDL"; +std::string System_GetProperty(SystemProperty prop) { + switch (prop) { + case SYSPROP_NAME: + return "SDL:"; + case SYSPROP_LANGREGION: + return "en_US"; + default: + return ""; + } } - - InputState input_state; diff --git a/base/QtMain.cpp b/base/QtMain.cpp index b4175a80dc..5170f1c99b 100644 --- a/base/QtMain.cpp +++ b/base/QtMain.cpp @@ -19,20 +19,27 @@ InputState* input_state; -std::string System_GetName() { +std::string System_GetProperty(SystemProperty prop) { + switch (prop) { + case SYSPROP_NAME: #ifdef __SYMBIAN32__ - return "Qt:Symbian"; + return "Qt:Symbian"; #elif defined(BLACKBERRY) - return "Qt:Blackberry10"; + return "Qt:Blackberry10"; #elif defined(MEEGO_EDITION_HARMATTAN) - return "Qt:Meego"; + return "Qt:Meego"; #elif defined(Q_WS_X11) - return "Qt:Linux"; + return "Qt:Linux"; #elif defined(_WIN32) - return "Qt:Windows"; + return "Qt:Windows"; #else - return "Qt"; + return "Qt"; #endif + case SYSPROP_LANGREGION: + return "en_US"; + default: + return ""; + } } void LaunchBrowser(const char *url) diff --git a/native.vcxproj b/native.vcxproj index 6ac3d9d086..68e8fd52e6 100644 --- a/native.vcxproj +++ b/native.vcxproj @@ -163,6 +163,12 @@ + + true + true + true + true + @@ -301,6 +307,12 @@ true true + + true + true + true + true + diff --git a/native.vcxproj.filters b/native.vcxproj.filters index 9e3b94243d..1df5dde379 100644 --- a/native.vcxproj.filters +++ b/native.vcxproj.filters @@ -18,6 +18,7 @@ ui + @@ -508,6 +509,7 @@ util +