diff src/gui/widgets/poster.cc @ 236:4d461ef7d424

HUGE UPDATE: convert build system to autotools why? because cmake sucks :)
author Paper <mrpapersonic@gmail.com>
date Fri, 19 Jan 2024 00:24:02 -0500
parents ff0061e75f0f
children d14f8e0e40c3
line wrap: on
line diff
--- a/src/gui/widgets/poster.cc	Tue Jan 16 15:22:29 2024 -0500
+++ b/src/gui/widgets/poster.cc	Fri Jan 19 00:24:02 2024 -0500
@@ -36,16 +36,10 @@
 
 void Poster::SetAnime(const Anime::Anime& anime) {
 	{
-		QByteArray* ba = new QByteArray;
+		HTTP::GetThread* thread = new HTTP::GetThread(anime.GetPosterUrl(), {}, this);
 
-		QThread* thread = QThread::create([ba, anime] {
-			*ba = HTTP::Get(anime.GetPosterUrl(), {});
-		});
-
-		connect(thread, &QThread::finished, this, [this, ba] {
-			ImageDownloadFinished(*ba);
-			delete ba;
-		});
+		connect(thread, &HTTP::GetThread::ReceivedData, this, &Poster::ImageDownloadFinished);
+		connect(thread, &HTTP::GetThread::finished, thread, &HTTP::GetThread::deleteLater);
 
 		thread->start();
 	}
@@ -70,5 +64,3 @@
 void Poster::resizeEvent(QResizeEvent*) {
 	RenderToLabel();
 }
-
-#include "gui/widgets/moc_poster.cpp"