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