Mercurial > minori
annotate include/gui/widgets/poster.h @ 335:5098387a3a46
kitsu: remove unused constants, fix token expiration calculation
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 19 Jun 2024 06:11:38 -0400 |
parents | b1f625b0227c |
children | 6b0768158dcd |
rev | line source |
---|---|
301
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
1 #ifndef MINORI_GUI_WIDGETS_POSTER_H_ |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
2 #define MINORI_GUI_WIDGETS_POSTER_H_ |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
3 #include <QFrame> |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
4 #include <QImage> |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
5 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
6 #include "gui/widgets/clickable_label.h" |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
7 #include "core/http.h" |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
8 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
9 namespace Anime { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
10 class Anime; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
11 } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
12 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
13 class Poster final : public QFrame { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
14 Q_OBJECT |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
15 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
16 public: |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
17 Poster(QWidget* parent = nullptr); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
18 Poster(const Anime::Anime& anime, QWidget* parent = nullptr); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
19 ~Poster(); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
20 void SetAnime(const Anime::Anime& anime); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
21 void SetClickable(bool clickable); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
22 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
23 protected: |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
24 void showEvent(QShowEvent*) override; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
25 void resizeEvent(QResizeEvent*) override; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
26 void ImageDownloadFinished(const QByteArray& arr); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
27 void RenderToLabel(); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
28 void DownloadPoster(); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
29 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
30 private: |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
31 /* stored as a pointer to prevent blocking */ |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
32 HTTP::RequestThread* get_thread_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
33 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
34 QImage img_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
35 QString service_url_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
36 std::string poster_url_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
37 ClickableLabel label_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
38 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
39 bool clickable_ = true; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
40 bool need_refresh_ = false; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
41 }; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
42 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
43 #endif // MINORI_GUI_WIDGETS_POSTER_H_ |