aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/widgets/LogView.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-11-22 03:55:16 +0100
committerPetr Mrázek <peterix@gmail.com>2021-11-22 03:55:16 +0100
commitb258eac215c791b2a8eed10cecbbf9551c87f0b9 (patch)
tree1ae72f62d344f6a9c982b9dc5d598d32fc742acc /launcher/ui/widgets/LogView.h
parent5040231f8d6ca865ea50250509c3315ea0c7400e (diff)
downloadPrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.gz
PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.bz2
PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.zip
NOISSUE continue reshuffling the codebase
Diffstat (limited to 'launcher/ui/widgets/LogView.h')
-rw-r--r--launcher/ui/widgets/LogView.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/launcher/ui/widgets/LogView.h b/launcher/ui/widgets/LogView.h
new file mode 100644
index 00000000..3143360a
--- /dev/null
+++ b/launcher/ui/widgets/LogView.h
@@ -0,0 +1,36 @@
+#pragma once
+#include <QPlainTextEdit>
+#include <QAbstractItemView>
+
+class QAbstractItemModel;
+
+class LogView: public QPlainTextEdit
+{
+ Q_OBJECT
+public:
+ explicit LogView(QWidget *parent = nullptr);
+ virtual ~LogView();
+
+ virtual void setModel(QAbstractItemModel *model);
+ QAbstractItemModel *model() const;
+
+public slots:
+ void setWordWrap(bool wrapping);
+ void findNext(const QString & what, bool reverse);
+ void scrollToBottom();
+
+protected slots:
+ void repopulate();
+ // note: this supports only appending
+ void rowsInserted(const QModelIndex &parent, int first, int last);
+ void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
+ // note: this supports only removing from front
+ void rowsRemoved(const QModelIndex &parent, int first, int last);
+ void modelDestroyed(QObject * model);
+
+protected:
+ QAbstractItemModel *m_model = nullptr;
+ QTextCharFormat *m_defaultFormat = nullptr;
+ bool m_scroll = false;
+ bool m_scrolling = false;
+};