mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Remove thread pingpong
This commit is contained in:
parent
e5d2d40d8c
commit
cc72d30f5b
@ -417,7 +417,7 @@ Render::~Render()
|
|||||||
{
|
{
|
||||||
if(comic!=0)
|
if(comic!=0)
|
||||||
{
|
{
|
||||||
comic->moveToThread(QApplication::instance()->thread());
|
//comic->moveToThread(QApplication::instance()->thread());
|
||||||
comic->deleteLater();
|
comic->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ void Render::setComic(Comic * c)
|
|||||||
{
|
{
|
||||||
if(comic !=0)
|
if(comic !=0)
|
||||||
{
|
{
|
||||||
comic->moveToThread(QApplication::instance()->thread());
|
//comic->moveToThread(QApplication::instance()->thread());
|
||||||
comic->disconnect();
|
comic->disconnect();
|
||||||
comic->deleteLater();
|
comic->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ void Comic::updateBookmarkImage(int index)
|
|||||||
bm->setBookmark(index,p);
|
bm->setBookmark(index,p);
|
||||||
emit bookmarksUpdated();
|
emit bookmarksUpdated();
|
||||||
//emit bookmarksLoaded(*bm);
|
//emit bookmarksLoaded(*bm);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(bm->getLastPage() == index)
|
if(bm->getLastPage() == index)
|
||||||
{
|
{
|
||||||
@ -237,7 +237,7 @@ QList<QString> Comic::findValidComicFiles(const QList<QUrl> &list)
|
|||||||
QLOG_DEBUG() << "-findValidComicFiles-";
|
QLOG_DEBUG() << "-findValidComicFiles-";
|
||||||
QList<QString> validComicFiles;
|
QList<QString> validComicFiles;
|
||||||
QString currentPath;
|
QString currentPath;
|
||||||
foreach (QUrl url, list)
|
foreach (QUrl url, list)
|
||||||
{
|
{
|
||||||
currentPath = url.toLocalFile();
|
currentPath = url.toLocalFile();
|
||||||
if(Comic::fileIsComic(currentPath))
|
if(Comic::fileIsComic(currentPath))
|
||||||
@ -267,7 +267,7 @@ QList<QString> Comic::findValidComicFilesInFolder(const QString &path)
|
|||||||
QFileInfoList folderContent = folder.entryInfoList();
|
QFileInfoList folderContent = folder.entryInfoList();
|
||||||
|
|
||||||
QString currentPath;
|
QString currentPath;
|
||||||
foreach (QFileInfo info, folderContent)
|
foreach (QFileInfo info, folderContent)
|
||||||
{
|
{
|
||||||
currentPath = info.absoluteFilePath();
|
currentPath = info.absoluteFilePath();
|
||||||
if(info.isDir())
|
if(info.isDir())
|
||||||
@ -353,7 +353,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@ -442,7 +442,7 @@ QList<QVector<quint32> > FileComic::getSections(int & sectionIndex)
|
|||||||
unsigned int realIdx;
|
unsigned int realIdx;
|
||||||
foreach(quint32 i, sortedIndexes)
|
foreach(quint32 i, sortedIndexes)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(_firstPage == idx)
|
if(_firstPage == idx)
|
||||||
{
|
{
|
||||||
sectionIndex = sectionCount;
|
sectionIndex = sectionCount;
|
||||||
@ -497,7 +497,7 @@ QList<QVector<quint32> > FileComic::getSections(int & sectionIndex)
|
|||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sectionIndex == sectionCount) //found
|
if(sectionIndex == sectionCount) //found
|
||||||
{
|
{
|
||||||
if(section.indexOf(realIdx)!=0)
|
if(section.indexOf(realIdx)!=0)
|
||||||
@ -540,14 +540,14 @@ 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;
|
||||||
}
|
}
|
||||||
@ -559,7 +559,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;
|
||||||
}
|
}
|
||||||
@ -599,7 +599,7 @@ void FileComic::process()
|
|||||||
{
|
{
|
||||||
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);
|
||||||
@ -608,7 +608,7 @@ void FileComic::process()
|
|||||||
{
|
{
|
||||||
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);
|
||||||
@ -623,7 +623,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ void FolderComic::process()
|
|||||||
{
|
{
|
||||||
//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
|
||||||
@ -712,7 +712,7 @@ void FolderComic::process()
|
|||||||
{
|
{
|
||||||
if(_invalidated)
|
if(_invalidated)
|
||||||
{
|
{
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ void FolderComic::process()
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit imagesLoaded();
|
emit imagesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,7 +757,7 @@ PDFComic::~PDFComic()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PDFComic::load(const QString & path, int atPage)
|
bool PDFComic::load(const QString & path, int atPage)
|
||||||
{
|
{
|
||||||
QFileInfo fi(path);
|
QFileInfo fi(path);
|
||||||
|
|
||||||
if(fi.exists())
|
if(fi.exists())
|
||||||
@ -774,7 +774,7 @@ bool PDFComic::load(const QString & path, int atPage)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -799,7 +799,7 @@ bool PDFComic::load(const QString & path, const ComicDB & comic)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@ -829,13 +829,13 @@ void PDFComic::process()
|
|||||||
{
|
{
|
||||||
//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;
|
||||||
}
|
}
|
||||||
@ -874,7 +874,7 @@ void PDFComic::process()
|
|||||||
if(_invalidated)
|
if(_invalidated)
|
||||||
{
|
{
|
||||||
delete pdfComic;
|
delete pdfComic;
|
||||||
moveToThread(QCoreApplication::instance()->thread());
|
//moveToThread(QCoreApplication::instance()->thread());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -885,14 +885,14 @@ void PDFComic::process()
|
|||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -931,7 +931,7 @@ Comic * FactoryComic::newComic(const QString & path)
|
|||||||
if(fi.exists())
|
if(fi.exists())
|
||||||
{
|
{
|
||||||
if(fi.isFile())
|
if(fi.isFile())
|
||||||
{
|
{
|
||||||
#ifndef NO_PDF
|
#ifndef NO_PDF
|
||||||
if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0)
|
if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0)
|
||||||
{
|
{
|
||||||
@ -1113,7 +1113,7 @@ QList<QString> merge_pages(QList<QString> & singlePageNames, QList<QString> & do
|
|||||||
{
|
{
|
||||||
pageNames.append(doublePageNames.at(j++));
|
pageNames.append(doublePageNames.at(j++));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pageNames;
|
return pageNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1141,7 +1141,7 @@ void comic_pages_sort(QList<QString> & pageNames, YACReaderPageSortingMode sorti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YACReaderAlphabeticalSorting:
|
case YACReaderAlphabeticalSorting:
|
||||||
std::sort(pageNames.begin(), pageNames.end());
|
std::sort(pageNames.begin(), pageNames.end());
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user