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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
1 #ifndef __ui_utils_h
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
2 #define __ui_utils_h
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
3 #include <QLabel>
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
4 #include <QFrame>
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
5 #include <QWidget>
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
6 #include <QString>
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
7 #include <QPoint>
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
8 #include <QSize>
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
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
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
11 #include <QPlainTextEdit>
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
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
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
14 bool IsInDarkMode();
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
15 std::string GetLengthFromQDateTime(QDateTime stamp);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
16 void SetPlainTextEditData(QPlainTextEdit* text_edit, QString data);
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
17
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
18 class Header : public QWidget {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
19 public:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
20 Header(QString title, QWidget* parent = nullptr);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
21 void SetTitle(QString title);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
22
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
23 private:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
24 QLabel* static_text_title;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
25 QFrame* static_text_line;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
26 };
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
27
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
28 class Paragraph : public QPlainTextEdit {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
29 public:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
30 Paragraph(QString text, QWidget* parent = nullptr);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
31 QSize minimumSizeHint() const override;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
32 QSize sizeHint() const override;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
33 };
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
34
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
35 /* Convenience class that combines Paragraph and Header.
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
36 Fairly awful naming, but meh :') */
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
37 class TextParagraph : public QWidget {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
38 public:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
39 TextParagraph(QString title, QString data, QWidget* parent = nullptr);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
40 Header* GetHeader();
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
41 Paragraph* GetParagraph();
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
42
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
43 private:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
44 Header* header;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
45 Paragraph* paragraph;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
46 };
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
47
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
48 class LabelledTextParagraph : public QWidget {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
49 public:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
50 LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
51 Header* GetHeader();
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
52 Paragraph* GetLabels();
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
53 Paragraph* GetParagraph();
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
54
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
55 private:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
56 Header* header;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
57 Paragraph* labels;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
58 Paragraph* paragraph;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
59 };
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
60
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
61 class SelectableTextParagraph : public QWidget {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
62 public:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
63 SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
64 Header* GetHeader();
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
65 Paragraph* GetParagraph();
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
66
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
67 private:
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
68 Header* header;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
69 Paragraph* paragraph;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
70 };
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
71 };
1
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72 #endif // __ui_utils_h