diff 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
line wrap: on
line diff
--- a/src/include/ui_utils.h	Thu Aug 24 23:11:38 2023 -0400
+++ b/src/include/ui_utils.h	Sat Aug 26 03:39:34 2023 -0400
@@ -1,5 +1,7 @@
 #ifndef __ui_utils_h
 #define __ui_utils_h
+#include <QLabel>
+#include <QFrame>
 #include <QWidget>
 #include <QString>
 #include <QPoint>
@@ -11,17 +13,60 @@
 	QIcon CreateSideBarIcon(const char* file);
 	bool IsInDarkMode();
 	std::string GetLengthFromQDateTime(QDateTime stamp);
-	QPlainTextEdit* CreateTextParagraph(QWidget* parent, QString title, QString data);
-	QPlainTextEdit* CreateTextParagraphWithLabels(QWidget* parent, QString title, QString label, QString data);
-	QPlainTextEdit* CreateSelectableTextParagraph(QWidget* parent, QString title, QString data);
 	void SetPlainTextEditData(QPlainTextEdit* text_edit, QString data);
-	void CreateTextHeader(QWidget* parent, QString title);
-};
+
+	class Header : public QWidget {
+		public:
+			Header(QString title, QWidget* parent = nullptr);
+			void SetTitle(QString title);
+
+		private:
+			QLabel* static_text_title;
+			QFrame* static_text_line;
+	};
+
+	class Paragraph : public QPlainTextEdit {
+		public:
+			Paragraph(QString text, QWidget* parent = nullptr);
+			QSize minimumSizeHint() const override;
+			QSize sizeHint() const override;
+	};
+
+	/* Convenience class that combines Paragraph and Header.
+	   Fairly awful naming, but meh :') */
+	class TextParagraph : public QWidget {
+		public:
+			TextParagraph(QString title, QString data, QWidget* parent = nullptr);
+			Header* GetHeader();
+			Paragraph* GetParagraph();
 
-class Paragraph : public QPlainTextEdit {
-	public:
-		Paragraph(QString text, QWidget* parent = nullptr);
-		QSize minimumSizeHint() const override;
-		QSize sizeHint() const override;
+		private:
+			Header* header;
+			Paragraph* paragraph;
+	};
+
+	class LabelledTextParagraph : public QWidget {
+		public:
+			LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr);
+			Header* GetHeader();
+			Paragraph* GetLabels();
+			Paragraph* GetParagraph();
+
+		private:
+			Header* header;
+			Paragraph* labels;
+			Paragraph* paragraph;
+	};
+
+	class SelectableTextParagraph : public QWidget {
+		public:
+			SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr);
+			Header* GetHeader();
+			Paragraph* GetParagraph();
+
+		private:
+			Header* header;
+			Paragraph* paragraph;
+	};
 };
 #endif // __ui_utils_h
\ No newline at end of file