Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
184:09492158bcc5 | 185:62e336597bb7 |
---|---|
105 if (!index.isValid()) | 105 if (!index.isValid()) |
106 return QVariant(); | 106 return QVariant(); |
107 switch (role) { | 107 switch (role) { |
108 case Qt::DisplayRole: | 108 case Qt::DisplayRole: |
109 switch (index.column()) { | 109 switch (index.column()) { |
110 case AL_TITLE: return QString::fromUtf8(list[index.row()].GetUserPreferredTitle().c_str()); | 110 case AL_TITLE: return Strings::ToQString(list[index.row()].GetUserPreferredTitle()); |
111 case AL_PROGRESS: | 111 case AL_PROGRESS: |
112 return QString::number(list[index.row()].GetUserProgress()) + "/" + | 112 return QString::number(list[index.row()].GetUserProgress()) + "/" + |
113 QString::number(list[index.row()].GetEpisodes()); | 113 QString::number(list[index.row()].GetEpisodes()); |
114 case AL_EPISODES: return list[index.row()].GetEpisodes(); | 114 case AL_EPISODES: return list[index.row()].GetEpisodes(); |
115 case AL_SCORE: return list[index.row()].GetUserScore(); | 115 case AL_SCORE: return Strings::ToQString(list[index.row()].GetUserPresentableScore()); |
116 case AL_TYPE: return Strings::ToQString(Translate::ToString(list[index.row()].GetFormat())); | 116 case AL_TYPE: return Strings::ToQString(Translate::ToString(list[index.row()].GetFormat())); |
117 case AL_SEASON: | 117 case AL_SEASON: |
118 return Strings::ToQString(Translate::ToString(list[index.row()].GetSeason())) + " " + | 118 return Strings::ToQString(Translate::ToString(list[index.row()].GetSeason())) + " " + |
119 QString::number(list[index.row()].GetAirDate().GetYear()); | 119 QString::number(list[index.row()].GetAirDate().GetYear()); |
120 case AL_AVG_SCORE: return QString::number(list[index.row()].GetAudienceScore()) + "%"; | 120 case AL_AVG_SCORE: return QString::number(list[index.row()].GetAudienceScore()) + "%"; |
122 case AL_COMPLETED: return list[index.row()].GetUserDateCompleted().GetAsQDate(); | 122 case AL_COMPLETED: return list[index.row()].GetUserDateCompleted().GetAsQDate(); |
123 case AL_UPDATED: { | 123 case AL_UPDATED: { |
124 if (list[index.row()].GetUserTimeUpdated() == 0) | 124 if (list[index.row()].GetUserTimeUpdated() == 0) |
125 return QString("-"); | 125 return QString("-"); |
126 Time::Duration duration(Time::GetSystemTime() - list[index.row()].GetUserTimeUpdated()); | 126 Time::Duration duration(Time::GetSystemTime() - list[index.row()].GetUserTimeUpdated()); |
127 return QString::fromUtf8(duration.AsRelativeString().c_str()); | 127 return Strings::ToQString(duration.AsRelativeString()); |
128 } | 128 } |
129 case AL_NOTES: return QString::fromUtf8(list[index.row()].GetUserNotes().c_str()); | 129 case AL_NOTES: return Strings::ToQString(list[index.row()].GetUserNotes()); |
130 default: return ""; | 130 default: return ""; |
131 } | 131 } |
132 break; | 132 break; |
133 case Qt::UserRole: | 133 case Qt::UserRole: |
134 switch (index.column()) { | 134 switch (index.column()) { |
135 case AL_PROGRESS: return list[index.row()].GetUserProgress(); | 135 case AL_PROGRESS: return list[index.row()].GetUserProgress(); |
136 case AL_SCORE: return list[index.row()].GetUserScore(); | |
136 case AL_TYPE: return static_cast<int>(list[index.row()].GetFormat()); | 137 case AL_TYPE: return static_cast<int>(list[index.row()].GetFormat()); |
137 case AL_SEASON: return list[index.row()].GetAirDate().GetAsQDate(); | 138 case AL_SEASON: return list[index.row()].GetAirDate().GetAsQDate(); |
138 case AL_AVG_SCORE: return list[index.row()].GetAudienceScore(); | 139 case AL_AVG_SCORE: return list[index.row()].GetAudienceScore(); |
139 case AL_UPDATED: return QVariant::fromValue(list[index.row()].GetUserTimeUpdated()); | 140 case AL_UPDATED: return QVariant::fromValue(list[index.row()].GetUserTimeUpdated()); |
140 default: return data(index, Qt::DisplayRole); | 141 default: return data(index, Qt::DisplayRole); |