Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
194:8548dc425697 | 195:975a3f0965e2 |
---|---|
179 return info_.title.native; | 179 return info_.title.native; |
180 } | 180 } |
181 | 181 |
182 std::vector<std::string> Anime::GetTitleSynonyms() const { | 182 std::vector<std::string> Anime::GetTitleSynonyms() const { |
183 std::vector<std::string> result; | 183 std::vector<std::string> result; |
184 #define IN_VECTOR(v, k) (std::count(v.begin(), v.end(), k)) | 184 |
185 #define ADD_TO_SYNONYMS(v, k) \ | 185 auto add_to_synonyms = [this](std::vector<std::string>& vec, std::string key) { |
186 if (!k.empty() && !IN_VECTOR(v, k) && k != GetUserPreferredTitle()) \ | 186 if (!key.empty() && !std::count(vec.begin(), vec.end(), key) && key != GetUserPreferredTitle()) |
187 v.push_back(k) | 187 vec.push_back(key); |
188 ADD_TO_SYNONYMS(result, info_.title.english); | 188 }; |
189 ADD_TO_SYNONYMS(result, info_.title.romaji); | 189 |
190 ADD_TO_SYNONYMS(result, info_.title.native); | 190 add_to_synonyms(result, info_.title.english); |
191 for (auto& synonym : info_.synonyms) { | 191 add_to_synonyms(result, info_.title.romaji); |
192 ADD_TO_SYNONYMS(result, synonym); | 192 add_to_synonyms(result, info_.title.native); |
193 } | 193 |
194 #undef ADD_TO_SYNONYMS | 194 for (auto& synonym : info_.synonyms) |
195 #undef IN_VECTOR | 195 add_to_synonyms(result, synonym); |
196 | |
196 return result; | 197 return result; |
197 } | 198 } |
198 | 199 |
199 int Anime::GetEpisodes() const { | 200 int Anime::GetEpisodes() const { |
200 return info_.episodes; | 201 return info_.episodes; |