Mercurial > minori
annotate src/include/ui_utils.h @ 8:b1f73678ef61
update
text paragraphs are now their own objects, as they should be
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 26 Aug 2023 03:39:34 -0400 |
parents | 07a9095eaeed |
children |
rev | line source |
---|---|
2 | 1 #ifndef __ui_utils_h |
2 #define __ui_utils_h | |
8 | 3 #include <QLabel> |
4 #include <QFrame> | |
2 | 5 #include <QWidget> |
6 #include <QString> | |
7 #include <QPoint> | |
8 #include <QSize> | |
9 #include <QDateTime> | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
10 #include <QIcon> |
7 | 11 #include <QPlainTextEdit> |
2 | 12 namespace UiUtils { |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
13 QIcon CreateSideBarIcon(const char* file); |
2 | 14 bool IsInDarkMode(); |
15 std::string GetLengthFromQDateTime(QDateTime stamp); | |
7 | 16 void SetPlainTextEditData(QPlainTextEdit* text_edit, QString data); |
8 | 17 |
18 class Header : public QWidget { | |
19 public: | |
20 Header(QString title, QWidget* parent = nullptr); | |
21 void SetTitle(QString title); | |
22 | |
23 private: | |
24 QLabel* static_text_title; | |
25 QFrame* static_text_line; | |
26 }; | |
27 | |
28 class Paragraph : public QPlainTextEdit { | |
29 public: | |
30 Paragraph(QString text, QWidget* parent = nullptr); | |
31 QSize minimumSizeHint() const override; | |
32 QSize sizeHint() const override; | |
33 }; | |
34 | |
35 /* Convenience class that combines Paragraph and Header. | |
36 Fairly awful naming, but meh :') */ | |
37 class TextParagraph : public QWidget { | |
38 public: | |
39 TextParagraph(QString title, QString data, QWidget* parent = nullptr); | |
40 Header* GetHeader(); | |
41 Paragraph* GetParagraph(); | |
7 | 42 |
8 | 43 private: |
44 Header* header; | |
45 Paragraph* paragraph; | |
46 }; | |
47 | |
48 class LabelledTextParagraph : public QWidget { | |
49 public: | |
50 LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr); | |
51 Header* GetHeader(); | |
52 Paragraph* GetLabels(); | |
53 Paragraph* GetParagraph(); | |
54 | |
55 private: | |
56 Header* header; | |
57 Paragraph* labels; | |
58 Paragraph* paragraph; | |
59 }; | |
60 | |
61 class SelectableTextParagraph : public QWidget { | |
62 public: | |
63 SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr); | |
64 Header* GetHeader(); | |
65 Paragraph* GetParagraph(); | |
66 | |
67 private: | |
68 Header* header; | |
69 Paragraph* paragraph; | |
70 }; | |
2 | 71 }; |
1 | 72 #endif // __ui_utils_h |