Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
log_filter_model.h
1#pragma once
2
3#include <QSortFilterProxyModel>
4
5#include "logging.h"
6
10class LogFilterProxyModel : public QSortFilterProxyModel
11{
12 Q_OBJECT
13
14public:
20 LogFilterProxyModel(QObject* parent = nullptr);
21
27 void setLevelEnabled(logging::LogLevel level, bool enabled);
28
34 void setSourceFilter(const QString& source);
35 void setSourceEnabled(const QString& source, bool enabled);
36
42 void setFileFilter(const QString& source);
43
49 void setTextFilter(const QString& text);
50
51protected:
59 bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
60
61private:
62 QSet<logging::LogLevel> mEnabledLevels;
63 QSet<QString> mSourcesLevels;
64 QString mFileFilter;
65 QString mTextFilter;
66};
void setLevelEnabled(logging::LogLevel level, bool enabled)
Sets the filter for log levels.
Definition log_filter_model.cpp:14
void setFileFilter(const QString &source)
Sets the filter for file names.
Definition log_filter_model.cpp:24
void setSourceFilter(const QString &source)
Sets the filter for source names.
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Determines whether a row should be accepted based on the current filters.
Definition log_filter_model.cpp:46
LogFilterProxyModel(QObject *parent=nullptr)
Constructs a new LogFilterProxyModel with the given parent object.
Definition log_filter_model.cpp:5
QString mTextFilter
The current file name filter.
Definition log_filter_model.h:65
void setTextFilter(const QString &text)
Sets the text filter for log entries.
Definition log_filter_model.cpp:40
QString mFileFilter
The currently enabled sources.
Definition log_filter_model.h:64
QSet< QString > mSourcesLevels
The currently enabled log levels.
Definition log_filter_model.h:63