comparison include/gui/widgets/text.h @ 75:d3e9310598b1

*: refactor some stuff text: "TextParagraph"s are now called sections, because that's the actual word for it :P text: new classes: Line and OneLineSection, solves many problems with paragraphs that are only one line long (ex. going out of bounds) http: reworked http stuff to allow threaded get requests, also moved it to its own file to (hopefully) remove clutter eventually I'll make a threaded post request method and use that in the "basic" function
author Paper <mrpapersonic@gmail.com>
date Wed, 04 Oct 2023 01:42:30 -0400
parents 27a19dd6cba1
children 3364fadc8a36
comparison
equal deleted inserted replaced
74:5ccb99bfa605 75:d3e9310598b1
3 3
4 #include <QWidget> 4 #include <QWidget>
5 #include <QString> 5 #include <QString>
6 #include <QSize> 6 #include <QSize>
7 #include <QPlainTextEdit> 7 #include <QPlainTextEdit>
8 #include <QLineEdit>
8 9
9 class QFrame; 10 class QFrame;
10 class QLabel; 11 class QLabel;
11 12
12 namespace TextWidgets { 13 namespace TextWidgets {
31 void SetText(QString text); 32 void SetText(QString text);
32 QSize minimumSizeHint() const override; 33 QSize minimumSizeHint() const override;
33 QSize sizeHint() const override; 34 QSize sizeHint() const override;
34 }; 35 };
35 36
36 /* technically a paragraph and a heading is actually a 37 class Line : public QLineEdit {
37 "section", but that name is equally as confusing as
38 "text paragraph". */
39 class TextParagraph : public QWidget {
40 Q_OBJECT 38 Q_OBJECT
41 39
42 public: 40 public:
43 TextParagraph(QString title, QString data, QWidget* parent = nullptr); 41 Line(QString text, QWidget* parent = nullptr);
42 };
43
44 class Title : public Line {
45 Q_OBJECT
46
47 public:
48 Title(QString title, QWidget* parent = nullptr);
49 };
50
51 class Section : public QWidget {
52 Q_OBJECT
53
54 public:
55 Section(QString title, QString data, QWidget* parent = nullptr);
44 Header* GetHeader(); 56 Header* GetHeader();
45 Paragraph* GetParagraph(); 57 Paragraph* GetParagraph();
46 58
47 private: 59 private:
48 Header* header; 60 Header* header;
49 Paragraph* paragraph; 61 Paragraph* paragraph;
50 }; 62 };
51 63
52 class LabelledTextParagraph : public QWidget { 64 class LabelledSection : public QWidget {
53 Q_OBJECT 65 Q_OBJECT
54 66
55 public: 67 public:
56 LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr); 68 LabelledSection(QString title, QString label, QString data, QWidget* parent = nullptr);
57 Header* GetHeader(); 69 Header* GetHeader();
58 Paragraph* GetLabels(); 70 Paragraph* GetLabels();
59 Paragraph* GetParagraph(); 71 Paragraph* GetParagraph();
60 72
61 private: 73 private:
62 Header* header; 74 Header* header;
63 Paragraph* labels; 75 Paragraph* labels;
64 Paragraph* paragraph; 76 Paragraph* paragraph;
65 }; 77 };
66 78
67 class SelectableTextParagraph : public QWidget { 79 class SelectableSection : public QWidget {
68 Q_OBJECT 80 Q_OBJECT
69 81
70 public: 82 public:
71 SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr); 83 SelectableSection(QString title, QString data, QWidget* parent = nullptr);
72 Header* GetHeader(); 84 Header* GetHeader();
73 Paragraph* GetParagraph(); 85 Paragraph* GetParagraph();
74 86
75 private: 87 private:
76 Header* header; 88 Header* header;
77 Paragraph* paragraph; 89 Paragraph* paragraph;
78 }; 90 };
79 91
80 class Title : public Paragraph { 92 class OneLineSection : public QWidget {
81 Q_OBJECT 93 Q_OBJECT
82 94
83 public: 95 public:
84 Title(QString title, QWidget* parent = nullptr); 96 OneLineSection(QString title, QString data, QWidget* parent = nullptr);
97 Header* GetHeader();
98 Line* GetLine();
99
100 private:
101 Header* header;
102 Line* line;
85 }; 103 };
86 104
87 } // namespace TextWidgets 105 } // namespace TextWidgets
88 106
89 #endif // __gui__ui_utils_h 107 #endif // __gui__ui_utils_h