Mercurial > minori
annotate include/gui/widgets/poster.h @ 367:8d45d892be88 default tip
*: instead of pugixml, use Qt XML features
this means we have one extra Qt dependency though...
author | Paper <paper@tflc.us> |
---|---|
date | Sun, 17 Nov 2024 22:55:47 -0500 |
parents | 6b0768158dcd |
children |
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 |
348
6b0768158dcd
text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
23 bool hasHeightForWidth(void) const override; |
6b0768158dcd
text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
24 int heightForWidth(int w) const override; |
6b0768158dcd
text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
25 |
301
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
26 protected: |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
27 void showEvent(QShowEvent*) override; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
28 void resizeEvent(QResizeEvent*) override; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
29 void ImageDownloadFinished(const QByteArray& arr); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
30 void RenderToLabel(); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
31 void DownloadPoster(); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
32 |
348
6b0768158dcd
text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
33 QSize sizeHint() const override; |
6b0768158dcd
text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
34 QSize minimumSizeHint() const override; |
6b0768158dcd
text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
35 |
301
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
36 private: |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
37 /* stored as a pointer to prevent blocking */ |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
38 HTTP::RequestThread* get_thread_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
39 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
40 QImage img_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
41 QString service_url_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
42 std::string poster_url_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
43 ClickableLabel label_; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
44 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
45 bool clickable_ = true; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
46 bool need_refresh_ = false; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
47 }; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
48 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
49 #endif // MINORI_GUI_WIDGETS_POSTER_H_ |