Convert rest of the values to JSON.

Originally committed to SVN as r5114.
This commit is contained in:
Amar Takhar 2011-01-03 13:33:53 +00:00
parent 4118580bb6
commit 7514812a25
5 changed files with 42 additions and 52 deletions

View file

@ -67,25 +67,20 @@ public:
// From <wx/gdicmn.h> // From <wx/gdicmn.h>
/// Is the display colour
/// @return true/false
/// @retval 1, 0
int DisplayColour();
/// Display depth /// Display depth
/// @return Depth /// @return Depth
/// @return Integer /// @return Integer
wxString DisplayDepth(); int DisplayDepth();
/// Display size /// Display size
/// @return Size delimited by a space. /// @return Size delimited by a space.
/// @retval "w h" /// @retval "w h"
wxString DisplaySize(); const char* DisplaySize();
/// Pixels per inch /// Pixels per inch
/// @return PPI /// @return PPI
/// @retval Integer /// @retval Integer
wxString DisplayPPI(); const char* DisplayPPI();
// Misc // Misc
@ -181,22 +176,22 @@ public:
/// OpenGL vendor /// OpenGL vendor
/// @return Vendor /// @return Vendor
/// @retval Any /// @retval Any
virtual wxString OpenGLVendor(); virtual std::string OpenGLVendor();
/// OpenGL renderer /// OpenGL renderer
/// @return Renderer /// @return Renderer
/// @retval Any /// @retval Any
virtual wxString OpenGLRenderer(); virtual std::string OpenGLRenderer();
/// OpenGL version /// OpenGL version
/// @return Renderer version /// @return Renderer version
/// @retval Any /// @retval Any
virtual wxString OpenGLVersion(); virtual std::string OpenGLVersion();
/// OpenGL extensions /// OpenGL extensions
/// @return OpenGL extensions /// @return OpenGL extensions
/// @retval Space delimited list of extensions /// @retval Space delimited list of extensions
virtual wxString OpenGLExt(); virtual std::string OpenGLExt();
//@} //@}
/// @name Windows /// @name Windows
@ -262,7 +257,7 @@ public:
/// Desktop environment /// Desktop environment
/// @return Environment /// @return Environment
/// @retval Gnome, KDE, WindowMaker... /// @retval Gnome, KDE, WindowMaker...
virtual wxString DesktopEnvironment()=0; virtual const char* DesktopEnvironment()=0;
#endif #endif
//@} //@}
@ -313,6 +308,6 @@ private:
/// Retrieve OpenGL video information. /// Retrieve OpenGL video information.
/// @param which Requested information /// @param which Requested information
/// @return Video info. /// @return Video info.
wxString GetVideoInfo(enum Platform::VideoInfo which); std::string GetVideoInfo(enum Platform::VideoInfo which);
}; };

View file

@ -75,7 +75,7 @@ void Platform::Init() {
* @brief Gather video adapter information via OpenGL * @brief Gather video adapter information via OpenGL
* *
*/ */
wxString Platform::GetVideoInfo(enum Platform::VideoInfo which) { std::string Platform::GetVideoInfo(enum Platform::VideoInfo which) {
int attList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 }; int attList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
wxGLCanvas *glc = new wxGLCanvas(wxTheApp->GetTopWindow(), wxID_ANY, attList, wxDefaultPosition, wxDefaultSize); wxGLCanvas *glc = new wxGLCanvas(wxTheApp->GetTopWindow(), wxID_ANY, attList, wxDefaultPosition, wxDefaultSize);
wxGLContext *ctx = new wxGLContext(glc, 0); wxGLContext *ctx = new wxGLContext(glc, 0);
@ -86,22 +86,22 @@ wxString Platform::GetVideoInfo(enum Platform::VideoInfo which) {
switch (which) { switch (which) {
case VIDEO_EXT: case VIDEO_EXT:
value = wxString(glGetString(GL_EXTENSIONS)); return reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
break; break;
case VIDEO_RENDERER: case VIDEO_RENDERER:
value = wxString(glGetString(GL_RENDERER)); return reinterpret_cast<const char*>(glGetString(GL_RENDERER));
break; break;
case VIDEO_VENDOR: case VIDEO_VENDOR:
value = wxString(glGetString(GL_VENDOR)); return reinterpret_cast<const char*>(glGetString(GL_VENDOR));
break; break;
case VIDEO_VERSION: case VIDEO_VERSION:
value = wxString(glGetString(GL_VERSION)); return reinterpret_cast<const char*>(glGetString(GL_VERSION));
default:
return "";
} }
delete ctx; delete ctx;
delete glc; delete glc;
return value;
} }
const char* Platform::ArchName() { const char* Platform::ArchName() {
@ -120,23 +120,19 @@ const char* Platform::Endian() {
return plat.GetEndiannessName().c_str(); return plat.GetEndiannessName().c_str();
}; };
int Platform::DisplayColour() {
return wxColourDisplay(); int Platform::DisplayDepth() {
//wxString::Format(L"%d", wxColourDisplay()); return wxDisplayDepth();
} }
wxString Platform::DisplayDepth() { const char* Platform::DisplaySize() {
return wxString::Format(L"%d", wxDisplayDepth());
}
wxString Platform::DisplaySize() {
int x, y; int x, y;
wxDisplaySize(&x, &y); wxDisplaySize(&x, &y);
return wxString::Format(L"%d %d", x, y); return wxString::Format(L"%d %d", x, y).c_str();
} }
wxString Platform::DisplayPPI() { const char* Platform::DisplayPPI() {
return wxString::Format(L"%d %d", wxGetDisplayPPI().GetWidth(), wxGetDisplayPPI().GetHeight()); return wxString::Format(L"%d %d", wxGetDisplayPPI().GetWidth(), wxGetDisplayPPI().GetHeight()).c_str();
} }
const char* Platform::wxVersion() { const char* Platform::wxVersion() {
@ -166,24 +162,24 @@ std::string Platform::Signature() {
} }
#ifdef __UNIX__ #ifdef __UNIX__
wxString Platform::DesktopEnvironment() { const char* Platform::DesktopEnvironment() {
return ""; return "";
} }
#endif #endif
wxString Platform::OpenGLVendor() { std::string Platform::OpenGLVendor() {
return GetVideoInfo(VIDEO_VENDOR); return GetVideoInfo(VIDEO_VENDOR);
} }
wxString Platform::OpenGLRenderer() { std::string Platform::OpenGLRenderer() {
return GetVideoInfo(VIDEO_RENDERER); return GetVideoInfo(VIDEO_RENDERER);
} }
wxString Platform::OpenGLVersion() { std::string Platform::OpenGLVersion() {
return GetVideoInfo(VIDEO_VERSION); return GetVideoInfo(VIDEO_VERSION);
} }
wxString Platform::OpenGLExt() { std::string Platform::OpenGLExt() {
return GetVideoInfo(VIDEO_EXT); return GetVideoInfo(VIDEO_EXT);
} }

View file

@ -40,8 +40,8 @@ const std::string PlatformUnix::OSVersion() {
return ""; return "";
} }
wxString PlatformUnix::DesktopEnvironment() { const char* PlatformUnix::DesktopEnvironment() {
return wxTheApp->GetTraits()->GetDesktopEnvironment(); return wxTheApp->GetTraits()->GetDesktopEnvironment().c_str();
} }

View file

@ -26,7 +26,7 @@ public:
PlatformUnix() {}; PlatformUnix() {};
virtual ~PlatformUnix() {}; virtual ~PlatformUnix() {};
const std::string OSVersion(); const std::string OSVersion();
wxString DesktopEnvironment(); const char* DesktopEnvironment();
// Hardware // Hardware
virtual std::string CPUId() { return ""; } virtual std::string CPUId() { return ""; }

View file

@ -95,18 +95,17 @@ Report::XMLReport Report::ReportCreate() {
json::Object display; json::Object display;
// display["Depth"] = json::Number(p->DisplayDepth()); display["Depth"] = json::Number(p->DisplayDepth());
// display["Colour"] = json::Number(p->DisplayColour()); display["Size"] = json::String(p->DisplaySize());
// display["Size"] = json::String(p->DisplaySize()); display["Pixels Per Inch"] = json::String(p->DisplayPPI());
// display["Pixels Per Inch"] = json::Number(p->DisplayPPI());
// json::Object gl; json::Object gl;
// gl["Vendor"] = json::String(p->OpenGLVendor()); gl["Vendor"] = json::String(p->OpenGLVendor());
// gl["Renderer"] = json::String(p->OpenGLRenderer()); gl["Renderer"] = json::String(p->OpenGLRenderer());
// gl["Version"] = json::String(p->OpenGLVersion()); gl["Version"] = json::String(p->OpenGLVersion());
// gl["Extensions"] = json::String(p->OpenGLExt()); gl["Extensions"] = json::String(p->OpenGLExt());
// display["OpenGL"] = gl; display["OpenGL"] = gl;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -122,8 +121,8 @@ Report::XMLReport Report::ReportCreate() {
#ifdef __UNIX__ #ifdef __UNIX__
json::Object u_nix; json::Object u_nix;
// u_nix["Desktop Environment"] = json::String(p->DesktopEnvironment()); u_nix["Desktop Environment"] = json::String(p->DesktopEnvironment());
// u_nix["Libraries"] = json::String(p->UnixLibraries()); u_nix["Libraries"] = json::String(p->UnixLibraries());
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__