Mercurial > minori
comparison src/gui/translate/anime.cc @ 286:53e3c015a973
anime: initial cross-service support
currently the Kitsu and MAL services don't work when chosen in the
GUI. This is because they haven't been implemented yet :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 08 May 2024 16:44:27 -0400 |
parents | 657fda1b9cac |
children | c32467cd06bb |
comparison
equal
deleted
inserted
replaced
285:65df2813d0de | 286:53e3c015a973 |
---|---|
58 } | 58 } |
59 | 59 |
60 std::string ToString(const Anime::Service service) { | 60 std::string ToString(const Anime::Service service) { |
61 switch (service) { | 61 switch (service) { |
62 case Anime::Service::AniList: return "AniList"; | 62 case Anime::Service::AniList: return "AniList"; |
63 case Anime::Service::MyAnimeList: return "MyAnimeList"; | |
64 case Anime::Service::Kitsu: return "Kitsu"; | |
63 default: | 65 default: |
64 case Anime::Service::None: return "None"; | 66 case Anime::Service::None: return "None"; |
65 } | 67 } |
66 } | 68 } |
67 | 69 |
142 return map.at(str); | 144 return map.at(str); |
143 } | 145 } |
144 | 146 |
145 Anime::Service ToService(const std::string& str) { | 147 Anime::Service ToService(const std::string& str) { |
146 static const std::unordered_map<std::string, Anime::Service> map = { | 148 static const std::unordered_map<std::string, Anime::Service> map = { |
147 {"AniList", Anime::Service::AniList} | 149 {"AniList", Anime::Service::AniList}, |
150 {"MyAnimeList", Anime::Service::MyAnimeList}, | |
151 {"Kitsu", Anime::Service::Kitsu} | |
148 }; | 152 }; |
149 | 153 |
150 if (map.find(str) == map.end()) | 154 if (map.find(str) == map.end()) |
151 return Anime::Service::None; | 155 return Anime::Service::None; |
152 return map.at(str); | 156 return map.at(str); |
236 } | 240 } |
237 | 241 |
238 std::string ToLocalString(const Anime::Service service) { | 242 std::string ToLocalString(const Anime::Service service) { |
239 switch (service) { | 243 switch (service) { |
240 case Anime::Service::AniList: return Strings::ToUtf8String(QCoreApplication::tr("AniList")); | 244 case Anime::Service::AniList: return Strings::ToUtf8String(QCoreApplication::tr("AniList")); |
245 case Anime::Service::MyAnimeList: return Strings::ToUtf8String(QCoreApplication::tr("MyAnimeList")); | |
246 case Anime::Service::Kitsu: return Strings::ToUtf8String(QCoreApplication::tr("Kitsu")); | |
241 default: | 247 default: |
242 case Anime::Service::None: return Strings::ToUtf8String(QCoreApplication::tr("None")); | 248 case Anime::Service::None: return Strings::ToUtf8String(QCoreApplication::tr("None")); |
243 } | 249 } |
244 } | 250 } |
245 | 251 |