Implemented JSON report data generation.

For issue #136. The PugiXML dependency has been removed. The following
limitations apply:
* Viewing reports externally doesn't currently work as the URL parameter
causes the JS file to be opened.
* The detection of change in report details is not yet re-implemented.
* The report cannot yet be translated.
This commit is contained in:
WrinklyNinja
2014-05-08 20:22:32 +01:00
parent 78572d0a9e
commit 39cbe12b99
7 changed files with 144 additions and 488 deletions
-1
View File
@@ -28,7 +28,6 @@ LOOT requires the following libraries (version numbers used in latest developmen
* [Libgit2](http://libgit2.github.com/) v0.20.0
* [Libloadorder](http://github.com/WrinklyNinja/libloadorder)
* [OpenSSL](https://www.openssl.org) - only if HTTPS support in libgit2 is required using compilers other than MSVC.
* [PugiXML](http://pugixml.org/) v1.4
* [wxWidgets](http://www.wxwidgets.org) v3.0.0
* [yaml-cpp](http://github.com/WrinklyNinja/yaml-cpp)
* [zlib](http://zlib.net/) v1.2.8
+2 -2
View File
@@ -229,8 +229,8 @@ namespace loot {
return g_path_local / lootFolderName / "userlist.yaml";
}
fs::path Game::ReportPath() const {
return g_path_local / lootFolderName / "report.html";
fs::path Game::ReportDataPath() const {
return g_path_local / lootFolderName / "reportdata.js";
}
void Game::RefreshActivePluginsList() {
+1 -1
View File
@@ -79,7 +79,7 @@ namespace loot {
boost::filesystem::path DataPath() const;
boost::filesystem::path MasterlistPath() const;
boost::filesystem::path UserlistPath() const;
boost::filesystem::path ReportPath() const;
boost::filesystem::path ReportDataPath() const;
//Game plugin functions.
+125 -464
View File
File diff suppressed because it is too large Load Diff
+6 -8
View File
@@ -33,12 +33,10 @@ namespace loot {
const unsigned int g_version_patch = 0;
//Common paths.
const boost::filesystem::path g_path_readme = boost::filesystem::current_path() / "docs" / "LOOT Readme.html";
const boost::filesystem::path g_path_css = boost::filesystem::current_path() / "resources" / "style.css";
const boost::filesystem::path g_path_js = boost::filesystem::current_path() / "resources" / "script.js";
const boost::filesystem::path g_path_polyfill = boost::filesystem::current_path() / "resources" / "polyfill.js";
const boost::filesystem::path g_path_l10n = boost::filesystem::current_path() / "resources" / "l10n";
const boost::filesystem::path g_path_local = GetLocalAppDataPath() / "LOOT";
const boost::filesystem::path g_path_settings = g_path_local / "settings.yaml";
const boost::filesystem::path g_path_log = g_path_local / "LOOTDebugLog.txt";
const boost::filesystem::path g_path_readme = boost::filesystem::current_path() / "docs" / "LOOT Readme.html";
const boost::filesystem::path g_path_report = boost::filesystem::current_path() / "resources" / "report" / "report.html";
const boost::filesystem::path g_path_l10n = boost::filesystem::current_path() / "resources" / "l10n";
const boost::filesystem::path g_path_local = GetLocalAppDataPath() / "LOOT";
const boost::filesystem::path g_path_settings = g_path_local / "settings.yaml";
const boost::filesystem::path g_path_log = g_path_local / "LOOTDebugLog.txt";
}
+4 -6
View File
@@ -34,14 +34,12 @@ namespace loot {
extern const unsigned int g_version_patch;
//Common paths.
extern const boost::filesystem::path g_path_local;
extern const boost::filesystem::path g_path_readme;
extern const boost::filesystem::path g_path_settings;
extern const boost::filesystem::path g_path_css;
extern const boost::filesystem::path g_path_js;
extern const boost::filesystem::path g_path_polyfill;
extern const boost::filesystem::path g_path_log;
extern const boost::filesystem::path g_path_report;
extern const boost::filesystem::path g_path_l10n;
extern const boost::filesystem::path g_path_local;
extern const boost::filesystem::path g_path_settings;
extern const boost::filesystem::path g_path_log;
}
#endif
+6 -6
View File
@@ -467,7 +467,7 @@ Launcher::Launcher(const wxChar *title, YAML::Node& settings, Game * game, vecto
//Set up initial state.
SortButton->SetDefault();
if (!fs::exists(_game->ReportPath()))
if (!fs::exists(g_path_report))
ViewButton->Enable(false);
if (_game->Id() == loot::Game::tes5)
@@ -516,12 +516,12 @@ void Launcher::OnClose(wxCloseEvent& event) {
void Launcher::OnViewLastReport(wxCommandEvent& event) {
if (_settings["View Report Externally"] && _settings["View Report Externally"].as<bool>()) {
BOOST_LOG_TRIVIAL(debug) << "Opening report in external application...";
wxLaunchDefaultBrowser(FromUTF8(ToFileURL(_game->ReportPath().string())));
wxLaunchDefaultBrowser(FromUTF8(ToFileURL(g_path_report.string() + "?data=" + _game->ReportDataPath().string())));
}
else {
//Create viewer window.
BOOST_LOG_TRIVIAL(debug) << "Opening viewer window...";
Viewer *viewer = new Viewer(this, translate("LOOT: Report Viewer"), FromUTF8(ToFileURL(_game->ReportPath().string())));
Viewer *viewer = new Viewer(this, translate("LOOT: Report Viewer"), FromUTF8(ToFileURL(g_path_report.string() + "?data=" + _game->ReportDataPath().string())));
viewer->Show();
}
BOOST_LOG_TRIVIAL(debug) << "Report displayed.";
@@ -912,7 +912,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
BOOST_LOG_TRIVIAL(debug) << "Generating report...";
try {
GenerateReport(_game->ReportPath(),
GenerateReport(_game->ReportDataPath(),
messages,
plugins,
revision,
@@ -933,10 +933,10 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
BOOST_LOG_TRIVIAL(debug) << "Displaying report...";
if (_settings["View Report Externally"] && _settings["View Report Externally"].as<bool>()) {
wxLaunchDefaultBrowser(FromUTF8(ToFileURL(_game->ReportPath().string())));
wxLaunchDefaultBrowser(FromUTF8(ToFileURL(g_path_report.string() + "?data=" + _game->ReportDataPath().string())));
} else {
//Create viewer window.
Viewer *viewer = new Viewer(this, translate("LOOT: Report Viewer"), FromUTF8(ToFileURL(_game->ReportPath().string())));
Viewer *viewer = new Viewer(this, translate("LOOT: Report Viewer"), FromUTF8(ToFileURL(g_path_report.string() + "?data=" + _game->ReportDataPath().string())));
viewer->Show();
}