From 82ea63afbd9ded29655911febf522a9b83f37fc8 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 12 May 2014 18:15:51 +0100 Subject: [PATCH] Plugin active state now included in report data. --- src/backend/generators.cpp | 18 ++++++++++++------ src/backend/generators.h | 2 +- src/gui/main.cpp | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/backend/generators.cpp b/src/backend/generators.cpp index b4b37d7c..552be17d 100644 --- a/src/backend/generators.cpp +++ b/src/backend/generators.cpp @@ -141,12 +141,18 @@ namespace loot { out << YAML::EndMap; } - void WritePlugin(YAML::Emitter& out, const Plugin& plugin) { + void WritePlugin(YAML::Emitter& out, const Plugin& plugin, const Game& game) { out << YAML::BeginMap; out << YAML::Key << "name" << YAML::Value << plugin.Name(); + out << YAML::Key << "isActive"; + if (game.IsActive(plugin.Name())) + out << YAML::Value << "true"; + else + out << YAML::Value << "false"; + if (plugin.Crc() != 0) { out << YAML::Key << "crc" << YAML::Value << IntToHexString(plugin.Crc()); @@ -216,7 +222,7 @@ namespace loot { out << YAML::EndMap; } - void GenerateReport(const boost::filesystem::path& file, + void GenerateReportData(const Game& game, std::list& messages, const std::list& plugins, const std::string& masterlistVersion, @@ -224,7 +230,7 @@ namespace loot { const bool masterlistUpdateEnabled) { YAML::Node oldDetails; - GetOldReportDetails(file, oldDetails); + GetOldReportDetails(game.ReportDataPath(), oldDetails); //Need to output YAML as a JSON Javascript variable. YAML::Emitter yout; @@ -268,7 +274,7 @@ namespace loot { tempout << YAML::BeginSeq; for (std::list::const_iterator it = plugins.begin(), endit = plugins.end(); it != endit; ++it) { - WritePlugin(tempout, *it); + WritePlugin(tempout, *it, game); } tempout << YAML::EndSeq; @@ -281,7 +287,7 @@ namespace loot { yout << YAML::Key << "plugins" << YAML::Value << YAML::BeginSeq; for (std::list::const_iterator it = plugins.begin(), endit = plugins.end(); it != endit; ++it) { - WritePlugin(yout, *it); + WritePlugin(yout, *it, game); } yout << YAML::EndSeq; } @@ -369,7 +375,7 @@ namespace loot { yout << YAML::EndMap; - loot::ofstream out(file); + loot::ofstream out(game.ReportDataPath()); out << "var data = " << yout.c_str(); out.close(); } diff --git a/src/backend/generators.h b/src/backend/generators.h index 08e5c632..76b26dbb 100644 --- a/src/backend/generators.h +++ b/src/backend/generators.h @@ -34,7 +34,7 @@ namespace loot { //LOOT Report generation stuff. - void GenerateReport(const boost::filesystem::path& file, + void GenerateReportData(const Game& game, std::list& messages, const std::list& plugins, const std::string& masterlistVersion, diff --git a/src/gui/main.cpp b/src/gui/main.cpp index bb292618..11e74bed 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -909,7 +909,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(debug) << "Generating report..."; try { - GenerateReport(_game->ReportDataPath(), + GenerateReportData(*_game, messages, plugins, revision,