Mercurial > minori
diff src/gui/pages/search.cc @ 279:657fda1b9cac
*: clean up enums
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Fri, 19 Apr 2024 13:24:06 -0400 |
parents | f31305b9f60a |
children | 91ac90a34003 |
line wrap: on
line diff
--- a/src/gui/pages/search.cc Thu Apr 18 17:24:42 2024 -0400 +++ b/src/gui/pages/search.cc Fri Apr 19 13:24:06 2024 -0400 @@ -210,46 +210,16 @@ menu->addSeparator(); { QMenu* submenu = menu->addMenu(tr("Add to list...")); - submenu->addAction(tr("Currently watching"), [animes] { - for (auto& anime : animes) { - if (!anime->IsInUserList()) - anime->AddToUserList(); - anime->SetUserStatus(Anime::ListStatus::CURRENT); - Services::UpdateAnimeEntry(anime->GetId()); - } - }); - submenu->addAction(tr("Completed"), [animes] { - for (auto& anime : animes) { - if (!anime->IsInUserList()) - anime->AddToUserList(); - anime->SetUserStatus(Anime::ListStatus::COMPLETED); - Services::UpdateAnimeEntry(anime->GetId()); - } - }); - submenu->addAction(tr("On hold"), [animes] { - for (auto& anime : animes) { - if (!anime->IsInUserList()) - anime->AddToUserList(); - anime->SetUserStatus(Anime::ListStatus::PAUSED); - Services::UpdateAnimeEntry(anime->GetId()); - } - }); - submenu->addAction(tr("Dropped"), [animes] { - for (auto& anime : animes) { - if (!anime->IsInUserList()) - anime->AddToUserList(); - anime->SetUserStatus(Anime::ListStatus::DROPPED); - Services::UpdateAnimeEntry(anime->GetId()); - } - }); - submenu->addAction(tr("Plan to watch"), [animes] { - for (auto& anime : animes) { - if (!anime->IsInUserList()) - anime->AddToUserList(); - anime->SetUserStatus(Anime::ListStatus::PLANNING); - Services::UpdateAnimeEntry(anime->GetId()); - } - }); + for (const auto& status : Anime::ListStatuses) { + submenu->addAction(Strings::ToQString(Translate::ToLocalString(status)), [animes, status] { + for (auto& anime : animes) { + if (!anime->IsInUserList()) + anime->AddToUserList(); + anime->SetUserStatus(status); + Services::UpdateAnimeEntry(anime->GetId()); + } + }); + } submenu->setEnabled(add_to_list_enable); } menu->popup(QCursor::pos());