* Remove all vestiges of XML.

* Generate the report in the constructor.

Originally committed to SVN as r5118.
This commit is contained in:
Amar Takhar 2011-01-03 14:28:24 +00:00
parent 22c797a5d1
commit c041bb8884
7 changed files with 20 additions and 72 deletions

View File

@ -209,8 +209,8 @@ public:
virtual wxString DriverGraphicsVersion()=0;
/// Directshow filters installed
/// @return wxXmlNode of filters installed
/// @retval A wxXmlNode in the format of:
/// @return json::Object of filters installed
/// @retval A json::Object format of:
/// \verbatim
/// <filter>
/// <name version="[version]">[name]</name>
@ -229,12 +229,10 @@ public:
virtual wxString Firewall()=0;
/// DLL versions used
/// @return wxXmlNode of DLLs used
/// @retval A wxXmlNode in the format of:
/// @return json::Array of DLLs used
/// @retval A json::Array in the format of:
/// \verbatim
/// <dll>
/// <file version="[version]">[name]</file>
/// </dll>
/// { "version", "name" }
/// \endverbatim
virtual wxString DLLVersions()=0;
#endif
@ -244,13 +242,11 @@ public:
//@{
#ifdef __UNIX__
/// Dynamic libraries used
/// @return wxXmlNode of libraries used
/// @retval A wxXmlNode in the format of:
/// Library versions used
/// @return json::Array of DLLs used
/// @retval A json::Array in the format of:
/// \verbatim
/// <lib>
/// <file version="[version]">[name]</file>
/// </lib>
/// { "version", "name" }
/// \endverbatim
virtual std::string UnixLibraries()=0;
@ -271,12 +267,10 @@ public:
virtual wxString PatchLevel()=0;
/// QuickTime extensions
/// @return wxXmlNode of extensions used
/// @retval A wxXmlNode in the format of:
/// @return json::Array of extensions used
/// @retval A json::Array in the format of:
/// \verbatim
/// <quicktime>
/// <ext version="[version]">[name]</file>
/// </quicktime>
/// { "version", "name" }
/// \endverbatim
virtual wxString QuickTimeExt()=0;

View File

@ -33,7 +33,6 @@
#pragma comment(lib, "wxmsw29ud_gl.lib")
#pragma comment(lib, "wxmsw29ud_stc.lib")
#pragma comment(lib, "wxscintillad.lib")
#pragma comment(lib, "wxbase29ud_xml.lib")
#pragma comment(lib, "wxexpatd.lib")
#else
#pragma comment(lib, "wxzlib.lib")
@ -47,7 +46,6 @@
#pragma comment(lib, "wxmsw29u_gl.lib")
#pragma comment(lib, "wxmsw29u_stc.lib")
#pragma comment(lib, "wxscintilla.lib")
#pragma comment(lib, "wxbase29u_xml.lib")
#pragma comment(lib, "wxexpat.lib")
#endif

View File

@ -50,7 +50,7 @@ bool Reporter::OnInit()
static const wxCmdLineEntryDesc cmdLineDesc[] = {
{ wxCMD_LINE_SWITCH, "c", "crash", "Launch in crash mode.", wxCMD_LINE_VAL_NONE, NULL },
{ wxCMD_LINE_SWITCH, "r", "report", "Launch in Report mode.", wxCMD_LINE_VAL_NONE, NULL },
{ wxCMD_LINE_SWITCH, "x", "xml", "Dump XML file", wxCMD_LINE_VAL_NONE, NULL },
{ wxCMD_LINE_SWITCH, "j", "json", "Dump JSON file", wxCMD_LINE_VAL_NONE, NULL },
{ wxCMD_LINE_SWITCH, "h", "help", "This help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, NULL}
};
@ -91,9 +91,9 @@ bool Reporter::OnInit()
mFrame *frame = new mFrame(_("Aegisub Reporter"));
// Report *r = new Report;
if (parser.Found("x")) {
r->Save("report.xml");
wxPrintf("Report saved to report.xml\n");
if (parser.Found("j")) {
r->Save("report.json");
std::cout << "Report saved to report.json" << std::endl;
return false;
}
@ -160,6 +160,6 @@ void mFrame::Cancel(wxCommandEvent& WXUNUSED(event)) {
void mFrame::Submit(wxCommandEvent& WXUNUSED(event)) {
Progress *progress = new Progress(this);
Upload *upload = new Upload(progress);
upload->Report(_("./test.xml"));
upload->Report(_("./test.json"));
}

View File

@ -66,6 +66,5 @@
#include <wx/wx.h>
#include <wx/wxchar.h>
#include <wx/wxprec.h>
#include <wx/xml/xml.h>
#endif

View File

@ -33,13 +33,6 @@
/// @brief Contstructor
Report::Report() {
ReportCreate();
}
/// @brief Create report layout and add contents.
/// @return Document.
Report::XMLReport Report::ReportCreate() {
json::Object root;
@ -132,10 +125,9 @@ Report::XMLReport Report::ReportCreate() {
osx["Model"] = json::String(p->HardwareModel());
#endif
return doc;
}
/// @brief Return Report as Text for the Clipboard.
void Report::Save(wxString file) {
doc.doc->Save(file);
// doc.doc->Save(file);
}

View File

@ -21,7 +21,6 @@
#ifndef R_PRECOMP
#include <map>
#include <wx/xml/xml.h>
#include <wx/listctrl.h>
#endif
@ -33,43 +32,9 @@ public:
Report();
~Report() {};
/// Fill wxListView with report contents.
/// @param text pointer to text buffer
/// @param listview wxListview to fill
void Fill(wxString *text, wxListView *listView);
/// Save XML report to a file.
/// Save JSON report to a file.
void Save(wxString file);
private:
/// Comparison callback for nameMap.
struct lst_comp {
bool operator() (const wxString &a, const wxString &b) const { return a.Cmp(b) < 0; }
};
/// Map of internal XML elements to human readable names.
typedef std::map<wxString, wxString, lst_comp> nameMap;
/// element->human name pairs.
typedef std::pair<wxString, wxString> nPair;
/// Struct to hold generatex XML Report.
struct XMLReport {
wxXmlDocument *doc; /// Parent document.
wxXmlNode *report; /// Root node.
wxXmlNode *general; /// General.
wxXmlNode *aegisub; /// Aegisub related..
wxXmlNode *hardware; /// Hardware.
wxXmlNode *windows; /// Windows specific.
wxXmlNode *unixx; /// Unix specific.
wxXmlNode *osx; /// OS X specific.
};
XMLReport ReportCreate();
XMLReport doc;
void Add(wxXmlNode *parent, wxString node, wxString text);
const nameMap HumanNames();
nameMap nMap;
void ProcessNode(wxXmlNode *node, wxString *text, wxListView *listView);
wxLocale *locale;
};

View File

@ -47,7 +47,7 @@ Upload::~Upload() {
}
/// @brief Submit an XML report.
/// @brief Submit a JSON report.
/// @param report filename of the report.
void Upload::Report(wxString report) {
wxFile file(report, wxFile::read);