* wxString is really annoying.
* Build JSON tree. Originally committed to SVN as r5119.
This commit is contained in:
parent
c041bb8884
commit
99aff7254f
6 changed files with 55 additions and 42 deletions
|
@ -48,22 +48,22 @@ public:
|
||||||
/// Architecture
|
/// Architecture
|
||||||
/// @return Architecture name.
|
/// @return Architecture name.
|
||||||
/// @retval 32 bit, 64 bit
|
/// @retval 32 bit, 64 bit
|
||||||
const char* ArchName();
|
std::string ArchName();
|
||||||
|
|
||||||
/// OS Family
|
/// OS Family
|
||||||
/// @return OS Family
|
/// @return OS Family
|
||||||
/// @retval Unix, Windows, Mac
|
/// @retval Unix, Windows, Mac
|
||||||
const char* OSFamily();
|
std::string OSFamily();
|
||||||
|
|
||||||
/// OS Name
|
/// OS Name
|
||||||
/// @return OS Name
|
/// @return OS Name
|
||||||
/// @retval FreeBSD, Windows, Mac
|
/// @retval FreeBSD, Windows, Mac
|
||||||
const char* OSName();
|
std::string OSName();
|
||||||
|
|
||||||
/// Endian
|
/// Endian
|
||||||
/// @return Endian
|
/// @return Endian
|
||||||
/// @retval Little endian, Big endian
|
/// @retval Little endian, Big endian
|
||||||
const char* Endian();
|
std::string Endian();
|
||||||
|
|
||||||
// From <wx/gdicmn.h>
|
// From <wx/gdicmn.h>
|
||||||
|
|
||||||
|
@ -75,12 +75,12 @@ public:
|
||||||
/// Display size
|
/// Display size
|
||||||
/// @return Size delimited by a space.
|
/// @return Size delimited by a space.
|
||||||
/// @retval "w h"
|
/// @retval "w h"
|
||||||
const char* DisplaySize();
|
std::string DisplaySize();
|
||||||
|
|
||||||
/// Pixels per inch
|
/// Pixels per inch
|
||||||
/// @return PPI
|
/// @return PPI
|
||||||
/// @retval Integer
|
/// @retval Integer
|
||||||
const char* DisplayPPI();
|
std::string DisplayPPI();
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
|
||||||
|
@ -92,12 +92,12 @@ public:
|
||||||
/// wxWidgets version
|
/// wxWidgets version
|
||||||
/// @return Version
|
/// @return Version
|
||||||
/// @retval Major.Minor.Micro.Patch: 2.9.0.0
|
/// @retval Major.Minor.Micro.Patch: 2.9.0.0
|
||||||
const char* wxVersion();
|
std::string wxVersion();
|
||||||
|
|
||||||
/// Locale
|
/// Locale
|
||||||
/// @return Locale name
|
/// @return Locale name
|
||||||
/// @retval C,POSIX,<code>
|
/// @retval C,POSIX,<code>
|
||||||
const char* Locale();
|
std::string Locale();
|
||||||
|
|
||||||
/// Language currently in use
|
/// Language currently in use
|
||||||
/// @return Language reporter is currently running in
|
/// @return Language reporter is currently running in
|
||||||
|
|
|
@ -89,7 +89,6 @@ bool Reporter::OnInit()
|
||||||
|
|
||||||
|
|
||||||
mFrame *frame = new mFrame(_("Aegisub Reporter"));
|
mFrame *frame = new mFrame(_("Aegisub Reporter"));
|
||||||
// Report *r = new Report;
|
|
||||||
|
|
||||||
if (parser.Found("j")) {
|
if (parser.Found("j")) {
|
||||||
r->Save("report.json");
|
r->Save("report.json");
|
||||||
|
@ -99,7 +98,8 @@ bool Reporter::OnInit()
|
||||||
|
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
|
|
||||||
// frame->SetReport(r);
|
r = new Report;
|
||||||
|
frame->SetReport(r);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
/// @ingroup base
|
/// @ingroup base
|
||||||
|
|
||||||
#ifndef R_PRECOMP
|
#ifndef R_PRECOMP
|
||||||
|
#include <sstream>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/gdicmn.h> // Display* functions.
|
#include <wx/gdicmn.h> // Display* functions.
|
||||||
|
@ -104,20 +105,20 @@ std::string Platform::GetVideoInfo(enum Platform::VideoInfo which) {
|
||||||
delete glc;
|
delete glc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Platform::ArchName() {
|
std::string Platform::ArchName() {
|
||||||
return plat.GetArchName().c_str();
|
return std::string(plat.GetArchName());
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* Platform::OSFamily() {
|
std::string Platform::OSFamily() {
|
||||||
return plat.GetOperatingSystemFamilyName().c_str();
|
return std::string(plat.GetOperatingSystemFamilyName());
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* Platform::OSName() {
|
std::string Platform::OSName() {
|
||||||
return plat.GetOperatingSystemIdName().c_str();
|
return std::string(plat.GetOperatingSystemIdName());
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* Platform::Endian() {
|
std::string Platform::Endian() {
|
||||||
return plat.GetEndiannessName().c_str();
|
return std::string(plat.GetEndiannessName());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,22 +126,28 @@ int Platform::DisplayDepth() {
|
||||||
return wxDisplayDepth();
|
return wxDisplayDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Platform::DisplaySize() {
|
std::string Platform::DisplaySize() {
|
||||||
int x, y;
|
int x, y;
|
||||||
wxDisplaySize(&x, &y);
|
wxDisplaySize(&x, &y);
|
||||||
return wxString::Format(L"%d %d", x, y).c_str();
|
std::stringstream ss;
|
||||||
|
ss << x << " " << y;
|
||||||
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Platform::DisplayPPI() {
|
std::string Platform::DisplayPPI() {
|
||||||
return wxString::Format(L"%d %d", wxGetDisplayPPI().GetWidth(), wxGetDisplayPPI().GetHeight()).c_str();
|
std::stringstream ss;
|
||||||
|
ss << wxGetDisplayPPI().GetWidth() << " " << wxGetDisplayPPI().GetHeight();
|
||||||
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Platform::wxVersion() {
|
std::string Platform::wxVersion() {
|
||||||
return wxString::Format(L"%d.%d.%d.%d", wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, wxSUBRELEASE_NUMBER).c_str();
|
std::stringstream ss;
|
||||||
|
ss << wxMAJOR_VERSION << "." << wxMINOR_VERSION << "." << wxRELEASE_NUMBER << "." << wxSUBRELEASE_NUMBER;
|
||||||
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Platform::Locale() {
|
std::string Platform::Locale() {
|
||||||
return wxLocale().GetSysName().c_str();
|
return std::string(wxLocale().GetSysName());
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Platform::Language() {
|
const char* Platform::Language() {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// C++ std
|
// C++ std
|
||||||
#include <map>
|
#include <sstream>
|
||||||
|
|
||||||
// 3rd party packages.
|
// 3rd party packages.
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <libaegisub/io.h>
|
||||||
#include <libaegisub/cajun/elements.h>
|
#include <libaegisub/cajun/elements.h>
|
||||||
#include <libaegisub/cajun/writer.h>
|
#include <libaegisub/cajun/writer.h>
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ Report::Report() {
|
||||||
general["Locale"] = json::String(p->Locale());
|
general["Locale"] = json::String(p->Locale());
|
||||||
general["Language"] = json::String(p->Language());
|
general["Language"] = json::String(p->Language());
|
||||||
general["System Language"] = json::String(p->SystemLanguage());
|
general["System Language"] = json::String(p->SystemLanguage());
|
||||||
|
root["General"] = general;
|
||||||
|
|
||||||
|
|
||||||
json::Object aegisub;
|
json::Object aegisub;
|
||||||
|
@ -76,7 +77,7 @@ Report::Report() {
|
||||||
|
|
||||||
json::Object hardware;
|
json::Object hardware;
|
||||||
hardware["Memory Size"] = json::Number();
|
hardware["Memory Size"] = json::Number();
|
||||||
|
root["Hardware"] = hardware;
|
||||||
|
|
||||||
json::Object cpu;
|
json::Object cpu;
|
||||||
cpu["Id"] = json::String(p->CPUId());
|
cpu["Id"] = json::String(p->CPUId());
|
||||||
|
@ -85,14 +86,13 @@ Report::Report() {
|
||||||
cpu["Cores"] = json::Number(p->CPUCores());
|
cpu["Cores"] = json::Number(p->CPUCores());
|
||||||
cpu["Features"] = json::String(p->CPUFeatures());
|
cpu["Features"] = json::String(p->CPUFeatures());
|
||||||
cpu["Features2"] = json::String(p->CPUFeatures2());
|
cpu["Features2"] = json::String(p->CPUFeatures2());
|
||||||
|
root["CPU"] = cpu;
|
||||||
|
|
||||||
json::Object display;
|
json::Object display;
|
||||||
display["Depth"] = json::Number(p->DisplayDepth());
|
display["Depth"] = json::Number(p->DisplayDepth());
|
||||||
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::String(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());
|
||||||
|
@ -100,6 +100,8 @@ Report::Report() {
|
||||||
gl["Extensions"] = json::String(p->OpenGLExt());
|
gl["Extensions"] = json::String(p->OpenGLExt());
|
||||||
display["OpenGL"] = gl;
|
display["OpenGL"] = gl;
|
||||||
|
|
||||||
|
root["Display"] = display;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
json::Object windows;
|
json::Object windows;
|
||||||
|
@ -109,6 +111,7 @@ Report::Report() {
|
||||||
windows["AntiVirus Installed"] = json::Boolean();
|
windows["AntiVirus Installed"] = json::Boolean();
|
||||||
windows["Firewall Installed"] = json::Boolean();
|
windows["Firewall Installed"] = json::Boolean();
|
||||||
windows["DLL"] = json::String();
|
windows["DLL"] = json::String();
|
||||||
|
root["Windows"] = windows;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -116,6 +119,7 @@ Report::Report() {
|
||||||
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());
|
||||||
|
root["Unix"] = u_nix;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -123,11 +127,16 @@ Report::Report() {
|
||||||
osx["Patch"] = json::String(p->PatchLevel());
|
osx["Patch"] = json::String(p->PatchLevel());
|
||||||
osx["QuickTime Extensions"] = json::String(p->QuickTimeExt());
|
osx["QuickTime Extensions"] = json::String(p->QuickTimeExt());
|
||||||
osx["Model"] = json::String(p->HardwareModel());
|
osx["Model"] = json::String(p->HardwareModel());
|
||||||
|
root["OS X"] = osx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
agi::io::Save file("./t.json");
|
||||||
|
json::Writer::Write(root, file.Get());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Return Report as Text for the Clipboard.
|
/// @brief Return Report as Text for the Clipboard.
|
||||||
void Report::Save(wxString file) {
|
void Report::Save(std::string filename) {
|
||||||
// doc.doc->Save(file);
|
// agi::io::Save file(filename);
|
||||||
|
// json::Writer::Write(root, file.Get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
/// @ingroup base
|
/// @ingroup base
|
||||||
|
|
||||||
#ifndef R_PRECOMP
|
#ifndef R_PRECOMP
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <wx/listctrl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// @class Report
|
/// @class Report
|
||||||
|
@ -33,7 +30,7 @@ public:
|
||||||
~Report() {};
|
~Report() {};
|
||||||
|
|
||||||
/// Save JSON report to a file.
|
/// Save JSON report to a file.
|
||||||
void Save(wxString file);
|
void Save(std::string filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxLocale *locale;
|
wxLocale *locale;
|
||||||
|
|
Loading…
Reference in a new issue