view include/gui/widgets/poster.h @ 291:9a88e1725fd2

*: refactor lots of stuff I forgot to put this into different commits, oops! anyway, it doesn't really matter *that* much since this is an unfinished hobby project anyway. once it starts getting stable commit history will be more important, but for now it's not that big of a deal
author Paper <paper@paper.us.eu.org>
date Sun, 12 May 2024 16:31:07 -0400
parents f31305b9f60a
children b82841e76e79
line wrap: on
line source

#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"

class QWidget;
namespace Anime {
class Anime;
}

class Poster final : public QFrame {
	Q_OBJECT

public:
	Poster(QWidget* parent = nullptr);
	Poster(const Anime::Anime& anime, QWidget* parent = nullptr);
	void SetAnime(const Anime::Anime& anime);
	void SetClickable(bool clickable);

protected:
	void resizeEvent(QResizeEvent*) override;
	void ImageDownloadFinished(const QByteArray& arr);
	void RenderToLabel();

private:
	HTTP::RequestThread get_thread_;

	QImage img_;
	QString service_url_;
	ClickableLabel label_;
	bool clickable_ = true;
};

#endif // MINORI_GUI_WIDGETS_POSTER_H_