2009-09-03 08:53:55 +02:00
|
|
|
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
2009-09-26 11:22:54 +02:00
|
|
|
/// @file report.cpp
|
2009-09-03 08:53:55 +02:00
|
|
|
/// @brief Generation and manipulation of reports.
|
2009-09-26 11:38:17 +02:00
|
|
|
/// @ingroup base
|
2009-09-03 08:53:55 +02:00
|
|
|
|
|
|
|
#ifndef R_PRECOMP
|
|
|
|
#include <wx/intl.h>
|
2009-09-26 16:53:27 +02:00
|
|
|
#include <wx/log.h>
|
2009-09-03 08:53:55 +02:00
|
|
|
#endif
|
|
|
|
|
2011-01-03 16:46:21 +01:00
|
|
|
#include <libaegisub/io.h>
|
2011-01-03 13:00:12 +01:00
|
|
|
#include <libaegisub/cajun/elements.h>
|
|
|
|
#include <libaegisub/cajun/writer.h>
|
|
|
|
|
|
|
|
|
2009-09-03 08:53:55 +02:00
|
|
|
#include "report.h"
|
2009-10-03 19:16:52 +02:00
|
|
|
#include "include/platform.h"
|
2009-09-03 08:53:55 +02:00
|
|
|
#include "aegisub.h"
|
|
|
|
|
|
|
|
/// @brief Contstructor
|
|
|
|
Report::Report() {
|
|
|
|
|
2011-01-03 13:00:12 +01:00
|
|
|
json::Object root;
|
2009-09-03 08:53:55 +02:00
|
|
|
|
2009-10-03 19:16:52 +02:00
|
|
|
Platform *p = Platform::GetPlatform();
|
2011-01-04 05:23:51 +01:00
|
|
|
Aegisub a;
|
2009-09-03 08:53:55 +02:00
|
|
|
|
2011-12-22 22:12:25 +01:00
|
|
|
json::Object& general = root["General"];
|
|
|
|
general["Signature"] = p->Signature();
|
|
|
|
general["Date"] = p->Date();
|
|
|
|
general["Architecture"] = p->ArchName();
|
|
|
|
general["OS Family"] = p->OSFamily();
|
|
|
|
general["OS Name"] = p->OSName();
|
|
|
|
general["Endian"] = p->Endian();
|
|
|
|
general["OS Version"] = p->OSVersion();
|
|
|
|
general["wx Version"] = p->wxVersion();
|
|
|
|
general["Locale"] = p->Locale();
|
|
|
|
general["Language"] = p->Language();
|
|
|
|
general["System Language"] = p->SystemLanguage();
|
2011-01-04 05:23:51 +01:00
|
|
|
|
|
|
|
try {
|
2011-12-22 22:12:25 +01:00
|
|
|
json::Object& aegisub = root["Aegisub"];
|
|
|
|
aegisub["Last Version"] = a.GetString("Version/Last Version");
|
|
|
|
aegisub["Spelling Language"] = a.GetString("Tool/Spell Checker/Language");
|
|
|
|
aegisub["Thesaurus Language"] = a.GetString("Tool/Thesaurus/Language");
|
|
|
|
aegisub["Audio Player"] = a.GetString("Audio/Player");
|
|
|
|
aegisub["Audio Provider"] = a.GetString("Audio/Provider");
|
|
|
|
aegisub["Video Provider"] = a.GetString("Video/Provider");
|
|
|
|
aegisub["Subtitles Provider"] = a.GetString("Subtitle/Provider");
|
|
|
|
aegisub["Save Charset"] = a.GetString("App/Save Charset");
|
|
|
|
aegisub["Grid Font Size"] = a.GetInt("Grid/Font Size");
|
|
|
|
aegisub["Edit Font Size"] = a.GetInt("Subtitle/Edit Box/Font Size");
|
|
|
|
aegisub["Spectrum Enabled"] = a.GetBool("Audio/Spectrum");
|
|
|
|
aegisub["Spectrum Quality"] = a.GetInt("Audio/Renderer/Spectrum/Quality");
|
|
|
|
aegisub["Call Tips Enabled"] = a.GetBool("App/Call Tips");
|
|
|
|
aegisub["Medusa Hotkeys Enabled"] = a.GetBool("Audio/Medusa Timing Hotkeys");
|
2011-01-04 05:23:51 +01:00
|
|
|
} catch(...) {
|
|
|
|
root["Aegisub"]["Error"] = json::String("Config file is corrupted");
|
|
|
|
}
|
|
|
|
|
2011-12-22 22:12:25 +01:00
|
|
|
json::Object& hardware = root["Hardware"];
|
|
|
|
hardware["Memory Size"] = 0;
|
|
|
|
|
|
|
|
json::Object& cpu = root["CPU"];
|
|
|
|
cpu["Id"] = p->CPUId();
|
|
|
|
cpu["Speed"] = p->CPUSpeed();
|
|
|
|
cpu["Count"] = p->CPUCount();
|
|
|
|
cpu["Cores"] = p->CPUCores();
|
|
|
|
cpu["Features"] = p->CPUFeatures();
|
|
|
|
cpu["Features2"] = p->CPUFeatures2();
|
|
|
|
|
|
|
|
json::Object& display = root["Display"];
|
|
|
|
display["Depth"] = p->DisplayDepth();
|
|
|
|
display["Size"] = p->DisplaySize();
|
|
|
|
display["Pixels Per Inch"] = p->DisplayPPI();
|
|
|
|
|
|
|
|
json::Object& gl = display["OpenGL"];
|
|
|
|
gl["Vendor"] = p->OpenGLVendor();
|
|
|
|
gl["Renderer"] = p->OpenGLRenderer();
|
|
|
|
gl["Version"] = p->OpenGLVersion();
|
|
|
|
gl["Extensions"] = p->OpenGLExt();
|
|
|
|
display["OpenGL"] = gl;
|
2009-09-03 08:53:55 +02:00
|
|
|
|
2011-01-03 14:20:53 +01:00
|
|
|
#ifdef __WINDOWS__
|
2011-12-22 22:12:25 +01:00
|
|
|
json::Object& windows = root["Windows"];
|
2011-01-03 14:20:53 +01:00
|
|
|
windows["Service Pack"] = json::String();
|
|
|
|
windows["Graphics Driver Version"] = json::String();
|
|
|
|
windows["DirectShow Filters"] = json::String();
|
|
|
|
windows["AntiVirus Installed"] = json::Boolean();
|
|
|
|
windows["Firewall Installed"] = json::Boolean();
|
|
|
|
windows["DLL"] = json::String();
|
|
|
|
#endif
|
2009-09-03 08:53:55 +02:00
|
|
|
|
2011-01-03 14:20:53 +01:00
|
|
|
#ifdef __UNIX__
|
2011-12-22 22:12:25 +01:00
|
|
|
json::Object& u_nix = root["Unix"];
|
|
|
|
u_nix["Desktop Environment"] = p->DesktopEnvironment();
|
|
|
|
u_nix["Libraries"] = p->UnixLibraries();
|
2011-01-03 14:20:53 +01:00
|
|
|
#endif
|
2009-09-03 08:53:55 +02:00
|
|
|
|
2011-01-03 14:20:53 +01:00
|
|
|
#ifdef __APPLE__
|
2011-12-22 22:12:25 +01:00
|
|
|
json::Object& osx = root["OS X"];
|
|
|
|
osx["Patch"] = p->PatchLevel();
|
|
|
|
osx["QuickTime Extensions"] = p->QuickTimeExt();
|
|
|
|
osx["Model"] = p->HardwareModel();
|
2011-01-03 14:20:53 +01:00
|
|
|
#endif
|
2009-09-03 08:53:55 +02:00
|
|
|
|
2011-01-03 16:46:21 +01:00
|
|
|
agi::io::Save file("./t.json");
|
|
|
|
json::Writer::Write(root, file.Get());
|
|
|
|
|
2009-09-03 08:53:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// @brief Return Report as Text for the Clipboard.
|
2011-01-03 16:46:21 +01:00
|
|
|
void Report::Save(std::string filename) {
|
|
|
|
// agi::io::Save file(filename);
|
|
|
|
// json::Writer::Write(root, file.Get());
|
2009-09-03 08:53:55 +02:00
|
|
|
}
|