Mercurial > minori
diff src/core/anime.cc @ 195:975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
also the general application stuff and anime list is separated in settings
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 07 Dec 2023 11:14:01 -0500 |
parents | 6ef31dbb90ca |
children | 7cf53145de11 |
line wrap: on
line diff
--- a/src/core/anime.cc Thu Dec 07 03:17:05 2023 -0500 +++ b/src/core/anime.cc Thu Dec 07 11:14:01 2023 -0500 @@ -181,18 +181,19 @@ std::vector<std::string> Anime::GetTitleSynonyms() const { std::vector<std::string> result; -#define IN_VECTOR(v, k) (std::count(v.begin(), v.end(), k)) -#define ADD_TO_SYNONYMS(v, k) \ - if (!k.empty() && !IN_VECTOR(v, k) && k != GetUserPreferredTitle()) \ - v.push_back(k) - ADD_TO_SYNONYMS(result, info_.title.english); - ADD_TO_SYNONYMS(result, info_.title.romaji); - ADD_TO_SYNONYMS(result, info_.title.native); - for (auto& synonym : info_.synonyms) { - ADD_TO_SYNONYMS(result, synonym); - } -#undef ADD_TO_SYNONYMS -#undef IN_VECTOR + + auto add_to_synonyms = [this](std::vector<std::string>& vec, std::string key) { + if (!key.empty() && !std::count(vec.begin(), vec.end(), key) && key != GetUserPreferredTitle()) + vec.push_back(key); + }; + + add_to_synonyms(result, info_.title.english); + add_to_synonyms(result, info_.title.romaji); + add_to_synonyms(result, info_.title.native); + + for (auto& synonym : info_.synonyms) + add_to_synonyms(result, synonym); + return result; }