comparison src/gui/translate/anime.cpp @ 65:26721c28bf22

*: avoid usage of (to|from)StdString in Qt5 (and probably Qt6 as well) these functions are only available (or even usable) if Qt and Minori were built with the *same standard headers*, which may not be the case in some circumstances. hence, we'll use our own conversion functions, which we probably should use anyway.
author Paper <mrpapersonic@gmail.com>
date Sun, 01 Oct 2023 23:26:35 -0400
parents 75c804f713b2
children
comparison
equal deleted inserted replaced
64:fe719c109dbc 65:26721c28bf22
1 #include "core/anime.h" 1 #include "core/anime.h"
2 #include "core/strings.h"
2 #include "gui/translate/anime.h" 3 #include "gui/translate/anime.h"
3 #include <QCoreApplication> 4 #include <QCoreApplication>
4 5
5 namespace Translate { 6 namespace Translate {
6 7
7 std::string ToString(const Anime::ListStatus status) { 8 std::string ToString(const Anime::ListStatus status) {
8 switch (status) { 9 switch (status) {
9 case Anime::ListStatus::NOT_IN_LIST: return QCoreApplication::tr("Not in list").toStdString(); 10 case Anime::ListStatus::NOT_IN_LIST: return Strings::ToUtf8String(QCoreApplication::tr("Not in list"));
10 case Anime::ListStatus::CURRENT: return QCoreApplication::tr("Currently watching").toStdString(); 11 case Anime::ListStatus::CURRENT: return Strings::ToUtf8String(QCoreApplication::tr("Currently watching"));
11 case Anime::ListStatus::PLANNING: return QCoreApplication::tr("Plan to watch").toStdString(); 12 case Anime::ListStatus::PLANNING: return Strings::ToUtf8String(QCoreApplication::tr("Plan to watch"));
12 case Anime::ListStatus::COMPLETED: return QCoreApplication::tr("Completed").toStdString(); 13 case Anime::ListStatus::COMPLETED: return Strings::ToUtf8String(QCoreApplication::tr("Completed"));
13 case Anime::ListStatus::DROPPED: return QCoreApplication::tr("Dropped").toStdString(); 14 case Anime::ListStatus::DROPPED: return Strings::ToUtf8String(QCoreApplication::tr("Dropped"));
14 case Anime::ListStatus::PAUSED: return QCoreApplication::tr("On hold").toStdString(); 15 case Anime::ListStatus::PAUSED: return Strings::ToUtf8String(QCoreApplication::tr("On hold"));
15 default: return ""; 16 default: return "";
16 } 17 }
17 } 18 }
18 19
19 std::string ToString(const Anime::SeriesFormat format) { 20 std::string ToString(const Anime::SeriesFormat format) {
20 switch (format) { 21 switch (format) {
21 case Anime::SeriesFormat::UNKNOWN: return QCoreApplication::tr("Unknown").toStdString(); 22 case Anime::SeriesFormat::UNKNOWN: return Strings::ToUtf8String(QCoreApplication::tr("Unknown"));
22 case Anime::SeriesFormat::TV: return QCoreApplication::tr("TV").toStdString(); 23 case Anime::SeriesFormat::TV: return Strings::ToUtf8String(QCoreApplication::tr("TV"));
23 case Anime::SeriesFormat::TV_SHORT: return QCoreApplication::tr("TV short").toStdString(); 24 case Anime::SeriesFormat::TV_SHORT: return Strings::ToUtf8String(QCoreApplication::tr("TV short"));
24 case Anime::SeriesFormat::OVA: return QCoreApplication::tr("OVA").toStdString(); 25 case Anime::SeriesFormat::OVA: return Strings::ToUtf8String(QCoreApplication::tr("OVA"));
25 case Anime::SeriesFormat::MOVIE: return QCoreApplication::tr("Movie").toStdString(); 26 case Anime::SeriesFormat::MOVIE: return Strings::ToUtf8String(QCoreApplication::tr("Movie"));
26 case Anime::SeriesFormat::SPECIAL: return QCoreApplication::tr("Special").toStdString(); 27 case Anime::SeriesFormat::SPECIAL: return Strings::ToUtf8String(QCoreApplication::tr("Special"));
27 case Anime::SeriesFormat::ONA: return QCoreApplication::tr("ONA").toStdString(); 28 case Anime::SeriesFormat::ONA: return Strings::ToUtf8String(QCoreApplication::tr("ONA"));
28 case Anime::SeriesFormat::MUSIC: return QCoreApplication::tr("Music").toStdString(); 29 case Anime::SeriesFormat::MUSIC: return Strings::ToUtf8String(QCoreApplication::tr("Music"));
29 default: return ""; 30 default: return "";
30 } 31 }
31 } 32 }
32 33
33 std::string ToString(const Anime::SeriesSeason season) { 34 std::string ToString(const Anime::SeriesSeason season) {
34 switch (season) { 35 switch (season) {
35 case Anime::SeriesSeason::UNKNOWN: return QCoreApplication::tr("Unknown").toStdString(); 36 case Anime::SeriesSeason::UNKNOWN: return Strings::ToUtf8String(QCoreApplication::tr("Unknown"));
36 case Anime::SeriesSeason::WINTER: return QCoreApplication::tr("Winter").toStdString(); 37 case Anime::SeriesSeason::WINTER: return Strings::ToUtf8String(QCoreApplication::tr("Winter"));
37 case Anime::SeriesSeason::SUMMER: return QCoreApplication::tr("Summer").toStdString(); 38 case Anime::SeriesSeason::SUMMER: return Strings::ToUtf8String(QCoreApplication::tr("Summer"));
38 case Anime::SeriesSeason::FALL: return QCoreApplication::tr("Fall").toStdString(); 39 case Anime::SeriesSeason::FALL: return Strings::ToUtf8String(QCoreApplication::tr("Fall"));
39 case Anime::SeriesSeason::SPRING: return QCoreApplication::tr("Spring").toStdString(); 40 case Anime::SeriesSeason::SPRING: return Strings::ToUtf8String(QCoreApplication::tr("Spring"));
40 default: return ""; 41 default: return "";
41 } 42 }
42 } 43 }
43 44
44 std::string ToString(const Anime::SeriesStatus status) { 45 std::string ToString(const Anime::SeriesStatus status) {
45 switch (status) { 46 switch (status) {
46 case Anime::SeriesStatus::UNKNOWN: return QCoreApplication::tr("Unknown").toStdString(); 47 case Anime::SeriesStatus::UNKNOWN: return Strings::ToUtf8String(QCoreApplication::tr("Unknown"));
47 case Anime::SeriesStatus::RELEASING: return QCoreApplication::tr("Currently airing").toStdString(); 48 case Anime::SeriesStatus::RELEASING: return Strings::ToUtf8String(QCoreApplication::tr("Currently airing"));
48 case Anime::SeriesStatus::FINISHED: return QCoreApplication::tr("Finished airing").toStdString(); 49 case Anime::SeriesStatus::FINISHED: return Strings::ToUtf8String(QCoreApplication::tr("Finished airing"));
49 case Anime::SeriesStatus::NOT_YET_RELEASED: return QCoreApplication::tr("Not yet aired").toStdString(); 50 case Anime::SeriesStatus::NOT_YET_RELEASED: return Strings::ToUtf8String(QCoreApplication::tr("Not yet aired"));
50 case Anime::SeriesStatus::CANCELLED: return QCoreApplication::tr("Cancelled").toStdString(); 51 case Anime::SeriesStatus::CANCELLED: return Strings::ToUtf8String(QCoreApplication::tr("Cancelled"));
51 case Anime::SeriesStatus::HIATUS: return QCoreApplication::tr("On hiatus").toStdString(); 52 case Anime::SeriesStatus::HIATUS: return Strings::ToUtf8String(QCoreApplication::tr("On hiatus"));
52 default: return ""; 53 default: return "";
53 } 54 }
54 } 55 }
55 56
56 } // namespace Translate 57 } // namespace Translate