Mercurial > minori
comparison src/gui/translate/anime.cc @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | 71832ffe425a |
children | 657fda1b9cac |
comparison
equal
deleted
inserted
replaced
257:699a20c57dc8 | 258:862d0d8619f6 |
---|---|
59 | 59 |
60 std::string ToString(const Anime::Services service) { | 60 std::string ToString(const Anime::Services service) { |
61 switch (service) { | 61 switch (service) { |
62 case Anime::Services::ANILIST: return "AniList"; | 62 case Anime::Services::ANILIST: return "AniList"; |
63 default: | 63 default: |
64 case Anime::Services::NONE: return "None"; | 64 case Anime::Services::NONE: return "None"; |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 std::string ToString(const Anime::TitleLanguage language) { | 68 std::string ToString(const Anime::TitleLanguage language) { |
69 switch (language) { | 69 switch (language) { |
70 case Anime::TitleLanguage::NATIVE: return "Native"; | 70 case Anime::TitleLanguage::NATIVE: return "Native"; |
71 case Anime::TitleLanguage::ENGLISH: return "English"; | 71 case Anime::TitleLanguage::ENGLISH: return "English"; |
72 default: | 72 default: |
73 case Anime::TitleLanguage::ROMAJI: return "Romaji"; | 73 case Anime::TitleLanguage::ROMAJI: return "Romaji"; |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 std::string ToString(const Anime::ScoreFormat format) { | 77 std::string ToString(const Anime::ScoreFormat format) { |
78 switch (format) { | 78 switch (format) { |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 Anime::ListStatus ToListStatus(const std::string& str) { | 88 Anime::ListStatus ToListStatus(const std::string& str) { |
89 static const std::unordered_map<std::string, Anime::ListStatus> map = { | 89 static const std::unordered_map<std::string, Anime::ListStatus> map = { |
90 {"Currently watching", Anime::ListStatus::CURRENT}, | 90 {"Currently watching", Anime::ListStatus::CURRENT }, |
91 {"Plan to watch", Anime::ListStatus::PLANNING}, | 91 {"Plan to watch", Anime::ListStatus::PLANNING }, |
92 {"Completed", Anime::ListStatus::COMPLETED}, | 92 {"Completed", Anime::ListStatus::COMPLETED}, |
93 {"Dropped", Anime::ListStatus::DROPPED}, | 93 {"Dropped", Anime::ListStatus::DROPPED }, |
94 {"On hold", Anime::ListStatus::PAUSED} | 94 {"On hold", Anime::ListStatus::PAUSED } |
95 }; | 95 }; |
96 | 96 |
97 if (map.find(str) == map.end()) | 97 if (map.find(str) == map.end()) |
98 return Anime::ListStatus::NOT_IN_LIST; | 98 return Anime::ListStatus::NOT_IN_LIST; |
99 return map.at(str); | 99 return map.at(str); |
100 } | 100 } |
101 | 101 |
102 Anime::SeriesStatus ToSeriesStatus(const std::string& str) { | 102 Anime::SeriesStatus ToSeriesStatus(const std::string& str) { |
103 static const std::unordered_map<std::string, Anime::SeriesStatus> map = { | 103 static const std::unordered_map<std::string, Anime::SeriesStatus> map = { |
104 {"Currently airing", Anime::SeriesStatus::RELEASING}, | 104 {"Currently airing", Anime::SeriesStatus::RELEASING }, |
105 {"Finished airing", Anime::SeriesStatus::FINISHED}, | 105 {"Finished airing", Anime::SeriesStatus::FINISHED }, |
106 {"Not yet aired", Anime::SeriesStatus::NOT_YET_RELEASED}, | 106 {"Not yet aired", Anime::SeriesStatus::NOT_YET_RELEASED}, |
107 {"Cancelled", Anime::SeriesStatus::CANCELLED}, | 107 {"Cancelled", Anime::SeriesStatus::CANCELLED }, |
108 {"On hiatus", Anime::SeriesStatus::HIATUS} | 108 {"On hiatus", Anime::SeriesStatus::HIATUS } |
109 }; | 109 }; |
110 | 110 |
111 if (map.find(str) == map.end()) | 111 if (map.find(str) == map.end()) |
112 return Anime::SeriesStatus::UNKNOWN; | 112 return Anime::SeriesStatus::UNKNOWN; |
113 return map.at(str); | 113 return map.at(str); |
114 } | 114 } |
115 | 115 |
116 Anime::SeriesSeason ToSeriesSeason(const std::string& str) { | 116 Anime::SeriesSeason ToSeriesSeason(const std::string& str) { |
117 static const std::unordered_map<std::string, Anime::SeriesSeason> map = { | 117 static const std::unordered_map<std::string, Anime::SeriesSeason> map = { |
118 {"Winter", Anime::SeriesSeason::WINTER}, | 118 {"Winter", Anime::SeriesSeason::WINTER}, |
119 {"Summer", Anime::SeriesSeason::SUMMER}, | 119 {"Summer", Anime::SeriesSeason::SUMMER}, |
120 {"Fall", Anime::SeriesSeason::FALL}, | 120 {"Fall", Anime::SeriesSeason::FALL }, |
121 {"Spring", Anime::SeriesSeason::SPRING} | 121 {"Spring", Anime::SeriesSeason::SPRING} |
122 }; | 122 }; |
123 | 123 |
124 if (map.find(str) == map.end()) | 124 if (map.find(str) == map.end()) |
125 return Anime::SeriesSeason::UNKNOWN; | 125 return Anime::SeriesSeason::UNKNOWN; |
126 return map.at(str); | 126 return map.at(str); |
127 } | 127 } |
128 | 128 |
129 Anime::SeriesFormat ToSeriesFormat(const std::string& str) { | 129 Anime::SeriesFormat ToSeriesFormat(const std::string& str) { |
130 static const std::unordered_map<std::string, Anime::SeriesFormat> map = { | 130 static const std::unordered_map<std::string, Anime::SeriesFormat> map = { |
131 {"TV", Anime::SeriesFormat::TV}, | 131 {"TV", Anime::SeriesFormat::TV }, |
132 {"TV short", Anime::SeriesFormat::TV_SHORT}, | 132 {"TV short", Anime::SeriesFormat::TV_SHORT}, |
133 {"OVA", Anime::SeriesFormat::OVA}, | 133 {"OVA", Anime::SeriesFormat::OVA }, |
134 {"Movie", Anime::SeriesFormat::MOVIE}, | 134 {"Movie", Anime::SeriesFormat::MOVIE }, |
135 {"Special", Anime::SeriesFormat::SPECIAL}, | 135 {"Special", Anime::SeriesFormat::SPECIAL }, |
136 {"ONA", Anime::SeriesFormat::ONA}, | 136 {"ONA", Anime::SeriesFormat::ONA }, |
137 {"Music", Anime::SeriesFormat::MUSIC} | 137 {"Music", Anime::SeriesFormat::MUSIC } |
138 }; | 138 }; |
139 | 139 |
140 if (map.find(str) == map.end()) | 140 if (map.find(str) == map.end()) |
141 return Anime::SeriesFormat::UNKNOWN; | 141 return Anime::SeriesFormat::UNKNOWN; |
142 return map.at(str); | 142 return map.at(str); |
143 } | 143 } |
144 | 144 |
145 Anime::Services ToService(const std::string& str) { | 145 Anime::Services ToService(const std::string& str) { |
146 static const std::unordered_map<std::string, Anime::Services> map = { | 146 static const std::unordered_map<std::string, Anime::Services> map = { |
147 {"AniList", Anime::Services::ANILIST} | 147 {"AniList", Anime::Services::ANILIST} |
148 }; | 148 }; |
149 | 149 |
150 if (map.find(str) == map.end()) | 150 if (map.find(str) == map.end()) |
151 return Anime::Services::NONE; | 151 return Anime::Services::NONE; |
152 return map.at(str); | 152 return map.at(str); |
153 } | 153 } |
154 | 154 |
155 Anime::TitleLanguage ToLanguage(const std::string& str) { | 155 Anime::TitleLanguage ToLanguage(const std::string& str) { |
156 static const std::unordered_map<std::string, Anime::TitleLanguage> map = { | 156 static const std::unordered_map<std::string, Anime::TitleLanguage> map = { |
157 {"Romaji", Anime::TitleLanguage::ROMAJI}, | 157 {"Romaji", Anime::TitleLanguage::ROMAJI }, |
158 {"Native", Anime::TitleLanguage::NATIVE}, | 158 {"Native", Anime::TitleLanguage::NATIVE }, |
159 {"English", Anime::TitleLanguage::ENGLISH} | 159 {"English", Anime::TitleLanguage::ENGLISH} |
160 }; | 160 }; |
161 | 161 |
162 if (map.find(str) == map.end()) | 162 if (map.find(str) == map.end()) |
163 return Anime::TitleLanguage::ROMAJI; | 163 return Anime::TitleLanguage::ROMAJI; |
164 return map.at(str); | 164 return map.at(str); |
165 } | 165 } |
166 | 166 |
167 Anime::ScoreFormat ToScoreFormat(const std::string& str) { | 167 Anime::ScoreFormat ToScoreFormat(const std::string& str) { |
168 static const std::unordered_map<std::string, Anime::ScoreFormat> map = { | 168 static const std::unordered_map<std::string, Anime::ScoreFormat> map = { |
169 {"POINT_3", Anime::ScoreFormat::POINT_3}, | 169 {"POINT_3", Anime::ScoreFormat::POINT_3 }, |
170 {"POINT_5", Anime::ScoreFormat::POINT_5}, | 170 {"POINT_5", Anime::ScoreFormat::POINT_5 }, |
171 {"POINT_10", Anime::ScoreFormat::POINT_10}, | 171 {"POINT_10", Anime::ScoreFormat::POINT_10 }, |
172 {"POINT_10_DECIMAL", Anime::ScoreFormat::POINT_10_DECIMAL}, | 172 {"POINT_10_DECIMAL", Anime::ScoreFormat::POINT_10_DECIMAL}, |
173 {"POINT_100", Anime::ScoreFormat::POINT_100} | 173 {"POINT_100", Anime::ScoreFormat::POINT_100 } |
174 }; | 174 }; |
175 | 175 |
176 if (map.find(str) == map.end()) | 176 if (map.find(str) == map.end()) |
177 return Anime::ScoreFormat::POINT_100; | 177 return Anime::ScoreFormat::POINT_100; |
178 return map.at(str); | 178 return map.at(str); |
179 } | 179 } |
231 | 231 |
232 std::string ToLocalString(const Anime::Services service) { | 232 std::string ToLocalString(const Anime::Services service) { |
233 switch (service) { | 233 switch (service) { |
234 case Anime::Services::ANILIST: return Strings::ToUtf8String(QCoreApplication::tr("AniList")); | 234 case Anime::Services::ANILIST: return Strings::ToUtf8String(QCoreApplication::tr("AniList")); |
235 default: | 235 default: |
236 case Anime::Services::NONE: return Strings::ToUtf8String(QCoreApplication::tr("None")); | 236 case Anime::Services::NONE: return Strings::ToUtf8String(QCoreApplication::tr("None")); |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 std::string ToLocalString(const Anime::TitleLanguage language) { | 240 std::string ToLocalString(const Anime::TitleLanguage language) { |
241 switch (language) { | 241 switch (language) { |
242 case Anime::TitleLanguage::NATIVE: return Strings::ToUtf8String(QCoreApplication::tr("Native")); | 242 case Anime::TitleLanguage::NATIVE: return Strings::ToUtf8String(QCoreApplication::tr("Native")); |
243 case Anime::TitleLanguage::ENGLISH: return Strings::ToUtf8String(QCoreApplication::tr("English")); | 243 case Anime::TitleLanguage::ENGLISH: return Strings::ToUtf8String(QCoreApplication::tr("English")); |
244 default: | 244 default: |
245 case Anime::TitleLanguage::ROMAJI: return Strings::ToUtf8String(QCoreApplication::tr("Romaji")); | 245 case Anime::TitleLanguage::ROMAJI: return Strings::ToUtf8String(QCoreApplication::tr("Romaji")); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 std::string ToLocalString(const Anime::ScoreFormat format) { | 249 std::string ToLocalString(const Anime::ScoreFormat format) { |
250 switch (format) { | 250 switch (format) { |
251 case Anime::ScoreFormat::POINT_3: return Strings::ToUtf8String(QCoreApplication::tr("3-point")); | 251 case Anime::ScoreFormat::POINT_3: return Strings::ToUtf8String(QCoreApplication::tr("3-point")); |
252 case Anime::ScoreFormat::POINT_5: return Strings::ToUtf8String(QCoreApplication::tr("5-point")); | 252 case Anime::ScoreFormat::POINT_5: return Strings::ToUtf8String(QCoreApplication::tr("5-point")); |
253 case Anime::ScoreFormat::POINT_10: return Strings::ToUtf8String(QCoreApplication::tr("10-point")); | 253 case Anime::ScoreFormat::POINT_10: return Strings::ToUtf8String(QCoreApplication::tr("10-point")); |
254 case Anime::ScoreFormat::POINT_10_DECIMAL: return Strings::ToUtf8String(QCoreApplication::tr("10-point (Decimal)")); | 254 case Anime::ScoreFormat::POINT_10_DECIMAL: |
255 return Strings::ToUtf8String(QCoreApplication::tr("10-point (Decimal)")); | |
255 default: | 256 default: |
256 case Anime::ScoreFormat::POINT_100: return Strings::ToUtf8String(QCoreApplication::tr("100-point")); | 257 case Anime::ScoreFormat::POINT_100: return Strings::ToUtf8String(QCoreApplication::tr("100-point")); |
257 } | 258 } |
258 } | 259 } |
259 | 260 |