| 703 | } |
| 704 | |
| 705 | void Render::createComic(const QString &path) |
| 706 | { |
| 707 | previousIndex = currentIndex = 0; |
| 708 | pagesEmited.clear(); |
| 709 | |
| 710 | if (comic != nullptr) { |
| 711 | comic->invalidate(); |
| 712 | comic->disconnect(); |
| 713 | // Dispatch pending events to guard against race conditons |
| 714 | QCoreApplication::sendPostedEvents(this); |
| 715 | comic->deleteLater(); |
| 716 | } |
| 717 | comic = FactoryComic::newComic(path); |
| 718 | |
| 719 | if (comic == nullptr) // archivo no encontrado o no válido |
| 720 | { |
| 721 | emit errorOpening(); |
| 722 | reset(); |
| 723 | return; |
| 724 | } |
| 725 | |
| 726 | connect(comic, QOverload<>::of(&Comic::errorOpening), this, QOverload<>::of(&Render::errorOpening), Qt::QueuedConnection); |
| 727 | connect(comic, QOverload<QString>::of(&Comic::errorOpening), this, QOverload<QString>::of(&Render::errorOpening), Qt::QueuedConnection); |
| 728 | connect(comic, &Comic::crcErrorFound, this, &Render::crcError, Qt::QueuedConnection); |
| 729 | connect(comic, QOverload<>::of(&Comic::errorOpening), this, &Render::reset, Qt::QueuedConnection); |
| 730 | connect(comic, QOverload<int>::of(&Comic::imageLoaded), this, &Render::pageRawDataReady, Qt::QueuedConnection); |
| 731 | connect(comic, QOverload<int>::of(&Comic::imageLoaded), this, QOverload<int>::of(&Render::imageLoaded), Qt::QueuedConnection); |
| 732 | connect(comic, &Comic::openAt, this, &Render::renderAt, Qt::QueuedConnection); |
| 733 | connect(comic, QOverload<unsigned int>::of(&Comic::numPages), this, QOverload<unsigned int>::of(&Render::numPages), Qt::QueuedConnection); |
| 734 | connect(comic, QOverload<unsigned int>::of(&Comic::numPages), this, QOverload<unsigned int>::of(&Render::setNumPages), Qt::QueuedConnection); |
| 735 | connect(comic, QOverload<int, const QByteArray &>::of(&Comic::imageLoaded), this, QOverload<int, const QByteArray &>::of(&Render::imageLoaded), Qt::QueuedConnection); |
| 736 | connect(comic, &Comic::isBookmark, this, &Render::currentPageIsBookmark, Qt::QueuedConnection); |
| 737 | |
| 738 | connect(comic, &Comic::bookmarksUpdated, this, &Render::bookmarksUpdated, Qt::QueuedConnection); |
| 739 | |
| 740 | // connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast())); |
| 741 | // connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover())); |
| 742 | |
| 743 | pagesReady.clear(); |
| 744 | } |
| 745 | void Render::loadComic(const QString &path, const ComicDB &comicDB) |
| 746 | { |
| 747 | comic->load(path, comicDB); |
nothing calls this directly
no test coverage detected