46
|
1 #ifndef __gui__ui_utils_h
|
|
2 #define __gui__ui_utils_h
|
|
3 #include <QFrame>
|
|
4 #include <QLabel>
|
|
5 #include <QPlainTextEdit>
|
|
6 #include <QSize>
|
|
7 #include <QString>
|
|
8 #include <QWidget>
|
|
9 namespace TextWidgets {
|
|
10 void SetPlainTextEditData(QPlainTextEdit* text_edit, QString data);
|
|
11
|
|
12 class Header : public QWidget {
|
|
13 Q_OBJECT
|
|
14
|
|
15 public:
|
|
16 Header(QString title, QWidget* parent = nullptr);
|
|
17 void SetTitle(QString title);
|
|
18
|
|
19 private:
|
|
20 QLabel* static_text_title;
|
|
21 QFrame* static_text_line;
|
|
22 };
|
|
23
|
|
24 class Paragraph : public QPlainTextEdit {
|
|
25 Q_OBJECT
|
|
26
|
|
27 public:
|
|
28 Paragraph(QString text, QWidget* parent = nullptr);
|
|
29 QSize minimumSizeHint() const override;
|
|
30 QSize sizeHint() const override;
|
|
31 };
|
|
32
|
|
33 /* technically a paragraph and a heading is actually a
|
|
34 "section", but that name is equally as confusing as
|
|
35 "text paragraph". */
|
|
36 class TextParagraph : public QWidget {
|
|
37 Q_OBJECT
|
|
38
|
|
39 public:
|
|
40 TextParagraph(QString title, QString data, QWidget* parent = nullptr);
|
|
41 Header* GetHeader();
|
|
42 Paragraph* GetParagraph();
|
|
43
|
|
44 private:
|
|
45 Header* header;
|
|
46 Paragraph* paragraph;
|
|
47 };
|
|
48
|
|
49 class LabelledTextParagraph : public QWidget {
|
|
50 Q_OBJECT
|
|
51
|
|
52 public:
|
|
53 LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr);
|
|
54 Header* GetHeader();
|
|
55 Paragraph* GetLabels();
|
|
56 Paragraph* GetParagraph();
|
|
57
|
|
58 private:
|
|
59 Header* header;
|
|
60 Paragraph* labels;
|
|
61 Paragraph* paragraph;
|
|
62 };
|
|
63
|
|
64 class SelectableTextParagraph : public QWidget {
|
|
65 Q_OBJECT
|
|
66
|
|
67 public:
|
|
68 SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr);
|
|
69 Header* GetHeader();
|
|
70 Paragraph* GetParagraph();
|
|
71
|
|
72 private:
|
|
73 Header* header;
|
|
74 Paragraph* paragraph;
|
|
75 };
|
63
|
76 }; // namespace TextWidgets
|
46
|
77 #endif // __gui__ui_utils_h
|