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