diff src/gui/pages/anime_list.cc @ 305:91ac90a34003

core/time: remove Duration class, use regular functions instead this class was pretty useless anyway
author Paper <paper@paper.us.eu.org>
date Sun, 19 May 2024 15:56:20 -0400
parents 9a88e1725fd2
children 8769c5d50b06
line wrap: on
line diff
--- a/src/gui/pages/anime_list.cc	Mon May 13 17:02:35 2024 -0400
+++ b/src/gui/pages/anime_list.cc	Sun May 19 15:56:20 2024 -0400
@@ -140,7 +140,7 @@
 				case AL_SEASON: {
 					std::optional<unsigned int> year = list[index.row()].GetAirDate().GetYear();
 					if (!year)
-						return "Unknown Unknown";
+						return tr("Unknown Unknown");
 					return Strings::ToQString(Translate::ToLocalString(list[index.row()].GetSeason()) + " " +
 											  Strings::ToUtf8String(year.value()));
 				}
@@ -150,8 +150,7 @@
 				case AL_UPDATED: {
 					if (list[index.row()].GetUserTimeUpdated() == 0)
 						return QString("-");
-					Time::Duration duration(Time::GetSystemTime() - list[index.row()].GetUserTimeUpdated());
-					return Strings::ToQString(duration.AsRelativeString());
+					return Strings::ToQString(Time::GetSecondsAsRelativeString(Time::GetSystemTime() - list[index.row()].GetUserTimeUpdated()));
 				}
 				case AL_NOTES: return Strings::ToQString(list[index.row()].GetUserNotes());
 				default: return "";
@@ -203,11 +202,9 @@
 
 	list.clear();
 
-	for (const auto& a : Anime::db.items) {
-		if (a.second.IsInUserList() && a.second.GetUserStatus() == status) {
+	for (const auto& a : Anime::db.items)
+		if (a.second.IsInUserList() && a.second.GetUserStatus() == status)
 			list.push_back(a.second);
-		}
-	}
 
 	endResetModel();
 }
@@ -315,7 +312,7 @@
 	menu->addAction(tr("Information"), [this, animes] {
 		for (auto& anime : animes) {
 			InformationDialog* dialog = new InformationDialog(
-				*anime, [this, anime] { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MAIN_INFO, this);
+				anime, [this](Anime::Anime* anime) { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MAIN_INFO, this);
 
 			dialog->show();
 			dialog->raise();
@@ -327,7 +324,7 @@
 	menu->addAction(tr("Edit"), [this, animes] {
 		for (auto& anime : animes) {
 			InformationDialog* dialog = new InformationDialog(
-				*anime, [this, anime] { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MY_LIST, this);
+				anime, [this](Anime::Anime* anime) { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MY_LIST, this);
 
 			dialog->show();
 			dialog->raise();
@@ -358,7 +355,7 @@
 	Anime::Anime* anime = source_model->GetAnimeFromIndex(index);
 
 	InformationDialog* dialog = new InformationDialog(
-		*anime, [this, anime] { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MAIN_INFO, this);
+		anime, [this](Anime::Anime* anime) { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MAIN_INFO, this);
 
 	dialog->show();
 	dialog->raise();