mirror of
https://github.com/YACReader/yacreader
synced 2025-07-16 03:54:34 -04:00
Revert "Backout changeset c42e71e42d7968ddb6c63fd39011669503b9122c"
This reverts commit 040664d3ba
.
This commit is contained in:
committed by
Luis Ángel San Martín
parent
68ae40fda7
commit
cc71f419cc
@ -381,8 +381,8 @@ Render::Render()
|
|||||||
|
|
||||||
Render::~Render()
|
Render::~Render()
|
||||||
{
|
{
|
||||||
if (comic != nullptr) {
|
if (comic != 0) {
|
||||||
comic->moveToThread(QApplication::instance()->thread());
|
//comic->moveToThread(QApplication::instance()->thread());
|
||||||
comic->deleteLater();
|
comic->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,8 +607,8 @@ void Render::setRotation(int degrees)
|
|||||||
|
|
||||||
void Render::setComic(Comic *c)
|
void Render::setComic(Comic *c)
|
||||||
{
|
{
|
||||||
if (comic != nullptr) {
|
if (comic != 0) {
|
||||||
comic->moveToThread(QApplication::instance()->thread());
|
//comic->moveToThread(QApplication::instance()->thread());
|
||||||
comic->disconnect();
|
comic->disconnect();
|
||||||
comic->deleteLater();
|
comic->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -234,6 +234,21 @@ void Comic::updateBookmarkImage(int index)
|
|||||||
emit bookmarksUpdated();
|
emit bookmarksUpdated();
|
||||||
//emit bookmarksLoaded(*bm);
|
//emit bookmarksLoaded(*bm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bm->isBookmark(index)) {
|
||||||
|
QImage p;
|
||||||
|
p.loadFromData(_pages[index]);
|
||||||
|
bm->setBookmark(index, p);
|
||||||
|
emit bookmarksUpdated();
|
||||||
|
//emit bookmarksLoaded(*bm);
|
||||||
|
}
|
||||||
|
if (bm->getLastPage() == index) {
|
||||||
|
QImage p;
|
||||||
|
p.loadFromData(_pages[index]);
|
||||||
|
bm->setLastPage(index, p);
|
||||||
|
emit bookmarksUpdated();
|
||||||
|
//emit bookmarksLoaded(*bm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Comic::setPageLoaded(int page)
|
void Comic::setPageLoaded(int page)
|
||||||
@ -378,7 +393,7 @@ bool FileComic::load(const QString &path, const ComicDB &comic)
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
|
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -502,6 +517,26 @@ QList<QVector<quint32>> FileComic::getSections(int §ionIndex)
|
|||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sectionIndex == sectionCount) //found
|
||||||
|
{
|
||||||
|
if (section.indexOf(realIdx) != 0) {
|
||||||
|
QVector<quint32> section1;
|
||||||
|
QVector<quint32> section2;
|
||||||
|
foreach (quint32 si, section) {
|
||||||
|
if (si < realIdx) {
|
||||||
|
section1.append(si);
|
||||||
|
} else {
|
||||||
|
section2.append(si);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sectionIndex++;
|
||||||
|
sections.append(section1);
|
||||||
|
sections.append(section2);
|
||||||
|
//out << "SPLIT" << endl;
|
||||||
|
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
|
||||||
if (sectionIndex == sectionCount) //found
|
if (sectionIndex == sectionCount) //found
|
||||||
{
|
{
|
||||||
if (section.indexOf(realIdx) != 0) {
|
if (section.indexOf(realIdx) != 0) {
|
||||||
@ -534,13 +569,13 @@ void FileComic::process()
|
|||||||
{
|
{
|
||||||
CompressedArchive archive(_path);
|
CompressedArchive archive(_path);
|
||||||
if (!archive.toolsLoaded()) {
|
if (!archive.toolsLoaded()) {
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening(tr("7z not found"));
|
emit errorOpening(tr("7z not found"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!archive.isValid()) {
|
if (!archive.isValid()) {
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening(tr("Format not supported"));
|
emit errorOpening(tr("Format not supported"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -551,7 +586,7 @@ void FileComic::process()
|
|||||||
|
|
||||||
if (_fileNames.size() == 0) {
|
if (_fileNames.size() == 0) {
|
||||||
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
|
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -587,14 +622,14 @@ void FileComic::process()
|
|||||||
|
|
||||||
for (int i = sectionIndex; i < sections.count(); i++) {
|
for (int i = sectionIndex; i < sections.count(); i++) {
|
||||||
if (_invalidated) {
|
if (_invalidated) {
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
archive.getAllData(sections.at(i), this);
|
archive.getAllData(sections.at(i), this);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < sectionIndex; i++) {
|
for (int i = 0; i < sectionIndex; i++) {
|
||||||
if (_invalidated) {
|
if (_invalidated) {
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
archive.getAllData(sections.at(i), this);
|
archive.getAllData(sections.at(i), this);
|
||||||
@ -609,7 +644,7 @@ void FileComic::process()
|
|||||||
emit imageLoaded(sortedIndex);
|
emit imageLoaded(sortedIndex);
|
||||||
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
|
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
|
||||||
}*/
|
}*/
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit imagesLoaded();
|
emit imagesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -664,7 +699,7 @@ void FolderComic::process()
|
|||||||
if (nPages == 0) {
|
if (nPages == 0) {
|
||||||
//TODO emitir este mensaje en otro sitio
|
//TODO emitir este mensaje en otro sitio
|
||||||
//QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder"));
|
//QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder"));
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
} else {
|
} else {
|
||||||
if (_firstPage == -1) {
|
if (_firstPage == -1) {
|
||||||
@ -687,7 +722,7 @@ void FolderComic::process()
|
|||||||
int i = _firstPage;
|
int i = _firstPage;
|
||||||
while (count < nPages) {
|
while (count < nPages) {
|
||||||
if (_invalidated) {
|
if (_invalidated) {
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +738,7 @@ void FolderComic::process()
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit imagesLoaded();
|
emit imagesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,7 +777,7 @@ bool PDFComic::load(const QString &path, int atPage)
|
|||||||
//emit bookmarksLoaded(*bm);
|
//emit bookmarksLoaded(*bm);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -763,7 +798,7 @@ bool PDFComic::load(const QString &path, const ComicDB &comic)
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
|
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -790,12 +825,12 @@ void PDFComic::process()
|
|||||||
if (!pdfComic) {
|
if (!pdfComic) {
|
||||||
//delete pdfComic;
|
//delete pdfComic;
|
||||||
//pdfComic = 0;
|
//pdfComic = 0;
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pdfComic->isLocked()) {
|
if (pdfComic->isLocked()) {
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -830,7 +865,7 @@ void PDFComic::process()
|
|||||||
for (int i = buffered_index; i < nPages; i++) {
|
for (int i = buffered_index; i < nPages; i++) {
|
||||||
if (_invalidated) {
|
if (_invalidated) {
|
||||||
delete pdfComic;
|
delete pdfComic;
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,14 +874,14 @@ void PDFComic::process()
|
|||||||
for (int i = 0; i < buffered_index; i++) {
|
for (int i = 0; i < buffered_index; i++) {
|
||||||
if (_invalidated) {
|
if (_invalidated) {
|
||||||
delete pdfComic;
|
delete pdfComic;
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
renderPage(i);
|
renderPage(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pdfComic;
|
delete pdfComic;
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit imagesLoaded();
|
emit imagesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user