diff src/gui/pages/anime_list.cc @ 185:62e336597bb7

anime list: add support for different score formats
author Paper <mrpapersonic@gmail.com>
date Tue, 05 Dec 2023 13:45:23 -0500
parents bc8d2ccff09c
children 9613d72b097e
line wrap: on
line diff
--- a/src/gui/pages/anime_list.cc	Mon Dec 04 13:44:42 2023 -0500
+++ b/src/gui/pages/anime_list.cc	Tue Dec 05 13:45:23 2023 -0500
@@ -107,12 +107,12 @@
 	switch (role) {
 		case Qt::DisplayRole:
 			switch (index.column()) {
-				case AL_TITLE: return QString::fromUtf8(list[index.row()].GetUserPreferredTitle().c_str());
+				case AL_TITLE: return Strings::ToQString(list[index.row()].GetUserPreferredTitle());
 				case AL_PROGRESS:
 					return QString::number(list[index.row()].GetUserProgress()) + "/" +
 						   QString::number(list[index.row()].GetEpisodes());
 				case AL_EPISODES: return list[index.row()].GetEpisodes();
-				case AL_SCORE: return list[index.row()].GetUserScore();
+				case AL_SCORE: return Strings::ToQString(list[index.row()].GetUserPresentableScore());
 				case AL_TYPE: return Strings::ToQString(Translate::ToString(list[index.row()].GetFormat()));
 				case AL_SEASON:
 					return Strings::ToQString(Translate::ToString(list[index.row()].GetSeason())) + " " +
@@ -124,15 +124,16 @@
 					if (list[index.row()].GetUserTimeUpdated() == 0)
 						return QString("-");
 					Time::Duration duration(Time::GetSystemTime() - list[index.row()].GetUserTimeUpdated());
-					return QString::fromUtf8(duration.AsRelativeString().c_str());
+					return Strings::ToQString(duration.AsRelativeString());
 				}
-				case AL_NOTES: return QString::fromUtf8(list[index.row()].GetUserNotes().c_str());
+				case AL_NOTES: return Strings::ToQString(list[index.row()].GetUserNotes());
 				default: return "";
 			}
 			break;
 		case Qt::UserRole:
 			switch (index.column()) {
 				case AL_PROGRESS: return list[index.row()].GetUserProgress();
+				case AL_SCORE: return list[index.row()].GetUserScore();
 				case AL_TYPE: return static_cast<int>(list[index.row()].GetFormat());
 				case AL_SEASON: return list[index.row()].GetAirDate().GetAsQDate();
 				case AL_AVG_SCORE: return list[index.row()].GetAudienceScore();