diff src/gui/widgets/poster.cpp @ 77:6f7385bd334c

*: update formatted all source files, no more subclassing QThread... many other changes :)
author Paper <mrpapersonic@gmail.com>
date Fri, 06 Oct 2023 06:18:53 -0400
parents 3364fadc8a36
children
line wrap: on
line diff
--- a/src/gui/widgets/poster.cpp	Wed Oct 04 01:46:33 2023 -0400
+++ b/src/gui/widgets/poster.cpp	Fri Oct 06 06:18:53 2023 -0400
@@ -12,6 +12,7 @@
 #include <QLabel>
 #include <QMessageBox>
 #include <QPixmap>
+#include <QThreadPool>
 #include <QUrl>
 #include <curl/curl.h>
 
@@ -26,10 +27,10 @@
 
 	const Anime::Anime& anime = Anime::db.items[id];
 
-	HTTP::HttpGetThread* image_thread = new HTTP::HttpGetThread(anime.GetPosterUrl(), {}, this);
-	connect(image_thread, &HTTP::HttpGetThread::resultReady, this, &Poster::ImageDownloadFinished);
-	connect(image_thread, &HTTP::HttpGetThread::finished, image_thread, &QObject::deleteLater);
-	image_thread->start();
+	QThreadPool::globalInstance()->start([this, anime] {
+		QByteArray ba = HTTP::Get(anime.GetPosterUrl(), {});
+		ImageDownloadFinished(ba);
+	});
 
 	QPixmap pixmap = QPixmap::fromImage(img);