LogTableModel Class Reference

A filtered view onto the shared LogStore. More...

#include <ArmarXGui/gui-plugins/LoggingPlugin/ArmarXLogViewer/LogTableModel.h>

+ Inheritance diagram for LogTableModel:

Public Types

enum class  UserRoles : int { FullMsgRole = Qt::UserRole + 1 }
 

Public Slots

void refreshMarkers ()
 Rebuild the set of injected pin rows and re-color rows (full reset).
 

Public Member Functions

int addEntries (const std::vector< LogSeq > &seqs, MessageType *batchMaxLevelOut=nullptr)
 Append those of seqs that pass this model's filters, in one insertion.
 
void addFilter (const std::string &columnName, const std::string &filter, MatchMode mode=MatchMode::Contains)
 
int clearData ()
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
void dropRowsBefore (LogSeq firstSeq)
 Discard rows whose store entry has been dropped. Called after the store trims.
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
int getColumn (const std::string &columnName) const
 
QString getCurrentSearchStr ()
 
const std::vector< LogFilter > & getFilters () const
 
const LogMessage & getLogEntry (size_t row) const
 The message shown in the given row. Only valid while the row exists.
 
MessageType getMaxNewLogLevelType ()
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
bool isMaterialised () const
 
bool isRowMarked (int row) const
 Whether the given display row is currently pinned (has a label color).
 
int lineCountAt (int row) const
 Number of display lines of the message column for the given row.
 
 LogTableModel (QObject *parent=0)
 
bool msgContainsString (const LogMessage &logMsg, QString searchStr) const
 
void reapplyAllFilters ()
 
void resetFilters ()
 
bool rowContainsString (int row, const QString &searchStr) const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
int rowForSeq (LogSeq seq) const
 Display row showing seq, or -1 if it is not shown.
 
void search (const QString &searchStr)
 
LogSeq seqAt (int row) const
 Store sequence number of the given display row, or 0 if the row is invalid.
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 
void setMarkerRegistry (LogMarkerRegistry *registry)
 Attach the shared pin registry.
 
void setMaterialised (bool materialised)
 Build rows (materialised) or drop them and only keep counting (not).
 
void setMaxEntries (std::size_t maxEntries)
 Upper bound on displayed rows.
 
void setStore (const LogStore *store)
 Attach the shared backing store. Must be called before any ingestion.
 

Protected Member Functions

bool applyFilter (const LogFilter &filter, const LogMessage &logMsg)
 
bool applyFilters (const LogMessage &logMsg)
 
void enforceMaxEntries ()
 Trim the oldest rows once the display window is exceeded.
 

Detailed Description

A filtered view onto the shared LogStore.

The model does not own any log message. It keeps a vector of LogSeq – one per displayed row – into the store owned by the LogViewer, plus the little per-filter state that genuinely differs between filters (search match, pin color, and whether the row is an injected pin rather than a row this filter accepted).

A model is materialised only while its table is visible. A hidden filter keeps counting the messages it accepts (for the new-message badge) but builds no rows at all, which is what keeps ingestion independent of how many filters exist. Rows are rebuilt from the store when the table is shown again.

Definition at line 93 of file LogTableModel.h.

Member Enumeration Documentation

◆ UserRoles

enum class UserRoles : int
strong
Enumerator
FullMsgRole 

Definition at line 97 of file LogTableModel.h.

Constructor & Destructor Documentation

◆ LogTableModel()

LogTableModel ( QObject * parent = 0)
explicit

Definition at line 94 of file LogTableModel.cpp.

Member Function Documentation

◆ addEntries()

int addEntries ( const std::vector< LogSeq > & seqs,
MessageType * batchMaxLevelOut = nullptr )

Append those of seqs that pass this model's filters, in one insertion.

The messages themselves are read from the shared store. Returns how many were accepted – which is counted even while the model is not materialised, so the new-message badge of a hidden filter stays correct. batchMaxLevelOut, if given, receives the highest severity among the accepted messages.

Definition at line 758 of file LogTableModel.cpp.

+ Here is the call graph for this function:

◆ addFilter()

void addFilter ( const std::string & columnName,
const std::string & filter,
MatchMode mode = MatchMode::Contains )

Definition at line 535 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ applyFilter()

bool applyFilter ( const LogFilter & filter,
const LogMessage & logMsg )
protected

Definition at line 1035 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ applyFilters()

bool applyFilters ( const LogMessage & logMsg)
protected

Definition at line 1077 of file LogTableModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearData()

int clearData ( )

Definition at line 987 of file LogTableModel.cpp.

◆ columnCount()

int columnCount ( const QModelIndex & parent = QModelIndex()) const
override

Definition at line 112 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ data()

QVariant data ( const QModelIndex & index,
int role ) const
override

Definition at line 134 of file LogTableModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dropRowsBefore()

void dropRowsBefore ( LogSeq firstSeq)

Discard rows whose store entry has been dropped. Called after the store trims.

Definition at line 899 of file LogTableModel.cpp.

◆ enforceMaxEntries()

void enforceMaxEntries ( )
protected

Trim the oldest rows once the display window is exceeded.

Definition at line 865 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ flags()

Qt::ItemFlags flags ( const QModelIndex & index) const
override

Definition at line 522 of file LogTableModel.cpp.

+ Here is the call graph for this function:

◆ getColumn()

int getColumn ( const std::string & columnName) const

Definition at line 966 of file LogTableModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentSearchStr()

QString getCurrentSearchStr ( )
inline

Definition at line 124 of file LogTableModel.h.

◆ getFilters()

const std::vector< LogFilter > & getFilters ( ) const
inline

Definition at line 144 of file LogTableModel.h.

◆ getLogEntry()

const LogMessage & getLogEntry ( size_t row) const

The message shown in the given row. Only valid while the row exists.

Definition at line 1014 of file LogTableModel.cpp.

◆ getMaxNewLogLevelType()

MessageType getMaxNewLogLevelType ( )
inline

Definition at line 130 of file LogTableModel.h.

◆ headerData()

QVariant headerData ( int section,
Qt::Orientation orientation,
int role ) const
override

Definition at line 440 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ isMaterialised()

bool isMaterialised ( ) const
inline

Definition at line 160 of file LogTableModel.h.

◆ isRowMarked()

bool isRowMarked ( int row) const

Whether the given display row is currently pinned (has a label color).

Definition at line 955 of file LogTableModel.cpp.

◆ lineCountAt()

int lineCountAt ( int row) const

Number of display lines of the message column for the given row.

Definition at line 1027 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ msgContainsString()

bool msgContainsString ( const LogMessage & logMsg,
QString searchStr ) const

Definition at line 373 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ reapplyAllFilters()

void reapplyAllFilters ( )

Definition at line 550 of file LogTableModel.cpp.

◆ refreshMarkers

void refreshMarkers ( )
slot

Rebuild the set of injected pin rows and re-color rows (full reset).

Definition at line 600 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ resetFilters()

void resetFilters ( )

Definition at line 572 of file LogTableModel.cpp.

◆ rowContainsString()

bool rowContainsString ( int row,
const QString & searchStr ) const

Definition at line 352 of file LogTableModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rowCount()

int rowCount ( const QModelIndex & parent = QModelIndex()) const
override

Definition at line 106 of file LogTableModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rowForSeq()

int rowForSeq ( LogSeq seq) const

Display row showing seq, or -1 if it is not shown.

Definition at line 941 of file LogTableModel.cpp.

◆ search()

void search ( const QString & searchStr)

Definition at line 414 of file LogTableModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ seqAt()

LogSeq seqAt ( int row) const

Store sequence number of the given display row, or 0 if the row is invalid.

Definition at line 930 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ setData()

bool setData ( const QModelIndex & index,
const QVariant & value,
int role )
override

Definition at line 516 of file LogTableModel.cpp.

◆ setMarkerRegistry()

void setMarkerRegistry ( LogMarkerRegistry * registry)

Attach the shared pin registry.

The model then shows registry markers that are not already present as rows of its own (injected, in time position), colors pinned rows, and refreshes whenever the registry changes.

Definition at line 578 of file LogTableModel.cpp.

+ Here is the call graph for this function:

◆ setMaterialised()

void setMaterialised ( bool materialised)

Build rows (materialised) or drop them and only keep counting (not).

Definition at line 730 of file LogTableModel.cpp.

+ Here is the caller graph for this function:

◆ setMaxEntries()

void setMaxEntries ( std::size_t maxEntries)

Upper bound on displayed rows.

0 disables the bound. The store keeps more history than this so that a quiet filter can still fill its window; this bounds what any single table has to lay out and paint.

Definition at line 858 of file LogTableModel.cpp.

+ Here is the call graph for this function:

◆ setStore()

void setStore ( const LogStore * store)

Attach the shared backing store. Must be called before any ingestion.

Definition at line 100 of file LogTableModel.cpp.


The documentation for this class was generated from the following files: