MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / LogModel

Class LogModel

launcher/launch/LogModel.h:7–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "MessageLevel.h"
6
7class LogModel : public QAbstractListModel
8{
9 Q_OBJECT
10public:
11 explicit LogModel(QObject *parent = 0);
12
13 int rowCount(const QModelIndex &parent = QModelIndex()) const;
14 QVariant data(const QModelIndex &index, int role) const;
15
16 void append(MessageLevel::Enum, QString line);
17 void clear();
18
19 void suspend(bool suspend);
20 bool suspended();
21
22 QString toPlainText();
23
24 int getMaxLines();
25 void setMaxLines(int maxLines);
26 void setStopOnOverflow(bool stop);
27 void setOverflowMessage(const QString & overflowMessage);
28
29 void setLineWrap(bool state);
30 bool wrapLines() const;
31
32 enum Roles
33 {
34 LevelRole = Qt::UserRole
35 };
36
37private /* types */:
38 struct entry
39 {
40 MessageLevel::Enum level;
41 QString line;
42 };
43
44private: /* data */
45 QVector <entry> m_content;
46 int m_maxLines = 1000;
47 // first line in the circular buffer
48 int m_firstLine = 0;
49 // number of lines occupied in the circular buffer
50 int m_numLines = 0;
51 bool m_stopOnOverflow = false;
52 QString m_overflowMessage = "OVERFLOW";
53 bool m_suspended = false;
54 bool m_lineWrap = true;
55
56private:
57 Q_DISABLE_COPY(LogModel)
58};

Callers

nothing calls this directly

Calls 1

QModelIndexClass · 0.85

Tested by

no test coverage detected