mirror of https://github.com/odrling/Aegisub
First stab at converting the reporter to use JSON and updating it to a saner design.
Originally committed to SVN as r5111.
This commit is contained in:
parent
85b577f25e
commit
5985c60ded
|
@ -11,8 +11,8 @@ PRECOMPILED_HEADER_NAME=r_pre.h
|
|||
#nodist_reporter_3_0_SOURCES = r_prec.h.gch
|
||||
#endif
|
||||
|
||||
CXXFLAGS += -Iinclude $(CFLAGS_WX)
|
||||
LDFLAGS += $(LDFLAGS_WX) $(LDFLAGS_LIBCURL)
|
||||
CXXFLAGS += -Iinclude $(CFLAGS_WX) -I../libaegisub/include
|
||||
LDFLAGS += $(LDFLAGS_WX) $(LDFLAGS_LIBCURL) -L../libaegisub -laegisub-3.0 $(LDFLAGS_UCHARDET) -rpath ../libaegisub
|
||||
|
||||
#if PRECOMPILED_HEADER
|
||||
## This doesn't depend on Makefile on purpose, you should already know what you're doing when using this.
|
||||
|
|
|
@ -48,29 +48,29 @@ public:
|
|||
/// Architecture
|
||||
/// @return Architecture name.
|
||||
/// @retval 32 bit, 64 bit
|
||||
wxString ArchName();
|
||||
const char* ArchName();
|
||||
|
||||
/// OS Family
|
||||
/// @return OS Family
|
||||
/// @retval Unix, Windows, Mac
|
||||
wxString OSFamily();
|
||||
const char* OSFamily();
|
||||
|
||||
/// OS Name
|
||||
/// @return OS Name
|
||||
/// @retval FreeBSD, Windows, Mac
|
||||
wxString OSName();
|
||||
const char* OSName();
|
||||
|
||||
/// Endian
|
||||
/// @return Endian
|
||||
/// @retval Little endian, Big endian
|
||||
wxString Endian();
|
||||
const char* Endian();
|
||||
|
||||
// From <wx/gdicmn.h>
|
||||
|
||||
/// Is the display colour
|
||||
/// @return true/false
|
||||
/// @retval 1, 0
|
||||
wxString DisplayColour();
|
||||
int DisplayColour();
|
||||
|
||||
/// Display depth
|
||||
/// @return Depth
|
||||
|
@ -92,32 +92,32 @@ public:
|
|||
/// Report signature
|
||||
/// @return Signature
|
||||
/// @retval SHA256 hash
|
||||
wxString Signature();
|
||||
std::string Signature();
|
||||
|
||||
/// wxWidgets version
|
||||
/// @return Version
|
||||
/// @retval Major.Minor.Micro.Patch: 2.9.0.0
|
||||
wxString wxVersion();
|
||||
const char* wxVersion();
|
||||
|
||||
/// Locale
|
||||
/// @return Locale name
|
||||
/// @retval C,POSIX,<code>
|
||||
wxString Locale();
|
||||
const char* Locale();
|
||||
|
||||
/// Language currently in use
|
||||
/// @return Language reporter is currently running in
|
||||
/// @retval Language code: en_US, en_CA...
|
||||
wxString Language();
|
||||
const char* Language();
|
||||
|
||||
/// System language
|
||||
/// @return Language operating system is currently running in
|
||||
/// @retval Language code: en_US, en_CA...
|
||||
wxString SystemLanguage();
|
||||
const char* SystemLanguage();
|
||||
|
||||
/// Date
|
||||
/// @return Date
|
||||
/// @retval Date in YYYY-MM-DD
|
||||
wxString Date();
|
||||
std::string Date();
|
||||
|
||||
/// Time
|
||||
/// @return Time
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
/// Operating System version
|
||||
/// @return OS Version
|
||||
/// @retval Any
|
||||
virtual wxString OSVersion()=0;
|
||||
virtual const std::string OSVersion()=0;
|
||||
|
||||
// Hardware
|
||||
|
||||
|
|
|
@ -104,24 +104,25 @@ wxString Platform::GetVideoInfo(enum Platform::VideoInfo which) {
|
|||
return value;
|
||||
}
|
||||
|
||||
wxString Platform::ArchName() {
|
||||
return plat.GetArchName();
|
||||
const char* Platform::ArchName() {
|
||||
return plat.GetArchName().c_str();
|
||||
};
|
||||
|
||||
wxString Platform::OSFamily() {
|
||||
return plat.GetOperatingSystemFamilyName();
|
||||
const char* Platform::OSFamily() {
|
||||
return plat.GetOperatingSystemFamilyName().c_str();
|
||||
};
|
||||
|
||||
wxString Platform::OSName() {
|
||||
return plat.GetOperatingSystemIdName();
|
||||
const char* Platform::OSName() {
|
||||
return plat.GetOperatingSystemIdName().c_str();
|
||||
};
|
||||
|
||||
wxString Platform::Endian() {
|
||||
return plat.GetEndiannessName();
|
||||
const char* Platform::Endian() {
|
||||
return plat.GetEndiannessName().c_str();
|
||||
};
|
||||
|
||||
wxString Platform::DisplayColour() {
|
||||
return wxString::Format(L"%d", wxColourDisplay());
|
||||
int Platform::DisplayColour() {
|
||||
return wxColourDisplay();
|
||||
//wxString::Format(L"%d", wxColourDisplay());
|
||||
}
|
||||
|
||||
wxString Platform::DisplayDepth() {
|
||||
|
@ -138,29 +139,29 @@ wxString Platform::DisplayPPI() {
|
|||
return wxString::Format(L"%d %d", wxGetDisplayPPI().GetWidth(), wxGetDisplayPPI().GetHeight());
|
||||
}
|
||||
|
||||
wxString Platform::wxVersion() {
|
||||
return wxString::Format(L"%d.%d.%d.%d", wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, wxSUBRELEASE_NUMBER);
|
||||
const char* Platform::wxVersion() {
|
||||
return wxString::Format(L"%d.%d.%d.%d", wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, wxSUBRELEASE_NUMBER).c_str();
|
||||
}
|
||||
|
||||
wxString Platform::Locale() {
|
||||
return wxLocale().GetSysName();
|
||||
const char* Platform::Locale() {
|
||||
return wxLocale().GetSysName().c_str();
|
||||
}
|
||||
|
||||
wxString Platform::Language() {
|
||||
const char* Platform::Language() {
|
||||
const wxLanguageInfo *info = locale->GetLanguageInfo(locale->GetLanguage());
|
||||
return info->CanonicalName;
|
||||
return info->CanonicalName.c_str();
|
||||
}
|
||||
|
||||
wxString Platform::SystemLanguage() {
|
||||
const char* Platform::SystemLanguage() {
|
||||
const wxLanguageInfo *info = locale->GetLanguageInfo(locale->GetSystemLanguage());
|
||||
return info->CanonicalName;
|
||||
return info->CanonicalName.c_str();
|
||||
}
|
||||
|
||||
wxString Platform::Date() {
|
||||
std::string Platform::Date() {
|
||||
return "";
|
||||
}
|
||||
|
||||
wxString Platform::Signature() {
|
||||
std::string Platform::Signature() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
wxString PlatformUnix::OSVersion() {
|
||||
const std::string PlatformUnix::OSVersion() {
|
||||
struct utsname name;
|
||||
if (uname(&name) != -1) {
|
||||
return name.release;
|
||||
|
|
|
@ -25,7 +25,7 @@ class PlatformUnix : public Platform {
|
|||
public:
|
||||
PlatformUnix() {};
|
||||
virtual ~PlatformUnix() {};
|
||||
wxString OSVersion();
|
||||
const std::string OSVersion();
|
||||
wxString DesktopEnvironment();
|
||||
|
||||
// Hardware
|
||||
|
|
|
@ -25,7 +25,7 @@ class PlatformWindows : public Platform {
|
|||
public:
|
||||
PlatformWindows() {};
|
||||
virtual ~PlatformWindows() {};
|
||||
wxString OSVersion();
|
||||
const std::string OSVersion();
|
||||
wxString DesktopEnvironment();
|
||||
|
||||
// Hardware
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#include <wx/log.h>
|
||||
#endif
|
||||
|
||||
#include <libaegisub/cajun/elements.h>
|
||||
#include <libaegisub/cajun/writer.h>
|
||||
|
||||
|
||||
#include "report.h"
|
||||
#include "include/platform.h"
|
||||
#include "aegisub.h"
|
||||
|
@ -36,102 +40,99 @@ Report::Report() {
|
|||
/// @return Document.
|
||||
Report::XMLReport Report::ReportCreate() {
|
||||
|
||||
// So we can use GetString() below.
|
||||
locale = new wxLocale();
|
||||
|
||||
doc.doc = new wxXmlDocument();
|
||||
json::Object root;
|
||||
|
||||
doc.report = new wxXmlNode(wxXML_ELEMENT_NODE, "report");
|
||||
doc.doc->SetRoot(doc.report);
|
||||
Platform *p = Platform::GetPlatform();
|
||||
|
||||
doc.general = new wxXmlNode(doc.report, wxXML_ELEMENT_NODE, "general");
|
||||
Add(doc.general, "signature", p->Signature());
|
||||
Add(doc.general, "date", p->Date());
|
||||
Add(doc.general, "arch", p->ArchName());
|
||||
Add(doc.general, "osfamily", p->OSFamily());
|
||||
Add(doc.general, "osname", p->OSName());
|
||||
Add(doc.general, "osendian", p->Endian());
|
||||
Add(doc.general, "osversion", p->OSVersion());
|
||||
Add(doc.general, "wxversion", p->wxVersion());
|
||||
Add(doc.general, "locale", p->Locale());
|
||||
Add(doc.general, "lang", p->Language());
|
||||
Add(doc.general, "syslang", p->SystemLanguage());
|
||||
json::Object general;
|
||||
general["Signature"] = json::String(p->Signature());
|
||||
general["Date"] = json::String(p->Date());
|
||||
general["Architecture"] = json::String(p->ArchName());
|
||||
general["OS Family"] = json::String(p->OSFamily());
|
||||
general["OS Name"] = json::String(p->OSName());
|
||||
general["Endian"] = json::String(p->Endian());
|
||||
general["OS Version"] = json::String(p->OSVersion());
|
||||
general["wx Version"] = json::String(p->wxVersion());
|
||||
general["Locale"] = json::String(p->Locale());
|
||||
general["Language"] = json::String(p->Language());
|
||||
general["System Language"] = json::String(p->SystemLanguage());
|
||||
|
||||
doc.aegisub = new wxXmlNode(wxXML_ELEMENT_NODE, "aegisub");
|
||||
/*
|
||||
doc.aegisub = new wxXmlNode(wxXML_ELEMENT_NODE, Aegisub);
|
||||
doc.report->AddChild(doc.aegisub);
|
||||
|
||||
Aegisub *config = new Aegisub();
|
||||
Add(doc.aegisub, "lastversion", config->Read("Config/last version"));
|
||||
Add(doc.aegisub, "spelllang", config->Read("Config/spell checker language"));
|
||||
Add(doc.aegisub, "thesauruslang", config->Read("Config/thesaurus language"));
|
||||
Add(doc.aegisub, "audioplayer", config->Read("Config/audio player"));
|
||||
Add(doc.aegisub, "audioprovider", config->Read("Config/audio provider"));
|
||||
Add(doc.aegisub, "videoprovider", config->Read("Config/video provider"));
|
||||
Add(doc.aegisub, "subtitleprovider", config->Read("Config/subtitles provider"));
|
||||
Add(doc.aegisub, "savecharset", config->Read("Config/save charset"));
|
||||
Add(doc.aegisub, "gridfontsize", config->Read("Config/grid font size"));
|
||||
Add(doc.aegisub, "editfontsize", config->Read("Config/edit font size"));
|
||||
Add(doc.aegisub, "spectrum", config->Read("Config/audio spectrum"));
|
||||
Add(doc.aegisub, "spectrumqual", config->Read("Config/audio spectrum quality"));
|
||||
Add(doc.aegisub, "calltips", config->Read("Config/call tips enabled"));
|
||||
Add(doc.aegisub, "medusakeys", config->Read("Config/audio medusa timing hotkeys"));
|
||||
Add(doc.aegisub, Last Version, config->Read("Config/last version"));
|
||||
Add(doc.aegisub, Spelling Language, config->Read("Config/spell checker language"));
|
||||
Add(doc.aegisub, Thesaurus Language, config->Read("Config/thesaurus language"));
|
||||
Add(doc.aegisub, Audio Player, config->Read("Config/audio player"));
|
||||
Add(doc.aegisub, Audio Provider, config->Read("Config/audio provider"));
|
||||
Add(doc.aegisub, Video Provider, config->Read("Config/video provider"));
|
||||
Add(doc.aegisub, Subtitles Provider, config->Read("Config/subtitles provider"));
|
||||
Add(doc.aegisub, Save Charset, config->Read("Config/save charset"));
|
||||
Add(doc.aegisub, Grid Font Size, config->Read("Config/grid font size"));
|
||||
Add(doc.aegisub, Edit Font Size, config->Read("Config/edit font size"));
|
||||
Add(doc.aegisub, Spectrum Enabled, config->Read("Config/audio spectrum"));
|
||||
Add(doc.aegisub, Spectrum Quality, config->Read("Config/audio spectrum quality"));
|
||||
Add(doc.aegisub, Call Tips Enabled, config->Read("Config/call tips enabled"));
|
||||
Add(doc.aegisub, Medusa Hotkeys Enabled, config->Read("Config/audio medusa timing hotkeys"));
|
||||
|
||||
doc.hardware = new wxXmlNode(wxXML_ELEMENT_NODE, "hardware");
|
||||
doc.hardware = new wxXmlNode(wxXML_ELEMENT_NODE, Hardware);
|
||||
doc.report->AddChild(doc.hardware);
|
||||
Add(doc.hardware, "memory", p->Memory());
|
||||
Add(doc.hardware, Memory, p->Memory());
|
||||
|
||||
wxXmlNode *cpu = new wxXmlNode(wxXML_ELEMENT_NODE, "cpu");
|
||||
wxXmlNode *cpu = new wxXmlNode(wxXML_ELEMENT_NODE, CPU);
|
||||
doc.hardware->AddChild(cpu);
|
||||
Add(cpu, "id", p->CPUId());
|
||||
Add(cpu, "speed", p->CPUSpeed());
|
||||
Add(cpu, "count", p->CPUCount());
|
||||
Add(cpu, "cores", p->CPUCores());
|
||||
Add(cpu, "features", p->CPUFeatures());
|
||||
Add(cpu, "features2", p->CPUFeatures2());
|
||||
Add(cpu, Id, p->CPUId());
|
||||
Add(cpu, Speed, p->CPUSpeed());
|
||||
Add(cpu, Count, p->CPUCount());
|
||||
Add(cpu, Cores, p->CPUCores());
|
||||
Add(cpu, Features, p->CPUFeatures());
|
||||
Add(cpu, Features2, p->CPUFeatures2());
|
||||
|
||||
wxXmlNode *display = new wxXmlNode(wxXML_ELEMENT_NODE, "display");
|
||||
wxXmlNode *display = new wxXmlNode(wxXML_ELEMENT_NODE, Display);
|
||||
doc.hardware->AddChild(display);
|
||||
Add(display, "depth", p->DisplayDepth());
|
||||
Add(display, "colour", p->DisplayColour());
|
||||
Add(display, "size", p->DisplaySize());
|
||||
Add(display, "ppi", p->DisplayPPI());
|
||||
Add(display, Depth, p->DisplayDepth());
|
||||
Add(display, Colour Screen, p->DisplayColour());
|
||||
Add(display, Size, p->DisplaySize());
|
||||
Add(display, Pixels Per Inch, p->DisplayPPI());
|
||||
|
||||
wxXmlNode *display_gl = new wxXmlNode(wxXML_ELEMENT_NODE, "opengl");
|
||||
wxXmlNode *display_gl = new wxXmlNode(wxXML_ELEMENT_NODE, OpenGL);
|
||||
display->AddChild(display_gl);
|
||||
|
||||
Add(display_gl, "vendor", p->OpenGLVendor());
|
||||
Add(display_gl, "renderer", p->OpenGLRenderer());
|
||||
Add(display_gl, "version", p->OpenGLVersion());
|
||||
Add(display_gl, "extensions", p->OpenGLExt());
|
||||
Add(display_gl, Vendor, p->OpenGLVendor());
|
||||
Add(display_gl, Renderer, p->OpenGLRenderer());
|
||||
Add(display_gl, Version, p->OpenGLVersion());
|
||||
Add(display_gl, Extensions, p->OpenGLExt());
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
doc.windows = new wxXmlNode(wxXML_ELEMENT_NODE, "windows");
|
||||
doc.windows = new wxXmlNode(wxXML_ELEMENT_NODE, Windows);
|
||||
doc.report->AddChild(doc.windows);
|
||||
Add(doc.windows, "sp", p->ServicePack());
|
||||
Add(doc.windows, "graphicsver", p->DriverGraphicsVersion());
|
||||
Add(doc.windows, "dshowfilter", p->DirectShowFilters());
|
||||
Add(doc.windows, "antivirus", p->AntiVirus());
|
||||
Add(doc.windows, "firewall", p->Firewall());
|
||||
Add(doc.windows, "dll", p->DLLVersions());
|
||||
Add(doc.windows, Service Pack, p->ServicePack());
|
||||
Add(doc.windows, Graphics Driver Version, p->DriverGraphicsVersion());
|
||||
Add(doc.windows, DirectShow Filters, p->DirectShowFilters());
|
||||
Add(doc.windows, AntiVirus Installed, p->AntiVirus());
|
||||
Add(doc.windows, Firewall Installed, p->Firewall());
|
||||
Add(doc.windows, DLL, p->DLLVersions());
|
||||
#endif
|
||||
|
||||
#ifdef __UNIX__
|
||||
doc.unixx = new wxXmlNode(wxXML_ELEMENT_NODE, "unix");
|
||||
doc.unixx = new wxXmlNode(wxXML_ELEMENT_NODE, Unix);
|
||||
doc.report->AddChild(doc.unixx);
|
||||
Add(doc.unixx, "desktopenv", p->DesktopEnvironment());
|
||||
Add(doc.unixx, "lib", p->UnixLibraries());
|
||||
Add(doc.unixx, Desktop Environment, p->DesktopEnvironment());
|
||||
Add(doc.unixx, Libraries, p->UnixLibraries());
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
doc.osx = new wxXmlNode(wxXML_ELEMENT_NODE, "osx");
|
||||
doc.osx = new wxXmlNode(wxXML_ELEMENT_NODE, OS X);
|
||||
doc.report->AddChild(doc.osx);
|
||||
Add(doc.osx, "patch", p->PatchLevel());
|
||||
Add(doc.osx, "quicktimeext", p->QuickTimeExt());
|
||||
Add(doc.osx, "model", p->HardwareModel());
|
||||
Add(doc.osx, Patch, p->PatchLevel());
|
||||
Add(doc.osx, QuickTime Extensions, p->QuickTimeExt());
|
||||
Add(doc.osx, Model, p->HardwareModel());
|
||||
|
||||
#endif
|
||||
|
||||
*/
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue