comparison src/gui/pages/anime_list.cc @ 211:7cf53145de11

strings: use templates for ToInt, std::to_string -> Strings::ToUtf8String
author Paper <mrpapersonic@gmail.com>
date Sun, 07 Jan 2024 09:54:17 -0500
parents bc1ae1810855
children 2f5a9247e501
comparison
equal deleted inserted replaced
200:da91af31ae73 211:7cf53145de11
117 case AL_TYPE: return Strings::ToQString(Translate::ToString(list[index.row()].GetFormat())); 117 case AL_TYPE: return Strings::ToQString(Translate::ToString(list[index.row()].GetFormat()));
118 case AL_SEASON: { 118 case AL_SEASON: {
119 std::optional<unsigned int> year = list[index.row()].GetAirDate().GetYear(); 119 std::optional<unsigned int> year = list[index.row()].GetAirDate().GetYear();
120 if (!year) 120 if (!year)
121 return "Unknown Unknown"; 121 return "Unknown Unknown";
122 return Strings::ToQString(Translate::ToLocalString(list[index.row()].GetSeason()) + " " + std::to_string(year.value())); 122 return Strings::ToQString(Translate::ToLocalString(list[index.row()].GetSeason()) + " " + Strings::ToUtf8String(year.value()));
123 } 123 }
124 case AL_AVG_SCORE: return QString::number(list[index.row()].GetAudienceScore()) + "%"; 124 case AL_AVG_SCORE: return QString::number(list[index.row()].GetAudienceScore()) + "%";
125 case AL_STARTED: return list[index.row()].GetUserDateStarted().GetAsQDate(); 125 case AL_STARTED: return list[index.row()].GetUserDateStarted().GetAsQDate();
126 case AL_COMPLETED: return list[index.row()].GetUserDateCompleted().GetAsQDate(); 126 case AL_COMPLETED: return list[index.row()].GetUserDateCompleted().GetAsQDate();
127 case AL_UPDATED: { 127 case AL_UPDATED: {
347 reinterpret_cast<AnimeListPageModel*>(sort_models[i]->sourceModel())->RefreshList(); 347 reinterpret_cast<AnimeListPageModel*>(sort_models[i]->sourceModel())->RefreshList();
348 } 348 }
349 349
350 void AnimeListPage::RefreshTabs() { 350 void AnimeListPage::RefreshTabs() {
351 for (unsigned int i = 0; i < sort_models.size(); i++) 351 for (unsigned int i = 0; i < sort_models.size(); i++)
352 tab_bar->setTabText(i, Strings::ToQString(Translate::ToString(Anime::ListStatuses[i]) + " (" + 352 tab_bar->setTabText(i, Strings::ToQString(Translate::ToString(Anime::ListStatuses[i])) + " (" +
353 std::to_string(Anime::db.GetListsAnimeAmount(Anime::ListStatuses[i])) + ")")); 353 QString::number(Anime::db.GetListsAnimeAmount(Anime::ListStatuses[i])) + ")");
354 } 354 }
355 355
356 void AnimeListPage::Refresh() { 356 void AnimeListPage::Refresh() {
357 RefreshList(); 357 RefreshList();
358 RefreshTabs(); 358 RefreshTabs();