Convert more groups to JSON and simplify source further.

Originally committed to SVN as r5112.
This commit is contained in:
Amar Takhar 2011-01-03 13:02:16 +00:00
parent 5985c60ded
commit e35badd20a
7 changed files with 52 additions and 69 deletions

View file

@ -176,7 +176,7 @@ public:
/// System memory
/// @return Memory
/// @retval Integer in bytes
virtual wxString Memory()=0;
virtual uint64_t Memory()=0;
/// OpenGL vendor
/// @return Vendor

View file

@ -28,11 +28,11 @@
#endif
#include "include/platform.h"
#include "platform_windows.h"
//#include "platform_windows.h"
#include "platform_unix.h"
#include "platform_unix_bsd.h"
#include "platform_unix_linux.h"
#include "platform_unix_osx.h"
//#include "platform_unix_linux.h"
//#include "platform_unix_osx.h"
extern "C" {
#ifdef __WXMAC__

View file

@ -44,34 +44,4 @@ wxString PlatformUnix::DesktopEnvironment() {
return wxTheApp->GetTraits()->GetDesktopEnvironment();
}
wxString PlatformUnix::CPUId() {
return "";
};
wxString PlatformUnix::CPUSpeed() {
return "";
};
wxString PlatformUnix::CPUCores() {
return "";
};
wxString PlatformUnix::CPUCount() {
return "";
};
wxString PlatformUnix::CPUFeatures() {
return "";
};
wxString PlatformUnix::CPUFeatures2() {
return "";
};
wxString PlatformUnix::Memory() {
return "";
};
wxString PlatformUnix::UnixLibraries() {
return "";
};

View file

@ -29,14 +29,14 @@ public:
wxString DesktopEnvironment();
// Hardware
virtual wxString CPUId();
virtual wxString CPUSpeed();
virtual wxString CPUCores();
virtual wxString CPUCount();
virtual wxString CPUFeatures();
virtual wxString CPUFeatures2();
virtual wxString Memory();
virtual wxString CPUId() { return ""; }
virtual wxString CPUSpeed() { return ""; }
virtual wxString CPUCores() { return ""; }
virtual wxString CPUCount() { return ""; }
virtual wxString CPUFeatures() { return ""; }
virtual wxString CPUFeatures2() { return ""; }
virtual uint64_t Memory() { return 0; }
// Unix Specific
virtual wxString UnixLibraries();
virtual wxString UnixLibraries() { return ""; };
};

View file

@ -62,12 +62,11 @@ wxString PlatformUnixBSD::CPUFeatures2() {
return "";
};
wxString PlatformUnixBSD::Memory() {
uint64_t PlatformUnixBSD::Memory() {
uint64_t memory;
size_t len = sizeof(memory);
sysctlbyname("hw.physmem", &memory, &len, NULL, 0);
return wxString::Format("%d", memory);
return "";
return memory;
};
wxString PlatformUnixBSD::UnixLibraries() {

View file

@ -33,7 +33,7 @@ public:
virtual wxString CPUCount();
virtual wxString CPUFeatures();
virtual wxString CPUFeatures2();
virtual wxString Memory();
virtual uint64_t Memory();
// Unix Specific
virtual wxString UnixLibraries();

View file

@ -58,30 +58,44 @@ Report::XMLReport Report::ReportCreate() {
general["Language"] = json::String(p->Language());
general["System Language"] = json::String(p->SystemLanguage());
json::Object aegisub;
/// I'll fix these at the end.
/*
Last Version
Spelling Language
Thesaurus Language
Audio Player
Audio Provider
Video Provider
Subtitles Provider
Save Charset
Grid Font Size
Edit Font Size
Spectrum Enabled
Spectrum Quality
Call Tips Enabled
Medusa Hotkeys Enabled
*/
json::Object hardware;
hardware["Memory Size"] = json::Number();
json::Object cpu;
cpu["Id"] = json::String();
cpu["Speed"] = json::String();
cpu["Count"] = json::String();
cpu["Cores"] = json::String();
cpu["Features"] = json::String();
cpu["Features2"] = json::String();
/*
doc.aegisub = new wxXmlNode(wxXML_ELEMENT_NODE, Aegisub);
doc.report->AddChild(doc.aegisub);
Aegisub *config = new Aegisub();
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.report->AddChild(doc.hardware);
Add(doc.hardware, Memory, p->Memory());
wxXmlNode *cpu = new wxXmlNode(wxXML_ELEMENT_NODE, CPU);
doc.hardware->AddChild(cpu);
Add(cpu, Id, p->CPUId());