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.

Member Enumeration Documentation

◆ UserRoles

enum class UserRoles : int
strong
Enumerator
FullMsgRole 

Constructor & Destructor Documentation

◆ LogTableModel()

LogTableModel ( QObject * parent = 0)
explicit

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.

◆ addFilter()

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

◆ applyFilter()

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

◆ applyFilters()

bool applyFilters ( const LogMessage & logMsg)
protected

◆ clearData()

int clearData ( )

◆ columnCount()

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

◆ data()

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

◆ dropRowsBefore()

void dropRowsBefore ( LogSeq firstSeq)

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

◆ enforceMaxEntries()

void enforceMaxEntries ( )
protected

Trim the oldest rows once the display window is exceeded.

◆ flags()

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

◆ getColumn()

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

◆ getCurrentSearchStr()

QString getCurrentSearchStr ( )
inline

◆ getFilters()

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

◆ getLogEntry()

const LogMessage & getLogEntry ( size_t row) const

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

◆ getMaxNewLogLevelType()

MessageType getMaxNewLogLevelType ( )
inline

◆ headerData()

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

◆ isMaterialised()

bool isMaterialised ( ) const
inline

◆ isRowMarked()

bool isRowMarked ( int row) const

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

◆ lineCountAt()

int lineCountAt ( int row) const

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

◆ msgContainsString()

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

◆ reapplyAllFilters()

void reapplyAllFilters ( )

◆ refreshMarkers

void refreshMarkers ( )
slot

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

◆ resetFilters()

void resetFilters ( )

◆ rowContainsString()

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

◆ rowCount()

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

◆ rowForSeq()

int rowForSeq ( LogSeq seq) const

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

◆ search()

void search ( const QString & searchStr)

◆ seqAt()

LogSeq seqAt ( int row) const

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

◆ setData()

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

◆ 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.

◆ setMaterialised()

void setMaterialised ( bool materialised)

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

◆ 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.

◆ setStore()

void setStore ( const LogStore * store)

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


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