Mercurial > minori
diff src/gui/widgets/poster.cpp @ 76:3364fadc8a36
*: format source code
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 04 Oct 2023 01:46:33 -0400 |
parents | d3e9310598b1 |
children | 6f7385bd334c |
line wrap: on
line diff
--- a/src/gui/widgets/poster.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/gui/widgets/poster.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -1,18 +1,18 @@ #include "gui/widgets/poster.h" -#include "gui/widgets/clickable_label.h" #include "core/anime_db.h" #include "core/http.h" +#include "core/session.h" #include "core/strings.h" -#include "core/session.h" +#include "gui/widgets/clickable_label.h" +#include <QByteArray> +#include <QDebug> +#include <QDesktopServices> #include <QFrame> -#include <QMessageBox> -#include <QLabel> #include <QHBoxLayout> -#include <QByteArray> -#include <QDesktopServices> +#include <QLabel> +#include <QMessageBox> +#include <QPixmap> #include <QUrl> -#include <QDebug> -#include <QPixmap> #include <curl/curl.h> Poster::Poster(int id, QWidget* parent) : QFrame(parent) { @@ -23,10 +23,10 @@ setFixedSize(150, 225); setFrameShape(QFrame::Box); setFrameShadow(QFrame::Plain); - + const Anime::Anime& anime = Anime::db.items[id]; - HTTP::HttpGetThread *image_thread = new HTTP::HttpGetThread(anime.GetPosterUrl(), {}, this); + 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(); @@ -35,9 +35,8 @@ label = new ClickableLabel(this); label->setAlignment(Qt::AlignCenter); - connect(label, &ClickableLabel::clicked, this, [anime]{ - QDesktopServices::openUrl(Strings::ToQString(anime.GetServiceUrl())); - }); + connect(label, &ClickableLabel::clicked, this, + [anime] { QDesktopServices::openUrl(Strings::ToQString(anime.GetServiceUrl())); }); layout->addWidget(label); } @@ -48,7 +47,8 @@ void Poster::RenderToLabel() { QPixmap pixmap = QPixmap::fromImage(img); - if (pixmap.isNull()) return; + if (pixmap.isNull()) + return; label->setPixmap(pixmap.scaled(label->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation)); }