annotate include/gui/widgets/poster.h @ 295:b82841e76e79

*: better support on Windows things now look much better in dark mode
author Paper <paper@paper.us.eu.org>
date Sun, 12 May 2024 20:24:09 -0400
parents 9a88e1725fd2
children b1f625b0227c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 254
diff changeset
1 #ifndef MINORI_GUI_WIDGETS_POSTER_H_
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 254
diff changeset
2 #define MINORI_GUI_WIDGETS_POSTER_H_
66
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 #include <QFrame>
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include <QImage>
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
6 #include "gui/widgets/clickable_label.h"
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
7 #include "core/http.h"
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
8
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
9 namespace Anime {
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
10 class Anime;
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
11 }
66
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
13 class Poster final : public QFrame {
254
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
14 Q_OBJECT
66
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15
254
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
16 public:
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
17 Poster(QWidget* parent = nullptr);
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
18 Poster(const Anime::Anime& anime, QWidget* parent = nullptr);
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
19 ~Poster();
254
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
20 void SetAnime(const Anime::Anime& anime);
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
21 void SetClickable(bool clickable);
66
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22
254
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
23 protected:
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
24 void showEvent(QShowEvent*) override;
254
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
25 void resizeEvent(QResizeEvent*) override;
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
26 void ImageDownloadFinished(const QByteArray& arr);
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
27 void RenderToLabel();
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
28 void DownloadPoster();
66
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29
254
d14f8e0e40c3 [UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
30 private:
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
31 /* stored as a pointer to prevent blocking */
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
32 HTTP::RequestThread* get_thread_;
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
33
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
34 QImage img_;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
35 QString service_url_;
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
36 std::string poster_url_;
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
37 ClickableLabel label_;
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
38
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
39 bool clickable_ = true;
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
40 bool need_refresh_ = false;
66
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41 };
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
43 #endif // MINORI_GUI_WIDGETS_POSTER_H_