Mercurial > minori
annotate include/gui/widgets/text.h @ 101:c537996cf67b
*: multitude of config changes
1. theme is now configurable from the settings menu
(but you have to restart for it to apply)
2. config is now stored in an INI file, with no method of
conversion from json (this repo is private-ish anyway)
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Fri, 03 Nov 2023 14:06:02 -0400 |
| parents | 8043152ef9d4 |
| children | b3549da699a6 |
| rev | line source |
|---|---|
| 46 | 1 #ifndef __gui__ui_utils_h |
| 2 #define __gui__ui_utils_h | |
| 64 | 3 |
| 76 | 4 #include <QLineEdit> |
| 5 #include <QPlainTextEdit> | |
| 69 | 6 #include <QSize> |
| 76 | 7 #include <QString> |
| 8 #include <QWidget> | |
| 69 | 9 |
| 10 class QFrame; | |
| 11 class QLabel; | |
| 64 | 12 |
| 46 | 13 namespace TextWidgets { |
| 14 | |
| 15 class Header : public QWidget { | |
| 16 Q_OBJECT | |
| 17 | |
| 18 public: | |
| 83 | 19 Header(const QString& title, QWidget* parent = nullptr); |
| 20 void SetText(const QString& title); | |
| 46 | 21 |
| 22 private: | |
| 23 QLabel* static_text_title; | |
| 24 QFrame* static_text_line; | |
| 25 }; | |
| 26 | |
| 27 class Paragraph : public QPlainTextEdit { | |
| 28 Q_OBJECT | |
| 29 | |
| 30 public: | |
| 83 | 31 Paragraph(const QString& text, QWidget* parent = nullptr); |
| 32 void SetText(const QString& text); | |
| 46 | 33 QSize minimumSizeHint() const override; |
| 34 QSize sizeHint() const override; | |
| 35 }; | |
| 36 | |
| 75 | 37 class Line : public QLineEdit { |
| 46 | 38 Q_OBJECT |
| 39 | |
| 40 public: | |
| 83 | 41 Line(QWidget* parent = nullptr); |
| 42 Line(const QString& text, QWidget* parent = nullptr); | |
| 43 void SetText(const QString& text); | |
| 75 | 44 }; |
| 45 | |
|
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
46 class Title final : public Line { |
| 75 | 47 Q_OBJECT |
| 48 | |
| 49 public: | |
| 83 | 50 Title(const QString& title, QWidget* parent = nullptr); |
| 75 | 51 }; |
| 52 | |
|
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
53 class Section final : public QWidget { |
| 75 | 54 Q_OBJECT |
| 55 | |
| 56 public: | |
| 83 | 57 Section(const QString& title, const QString& data, QWidget* parent = nullptr); |
| 46 | 58 Header* GetHeader(); |
| 59 Paragraph* GetParagraph(); | |
| 60 | |
| 61 private: | |
| 62 Header* header; | |
| 63 Paragraph* paragraph; | |
| 64 }; | |
| 65 | |
|
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
66 class LabelledSection final : public QWidget { |
| 46 | 67 Q_OBJECT |
| 68 | |
| 69 public: | |
| 83 | 70 LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent = nullptr); |
| 46 | 71 Header* GetHeader(); |
| 72 Paragraph* GetLabels(); | |
| 73 Paragraph* GetParagraph(); | |
| 74 | |
| 75 private: | |
| 76 Header* header; | |
| 77 Paragraph* labels; | |
| 78 Paragraph* paragraph; | |
| 79 }; | |
| 80 | |
|
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
81 class SelectableSection final : public QWidget { |
| 46 | 82 Q_OBJECT |
| 83 | |
| 84 public: | |
| 83 | 85 SelectableSection(const QString& title, const QString& data, QWidget* parent = nullptr); |
| 46 | 86 Header* GetHeader(); |
| 87 Paragraph* GetParagraph(); | |
| 88 | |
| 89 private: | |
| 90 Header* header; | |
| 91 Paragraph* paragraph; | |
| 92 }; | |
| 64 | 93 |
|
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
94 class OneLineSection final : public QWidget { |
| 64 | 95 Q_OBJECT |
| 96 | |
| 97 public: | |
| 83 | 98 OneLineSection(const QString& title, const QString& data, QWidget* parent = nullptr); |
| 75 | 99 Header* GetHeader(); |
| 100 Line* GetLine(); | |
| 101 | |
| 102 private: | |
| 103 Header* header; | |
| 104 Line* line; | |
| 64 | 105 }; |
| 106 | |
| 107 } // namespace TextWidgets | |
| 108 | |
| 46 | 109 #endif // __gui__ui_utils_h |
