Mercurial > minori
diff src/gui/translate/anilist.cpp @ 47:d8eb763e6661
information.cpp: add widgets to the list tab, and add an
"optional date" widget like taiga has so users can specify whether to
set the date or not
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 25 Sep 2023 00:43:38 -0400 |
parents | d0adc4aedfc8 |
children | 3d2decf093bb |
line wrap: on
line diff
--- a/src/gui/translate/anilist.cpp Sat Sep 23 01:02:15 2023 -0400 +++ b/src/gui/translate/anilist.cpp Mon Sep 25 00:43:38 2023 -0400 @@ -3,7 +3,7 @@ namespace Translate::AniList { Anime::SeriesStatus ToSeriesStatus(std::string status) { - std::unordered_map<std::string, Anime::SeriesStatus> map = { + const std::unordered_map<std::string, Anime::SeriesStatus> map = { {"FINISHED", Anime::SeriesStatus::FINISHED }, {"RELEASING", Anime::SeriesStatus::RELEASING }, {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED}, @@ -11,26 +11,26 @@ {"HIATUS", Anime::SeriesStatus::HIATUS } }; - if (!map.contains(status)) + if (map.find(status) == map.end()) return Anime::SeriesStatus::UNKNOWN; - return map[status]; + return map.at(status); } Anime::SeriesSeason ToSeriesSeason(std::string season) { - std::unordered_map<std::string, Anime::SeriesSeason> map = { + const std::unordered_map<std::string, Anime::SeriesSeason> map = { {"WINTER", Anime::SeriesSeason::WINTER}, {"SPRING", Anime::SeriesSeason::SPRING}, {"SUMMER", Anime::SeriesSeason::SUMMER}, {"FALL", Anime::SeriesSeason::FALL } }; - if (!map.contains(season)) + if (map.find(season) == map.end()) return Anime::SeriesSeason::UNKNOWN; - return map[season]; + return map.at(season); } Anime::SeriesFormat ToSeriesFormat(std::string format) { - std::unordered_map<std::string, enum Anime::SeriesFormat> map = { + const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { {"TV", Anime::SeriesFormat::TV }, {"TV_SHORT", Anime::SeriesFormat::TV_SHORT}, {"MOVIE", Anime::SeriesFormat::MOVIE }, @@ -43,9 +43,9 @@ {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT} }; - if (!map.contains(format)) + if (map.find(format) == map.end()) return Anime::SeriesFormat::UNKNOWN; - return map[format]; + return map.at(format); } } // namespace Translate::AniList