Mercurial > minori
diff include/gui/widgets/poster.h @ 301:b1f625b0227c
*: convert all files CRLF -> LF
some files were in DOS format, others were in unix. now everything
(that at least is under our control) should all be the same format
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 13 May 2024 15:04:51 -0400 |
parents | b82841e76e79 |
children | 6b0768158dcd |
line wrap: on
line diff
--- a/include/gui/widgets/poster.h Mon May 13 14:56:37 2024 -0400 +++ b/include/gui/widgets/poster.h Mon May 13 15:04:51 2024 -0400 @@ -1,43 +1,43 @@ -#ifndef MINORI_GUI_WIDGETS_POSTER_H_ -#define MINORI_GUI_WIDGETS_POSTER_H_ -#include <QFrame> -#include <QImage> - -#include "gui/widgets/clickable_label.h" -#include "core/http.h" - -namespace Anime { -class Anime; -} - -class Poster final : public QFrame { - Q_OBJECT - -public: - Poster(QWidget* parent = nullptr); - Poster(const Anime::Anime& anime, QWidget* parent = nullptr); - ~Poster(); - void SetAnime(const Anime::Anime& anime); - void SetClickable(bool clickable); - -protected: - void showEvent(QShowEvent*) override; - void resizeEvent(QResizeEvent*) override; - void ImageDownloadFinished(const QByteArray& arr); - void RenderToLabel(); - void DownloadPoster(); - -private: - /* stored as a pointer to prevent blocking */ - HTTP::RequestThread* get_thread_; - - QImage img_; - QString service_url_; - std::string poster_url_; - ClickableLabel label_; - - bool clickable_ = true; - bool need_refresh_ = false; -}; - -#endif // MINORI_GUI_WIDGETS_POSTER_H_ +#ifndef MINORI_GUI_WIDGETS_POSTER_H_ +#define MINORI_GUI_WIDGETS_POSTER_H_ +#include <QFrame> +#include <QImage> + +#include "gui/widgets/clickable_label.h" +#include "core/http.h" + +namespace Anime { +class Anime; +} + +class Poster final : public QFrame { + Q_OBJECT + +public: + Poster(QWidget* parent = nullptr); + Poster(const Anime::Anime& anime, QWidget* parent = nullptr); + ~Poster(); + void SetAnime(const Anime::Anime& anime); + void SetClickable(bool clickable); + +protected: + void showEvent(QShowEvent*) override; + void resizeEvent(QResizeEvent*) override; + void ImageDownloadFinished(const QByteArray& arr); + void RenderToLabel(); + void DownloadPoster(); + +private: + /* stored as a pointer to prevent blocking */ + HTTP::RequestThread* get_thread_; + + QImage img_; + QString service_url_; + std::string poster_url_; + ClickableLabel label_; + + bool clickable_ = true; + bool need_refresh_ = false; +}; + +#endif // MINORI_GUI_WIDGETS_POSTER_H_