| 558 | } |
| 559 | |
| 560 | void FileComic::process() |
| 561 | { |
| 562 | CompressedArchive archive(_path); |
| 563 | if (!archive.toolsLoaded()) { |
| 564 | moveToThread(QCoreApplication::instance()->thread()); |
| 565 | emit errorOpening(tr("7z not found")); |
| 566 | return; |
| 567 | } |
| 568 | |
| 569 | if (!archive.isValid()) { |
| 570 | moveToThread(QCoreApplication::instance()->thread()); |
| 571 | emit errorOpening(tr("Format not supported")); |
| 572 | return; |
| 573 | } |
| 574 | |
| 575 | // se filtran para obtener s�lo los formatos soportados |
| 576 | _order = archive.getFileNames(); |
| 577 | _fileNames = filter(_order); |
| 578 | |
| 579 | if (_fileNames.size() == 0) { |
| 580 | // QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file")); |
| 581 | moveToThread(QCoreApplication::instance()->thread()); |
| 582 | emit errorOpening(); |
| 583 | return; |
| 584 | } |
| 585 | |
| 586 | // TODO, cambiar por listas |
| 587 | //_order = _fileNames; |
| 588 | |
| 589 | _pages.resize(_fileNames.size()); |
| 590 | _loadedPages = QVector<bool>(_fileNames.size(), false); |
| 591 | |
| 592 | emit pageChanged(0); // this indicates new comic, index=0 |
| 593 | emit numPages(_pages.size()); |
| 594 | _loaded = true; |
| 595 | |
| 596 | _cfi = 0; |
| 597 | |
| 598 | // TODO, add a setting for choosing the type of page sorting used. |
| 599 | comic_pages_sort(_fileNames, YACReaderHeuristicSorting); |
| 600 | |
| 601 | if (_firstPage == -1) { |
| 602 | _firstPage = bm->getLastPage(); |
| 603 | } |
| 604 | |
| 605 | if (_firstPage >= _pages.length()) { |
| 606 | _firstPage = 0; |
| 607 | } |
| 608 | |
| 609 | _index = _firstPage; |
| 610 | emit openAt(_index); |
| 611 | |
| 612 | int sectionIndex; |
| 613 | QList<QVector<quint32>> sections = getSections(sectionIndex); |
| 614 | |
| 615 | for (int i = sectionIndex; i < sections.count(); i++) { |
| 616 | if (_invalidated) { |
| 617 | moveToThread(QCoreApplication::instance()->thread()); |
nothing calls this directly
no test coverage detected