mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Some minor refactoring of constants.
Moved message types, languages, and game constants to their respective classes.
This commit is contained in:
+17
-17
@@ -62,26 +62,26 @@ const unsigned int loot_error_sorting_error = loot::error::sorting_error
|
||||
const unsigned int loot_return_max = loot_error_sorting_error;
|
||||
|
||||
// The following are the games identifiers used by the API.
|
||||
const unsigned int loot_game_tes4 = loot::g_game_tes4;
|
||||
const unsigned int loot_game_tes5 = loot::g_game_tes5;
|
||||
const unsigned int loot_game_fo3 = loot::g_game_fo3;
|
||||
const unsigned int loot_game_fonv = loot::g_game_fonv;
|
||||
const unsigned int loot_game_tes4 = loot::Game::tes4;
|
||||
const unsigned int loot_game_tes5 = loot::Game::tes5;
|
||||
const unsigned int loot_game_fo3 = loot::Game::fo3;
|
||||
const unsigned int loot_game_fonv = loot::Game::fonv;
|
||||
|
||||
// LOOT message types.
|
||||
const unsigned int loot_message_say = loot::g_message_say;
|
||||
const unsigned int loot_message_warn = loot::g_message_warn;
|
||||
const unsigned int loot_message_error = loot::g_message_error;
|
||||
const unsigned int loot_message_tag = loot::g_message_tag;
|
||||
const unsigned int loot_message_say = loot::Message::say;
|
||||
const unsigned int loot_message_warn = loot::Message::warn;
|
||||
const unsigned int loot_message_error = loot::Message::error;
|
||||
const unsigned int loot_message_tag = loot::Message::tag;
|
||||
|
||||
// LOOT message languages.
|
||||
const unsigned int loot_lang_any = loot::g_lang_any;
|
||||
const unsigned int loot_lang_english = loot::g_lang_english;
|
||||
const unsigned int loot_lang_spanish = loot::g_lang_spanish;
|
||||
const unsigned int loot_lang_russian = loot::g_lang_russian;
|
||||
const unsigned int loot_lang_french = loot::g_lang_french;
|
||||
const unsigned int loot_lang_chinese = loot::g_lang_chinese;
|
||||
const unsigned int loot_lang_polish = loot::g_lang_polish;
|
||||
const unsigned int loot_lang_brazilian_portuguese = loot::g_lang_brazilian_portuguese;
|
||||
const unsigned int loot_lang_any = loot::Language::any;
|
||||
const unsigned int loot_lang_english = loot::Language::english;
|
||||
const unsigned int loot_lang_spanish = loot::Language::spanish;
|
||||
const unsigned int loot_lang_russian = loot::Language::russian;
|
||||
const unsigned int loot_lang_french = loot::Language::french;
|
||||
const unsigned int loot_lang_chinese = loot::Language::chinese;
|
||||
const unsigned int loot_lang_polish = loot::Language::polish;
|
||||
const unsigned int loot_lang_brazilian_portuguese = loot::Language::brazilian_portuguese;
|
||||
|
||||
// LOOT cleanliness codes.
|
||||
const unsigned int loot_needs_cleaning_no = 0;
|
||||
@@ -618,7 +618,7 @@ LOOT_API unsigned int loot_get_plugin_messages (loot_db db, const char * const p
|
||||
int i = 0;
|
||||
for (std::list<loot::Message>::const_iterator it=pluginMessages.begin(), endIt=pluginMessages.end(); it != endIt; ++it) {
|
||||
db->extMessageArray[i].type = it->Type();
|
||||
db->extMessageArray[i].message = ToNewCString(it->ChooseContent(loot::g_lang_any).Str());
|
||||
db->extMessageArray[i].message = ToNewCString(it->ChooseContent(loot::Language::any).Str());
|
||||
}
|
||||
} catch (std::bad_alloc& e) {
|
||||
return c_error(loot_error_no_mem, e.what());
|
||||
|
||||
+25
-25
@@ -44,25 +44,25 @@ namespace loot {
|
||||
if (settings["Games"])
|
||||
games = settings["Games"].as< vector<Game> >();
|
||||
|
||||
if (find(games.begin(), games.end(), Game(g_game_tes4)) == games.end())
|
||||
games.push_back(Game(g_game_tes4));
|
||||
if (find(games.begin(), games.end(), Game(Game::tes4)) == games.end())
|
||||
games.push_back(Game(Game::tes4));
|
||||
|
||||
if (find(games.begin(), games.end(), Game(g_game_tes5)) == games.end())
|
||||
games.push_back(Game(g_game_tes5));
|
||||
if (find(games.begin(), games.end(), Game(Game::tes5)) == games.end())
|
||||
games.push_back(Game(Game::tes5));
|
||||
|
||||
if (find(games.begin(), games.end(), Game(g_game_fo3)) == games.end())
|
||||
games.push_back(Game(g_game_fo3));
|
||||
if (find(games.begin(), games.end(), Game(Game::fo3)) == games.end())
|
||||
games.push_back(Game(Game::fo3));
|
||||
|
||||
if (find(games.begin(), games.end(), Game(g_game_fonv)) == games.end())
|
||||
games.push_back(Game(g_game_fonv));
|
||||
if (find(games.begin(), games.end(), Game(Game::fonv)) == games.end())
|
||||
games.push_back(Game(Game::fonv));
|
||||
|
||||
return games;
|
||||
}
|
||||
|
||||
Game::Game() : id(g_game_autodetect) {}
|
||||
Game::Game() : id(Game::autodetect) {}
|
||||
|
||||
Game::Game(const unsigned int gameCode, const std::string& folder) : id(gameCode) {
|
||||
if (Id() == g_game_tes4) {
|
||||
if (Id() == Game::tes4) {
|
||||
_name = "TES IV: Oblivion";
|
||||
registryKey = "Software\\Bethesda Softworks\\Oblivion\\Installed Path";
|
||||
lootFolderName = "Oblivion";
|
||||
@@ -70,7 +70,7 @@ namespace loot {
|
||||
espm_settings = espm::Settings("tes4");
|
||||
_repositoryURL = "https://github.com/loot/oblivion.git";
|
||||
_repositoryBranch = "gh-pages";
|
||||
} else if (Id() == g_game_tes5) {
|
||||
} else if (Id() == Game::tes5) {
|
||||
_name = "TES V: Skyrim";
|
||||
registryKey = "Software\\Bethesda Softworks\\Skyrim\\Installed Path";
|
||||
lootFolderName = "Skyrim";
|
||||
@@ -78,7 +78,7 @@ namespace loot {
|
||||
espm_settings = espm::Settings("tes5");
|
||||
_repositoryURL = "https://github.com/loot/skyrim.git";
|
||||
_repositoryBranch = "gh-pages";
|
||||
} else if (Id() == g_game_fo3) {
|
||||
} else if (Id() == Game::fo3) {
|
||||
_name = "Fallout 3";
|
||||
registryKey = "Software\\Bethesda Softworks\\Fallout3\\Installed Path";
|
||||
lootFolderName = "Fallout3";
|
||||
@@ -86,7 +86,7 @@ namespace loot {
|
||||
espm_settings = espm::Settings("fo3");
|
||||
_repositoryURL = "https://github.com/loot/fallout3.git";
|
||||
_repositoryBranch = "gh-pages";
|
||||
} else if (Id() == g_game_fonv) {
|
||||
} else if (Id() == Game::fonv) {
|
||||
_name = "Fallout: New Vegas";
|
||||
registryKey = "Software\\Bethesda Softworks\\FalloutNV\\Installed Path";
|
||||
lootFolderName = "FalloutNV";
|
||||
@@ -244,13 +244,13 @@ namespace loot {
|
||||
char ** pluginArr;
|
||||
size_t pluginArrSize;
|
||||
int ret;
|
||||
if (Id() == g_game_tes4)
|
||||
if (Id() == Game::tes4)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_TES4, gamePath.string().c_str());
|
||||
else if (Id() == g_game_tes5)
|
||||
else if (Id() == Game::tes5)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_TES5, gamePath.string().c_str());
|
||||
else if (Id() == g_game_fo3)
|
||||
else if (Id() == Game::fo3)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_FO3, gamePath.string().c_str());
|
||||
else if (Id() == g_game_fonv)
|
||||
else if (Id() == Game::fonv)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str());
|
||||
|
||||
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||
@@ -325,13 +325,13 @@ namespace loot {
|
||||
size_t pluginArrSize;
|
||||
|
||||
int ret;
|
||||
if (Id() == g_game_tes4)
|
||||
if (Id() == Game::tes4)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_TES4, gamePath.string().c_str());
|
||||
else if (Id() == g_game_tes5)
|
||||
else if (Id() == Game::tes5)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_TES5, gamePath.string().c_str());
|
||||
else if (Id() == g_game_fo3)
|
||||
else if (Id() == Game::fo3)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_FO3, gamePath.string().c_str());
|
||||
else if (Id() == g_game_fonv)
|
||||
else if (Id() == Game::fonv)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str());
|
||||
|
||||
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||
@@ -401,13 +401,13 @@ namespace loot {
|
||||
char ** pluginArr = NULL;
|
||||
size_t pluginArrSize = 0;
|
||||
int ret;
|
||||
if (Id() == g_game_tes4)
|
||||
if (Id() == Game::tes4)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_TES4, gamePath.string().c_str());
|
||||
else if (Id() == g_game_tes5)
|
||||
else if (Id() == Game::tes5)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_TES5, gamePath.string().c_str());
|
||||
else if (Id() == g_game_fo3)
|
||||
else if (Id() == Game::fo3)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_FO3, gamePath.string().c_str());
|
||||
else if (Id() == g_game_fonv)
|
||||
else if (Id() == Game::fonv)
|
||||
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str());
|
||||
|
||||
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||
|
||||
+7
-1
@@ -44,7 +44,7 @@ namespace loot {
|
||||
|
||||
class Game {
|
||||
public:
|
||||
Game(); //Sets game to LOOT_g_game_autodetect, with all other vars being empty.
|
||||
Game(); //Sets game to LOOT_Game::autodetect, with all other vars being empty.
|
||||
Game(const unsigned int baseGameCode, const std::string& lootFolder = "");
|
||||
|
||||
Game& SetDetails(const std::string& name, const std::string& masterFile,
|
||||
@@ -84,6 +84,12 @@ namespace loot {
|
||||
boost::unordered_map<std::string, uint32_t> crcCache; //Holds lowercased strings.
|
||||
|
||||
espm::Settings espm_settings;
|
||||
|
||||
static const unsigned int autodetect = 0;
|
||||
static const unsigned int tes4 = 1;
|
||||
static const unsigned int tes5 = 2;
|
||||
static const unsigned int fo3 = 3;
|
||||
static const unsigned int fonv = 4;
|
||||
private:
|
||||
unsigned id;
|
||||
std::string _name;
|
||||
|
||||
+24
-24
@@ -53,11 +53,11 @@ namespace loot {
|
||||
|
||||
inline void WriteMessage(pugi::xml_node& listItem, unsigned int type, std::string content) {
|
||||
|
||||
if (type == g_message_say)
|
||||
if (type == Message::say)
|
||||
content = boost::locale::translate("Note:").str() + " " + content;
|
||||
else if (type == g_message_tag) {
|
||||
else if (type == Message::tag) {
|
||||
content = boost::locale::translate("Bash Tag Suggestion(s):").str() + " " + content;
|
||||
} else if (type == g_message_warn)
|
||||
} else if (type == Message::warn)
|
||||
content = boost::locale::translate("Warning:").str() + " " + content;
|
||||
else
|
||||
content = boost::locale::translate("Error:").str() + " " + content;
|
||||
@@ -176,11 +176,11 @@ namespace loot {
|
||||
pugi::xml_node li = list.append_child();
|
||||
li.set_name("li");
|
||||
|
||||
if (it->Type() == g_message_say)
|
||||
if (it->Type() == Message::say)
|
||||
li.append_attribute("class").set_value("say");
|
||||
else if (it->Type() == g_message_tag)
|
||||
else if (it->Type() == Message::tag)
|
||||
li.append_attribute("class").set_value("tag");
|
||||
else if (it->Type() == g_message_warn) {
|
||||
else if (it->Type() == Message::warn) {
|
||||
li.append_attribute("class").set_value("warn");
|
||||
++warnNo;
|
||||
} else {
|
||||
@@ -260,7 +260,7 @@ namespace loot {
|
||||
note.append_attribute("id").set_value("noChanges");
|
||||
note.text().set(boost::locale::translate("No change in details since last run.").str().c_str());
|
||||
*/
|
||||
messages.push_front(loot::Message(loot::g_message_say, boost::locale::translate("There have been no changes in the Details tab since LOOT was last run for this game.").str()));
|
||||
messages.push_front(loot::Message(loot::Message::say, boost::locale::translate("There have been no changes in the Details tab since LOOT was last run for this game.").str()));
|
||||
}
|
||||
|
||||
if (!messages.empty()) {
|
||||
@@ -393,7 +393,7 @@ namespace loot {
|
||||
else if (jt->ITMs() > 0 && jt->UDRs() > 0 && jt->DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% UDR records. Clean with %3%.")) % jt->ITMs() % jt->UDRs() % jt->CleaningUtility();
|
||||
|
||||
messages.push_back(loot::Message(loot::g_message_warn, f.str()));
|
||||
messages.push_back(loot::Message(loot::Message::warn, f.str()));
|
||||
}
|
||||
|
||||
AppendMessages(plugin, messages, warnNo, errorNo);
|
||||
@@ -584,11 +584,11 @@ namespace loot {
|
||||
root["Update Masterlist"] = true;
|
||||
root["View Report Externally"] = false;
|
||||
|
||||
games.push_back(Game(g_game_tes4));
|
||||
games.push_back(Game(g_game_tes5));
|
||||
games.push_back(Game(g_game_fo3));
|
||||
games.push_back(Game(g_game_fonv));
|
||||
games.push_back(Game(g_game_tes4, "Nehrim").SetDetails("Nehrim - At Fate's Edge", "Nehrim.esm", "https://github.com/loot-developers/loot-oblivion.git", "gh-pages", "", "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Nehrim - At Fate's Edge_is1"));
|
||||
games.push_back(Game(Game::tes4));
|
||||
games.push_back(Game(Game::tes5));
|
||||
games.push_back(Game(Game::fo3));
|
||||
games.push_back(Game(Game::fonv));
|
||||
games.push_back(Game(Game::tes4, "Nehrim").SetDetails("Nehrim - At Fate's Edge", "Nehrim.esm", "https://github.com/loot-developers/loot-oblivion.git", "gh-pages", "", "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Nehrim - At Fate's Edge_is1"));
|
||||
|
||||
root["Games"] = games;
|
||||
|
||||
@@ -643,14 +643,14 @@ namespace YAML {
|
||||
<< Key << "path" << Value << rhs.GamePath().string()
|
||||
<< Key << "registry" << Value << rhs.RegistryKey();
|
||||
|
||||
if (rhs.Id() == loot::g_game_tes4)
|
||||
out << Key << Value << loot::Game(loot::g_game_tes4).FolderName();
|
||||
else if (rhs.Id() == loot::g_game_tes5)
|
||||
out << Key << Value << loot::Game(loot::g_game_tes5).FolderName();
|
||||
else if (rhs.Id() == loot::g_game_fo3)
|
||||
out << Key << Value << loot::Game(loot::g_game_fo3).FolderName();
|
||||
else if (rhs.Id() == loot::g_game_fonv)
|
||||
out << Key << Value << loot::Game(loot::g_game_fonv).FolderName();
|
||||
if (rhs.Id() == loot::Game::tes4)
|
||||
out << Key << Value << loot::Game(loot::Game::tes4).FolderName();
|
||||
else if (rhs.Id() == loot::Game::tes5)
|
||||
out << Key << Value << loot::Game(loot::Game::tes5).FolderName();
|
||||
else if (rhs.Id() == loot::Game::fo3)
|
||||
out << Key << Value << loot::Game(loot::Game::fo3).FolderName();
|
||||
else if (rhs.Id() == loot::Game::fonv)
|
||||
out << Key << Value << loot::Game(loot::Game::fonv).FolderName();
|
||||
|
||||
out << EndMap;
|
||||
|
||||
@@ -672,14 +672,14 @@ namespace YAML {
|
||||
inline Emitter& operator << (Emitter& out, const loot::Message& rhs) {
|
||||
out << BeginMap;
|
||||
|
||||
if (rhs.Type() == loot::g_message_say)
|
||||
if (rhs.Type() == loot::Message::say)
|
||||
out << Key << "type" << Value << "say";
|
||||
else if (rhs.Type() == loot::g_message_warn)
|
||||
else if (rhs.Type() == loot::Message::warn)
|
||||
out << Key << "type" << Value << "warn";
|
||||
else
|
||||
out << Key << "type" << Value << "error";
|
||||
|
||||
if (rhs.Content().size() == 1 && rhs.Content().front().Language() == loot::g_lang_any)
|
||||
if (rhs.Content().size() == 1 && rhs.Content().front().Language() == loot::Language::any)
|
||||
out << Key << "content" << Value << rhs.Content().front().Str();
|
||||
else
|
||||
out << Key << "content" << Value << rhs.Content();
|
||||
|
||||
@@ -27,29 +27,6 @@
|
||||
|
||||
namespace loot {
|
||||
|
||||
//Game values.
|
||||
const unsigned int g_game_autodetect = 0;
|
||||
const unsigned int g_game_tes4 = 1;
|
||||
const unsigned int g_game_tes5 = 2;
|
||||
const unsigned int g_game_fo3 = 3;
|
||||
const unsigned int g_game_fonv = 4;
|
||||
|
||||
//Message types.
|
||||
const unsigned int g_message_say = 0;
|
||||
const unsigned int g_message_warn = 1;
|
||||
const unsigned int g_message_error = 2;
|
||||
const unsigned int g_message_tag = 3;
|
||||
|
||||
//Languages.
|
||||
const unsigned int g_lang_any = 0;
|
||||
const unsigned int g_lang_english = 1;
|
||||
const unsigned int g_lang_spanish = 2;
|
||||
const unsigned int g_lang_russian = 3;
|
||||
const unsigned int g_lang_french = 4;
|
||||
const unsigned int g_lang_chinese = 5;
|
||||
const unsigned int g_lang_polish = 6;
|
||||
const unsigned int g_lang_brazilian_portuguese = 7;
|
||||
|
||||
//Version numbers.
|
||||
const unsigned int g_version_major = 3;
|
||||
const unsigned int g_version_minor = 0;
|
||||
|
||||
@@ -28,29 +28,6 @@
|
||||
|
||||
namespace loot {
|
||||
|
||||
//Game values.
|
||||
extern const unsigned int g_game_autodetect;
|
||||
extern const unsigned int g_game_tes4;
|
||||
extern const unsigned int g_game_tes5;
|
||||
extern const unsigned int g_game_fo3;
|
||||
extern const unsigned int g_game_fonv;
|
||||
|
||||
//Message types.
|
||||
extern const unsigned int g_message_say;
|
||||
extern const unsigned int g_message_warn;
|
||||
extern const unsigned int g_message_error;
|
||||
extern const unsigned int g_message_tag;
|
||||
|
||||
//Languages
|
||||
extern const unsigned int g_lang_any;
|
||||
extern const unsigned int g_lang_english;
|
||||
extern const unsigned int g_lang_spanish;
|
||||
extern const unsigned int g_lang_russian;
|
||||
extern const unsigned int g_lang_french;
|
||||
extern const unsigned int g_lang_chinese;
|
||||
extern const unsigned int g_lang_polish;
|
||||
extern const unsigned int g_lang_brazilian_portuguese;
|
||||
|
||||
//Version numbers.
|
||||
extern const unsigned int g_version_major;
|
||||
extern const unsigned int g_version_minor;
|
||||
|
||||
+23
-23
@@ -238,55 +238,55 @@ namespace loot {
|
||||
}
|
||||
|
||||
Language::Language(const std::string& nameOrISOCode) {
|
||||
if (nameOrISOCode == Language(g_lang_english).Name() || nameOrISOCode == Language(g_lang_english).Locale())
|
||||
Construct(g_lang_english);
|
||||
else if (nameOrISOCode == Language(g_lang_spanish).Name() || nameOrISOCode == Language(g_lang_spanish).Locale())
|
||||
Construct(g_lang_spanish);
|
||||
else if (nameOrISOCode == Language(g_lang_russian).Name() || nameOrISOCode == Language(g_lang_russian).Locale())
|
||||
Construct(g_lang_russian);
|
||||
else if (nameOrISOCode == Language(g_lang_french).Name() || nameOrISOCode == Language(g_lang_french).Locale())
|
||||
Construct(g_lang_french);
|
||||
else if (nameOrISOCode == Language(g_lang_chinese).Name() || nameOrISOCode == Language(g_lang_chinese).Locale())
|
||||
Construct(g_lang_chinese);
|
||||
else if (nameOrISOCode == Language(g_lang_polish).Name() || nameOrISOCode == Language(g_lang_polish).Locale())
|
||||
Construct(g_lang_polish);
|
||||
else if (nameOrISOCode == Language(g_lang_brazilian_portuguese).Name() || nameOrISOCode == Language(g_lang_brazilian_portuguese).Locale())
|
||||
Construct(g_lang_brazilian_portuguese);
|
||||
if (nameOrISOCode == Language(Language::english).Name() || nameOrISOCode == Language(Language::english).Locale())
|
||||
Construct(Language::english);
|
||||
else if (nameOrISOCode == Language(Language::spanish).Name() || nameOrISOCode == Language(Language::spanish).Locale())
|
||||
Construct(Language::spanish);
|
||||
else if (nameOrISOCode == Language(Language::russian).Name() || nameOrISOCode == Language(Language::russian).Locale())
|
||||
Construct(Language::russian);
|
||||
else if (nameOrISOCode == Language(Language::french).Name() || nameOrISOCode == Language(Language::french).Locale())
|
||||
Construct(Language::french);
|
||||
else if (nameOrISOCode == Language(Language::chinese).Name() || nameOrISOCode == Language(Language::chinese).Locale())
|
||||
Construct(Language::chinese);
|
||||
else if (nameOrISOCode == Language(Language::polish).Name() || nameOrISOCode == Language(Language::polish).Locale())
|
||||
Construct(Language::polish);
|
||||
else if (nameOrISOCode == Language(Language::brazilian_portuguese).Name() || nameOrISOCode == Language(Language::brazilian_portuguese).Locale())
|
||||
Construct(Language::brazilian_portuguese);
|
||||
else
|
||||
Construct(g_lang_any);
|
||||
Construct(Language::any);
|
||||
}
|
||||
|
||||
void Language::Construct(const unsigned int code) {
|
||||
_code = code;
|
||||
if (_code == g_lang_any) {
|
||||
if (_code == Language::any) {
|
||||
_name = boost::locale::translate("None Specified");
|
||||
_locale = "en";
|
||||
}
|
||||
else if (_code == g_lang_english) {
|
||||
else if (_code == Language::english) {
|
||||
_name = "English";
|
||||
_locale = "en";
|
||||
}
|
||||
else if (_code == g_lang_spanish) {
|
||||
else if (_code == Language::spanish) {
|
||||
_name = "Español";
|
||||
_locale = "es";
|
||||
}
|
||||
else if (_code == g_lang_russian) {
|
||||
else if (_code == Language::russian) {
|
||||
_name = "Русский";
|
||||
_locale = "ru";
|
||||
}
|
||||
else if (_code == g_lang_french) {
|
||||
else if (_code == Language::french) {
|
||||
_name = "Français";
|
||||
_locale = "fr";
|
||||
}
|
||||
else if (_code == g_lang_chinese) {
|
||||
else if (_code == Language::chinese) {
|
||||
_name = "简体中文";
|
||||
_locale = "zh_CN";
|
||||
}
|
||||
else if (_code == g_lang_polish) {
|
||||
else if (_code == Language::polish) {
|
||||
_name = "Polski";
|
||||
_locale = "pl";
|
||||
}
|
||||
else if (_code == g_lang_brazilian_portuguese) {
|
||||
else if (_code == Language::brazilian_portuguese) {
|
||||
_name = "Português do Brasil";
|
||||
_locale = "pt_BR";
|
||||
}
|
||||
|
||||
+17
-8
@@ -76,16 +76,25 @@ namespace loot {
|
||||
std::string Name() const;
|
||||
std::string Locale() const;
|
||||
|
||||
static const unsigned int any = 0;
|
||||
static const unsigned int english = 1;
|
||||
static const unsigned int spanish = 2;
|
||||
static const unsigned int russian = 3;
|
||||
static const unsigned int french = 4;
|
||||
static const unsigned int chinese = 5;
|
||||
static const unsigned int polish = 6;
|
||||
static const unsigned int brazilian_portuguese = 7;
|
||||
|
||||
static std::vector<std::string> Names() {
|
||||
std::vector<std::string> vec;
|
||||
vec.push_back(Language(g_lang_any).Name());
|
||||
vec.push_back(Language(g_lang_english).Name());
|
||||
vec.push_back(Language(g_lang_spanish).Name());
|
||||
vec.push_back(Language(g_lang_russian).Name());
|
||||
vec.push_back(Language(g_lang_french).Name());
|
||||
vec.push_back(Language(g_lang_chinese).Name());
|
||||
vec.push_back(Language(g_lang_polish).Name());
|
||||
vec.push_back(Language(g_lang_brazilian_portuguese).Name());
|
||||
vec.push_back(Language(Language::any).Name());
|
||||
vec.push_back(Language(Language::english).Name());
|
||||
vec.push_back(Language(Language::spanish).Name());
|
||||
vec.push_back(Language(Language::russian).Name());
|
||||
vec.push_back(Language(Language::french).Name());
|
||||
vec.push_back(Language(Language::chinese).Name());
|
||||
vec.push_back(Language(Language::polish).Name());
|
||||
vec.push_back(Language(Language::brazilian_portuguese).Name());
|
||||
return vec;
|
||||
}
|
||||
private:
|
||||
|
||||
+15
-15
@@ -153,7 +153,7 @@ namespace loot {
|
||||
return eval;
|
||||
}
|
||||
|
||||
MessageContent::MessageContent() : _language(g_lang_any) {}
|
||||
MessageContent::MessageContent() : _language(Language::any) {}
|
||||
|
||||
MessageContent::MessageContent(const std::string& str, const unsigned int language) : _str(str), _language(language) {}
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace loot {
|
||||
|
||||
Message::Message(const unsigned int type, const std::string& content,
|
||||
const std::string& condition) : _type(type), ConditionStruct(condition) {
|
||||
_content.push_back(MessageContent(content));
|
||||
_content.push_back(MessageContent(content, Language::any));
|
||||
}
|
||||
|
||||
Message::Message(const unsigned int type, const std::vector<MessageContent>& content,
|
||||
@@ -201,7 +201,7 @@ namespace loot {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Choosing message language.";
|
||||
|
||||
if (_content.size() > 1) {
|
||||
if (language == g_lang_any) //Can use a message of any language, so use the first string.
|
||||
if (language == Language::any) //Can use a message of any language, so use the first string.
|
||||
_content.resize(1);
|
||||
else {
|
||||
MessageContent english, match;
|
||||
@@ -209,7 +209,7 @@ namespace loot {
|
||||
if (it->Language() == language) {
|
||||
match = *it;
|
||||
break;
|
||||
} else if (it->Language() == g_lang_english)
|
||||
} else if (it->Language() == Language::english)
|
||||
english = *it;
|
||||
}
|
||||
_content.resize(1);
|
||||
@@ -224,7 +224,7 @@ namespace loot {
|
||||
|
||||
MessageContent Message::ChooseContent(const unsigned int language) const {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Choosing message content.";
|
||||
if (_content.size() == 1 || language == g_lang_any)
|
||||
if (_content.size() == 1 || language == Language::any)
|
||||
return _content[0];
|
||||
else {
|
||||
MessageContent english, match;
|
||||
@@ -232,7 +232,7 @@ namespace loot {
|
||||
if (it->Language() == language) {
|
||||
match = *it;
|
||||
break;
|
||||
} else if (it->Language() == g_lang_english)
|
||||
} else if (it->Language() == Language::english)
|
||||
english = *it;
|
||||
}
|
||||
if (!match.Str().empty())
|
||||
@@ -316,18 +316,18 @@ namespace loot {
|
||||
|
||||
espm::File * file = NULL;
|
||||
try {
|
||||
if (game.Id() == g_game_tes4)
|
||||
if (game.Id() == Game::tes4)
|
||||
file = new espm::tes4::File(filepath, game.espm_settings, false, headerOnly);
|
||||
else if (game.Id() == g_game_tes5)
|
||||
else if (game.Id() == Game::tes5)
|
||||
file = new espm::tes5::File(filepath, game.espm_settings, false, headerOnly);
|
||||
else if (game.Id() == g_game_fo3)
|
||||
else if (game.Id() == Game::fo3)
|
||||
file = new espm::fo3::File(filepath, game.espm_settings, false, headerOnly);
|
||||
else
|
||||
file = new espm::fonv::File(filepath, game.espm_settings, false, headerOnly);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Cannot read plugin file \"" << name << "\". Details: " << e.what();
|
||||
messages.push_back(loot::Message(loot::g_message_error, (boost::format(boost::locale::translate("Cannot read \"%1%\". Details: %2%")) % name % e.what()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("Cannot read \"%1%\". Details: %2%")) % name % e.what()).str()));
|
||||
}
|
||||
|
||||
//If the name passed ends in '.ghost', that should be trimmed.
|
||||
@@ -726,30 +726,30 @@ namespace loot {
|
||||
for (vector<string>::const_iterator it=masters.begin(), endIt=masters.end(); it != endIt; ++it) {
|
||||
if (!boost::filesystem::exists(game.DataPath() / *it) && !boost::filesystem::exists(game.DataPath() / (*it + ".ghost"))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << *it << "\", but it is missing.";
|
||||
messages.push_back(loot::Message(loot::g_message_error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % *it).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % *it).str()));
|
||||
}
|
||||
else if (!game.IsActive(*it) && game.IsActive(name)) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << *it << "\", but it is inactive.";
|
||||
messages.push_back(loot::Message(loot::g_message_error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be active, but it is inactive.")) % *it).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be active, but it is inactive.")) % *it).str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (set<File>::const_iterator it=requirements.begin(), endIt=requirements.end(); it != endIt; ++it) {
|
||||
if (!boost::filesystem::exists(game.DataPath() / it->Name()) && !(IsPlugin(it->Name()) && boost::filesystem::exists(game.DataPath() / (it->Name() + ".ghost")))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << it->Name() << "\", but it is missing.";
|
||||
messages.push_back(loot::Message(loot::g_message_error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % it->Name()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % it->Name()).str()));
|
||||
}
|
||||
}
|
||||
for (set<File>::const_iterator it=incompatibilities.begin(), endIt=incompatibilities.end(); it != endIt; ++it) {
|
||||
if (boost::filesystem::exists(game.DataPath() / it->Name()) || (IsPlugin(it->Name()) && boost::filesystem::exists(game.DataPath() / (it->Name() + ".ghost")))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" is incompatible with \"" << it->Name() << "\", but both are present.";
|
||||
messages.push_back(loot::Message(loot::g_message_error, (boost::format(boost::locale::translate("This plugin is incompatible with \"%1%\", but both are present.")) % it->Name()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (boost::format(boost::locale::translate("This plugin is incompatible with \"%1%\", but both are present.")) % it->Name()).str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Plugin::LoadsBSA(const Game& game) const {
|
||||
if (game.Id() != g_game_tes5 || IsRegexPlugin())
|
||||
if (game.Id() != Game::tes5 || IsRegexPlugin())
|
||||
return false;
|
||||
return boost::filesystem::exists(game.DataPath() / (name.substr(0, name.length() - 3) + "bsa"));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "game.h"
|
||||
#include "globals.h"
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -89,7 +90,7 @@ namespace loot {
|
||||
class MessageContent {
|
||||
public:
|
||||
MessageContent();
|
||||
MessageContent(const std::string& str, const unsigned int language = g_lang_any);
|
||||
MessageContent(const std::string& str, const unsigned int language);
|
||||
|
||||
std::string Str() const;
|
||||
unsigned int Language() const;
|
||||
@@ -117,6 +118,11 @@ namespace loot {
|
||||
unsigned int Type() const;
|
||||
std::vector<MessageContent> Content() const;
|
||||
MessageContent ChooseContent(const unsigned int language) const;
|
||||
|
||||
static const unsigned int say = 0;
|
||||
static const unsigned int warn = 1;
|
||||
static const unsigned int error = 2;
|
||||
static const unsigned int tag = 3;
|
||||
private:
|
||||
unsigned int _type;
|
||||
std::vector<MessageContent> _content;
|
||||
|
||||
@@ -281,11 +281,11 @@ namespace loot {
|
||||
plugins = mlist["plugins"].as< list<loot::Plugin> >();
|
||||
|
||||
for (list<loot::Plugin>::iterator it=plugins.begin(), endIt=plugins.end(); it != endIt; ++it) {
|
||||
it->EvalAllConditions(game, g_lang_any);
|
||||
it->EvalAllConditions(game, Language::any);
|
||||
}
|
||||
|
||||
for (list<loot::Message>::iterator it=messages.begin(), endIt=messages.end(); it != endIt; ++it) {
|
||||
it->EvalCondition(game, g_lang_any);
|
||||
it->EvalCondition(game, Language::any);
|
||||
}
|
||||
|
||||
parsingFailed = false;
|
||||
@@ -297,7 +297,7 @@ namespace loot {
|
||||
//Roll back one revision if there's an error.
|
||||
BOOST_LOG_TRIVIAL(error) << "Masterlist parsing failed. Masterlist revision " + string(revision) + ": " + e.what();
|
||||
|
||||
parsingErrors.push_back(loot::Message(loot::g_message_error, boost::locale::translate("Masterlist revision").str() + " " + string(revision) + ": " + e.what() + " " + boost::locale::translate("Rolled back to the previous revision.").str()));
|
||||
parsingErrors.push_back(loot::Message(loot::Message::error, boost::locale::translate("Masterlist revision").str() + " " + string(revision) + ": " + e.what() + " " + boost::locale::translate("Rolled back to the previous revision.").str()));
|
||||
}
|
||||
} while (parsingFailed);
|
||||
|
||||
|
||||
+15
-15
@@ -80,14 +80,14 @@ namespace YAML {
|
||||
if (!node.IsMap() || !node["folder"] || !node["type"])
|
||||
return false;
|
||||
|
||||
if (node["type"].as<std::string>() == loot::Game(loot::g_game_tes4).FolderName())
|
||||
rhs = loot::Game(loot::g_game_tes4, node["folder"].as<std::string>());
|
||||
else if (node["type"].as<std::string>() == loot::Game(loot::g_game_tes5).FolderName())
|
||||
rhs = loot::Game(loot::g_game_tes5, node["folder"].as<std::string>());
|
||||
else if (node["type"].as<std::string>() == loot::Game(loot::g_game_fo3).FolderName())
|
||||
rhs = loot::Game(loot::g_game_fo3, node["folder"].as<std::string>());
|
||||
else if (node["type"].as<std::string>() == loot::Game(loot::g_game_fonv).FolderName())
|
||||
rhs = loot::Game(loot::g_game_fonv, node["folder"].as<std::string>());
|
||||
if (node["type"].as<std::string>() == loot::Game(loot::Game::tes4).FolderName())
|
||||
rhs = loot::Game(loot::Game::tes4, node["folder"].as<std::string>());
|
||||
else if (node["type"].as<std::string>() == loot::Game(loot::Game::tes5).FolderName())
|
||||
rhs = loot::Game(loot::Game::tes5, node["folder"].as<std::string>());
|
||||
else if (node["type"].as<std::string>() == loot::Game(loot::Game::fo3).FolderName())
|
||||
rhs = loot::Game(loot::Game::fo3, node["folder"].as<std::string>());
|
||||
else if (node["type"].as<std::string>() == loot::Game(loot::Game::fonv).FolderName())
|
||||
rhs = loot::Game(loot::Game::fonv, node["folder"].as<std::string>());
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -180,9 +180,9 @@ namespace YAML {
|
||||
node["condition"] = rhs.Condition();
|
||||
node["content"] = rhs.Content();
|
||||
|
||||
if (rhs.Type() == loot::g_message_say)
|
||||
if (rhs.Type() == loot::Message::say)
|
||||
node["type"] = "say";
|
||||
else if (rhs.Type() == loot::g_message_warn)
|
||||
else if (rhs.Type() == loot::Message::warn)
|
||||
node["type"] = "warn";
|
||||
else
|
||||
node["type"] = "error";
|
||||
@@ -200,25 +200,25 @@ namespace YAML {
|
||||
type = node["type"].as<std::string>();
|
||||
|
||||
if (boost::iequals(type, "say"))
|
||||
typeNo = loot::g_message_say;
|
||||
typeNo = loot::Message::say;
|
||||
else if (boost::iequals(type, "warn"))
|
||||
typeNo = loot::g_message_warn;
|
||||
typeNo = loot::Message::warn;
|
||||
else
|
||||
typeNo = loot::g_message_error;
|
||||
typeNo = loot::Message::error;
|
||||
}
|
||||
|
||||
std::vector<loot::MessageContent> content;
|
||||
if (node["content"].IsSequence())
|
||||
content = node["content"].as< std::vector<loot::MessageContent> >();
|
||||
else {
|
||||
content.push_back(loot::MessageContent(node["content"].as<std::string>()));
|
||||
content.push_back(loot::MessageContent(node["content"].as<std::string>(), loot::Language::any));
|
||||
}
|
||||
|
||||
//Check now that at least one item in content is English if there are multiple items.
|
||||
if (content.size() > 1) {
|
||||
bool found = false;
|
||||
for (std::vector<loot::MessageContent>::const_iterator it=content.begin(), endit=content.end(); it != endit; ++it) {
|
||||
if (it->Language() == loot::g_lang_english)
|
||||
if (it->Language() == loot::Language::english)
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
|
||||
+2
-2
@@ -1152,11 +1152,11 @@ void Editor::OnRowSelect(wxListEvent& event) {
|
||||
list<loot::Message> messages = plugin.Messages();
|
||||
|
||||
if (find(messages.begin(), messages.end(), message) == messages.end()) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Message \"" << message.ChooseContent(loot::g_lang_any).Str() << "\" was not found in base plugin metadata. Editing enabled.";
|
||||
BOOST_LOG_TRIVIAL(trace) << "Message \"" << message.ChooseContent(loot::Language::any).Str() << "\" was not found in base plugin metadata. Editing enabled.";
|
||||
editBtn->Enable(true);
|
||||
removeBtn->Enable(true);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Message \"" << message.ChooseContent(loot::g_lang_any).Str() << "\" was found in base plugin metadata. Editing disabled.";
|
||||
BOOST_LOG_TRIVIAL(trace) << "Message \"" << message.ChooseContent(loot::Language::any).Str() << "\" was found in base plugin metadata. Editing disabled.";
|
||||
editBtn->Enable(false);
|
||||
removeBtn->Enable(false);
|
||||
}
|
||||
|
||||
+21
-21
@@ -117,7 +117,7 @@ struct masterlist_updater_parser {
|
||||
_plugins.clear();
|
||||
_messages.clear();
|
||||
BOOST_LOG_TRIVIAL(error) << "Masterlist update failed. Details: " << e.what();
|
||||
_errors.push_back(loot::Message(loot::g_message_error, (format(loc::translate("Masterlist update failed. Details: %1%")) % e.what()).str()));
|
||||
_errors.push_back(loot::Message(loot::Message::error, (format(loc::translate("Masterlist update failed. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -129,7 +129,7 @@ struct masterlist_updater_parser {
|
||||
_plugins.clear();
|
||||
_messages.clear();
|
||||
BOOST_LOG_TRIVIAL(error) << "Masterlist revision check failed. Details: " << e.what();
|
||||
_errors.push_back(loot::Message(loot::g_message_error, (format(loc::translate("Masterlist revision check failed. Details: %1%")) % e.what()).str()));
|
||||
_errors.push_back(loot::Message(loot::Message::error, (format(loc::translate("Masterlist revision check failed. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ struct masterlist_updater_parser {
|
||||
_plugins = mlist["plugins"].as< list<loot::Plugin> >();
|
||||
} catch (YAML::Exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Masterlist parsing failed. Details: " << e.what();
|
||||
_errors.push_back(loot::Message(loot::g_message_error, (format(loc::translate("Masterlist parsing failed. Details: %1%")) % e.what()).str()));
|
||||
_errors.push_back(loot::Message(loot::Message::error, (format(loc::translate("Masterlist parsing failed. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(debug) << "Finished parsing masterlist.";
|
||||
|
||||
@@ -247,25 +247,25 @@ bool LOOT::OnInit() {
|
||||
//Set the locale to get encoding and language conversions working correctly.
|
||||
BOOST_LOG_TRIVIAL(debug) << "Initialising language settings.";
|
||||
//Defaults in case language string is empty or setting is missing.
|
||||
string localeId = loot::Language(loot::g_lang_any).Locale() + ".UTF-8";
|
||||
string localeId = loot::Language(loot::Language::any).Locale() + ".UTF-8";
|
||||
wxLanguage wxLang = wxLANGUAGE_ENGLISH;
|
||||
if (_settings["Language"]) {
|
||||
loot::Language lang(_settings["Language"].as<string>());
|
||||
BOOST_LOG_TRIVIAL(debug) << "Selected language: " << lang.Name();
|
||||
localeId = lang.Locale() + ".UTF-8";
|
||||
if (lang.Code() == loot::g_lang_english)
|
||||
if (lang.Code() == loot::Language::english)
|
||||
wxLang = wxLANGUAGE_ENGLISH;
|
||||
else if (lang.Code() == loot::g_lang_spanish)
|
||||
else if (lang.Code() == loot::Language::spanish)
|
||||
wxLang = wxLANGUAGE_SPANISH;
|
||||
else if (lang.Code() == loot::g_lang_russian)
|
||||
else if (lang.Code() == loot::Language::russian)
|
||||
wxLang = wxLANGUAGE_RUSSIAN;
|
||||
else if (lang.Code() == loot::g_lang_french)
|
||||
else if (lang.Code() == loot::Language::french)
|
||||
wxLang = wxLANGUAGE_FRENCH;
|
||||
else if (lang.Code() == loot::g_lang_chinese)
|
||||
else if (lang.Code() == loot::Language::chinese)
|
||||
wxLang = wxLANGUAGE_CHINESE;
|
||||
else if (lang.Code() == loot::g_lang_polish)
|
||||
else if (lang.Code() == loot::Language::polish)
|
||||
wxLang = wxLANGUAGE_POLISH;
|
||||
else if (lang.Code() == loot::g_lang_brazilian_portuguese)
|
||||
else if (lang.Code() == loot::Language::brazilian_portuguese)
|
||||
wxLang = wxLANGUAGE_PORTUGUESE_BRAZILIAN;
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ Launcher::Launcher(const wxChar *title, YAML::Node& settings, Game& game, vector
|
||||
if (!fs::exists(_game.ReportPath()))
|
||||
ViewButton->Enable(false);
|
||||
|
||||
if (_game.Id() == loot::g_game_tes5)
|
||||
if (_game.Id() == loot::Game::tes5)
|
||||
RedatePluginsItem->Enable(true);
|
||||
else
|
||||
RedatePluginsItem->Enable(false);
|
||||
@@ -546,7 +546,7 @@ void Launcher::OnGameChange(wxCommandEvent& event) {
|
||||
NULL);
|
||||
}
|
||||
SetTitle(FromUTF8("LOOT - " + _game.Name()));
|
||||
if (_game.Id() == loot::g_game_tes5)
|
||||
if (_game.Id() == loot::Game::tes5)
|
||||
RedatePluginsItem->Enable(true);
|
||||
else
|
||||
RedatePluginsItem->Enable(false);
|
||||
@@ -677,7 +677,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
ulist_plugins = ulist["plugins"].as< list<loot::Plugin> >();
|
||||
} catch (YAML::ParserException& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Userlist parsing failed. Details: " << e.what();
|
||||
messages.push_back(loot::Message(loot::g_message_error, (format(loc::translate("Userlist parsing failed. Details: %1%")) % e.what()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("Userlist parsing failed. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
if (ulist["plugins"])
|
||||
ulist_plugins = ulist["plugins"].as< list<loot::Plugin> >();
|
||||
@@ -696,7 +696,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
if (_settings["Language"])
|
||||
lang = Language(_settings["Language"].as<string>()).Code();
|
||||
else
|
||||
lang = loot::g_lang_any;
|
||||
lang = loot::Language::any;
|
||||
|
||||
|
||||
//Merge all global message lists.
|
||||
@@ -718,7 +718,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
}
|
||||
} catch (loot::error& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "A global message contains a condition that could not be evaluated. Details: " << e.what();
|
||||
messages.push_back(loot::Message(loot::g_message_error, (format(loc::translate("A global message contains a condition that could not be evaluated. Details: %1%")) % e.what()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("A global message contains a condition that could not be evaluated. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
|
||||
//Merge plugin list, masterlist and userlist plugin data.
|
||||
@@ -751,7 +751,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
graph[*vit].EvalAllConditions(_game, lang);
|
||||
} catch (loot::error& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << graph[*vit].Name() << "\" contains a condition that could not be evaluated. Details: " << e.what();
|
||||
messages.push_back(loot::Message(loot::g_message_error, (format(loc::translate("\"%1%\" contains a condition that could not be evaluated. Details: %2%")) % graph[*vit].Name() % e.what()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("\"%1%\" contains a condition that could not be evaluated. Details: %2%")) % graph[*vit].Name() % e.what()).str()));
|
||||
}
|
||||
|
||||
progDia->Pulse();
|
||||
@@ -881,7 +881,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
}
|
||||
catch (loot::error& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to set the load order. Details: " << e.what();
|
||||
messages.push_back(loot::Message(loot::g_message_error, (format(loc::translate("Failed to set the load order. Details: %1%")) % e.what()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("Failed to set the load order. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(trace) << "Load order set:";
|
||||
for (list<loot::Plugin>::iterator it = plugins.begin(), endIt = plugins.end(); it != endIt; ++it) {
|
||||
@@ -891,12 +891,12 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
else {
|
||||
//User decided to cancel sorting. Just go straight to displaying the report.
|
||||
BOOST_LOG_TRIVIAL(info) << "The load order calculated was not applied as sorting was canceled.";
|
||||
messages.push_back(loot::Message(loot::g_message_warn, loc::translate("The load order displayed in the Details tab was not applied as sorting was canceled.")));
|
||||
messages.push_back(loot::Message(loot::Message::warn, loc::translate("The load order displayed in the Details tab was not applied as sorting was canceled.")));
|
||||
}
|
||||
|
||||
} catch (std::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to calculate the load order. Details: " << e.what();
|
||||
messages.push_back(loot::Message(loot::g_message_error, (format(loc::translate("Failed to calculate the load order. Details: %1%")) % e.what()).str()));
|
||||
messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("Failed to calculate the load order. Details: %1%")) % e.what()).str()));
|
||||
|
||||
progDia->Destroy();
|
||||
progDia = NULL;
|
||||
@@ -1058,7 +1058,7 @@ void Launcher::OnEditMetadata(wxCommandEvent& event) {
|
||||
if (_settings["Language"])
|
||||
lang = Language(_settings["Language"].as<string>()).Code();
|
||||
else
|
||||
lang = loot::g_lang_any;
|
||||
lang = loot::Language::any;
|
||||
|
||||
//Create editor window.
|
||||
BOOST_LOG_TRIVIAL(debug) << "Opening editor window.";
|
||||
|
||||
+7
-7
@@ -78,9 +78,9 @@ wxString MessageList::OnGetItemText(long item, long column) const {
|
||||
return wxString();
|
||||
|
||||
if (column == 0) {
|
||||
if (_messages[item].Type() == loot::g_message_say)
|
||||
if (_messages[item].Type() == loot::Message::say)
|
||||
return Type[0];
|
||||
else if (_messages[item].Type() == loot::g_message_warn)
|
||||
else if (_messages[item].Type() == loot::Message::warn)
|
||||
return Type[1];
|
||||
else
|
||||
return Type[2];
|
||||
@@ -251,9 +251,9 @@ MessageEditDialog::MessageEditDialog(wxWindow *parent, const wxString& title) :
|
||||
|
||||
void MessageEditDialog::SetMessage(const loot::Message& message) {
|
||||
|
||||
if (message.Type() == loot::g_message_say)
|
||||
if (message.Type() == loot::Message::say)
|
||||
_type->SetSelection(0);
|
||||
else if (message.Type() == loot::g_message_warn)
|
||||
else if (message.Type() == loot::Message::warn)
|
||||
_type->SetSelection(1);
|
||||
else
|
||||
_type->SetSelection(2);
|
||||
@@ -272,11 +272,11 @@ loot::Message MessageEditDialog::GetMessage() const {
|
||||
unsigned int type;
|
||||
string condition;
|
||||
if (_type->GetSelection() == 0)
|
||||
type = loot::g_message_say;
|
||||
type = loot::Message::say;
|
||||
else if (_type->GetSelection() == 1)
|
||||
type = loot::g_message_warn;
|
||||
type = loot::Message::warn;
|
||||
else
|
||||
type = loot::g_message_error;
|
||||
type = loot::Message::error;
|
||||
|
||||
condition = string(_condition->GetValue().ToUTF8());
|
||||
|
||||
|
||||
+25
-25
@@ -245,14 +245,14 @@ void SettingsFrame::OnQuit(wxCommandEvent& event) {
|
||||
path = gamesList->GetItemText(i, 6).ToUTF8();
|
||||
registry = gamesList->GetItemText(i, 7).ToUTF8();
|
||||
|
||||
if (gamesList->GetItemText(i, 1).ToUTF8() == loot::Game(loot::g_game_tes4).FolderName())
|
||||
id = loot::g_game_tes4;
|
||||
else if (gamesList->GetItemText(i, 1).ToUTF8() == loot::Game(loot::g_game_tes5).FolderName())
|
||||
id = loot::g_game_tes5;
|
||||
else if (gamesList->GetItemText(i, 1).ToUTF8() == loot::Game(loot::g_game_fo3).FolderName())
|
||||
id = loot::g_game_fo3;
|
||||
if (gamesList->GetItemText(i, 1).ToUTF8() == loot::Game(loot::Game::tes4).FolderName())
|
||||
id = loot::Game::tes4;
|
||||
else if (gamesList->GetItemText(i, 1).ToUTF8() == loot::Game(loot::Game::tes5).FolderName())
|
||||
id = loot::Game::tes5;
|
||||
else if (gamesList->GetItemText(i, 1).ToUTF8() == loot::Game(loot::Game::fo3).FolderName())
|
||||
id = loot::Game::fo3;
|
||||
else
|
||||
id = loot::g_game_fonv;
|
||||
id = loot::Game::fonv;
|
||||
|
||||
_games.push_back(loot::Game(id, folder).SetDetails(name, master, repo, branch, path, registry));
|
||||
}
|
||||
@@ -263,10 +263,10 @@ void SettingsFrame::OnQuit(wxCommandEvent& event) {
|
||||
|
||||
void SettingsFrame::OnGameSelect(wxListEvent& event) {
|
||||
wxString name = gamesList->GetItemText(event.GetIndex());
|
||||
if (name == loot::Game(loot::g_game_tes4).Name()
|
||||
|| name == loot::Game(loot::g_game_tes5).Name()
|
||||
|| name == loot::Game(loot::g_game_fo3).Name()
|
||||
|| name == loot::Game(loot::g_game_fonv).Name()) {
|
||||
if (name == loot::Game(loot::Game::tes4).Name()
|
||||
|| name == loot::Game(loot::Game::tes5).Name()
|
||||
|| name == loot::Game(loot::Game::fo3).Name()
|
||||
|| name == loot::Game(loot::Game::fonv).Name()) {
|
||||
removeBtn->Enable(false);
|
||||
} else {
|
||||
removeBtn->Enable(true);
|
||||
@@ -332,14 +332,14 @@ void SettingsFrame::OnEditGame(wxCommandEvent& event) {
|
||||
long i = gamesList->GetFirstSelected();
|
||||
|
||||
int stateNo;
|
||||
if (gamesList->GetItemText(i, 1) == loot::Game(loot::g_game_tes4).FolderName())
|
||||
stateNo = loot::g_game_tes4;
|
||||
else if (gamesList->GetItemText(i, 1) == loot::Game(loot::g_game_tes5).FolderName())
|
||||
stateNo = loot::g_game_tes5;
|
||||
else if (gamesList->GetItemText(i, 1) == loot::Game(loot::g_game_fo3).FolderName())
|
||||
stateNo = loot::g_game_fo3;
|
||||
if (gamesList->GetItemText(i, 1) == loot::Game(loot::Game::tes4).FolderName())
|
||||
stateNo = loot::Game::tes4;
|
||||
else if (gamesList->GetItemText(i, 1) == loot::Game(loot::Game::tes5).FolderName())
|
||||
stateNo = loot::Game::tes5;
|
||||
else if (gamesList->GetItemText(i, 1) == loot::Game(loot::Game::fo3).FolderName())
|
||||
stateNo = loot::Game::fo3;
|
||||
else
|
||||
stateNo = loot::g_game_fonv;
|
||||
stateNo = loot::Game::fonv;
|
||||
|
||||
rowDialog->SetValues(stateNo, gamesList->GetItemText(i, 0), gamesList->GetItemText(i, 2), gamesList->GetItemText(i, 3), gamesList->GetItemText(i, 4), gamesList->GetItemText(i, 5), gamesList->GetItemText(i, 6), gamesList->GetItemText(i, 7));
|
||||
|
||||
@@ -394,10 +394,10 @@ void SettingsFrame::OnRemoveGame(wxCommandEvent& event) {
|
||||
GameEditDialog::GameEditDialog(wxWindow *parent, const wxString& title) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) {
|
||||
|
||||
wxString Types[] = {
|
||||
FromUTF8(loot::Game(loot::g_game_tes4).FolderName()),
|
||||
FromUTF8(loot::Game(loot::g_game_tes5).FolderName()),
|
||||
FromUTF8(loot::Game(loot::g_game_fo3).FolderName()),
|
||||
FromUTF8(loot::Game(loot::g_game_fonv).FolderName())
|
||||
FromUTF8(loot::Game(loot::Game::tes4).FolderName()),
|
||||
FromUTF8(loot::Game(loot::Game::tes5).FolderName()),
|
||||
FromUTF8(loot::Game(loot::Game::fo3).FolderName()),
|
||||
FromUTF8(loot::Game(loot::Game::fonv).FolderName())
|
||||
};
|
||||
|
||||
//Initialise controls.
|
||||
@@ -467,11 +467,11 @@ GameEditDialog::GameEditDialog(wxWindow *parent, const wxString& title) : wxDial
|
||||
|
||||
void GameEditDialog::SetValues(unsigned int type, const wxString& name, const wxString& folderName, const wxString& master,
|
||||
const wxString& repo, const wxString& branch, const wxString& path, const wxString& registry) {
|
||||
if (type == loot::g_game_tes4)
|
||||
if (type == loot::Game::tes4)
|
||||
_type->SetSelection(0);
|
||||
else if (type == loot::g_game_tes5)
|
||||
else if (type == loot::Game::tes5)
|
||||
_type->SetSelection(1);
|
||||
else if (type == loot::g_game_fo3)
|
||||
else if (type == loot::Game::fo3)
|
||||
_type->SetSelection(2);
|
||||
else
|
||||
_type->SetSelection(3);
|
||||
|
||||
Reference in New Issue
Block a user