comparison src/gui/pages/anime_list.cc @ 315:34347fd2a2de

session: allow printing status messages ...!
author Paper <paper@paper.us.eu.org>
date Tue, 11 Jun 2024 14:16:40 -0400
parents 8769c5d50b06
children 1b5c04268d6a
comparison
equal deleted inserted replaced
314:76d7315504c4 315:34347fd2a2de
303 std::set<Anime::Anime*> animes; 303 std::set<Anime::Anime*> animes;
304 for (const auto& index : selection.indexes()) { 304 for (const auto& index : selection.indexes()) {
305 if (!index.isValid()) 305 if (!index.isValid())
306 continue; 306 continue;
307 Anime::Anime* anime = source_model->GetAnimeFromIndex(index); 307 Anime::Anime* anime = source_model->GetAnimeFromIndex(index);
308 if (anime) 308 if (!anime)
309 animes.insert(anime); 309 continue;
310 animes.insert(&Anime::db.items[anime->GetId()]);
310 } 311 }
311 312
312 menu->addAction(tr("Information"), [this, animes] { 313 menu->addAction(tr("Information"), [this, animes] {
313 for (auto& anime : animes) { 314 for (auto& anime : animes) {
314 InformationDialog* dialog = new InformationDialog( 315 InformationDialog* dialog = new InformationDialog(
350 351
351 AnimeListPageModel* source_model = 352 AnimeListPageModel* source_model =
352 reinterpret_cast<AnimeListPageModel*>(sort_models[tab_bar->currentIndex()]->sourceModel()); 353 reinterpret_cast<AnimeListPageModel*>(sort_models[tab_bar->currentIndex()]->sourceModel());
353 354
354 const QModelIndex index = source_model->index(selection.indexes().first().row()); 355 const QModelIndex index = source_model->index(selection.indexes().first().row());
355 Anime::Anime* anime = source_model->GetAnimeFromIndex(index); 356 Anime::Anime& anime = Anime::db.items[source_model->GetAnimeFromIndex(index)->GetId()];
356 357
357 InformationDialog* dialog = new InformationDialog( 358 InformationDialog* dialog = new InformationDialog(
358 anime, [this](Anime::Anime* anime) { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MAIN_INFO, this); 359 &anime, [this](Anime::Anime* anime) { UpdateAnime(anime->GetId()); }, InformationDialog::PAGE_MAIN_INFO, this);
359 360
360 dialog->show(); 361 dialog->show();
361 dialog->raise(); 362 dialog->raise();
362 dialog->activateWindow(); 363 dialog->activateWindow();
363 connect(dialog, &InformationDialog::finished, dialog, &InformationDialog::deleteLater); 364 connect(dialog, &InformationDialog::finished, dialog, &InformationDialog::deleteLater);