annotate include/gui/widgets/text.h @ 327:b5d6c27c308f

anime: refactor Anime::SeriesSeason to Season class ToLocalString has also been altered to take in both season and year because lots of locales actually treat formatting seasons differently! most notably is Russian which adds a suffix at the end to notate seasons(??)
author Paper <paper@paper.us.eu.org>
date Thu, 13 Jun 2024 01:49:18 -0400
parents b82841e76e79
children 6b0768158dcd
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: 258
diff changeset
1 #ifndef MINORI_GUI_WIDGETS_TEXT_H_
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
2 #define MINORI_GUI_WIDGETS_TEXT_H_
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
3
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
4 #include <QLineEdit>
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
5 #include <QPlainTextEdit>
69
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
6 #include <QSize>
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
7 #include <QString>
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
8 #include <QWidget>
69
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
9
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
10 class QFrame;
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
11
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
12 #include <QLabel>
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
13
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 namespace TextWidgets {
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 class Header : public QWidget {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
17 Q_OBJECT
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
19 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
20 Header(const QString& title, QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
21 void SetText(const QString& title);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
23 private:
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
24 QLabel static_text_title;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
25 QFrame static_text_line;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
28 class Paragraph : public QWidget {
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
29 Q_OBJECT
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
31 public:
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
32 Paragraph(const QString& text, QWidget* parent = nullptr);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
33 void SetText(const QString& text);
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
34 QPlainTextEdit* GetLabel();
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
35
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
36 protected:
295
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
37 bool hasHeightForWidth() const override;
b82841e76e79 *: better support on Windows
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
38 int heightForWidth(int w) const override;
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
39
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
40 private:
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
41 QPlainTextEdit text_edit;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
44 class LabelledParagraph final : public QWidget {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
45 Q_OBJECT
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
46
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
47 public:
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
48 LabelledParagraph(const QString& label, const QString& data, QWidget* parent = nullptr);
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
49 QLabel* GetLabels();
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
50 QLabel* GetData();
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
51
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
52 /* synonymous with GetData(), kept for compatibility. don't use in new code!!! */
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
53 QLabel* GetParagraph();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
55 private:
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
56 QLabel labels_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
57 QLabel data_;
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
58 };
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
59
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
60 class Line : public QWidget {
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
61 Q_OBJECT
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
62
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
63 public:
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
64 Line(QWidget* parent = nullptr);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
65 Line(const QString& text, QWidget* parent = nullptr);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
66 void SetText(const QString& text);
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
67
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
68 protected:
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
69 QLineEdit line_edit_;
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
70 };
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
71
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
72 class Title final : public Line {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
73 Q_OBJECT
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
74
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
75 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
76 Title(const QString& title, QWidget* parent = nullptr);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
77 };
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
78
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
79 class Section final : public QWidget {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
80 Q_OBJECT
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
81
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
82 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
83 Section(const QString& title, const QString& data, QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
84 Header* GetHeader();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
85 Paragraph* GetParagraph();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
87 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
88 Header* header;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
89 Paragraph* paragraph;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
92 class LabelledSection final : public QWidget {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
93 Q_OBJECT
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
95 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
96 LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
97 Header* GetHeader();
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
98 QLabel* GetLabels();
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
99 QLabel* GetData();
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
100 QLabel* GetParagraph();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
102 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
103 Header* header;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
104 LabelledParagraph* content;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
105 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
107 class SelectableSection final : public QWidget {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
108 Q_OBJECT
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
110 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
111 SelectableSection(const QString& title, const QString& data, QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
112 Header* GetHeader();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
113 Paragraph* GetParagraph();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
115 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
116 Header* header;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
117 Paragraph* paragraph;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
118 };
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
119
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
120 class OneLineSection final : public QWidget {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
121 Q_OBJECT
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
122
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
123 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
124 OneLineSection(const QString& title, const QString& data, QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
125 Header* GetHeader();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
126 Line* GetLine();
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
127
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
128 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
129 Header* header;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
130 Line* line;
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
131 };
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
132
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
133 } // namespace TextWidgets
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
134
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
135 #endif // MINORI_GUI_WIDGETS_TEXT_H_