diff 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
line wrap: on
line diff
--- a/src/gui/translate/anime.cpp	Sun Oct 01 23:15:43 2023 -0400
+++ b/src/gui/translate/anime.cpp	Sun Oct 01 23:26:35 2023 -0400
@@ -1,4 +1,5 @@
 #include "core/anime.h"
+#include "core/strings.h"
 #include "gui/translate/anime.h"
 #include <QCoreApplication>
 
@@ -6,49 +7,49 @@
 
 std::string ToString(const Anime::ListStatus status) {
 	switch (status) {
-		case Anime::ListStatus::NOT_IN_LIST: return QCoreApplication::tr("Not in list").toStdString();
-		case Anime::ListStatus::CURRENT: return QCoreApplication::tr("Currently watching").toStdString();
-		case Anime::ListStatus::PLANNING: return QCoreApplication::tr("Plan to watch").toStdString();
-		case Anime::ListStatus::COMPLETED: return QCoreApplication::tr("Completed").toStdString();
-		case Anime::ListStatus::DROPPED: return QCoreApplication::tr("Dropped").toStdString();
-		case Anime::ListStatus::PAUSED: return QCoreApplication::tr("On hold").toStdString();
+		case Anime::ListStatus::NOT_IN_LIST: return Strings::ToUtf8String(QCoreApplication::tr("Not in list"));
+		case Anime::ListStatus::CURRENT: return Strings::ToUtf8String(QCoreApplication::tr("Currently watching"));
+		case Anime::ListStatus::PLANNING: return Strings::ToUtf8String(QCoreApplication::tr("Plan to watch"));
+		case Anime::ListStatus::COMPLETED: return Strings::ToUtf8String(QCoreApplication::tr("Completed"));
+		case Anime::ListStatus::DROPPED: return Strings::ToUtf8String(QCoreApplication::tr("Dropped"));
+		case Anime::ListStatus::PAUSED: return Strings::ToUtf8String(QCoreApplication::tr("On hold"));
 		default: return "";
 	}
 }
 
 std::string ToString(const Anime::SeriesFormat format) {
 	switch (format) {
-		case Anime::SeriesFormat::UNKNOWN: return QCoreApplication::tr("Unknown").toStdString();
-		case Anime::SeriesFormat::TV: return QCoreApplication::tr("TV").toStdString();
-		case Anime::SeriesFormat::TV_SHORT: return QCoreApplication::tr("TV short").toStdString();
-		case Anime::SeriesFormat::OVA: return QCoreApplication::tr("OVA").toStdString();
-		case Anime::SeriesFormat::MOVIE: return QCoreApplication::tr("Movie").toStdString();
-		case Anime::SeriesFormat::SPECIAL: return QCoreApplication::tr("Special").toStdString();
-		case Anime::SeriesFormat::ONA: return QCoreApplication::tr("ONA").toStdString();
-		case Anime::SeriesFormat::MUSIC: return QCoreApplication::tr("Music").toStdString();
+		case Anime::SeriesFormat::UNKNOWN: return Strings::ToUtf8String(QCoreApplication::tr("Unknown"));
+		case Anime::SeriesFormat::TV: return Strings::ToUtf8String(QCoreApplication::tr("TV"));
+		case Anime::SeriesFormat::TV_SHORT: return Strings::ToUtf8String(QCoreApplication::tr("TV short"));
+		case Anime::SeriesFormat::OVA: return Strings::ToUtf8String(QCoreApplication::tr("OVA"));
+		case Anime::SeriesFormat::MOVIE: return Strings::ToUtf8String(QCoreApplication::tr("Movie"));
+		case Anime::SeriesFormat::SPECIAL: return Strings::ToUtf8String(QCoreApplication::tr("Special"));
+		case Anime::SeriesFormat::ONA: return Strings::ToUtf8String(QCoreApplication::tr("ONA"));
+		case Anime::SeriesFormat::MUSIC: return Strings::ToUtf8String(QCoreApplication::tr("Music"));
 		default: return "";
 	}
 }
 
 std::string ToString(const Anime::SeriesSeason season) {
 	switch (season) {
-		case Anime::SeriesSeason::UNKNOWN: return QCoreApplication::tr("Unknown").toStdString();
-		case Anime::SeriesSeason::WINTER: return QCoreApplication::tr("Winter").toStdString();
-		case Anime::SeriesSeason::SUMMER: return QCoreApplication::tr("Summer").toStdString();
-		case Anime::SeriesSeason::FALL: return QCoreApplication::tr("Fall").toStdString();
-		case Anime::SeriesSeason::SPRING: return QCoreApplication::tr("Spring").toStdString();
+		case Anime::SeriesSeason::UNKNOWN: return Strings::ToUtf8String(QCoreApplication::tr("Unknown"));
+		case Anime::SeriesSeason::WINTER: return Strings::ToUtf8String(QCoreApplication::tr("Winter"));
+		case Anime::SeriesSeason::SUMMER: return Strings::ToUtf8String(QCoreApplication::tr("Summer"));
+		case Anime::SeriesSeason::FALL: return Strings::ToUtf8String(QCoreApplication::tr("Fall"));
+		case Anime::SeriesSeason::SPRING: return Strings::ToUtf8String(QCoreApplication::tr("Spring"));
 		default: return "";
 	}
 }
 
 std::string ToString(const Anime::SeriesStatus status) {
 	switch (status) {
-		case Anime::SeriesStatus::UNKNOWN: return QCoreApplication::tr("Unknown").toStdString();
-		case Anime::SeriesStatus::RELEASING: return QCoreApplication::tr("Currently airing").toStdString();
-		case Anime::SeriesStatus::FINISHED: return QCoreApplication::tr("Finished airing").toStdString();
-		case Anime::SeriesStatus::NOT_YET_RELEASED: return QCoreApplication::tr("Not yet aired").toStdString();
-		case Anime::SeriesStatus::CANCELLED: return QCoreApplication::tr("Cancelled").toStdString();
-		case Anime::SeriesStatus::HIATUS: return QCoreApplication::tr("On hiatus").toStdString();
+		case Anime::SeriesStatus::UNKNOWN: return Strings::ToUtf8String(QCoreApplication::tr("Unknown"));
+		case Anime::SeriesStatus::RELEASING: return Strings::ToUtf8String(QCoreApplication::tr("Currently airing"));
+		case Anime::SeriesStatus::FINISHED: return Strings::ToUtf8String(QCoreApplication::tr("Finished airing"));
+		case Anime::SeriesStatus::NOT_YET_RELEASED: return Strings::ToUtf8String(QCoreApplication::tr("Not yet aired"));
+		case Anime::SeriesStatus::CANCELLED: return Strings::ToUtf8String(QCoreApplication::tr("Cancelled"));
+		case Anime::SeriesStatus::HIATUS: return Strings::ToUtf8String(QCoreApplication::tr("On hiatus"));
 		default: return "";
 	}
 }