Comic/Render: Use overloads refactor some SIGNAL/SLOT connections to new syntax

This commit is contained in:
Felix Kauselmann 2021-06-11 11:46:54 +02:00
parent ae8e47d863
commit 47324e7f22
6 changed files with 25 additions and 27 deletions

View File

@ -710,16 +710,16 @@ void Render::createComic(const QString &path)
return;
}
connect(comic, SIGNAL(errorOpening()), this, SIGNAL(errorOpening()), Qt::QueuedConnection);
connect(comic, SIGNAL(errorOpening(QString)), this, SIGNAL(errorOpening(QString)), Qt::QueuedConnection);
connect(comic, QOverload<>::of(&Comic::errorOpening), this, QOverload<>::of(&Render::errorOpening), Qt::QueuedConnection);
connect(comic, QOverload<QString>::of(&Comic::errorOpening), this, QOverload<QString>::of(&Render::errorOpening), Qt::QueuedConnection);
connect(comic, &Comic::crcErrorFound, this, &Render::crcError, Qt::QueuedConnection);
connect(comic, SIGNAL(errorOpening()), this, SLOT(reset()), Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int)), this, SLOT(pageRawDataReady(int)), Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int)), this, SIGNAL(imageLoaded(int)), Qt::QueuedConnection);
connect(comic, QOverload<>::of(&Comic::errorOpening), this, &Render::reset, Qt::QueuedConnection);
connect(comic, QOverload<int>::of(&Comic::imageLoaded), this, &Render::pageRawDataReady, Qt::QueuedConnection);
connect(comic, QOverload<int>::of(&Comic::imageLoaded), this, QOverload<int>::of(&Render::imageLoaded), Qt::QueuedConnection);
connect(comic, &Comic::openAt, this, &Render::renderAt, Qt::QueuedConnection);
connect(comic, SIGNAL(numPages(unsigned int)), this, SIGNAL(numPages(unsigned int)), Qt::QueuedConnection);
connect(comic, SIGNAL(numPages(unsigned int)), this, SLOT(setNumPages(unsigned int)), Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int, QByteArray)), this, SIGNAL(imageLoaded(int, QByteArray)), Qt::QueuedConnection);
connect(comic, QOverload<unsigned int>::of(&Comic::numPages), this, QOverload<unsigned int>::of(&Render::numPages), Qt::QueuedConnection);
connect(comic, QOverload<unsigned int>::of(&Comic::numPages), this, QOverload<unsigned int>::of(&Render::setNumPages), Qt::QueuedConnection);
connect(comic, QOverload<int, const QByteArray &>::of(&Comic::imageLoaded), this, QOverload<int, const QByteArray &>::of(&Render::imageLoaded), Qt::QueuedConnection);
connect(comic, &Comic::isBookmark, this, &Render::currentPageIsBookmark, Qt::QueuedConnection);
connect(comic, &Comic::bookmarksUpdated, this, &Render::bookmarksUpdated, Qt::QueuedConnection);
@ -746,10 +746,10 @@ void Render::startLoad()
comic->moveToThread(thread);
connect(comic, SIGNAL(errorOpening()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, QOverload<>::of(&Comic::errorOpening), thread, &QThread::quit, Qt::QueuedConnection);
connect(comic, QOverload<QString>::of(&Comic::errorOpening), thread, &QThread::quit, Qt::QueuedConnection);
connect(comic, &Comic::imagesLoaded, thread, &QThread::quit, Qt::QueuedConnection);
connect(comic, SIGNAL(destroyed()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, &Comic::destroyed, thread, &QThread::quit, Qt::QueuedConnection);
connect(comic, &Comic::invalidated, thread, &QThread::quit, Qt::QueuedConnection);
connect(thread, &QThread::started, comic, &Comic::process);
connect(thread, &QThread::finished, thread, &QObject::deleteLater);

View File

@ -172,19 +172,17 @@ void Viewer::createConnections()
connect(bd, &BookmarksDialog::goToPage, this, &Viewer::goTo);
//render
connect(render, SIGNAL(errorOpening()), this, SLOT(resetContent()));
connect(render, SIGNAL(errorOpening()), this, SLOT(showMessageErrorOpening()));
connect(render, SIGNAL(errorOpening(QString)), this, SLOT(showMessageErrorOpening(QString)));
connect(render, QOverload<>::of(&Render::errorOpening), this, &Viewer::resetContent);
connect(render, QOverload<>::of(&Render::errorOpening), this, QOverload<>::of(&Viewer::showMessageErrorOpening));
connect(render, QOverload<QString>::of(&Render::errorOpening), this, QOverload<QString>::of(&Viewer::showMessageErrorOpening));
connect(render, &Render::crcError, this, &Viewer::processCRCError);
connect(render, SIGNAL(numPages(unsigned int)), goToFlow, SLOT(setNumSlides(unsigned int)));
connect(render, SIGNAL(numPages(unsigned int)), goToDialog, SLOT(setNumPages(unsigned int)));
//connect(render,SIGNAL(numPages(unsigned int)),this,SLOT(updateInformation()));
connect(render, SIGNAL(imageLoaded(int, QByteArray)), goToFlow, SLOT(setImageReady(int, QByteArray)));
connect(render, QOverload<unsigned int>::of(&Render::numPages), goToFlow, &GoToFlowWidget::setNumSlides);
connect(render, QOverload<unsigned int>::of(&Render::numPages), goToDialog, &GoToDialog::setNumPages);
connect(render, QOverload<int, const QByteArray &>::of(&Render::imageLoaded), goToFlow, &GoToFlowWidget::setImageReady);
connect(render, &Render::currentPageReady, this, &Viewer::updatePage);
connect(render, &Render::processingPage, this, &Viewer::setLoadingMessage);
connect(render, &Render::currentPageIsBookmark, this, &Viewer::pageIsBookmark);
connect(render, &Render::pageChanged, this, &Viewer::updateInformation);
//connect(render,SIGNAL(bookmarksLoaded(Bookmarks)),this,SLOT(setBookmarks(Bookmarks)));
connect(render, &Render::isLast, this, &Viewer::showIsLastMessage);
connect(render, &Render::isCover, this, &Viewer::showIsCoverMessage);

View File

@ -61,8 +61,8 @@ void ComicController::service(HttpRequest &request, HttpResponse &response)
comicFile->moveToThread(thread);
connect(comicFile, SIGNAL(errorOpening()), thread, SLOT(quit()));
connect(comicFile, SIGNAL(errorOpening(QString)), thread, SLOT(quit()));
connect(comicFile, QOverload<>::of(&Comic::errorOpening), thread, &QThread::quit);
connect(comicFile, QOverload<QString>::of(&Comic::errorOpening), thread, &QThread::quit);
connect(comicFile, &Comic::imagesLoaded, thread, &QThread::quit);
connect(thread, &QThread::started, comicFile, &Comic::process);
connect(thread, &QThread::finished, thread, &QObject::deleteLater);

View File

@ -66,8 +66,8 @@ void ComicControllerV2::service(HttpRequest &request, HttpResponse &response)
comicFile->moveToThread(thread);
connect(comicFile, SIGNAL(errorOpening()), thread, SLOT(quit()));
connect(comicFile, SIGNAL(errorOpening(QString)), thread, SLOT(quit()));
connect(comicFile, QOverload<>::of(&Comic::errorOpening), thread, &QThread::quit);
connect(comicFile, QOverload<QString>::of(&Comic::errorOpening), thread, &QThread::quit);
connect(comicFile, &Comic::imagesLoaded, thread, &QThread::quit);
connect(thread, &QThread::started, comicFile, &Comic::process);
connect(thread, &QThread::finished, thread, &QObject::deleteLater);

View File

@ -53,8 +53,8 @@ void ComicControllerInReadingListV2::service(HttpRequest &request, HttpResponse
comicFile->moveToThread(thread);
connect(comicFile, SIGNAL(errorOpening()), thread, SLOT(quit()));
connect(comicFile, SIGNAL(errorOpening(QString)), thread, SLOT(quit()));
connect(comicFile, QOverload<>::of(&Comic::errorOpening), thread, &QThread::quit);
connect(comicFile, QOverload<QString>::of(&Comic::errorOpening), thread, &QThread::quit);
connect(comicFile, &Comic::imagesLoaded, thread, &QThread::quit);
connect(thread, &QThread::started, comicFile, &Comic::process);
connect(thread, &QThread::finished, thread, &QObject::deleteLater);

View File

@ -127,8 +127,8 @@ Comic::~Comic()
void Comic::setup()
{
connect(this, &Comic::pageChanged, this, &Comic::checkIsBookmark);
connect(this, SIGNAL(imageLoaded(int)), this, SLOT(updateBookmarkImage(int)));
connect(this, SIGNAL(imageLoaded(int)), this, SLOT(setPageLoaded(int)));
connect(this, QOverload<int>::of(&Comic::imageLoaded), this, &Comic::updateBookmarkImage);
connect(this, QOverload<int>::of(&Comic::imageLoaded), this, &Comic::setPageLoaded);
auto l = [&]() { _errorOpening = true; };