Mercurial > minori
view include/gui/widgets/poster.h @ 347:a0aa8c8c4307
dep/anitomy: port to use UCS-4 rather than wide strings
rationale: wide strings are not the same on every platform, and
might not even be Unicode. (while they usually are, its possible
that they are not)
I was *going* to change StringToInt to use a string stream, but
outputting to an integer doesn't seem to work at all with UCS-4,
even though it ought to, so I just rolled my own that uses the
arabic digits only.
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 23 Jun 2024 10:32:09 -0400 |
parents | b1f625b0227c |
children | 6b0768158dcd |
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" 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_