gui2/game_version: Move report text generator to game_config ns for general use

This commit is contained in:
Ignacio R. Morelle 2017-05-21 22:27:43 -04:00
parent 246ea98dd9
commit 5ed8dc3847
3 changed files with 39 additions and 26 deletions

View file

@ -16,6 +16,9 @@
#include "build_info.hpp"
#include "desktop/version.hpp"
#include "game_config.hpp"
#include "filesystem.hpp"
#include "formatter.hpp"
#include "gettext.hpp"
@ -345,4 +348,34 @@ std::string optional_features_report()
return o.str();
}
std::string full_build_report()
{
std::ostringstream o;
o << "The Battle for Wesnoth version " << game_config::revision << '\n'
<< "Running on " << desktop::os_version() << '\n'
<< '\n'
<< "Game paths\n"
<< "==========\n"
<< '\n'
<< "Data dir: " << game_config::path << '\n'
<< "User config dir: " << filesystem::get_user_config_dir() << '\n'
<< "User data dir: " << filesystem::get_user_data_dir() << '\n'
<< "Saves dir: " << filesystem::get_saves_dir() << '\n'
<< "Add-ons dir: " << filesystem::get_addons_dir() << '\n'
<< "Cache dir: " << filesystem::get_cache_dir() << '\n'
<< '\n'
<< "Libraries\n"
<< "=========\n"
<< '\n'
<< game_config::library_versions_report()
<< '\n'
<< "Features\n"
<< "========\n"
<< '\n'
<< game_config::optional_features_report();
return o.str();
}
} // end namespace game_config

View file

@ -75,4 +75,9 @@ const std::string& library_name(LIBRARY_ID lib);
*/
std::string library_versions_report();
/**
* Produce a bug report-style info dump.
*/
std::string full_build_report();
} // end namespace game_config

View file

@ -310,32 +310,7 @@ void game_version::report_copy_callback()
void game_version::generate_plain_text_report()
{
std::ostringstream o;
o << "The Battle for Wesnoth version " << game_config::revision << '\n'
<< "Running on " << desktop::os_version() << '\n'
<< '\n'
<< "Game paths\n"
<< "==========\n"
<< '\n'
<< "Data dir: " << path_map_["datadir"] << '\n'
<< "User config dir: " << path_map_["config"] << '\n'
<< "User data dir: " << path_map_["userdata"] << '\n'
<< "Saves dir: " << path_map_["saves"] << '\n'
<< "Add-ons dir: " << path_map_["addons"] << '\n'
<< "Cache dir: " << path_map_["cache"] << '\n'
<< '\n'
<< "Libraries\n"
<< "=========\n"
<< '\n'
<< game_config::library_versions_report()
<< '\n'
<< "Features\n"
<< "========\n"
<< '\n'
<< game_config::optional_features_report();
report_ = o.str();
report_ = game_config::full_build_report();
}
} // namespace dialogs