2022-03-26 09:09:24 +00:00
|
|
|
#pragma once
|
|
|
|
#include <qwidget.h>
|
|
|
|
#include "../../QSbieAPI/SbieAPI.h"
|
|
|
|
#include "../../MiscHelpers/Common/TreeItemModel.h"
|
|
|
|
|
|
|
|
|
|
|
|
class CMonitorEntry : public QSharedData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CMonitorEntry(const QString& Name, quint8 Type) {
|
|
|
|
m_Name = Name;
|
|
|
|
m_Type = Type;
|
|
|
|
m_Counter = 0;
|
|
|
|
m_bOpen = false;
|
|
|
|
m_bClosed = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString GetName() const { return m_Name; }
|
|
|
|
QString GetStautsStr() const {
|
|
|
|
QString Status;
|
|
|
|
if (m_bOpen)
|
|
|
|
Status.append("O ");
|
|
|
|
if (m_bClosed)
|
|
|
|
Status.append("X ");
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
QString GetTypeStr() const { return CTraceEntry::GetTypeStr(m_Type); }
|
|
|
|
int GetCount() const { return m_Counter; }
|
|
|
|
|
|
|
|
void Merge(const CTraceEntryPtr& pEntry) {
|
2023-01-07 15:57:55 +00:00
|
|
|
#ifdef USE_MERGE_TRACE
|
2022-03-26 09:09:24 +00:00
|
|
|
m_Counter += pEntry->GetCount();
|
2023-01-07 15:57:55 +00:00
|
|
|
#else
|
|
|
|
m_Counter++;
|
|
|
|
#endif
|
2022-03-26 09:09:24 +00:00
|
|
|
if (!m_bOpen && pEntry->IsOpen())
|
|
|
|
m_bOpen = true;
|
|
|
|
if (!m_bClosed && pEntry->IsClosed())
|
|
|
|
m_bClosed = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QString m_Name;
|
|
|
|
int m_Counter;
|
|
|
|
quint8 m_Type;
|
|
|
|
bool m_bOpen;
|
|
|
|
bool m_bClosed;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef QSharedDataPointer<CMonitorEntry> CMonitorEntryPtr;
|
|
|
|
|
|
|
|
class CMonitorModel : public CTreeItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CMonitorModel(QObject* parent = 0);
|
|
|
|
~CMonitorModel();
|
|
|
|
|
2023-01-07 15:57:55 +00:00
|
|
|
void SetObjTree(bool bTree) { m_bObjTree = bTree; }
|
|
|
|
bool IsObjTree() const { return m_bObjTree; }
|
|
|
|
|
|
|
|
QList<QModelIndex> Sync(const QMap<QString, CMonitorEntryPtr>& EntryMap, void* params);
|
2022-03-26 09:09:24 +00:00
|
|
|
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
enum EColumns
|
|
|
|
{
|
|
|
|
eType = 0,
|
|
|
|
eStatus,
|
|
|
|
eValue,
|
|
|
|
eCounter,
|
|
|
|
eCount
|
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
struct STraceNode : STreeNode
|
|
|
|
{
|
2023-05-29 19:50:51 +01:00
|
|
|
STraceNode(CTreeItemModel* pModel, const QVariant& Id) : STreeNode(pModel, Id) { }
|
2022-03-26 09:09:24 +00:00
|
|
|
|
|
|
|
CMonitorEntryPtr pEntry;
|
|
|
|
};
|
|
|
|
|
2023-05-29 19:50:51 +01:00
|
|
|
virtual STreeNode* MkNode(const QVariant& Id) { return new STraceNode(this, Id); }
|
2023-01-07 15:57:55 +00:00
|
|
|
virtual STreeNode* MkVirtualNode(const QVariant& Id, STreeNode* pParent);
|
|
|
|
|
|
|
|
bool m_bObjTree;
|
2022-03-26 09:09:24 +00:00
|
|
|
};
|