From c041bb8884a47a5846a4d39bf0622588b935bc0f Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Mon, 3 Jan 2011 14:28:24 +0000 Subject: [PATCH] * Remove all vestiges of XML. * Generate the report in the constructor. Originally committed to SVN as r5118. --- aegisub/reporter/include/platform.h | 30 ++++++++++------------- aegisub/reporter/libraries.cpp | 2 -- aegisub/reporter/main.cpp | 10 ++++---- aegisub/reporter/r_pre.h | 1 - aegisub/reporter/report.cpp | 10 +------- aegisub/reporter/report.h | 37 +---------------------------- aegisub/reporter/upload.cpp | 2 +- 7 files changed, 20 insertions(+), 72 deletions(-) diff --git a/aegisub/reporter/include/platform.h b/aegisub/reporter/include/platform.h index 968b10f2b..98f1ed512 100644 --- a/aegisub/reporter/include/platform.h +++ b/aegisub/reporter/include/platform.h @@ -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 /// /// [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 - /// - /// [name] - /// + /// { "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 - /// - /// [name] - /// + /// { "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 - /// - /// [name] - /// + /// { "version", "name" } /// \endverbatim virtual wxString QuickTimeExt()=0; diff --git a/aegisub/reporter/libraries.cpp b/aegisub/reporter/libraries.cpp index b480e4875..ad548bd33 100644 --- a/aegisub/reporter/libraries.cpp +++ b/aegisub/reporter/libraries.cpp @@ -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 diff --git a/aegisub/reporter/main.cpp b/aegisub/reporter/main.cpp index a81e0bbea..252a041e4 100644 --- a/aegisub/reporter/main.cpp +++ b/aegisub/reporter/main.cpp @@ -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")); } diff --git a/aegisub/reporter/r_pre.h b/aegisub/reporter/r_pre.h index 8e8b0f107..69fcbb4f5 100644 --- a/aegisub/reporter/r_pre.h +++ b/aegisub/reporter/r_pre.h @@ -66,6 +66,5 @@ #include #include #include -#include #endif diff --git a/aegisub/reporter/report.cpp b/aegisub/reporter/report.cpp index 7a225a34d..446b2c219 100644 --- a/aegisub/reporter/report.cpp +++ b/aegisub/reporter/report.cpp @@ -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); } diff --git a/aegisub/reporter/report.h b/aegisub/reporter/report.h index 1356d33fc..c5969b0f5 100644 --- a/aegisub/reporter/report.h +++ b/aegisub/reporter/report.h @@ -21,7 +21,6 @@ #ifndef R_PRECOMP #include -#include #include #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 nameMap; - - /// element->human name pairs. - typedef std::pair 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; }; diff --git a/aegisub/reporter/upload.cpp b/aegisub/reporter/upload.cpp index b1b7da7fd..df21d8767 100644 --- a/aegisub/reporter/upload.cpp +++ b/aegisub/reporter/upload.cpp @@ -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);