Plasma Engine  2.0
Loading...
Searching...
No Matches
LogModel.moc.h
1#pragma once
2
3#include <Foundation/Basics.h>
4#include <Foundation/Containers/Deque.h>
5#include <Foundation/Logging/LogEntry.h>
6#include <GuiFoundation/GuiFoundationDLL.h>
7#include <QAbstractItemModel>
8
10class PL_GUIFOUNDATION_DLL plQtLogModel : public QAbstractItemModel
11{
12 Q_OBJECT
13
14public:
15 plQtLogModel(QObject* pParent);
16 void Clear();
17 void SetLogLevel(plLogMsgType::Enum logLevel);
18 void SetSearchText(const char* szText);
19 void AddLogMsg(const plLogEntry& msg);
20
21 plUInt32 GetVisibleItemCount() const { return m_VisibleMessages.GetCount(); }
22
23 plUInt32 GetNumErrors() const { return m_uiNumErrors; }
24 plUInt32 GetNumSeriousWarnings() const { return m_uiNumSeriousWarnings; }
25 plUInt32 GetNumWarnings() const { return m_uiNumWarnings; }
26
27public: // QAbstractItemModel interface
28 virtual QVariant data(const QModelIndex& index, int iRole) const override;
29 virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
30 virtual QVariant headerData(int iSection, Qt::Orientation orientation, int iRole = Qt::DisplayRole) const override;
31 virtual QModelIndex index(int iRow, int iColumn, const QModelIndex& parent = QModelIndex()) const override;
32 virtual QModelIndex parent(const QModelIndex& index) const override;
33 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
34 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
35
36Q_SIGNALS:
37 void NewErrorsOrWarnings(const char* szLatest, bool bError);
38
39private Q_SLOTS:
41 void ProcessNewMessages();
42
43private:
44 void Invalidate();
45 bool IsFiltered(const plLogEntry& lm) const;
46 void UpdateVisibleEntries() const;
47
48 plLogMsgType::Enum m_LogLevel;
49 plString m_sSearchText;
50 plDeque<plLogEntry> m_AllMessages;
51
52 mutable bool m_bIsValid;
53 mutable plDeque<const plLogEntry*> m_VisibleMessages;
54 mutable plHybridArray<const plLogEntry*, 16> m_BlockQueue;
55
56 mutable plMutex m_NewMessagesMutex;
57 plDeque<plLogEntry> m_NewMessages;
58
59 plUInt32 m_uiNumErrors = 0;
60 plUInt32 m_uiNumSeriousWarnings = 0;
61 plUInt32 m_uiNumWarnings = 0;
62};
63
Definition Deque.h:270
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Provides a simple mechanism for mutual exclusion to prevent multiple threads from accessing a shared ...
Definition Mutex.h:13
The Qt model that represents log output for a view.
Definition LogModel.moc.h:11
A persistent log entry created from a plLoggingEventData. Allows for a log event to survive for longe...
Definition LogEntry.h:14
Enum
Definition Log.h:29