comparison 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
comparison
equal deleted inserted replaced
235:593108b3d555 236:4d461ef7d424
34 SetAnime(anime); 34 SetAnime(anime);
35 } 35 }
36 36
37 void Poster::SetAnime(const Anime::Anime& anime) { 37 void Poster::SetAnime(const Anime::Anime& anime) {
38 { 38 {
39 QByteArray* ba = new QByteArray; 39 HTTP::GetThread* thread = new HTTP::GetThread(anime.GetPosterUrl(), {}, this);
40 40
41 QThread* thread = QThread::create([ba, anime] { 41 connect(thread, &HTTP::GetThread::ReceivedData, this, &Poster::ImageDownloadFinished);
42 *ba = HTTP::Get(anime.GetPosterUrl(), {}); 42 connect(thread, &HTTP::GetThread::finished, thread, &HTTP::GetThread::deleteLater);
43 });
44
45 connect(thread, &QThread::finished, this, [this, ba] {
46 ImageDownloadFinished(*ba);
47 delete ba;
48 });
49 43
50 thread->start(); 44 thread->start();
51 } 45 }
52 46
53 label->disconnect(); 47 label->disconnect();
68 } 62 }
69 63
70 void Poster::resizeEvent(QResizeEvent*) { 64 void Poster::resizeEvent(QResizeEvent*) {
71 RenderToLabel(); 65 RenderToLabel();
72 } 66 }
73
74 #include "gui/widgets/moc_poster.cpp"