From 7514812a253abdf5bb98433cb7411bf7a800ef6d Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Mon, 3 Jan 2011 13:33:53 +0000 Subject: [PATCH] Convert rest of the values to JSON. Originally committed to SVN as r5114. --- aegisub/reporter/include/platform.h | 23 +++++++--------- aegisub/reporter/platform.cpp | 42 +++++++++++++---------------- aegisub/reporter/platform_unix.cpp | 4 +-- aegisub/reporter/platform_unix.h | 2 +- aegisub/reporter/report.cpp | 23 ++++++++-------- 5 files changed, 42 insertions(+), 52 deletions(-) diff --git a/aegisub/reporter/include/platform.h b/aegisub/reporter/include/platform.h index b38dfc8d0..968b10f2b 100644 --- a/aegisub/reporter/include/platform.h +++ b/aegisub/reporter/include/platform.h @@ -67,25 +67,20 @@ public: // From - /// Is the display colour - /// @return true/false - /// @retval 1, 0 - int DisplayColour(); - /// Display depth /// @return Depth /// @return Integer - wxString DisplayDepth(); + int DisplayDepth(); /// Display size /// @return Size delimited by a space. /// @retval "w h" - wxString DisplaySize(); + const char* DisplaySize(); /// Pixels per inch /// @return PPI /// @retval Integer - wxString DisplayPPI(); + const char* DisplayPPI(); // Misc @@ -181,22 +176,22 @@ public: /// OpenGL vendor /// @return Vendor /// @retval Any - virtual wxString OpenGLVendor(); + virtual std::string OpenGLVendor(); /// OpenGL renderer /// @return Renderer /// @retval Any - virtual wxString OpenGLRenderer(); + virtual std::string OpenGLRenderer(); /// OpenGL version /// @return Renderer version /// @retval Any - virtual wxString OpenGLVersion(); + virtual std::string OpenGLVersion(); /// OpenGL extensions /// @return OpenGL extensions /// @retval Space delimited list of extensions - virtual wxString OpenGLExt(); + virtual std::string OpenGLExt(); //@} /// @name Windows @@ -262,7 +257,7 @@ public: /// Desktop environment /// @return Environment /// @retval Gnome, KDE, WindowMaker... - virtual wxString DesktopEnvironment()=0; + virtual const char* DesktopEnvironment()=0; #endif //@} @@ -313,6 +308,6 @@ private: /// Retrieve OpenGL video information. /// @param which Requested information /// @return Video info. - wxString GetVideoInfo(enum Platform::VideoInfo which); + std::string GetVideoInfo(enum Platform::VideoInfo which); }; diff --git a/aegisub/reporter/platform.cpp b/aegisub/reporter/platform.cpp index fc606e630..89fa728dd 100644 --- a/aegisub/reporter/platform.cpp +++ b/aegisub/reporter/platform.cpp @@ -75,7 +75,7 @@ void Platform::Init() { * @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 }; wxGLCanvas *glc = new wxGLCanvas(wxTheApp->GetTopWindow(), wxID_ANY, attList, wxDefaultPosition, wxDefaultSize); wxGLContext *ctx = new wxGLContext(glc, 0); @@ -86,22 +86,22 @@ wxString Platform::GetVideoInfo(enum Platform::VideoInfo which) { switch (which) { case VIDEO_EXT: - value = wxString(glGetString(GL_EXTENSIONS)); + return reinterpret_cast(glGetString(GL_EXTENSIONS)); break; case VIDEO_RENDERER: - value = wxString(glGetString(GL_RENDERER)); + return reinterpret_cast(glGetString(GL_RENDERER)); break; case VIDEO_VENDOR: - value = wxString(glGetString(GL_VENDOR)); + return reinterpret_cast(glGetString(GL_VENDOR)); break; case VIDEO_VERSION: - value = wxString(glGetString(GL_VERSION)); + return reinterpret_cast(glGetString(GL_VERSION)); + default: + return ""; } delete ctx; delete glc; - - return value; } const char* Platform::ArchName() { @@ -120,23 +120,19 @@ const char* Platform::Endian() { return plat.GetEndiannessName().c_str(); }; -int Platform::DisplayColour() { - return wxColourDisplay(); -//wxString::Format(L"%d", wxColourDisplay()); + +int Platform::DisplayDepth() { + return wxDisplayDepth(); } -wxString Platform::DisplayDepth() { - return wxString::Format(L"%d", wxDisplayDepth()); -} - -wxString Platform::DisplaySize() { +const char* Platform::DisplaySize() { int 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() { - return wxString::Format(L"%d %d", wxGetDisplayPPI().GetWidth(), wxGetDisplayPPI().GetHeight()); +const char* Platform::DisplayPPI() { + return wxString::Format(L"%d %d", wxGetDisplayPPI().GetWidth(), wxGetDisplayPPI().GetHeight()).c_str(); } const char* Platform::wxVersion() { @@ -166,24 +162,24 @@ std::string Platform::Signature() { } #ifdef __UNIX__ -wxString Platform::DesktopEnvironment() { +const char* Platform::DesktopEnvironment() { return ""; } #endif -wxString Platform::OpenGLVendor() { +std::string Platform::OpenGLVendor() { return GetVideoInfo(VIDEO_VENDOR); } -wxString Platform::OpenGLRenderer() { +std::string Platform::OpenGLRenderer() { return GetVideoInfo(VIDEO_RENDERER); } -wxString Platform::OpenGLVersion() { +std::string Platform::OpenGLVersion() { return GetVideoInfo(VIDEO_VERSION); } -wxString Platform::OpenGLExt() { +std::string Platform::OpenGLExt() { return GetVideoInfo(VIDEO_EXT); } diff --git a/aegisub/reporter/platform_unix.cpp b/aegisub/reporter/platform_unix.cpp index f3cfedafd..de7654a56 100644 --- a/aegisub/reporter/platform_unix.cpp +++ b/aegisub/reporter/platform_unix.cpp @@ -40,8 +40,8 @@ const std::string PlatformUnix::OSVersion() { return ""; } -wxString PlatformUnix::DesktopEnvironment() { - return wxTheApp->GetTraits()->GetDesktopEnvironment(); +const char* PlatformUnix::DesktopEnvironment() { + return wxTheApp->GetTraits()->GetDesktopEnvironment().c_str(); } diff --git a/aegisub/reporter/platform_unix.h b/aegisub/reporter/platform_unix.h index 538c6f437..4933ca253 100644 --- a/aegisub/reporter/platform_unix.h +++ b/aegisub/reporter/platform_unix.h @@ -26,7 +26,7 @@ public: PlatformUnix() {}; virtual ~PlatformUnix() {}; const std::string OSVersion(); - wxString DesktopEnvironment(); + const char* DesktopEnvironment(); // Hardware virtual std::string CPUId() { return ""; } diff --git a/aegisub/reporter/report.cpp b/aegisub/reporter/report.cpp index 03c478d56..7a225a34d 100644 --- a/aegisub/reporter/report.cpp +++ b/aegisub/reporter/report.cpp @@ -95,18 +95,17 @@ Report::XMLReport Report::ReportCreate() { json::Object display; -// display["Depth"] = json::Number(p->DisplayDepth()); -// display["Colour"] = json::Number(p->DisplayColour()); -// display["Size"] = json::String(p->DisplaySize()); -// display["Pixels Per Inch"] = json::Number(p->DisplayPPI()); + display["Depth"] = json::Number(p->DisplayDepth()); + display["Size"] = json::String(p->DisplaySize()); + display["Pixels Per Inch"] = json::String(p->DisplayPPI()); -// json::Object gl; -// gl["Vendor"] = json::String(p->OpenGLVendor()); -// gl["Renderer"] = json::String(p->OpenGLRenderer()); -// gl["Version"] = json::String(p->OpenGLVersion()); -// gl["Extensions"] = json::String(p->OpenGLExt()); -// display["OpenGL"] = gl; + json::Object gl; + gl["Vendor"] = json::String(p->OpenGLVendor()); + gl["Renderer"] = json::String(p->OpenGLRenderer()); + gl["Version"] = json::String(p->OpenGLVersion()); + gl["Extensions"] = json::String(p->OpenGLExt()); + display["OpenGL"] = gl; #ifdef __WINDOWS__ @@ -122,8 +121,8 @@ Report::XMLReport Report::ReportCreate() { #ifdef __UNIX__ json::Object u_nix; -// u_nix["Desktop Environment"] = json::String(p->DesktopEnvironment()); -// u_nix["Libraries"] = json::String(p->UnixLibraries()); + u_nix["Desktop Environment"] = json::String(p->DesktopEnvironment()); + u_nix["Libraries"] = json::String(p->UnixLibraries()); #endif #ifdef __APPLE__