comparison 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
comparison
equal deleted inserted replaced
274:f6a756c19bfb 279:657fda1b9cac
208 } 208 }
209 }); 209 });
210 menu->addSeparator(); 210 menu->addSeparator();
211 { 211 {
212 QMenu* submenu = menu->addMenu(tr("Add to list...")); 212 QMenu* submenu = menu->addMenu(tr("Add to list..."));
213 submenu->addAction(tr("Currently watching"), [animes] { 213 for (const auto& status : Anime::ListStatuses) {
214 for (auto& anime : animes) { 214 submenu->addAction(Strings::ToQString(Translate::ToLocalString(status)), [animes, status] {
215 if (!anime->IsInUserList()) 215 for (auto& anime : animes) {
216 anime->AddToUserList(); 216 if (!anime->IsInUserList())
217 anime->SetUserStatus(Anime::ListStatus::CURRENT); 217 anime->AddToUserList();
218 Services::UpdateAnimeEntry(anime->GetId()); 218 anime->SetUserStatus(status);
219 } 219 Services::UpdateAnimeEntry(anime->GetId());
220 }); 220 }
221 submenu->addAction(tr("Completed"), [animes] { 221 });
222 for (auto& anime : animes) { 222 }
223 if (!anime->IsInUserList())
224 anime->AddToUserList();
225 anime->SetUserStatus(Anime::ListStatus::COMPLETED);
226 Services::UpdateAnimeEntry(anime->GetId());
227 }
228 });
229 submenu->addAction(tr("On hold"), [animes] {
230 for (auto& anime : animes) {
231 if (!anime->IsInUserList())
232 anime->AddToUserList();
233 anime->SetUserStatus(Anime::ListStatus::PAUSED);
234 Services::UpdateAnimeEntry(anime->GetId());
235 }
236 });
237 submenu->addAction(tr("Dropped"), [animes] {
238 for (auto& anime : animes) {
239 if (!anime->IsInUserList())
240 anime->AddToUserList();
241 anime->SetUserStatus(Anime::ListStatus::DROPPED);
242 Services::UpdateAnimeEntry(anime->GetId());
243 }
244 });
245 submenu->addAction(tr("Plan to watch"), [animes] {
246 for (auto& anime : animes) {
247 if (!anime->IsInUserList())
248 anime->AddToUserList();
249 anime->SetUserStatus(Anime::ListStatus::PLANNING);
250 Services::UpdateAnimeEntry(anime->GetId());
251 }
252 });
253 submenu->setEnabled(add_to_list_enable); 223 submenu->setEnabled(add_to_list_enable);
254 } 224 }
255 menu->popup(QCursor::pos()); 225 menu->popup(QCursor::pos());
256 } 226 }
257 227