modelfilter.hpp
Go to the documentation of this file.
1 #ifndef MODELFILTER_HPP
2 #define MODELFILTER_HPP
3 
4 #include <chrono>
5 #include <QSortFilterProxyModel>
6 #include <QDateTime>
7 #include <QString>
8 #include <QRegExpValidator>
9 
10 typedef std::chrono::high_resolution_clock::time_point TimePoint;
11 
12 class ModelFilter : public QSortFilterProxyModel
13 {
14  Q_OBJECT
15 public:
16  explicit ModelFilter(QObject *parent = 0);
17 
18  typedef enum{
20  WILDCARDS = 1,
21  REGEX = 2
22  }FilterMode;
23 
24 signals:
25 
26 public slots:
27 
28  void setMessageFilterEnabled(bool enabled);
29  void setNodeFilterEnabled(bool enabled);
30  void setSourceFilterEnabled(bool enabled);
31  void setTimeFilterEnabled(bool enabled);
32 
33  void messageFilterUpdated(FilterMode mode, const QString& text );
34  void nodeFilterUpdated(FilterMode mode, const QString& text );
35  void sourceFilterUpdated(FilterMode mode, const QString& text );
36  void timeMinMaxUpdated(TimePoint min, TimePoint max);
37 
38  void setSeverityInfoEnabled(bool enabled);
39  void setSeverityDebugEnabled(bool enabled);
40  void setSeverityErrorEnabled(bool enabled);
41  void setSeverityWarningsEnabled(bool enabled);
42 
43 private:
44  bool applyFilter(const QString &filter, ModelFilter::FilterMode mode,
45  const QString& text_to_parse, const QRegExpValidator *validator) const;
46 
47 protected:
48  virtual bool filterAcceptsRow(int sourceRow,
49  const QModelIndex &sourceParent) const override;
50 
53 
58 
63 
67 
68  QString _node_text;
69  QString _msg_text;
70  QString _source_text;
71 
72  QRegExpValidator _node_validator;
73  QRegExpValidator _msg_validator;
74  QRegExpValidator _source_validator;
75 };
76 
77 #endif // MODELFILTER_HPP
QRegExpValidator _msg_validator
Definition: modelfilter.hpp:73
std::chrono::high_resolution_clock::time_point TimePoint
FilterMode _node_mode
Definition: modelfilter.hpp:64
bool _msg_filter_enabled
Definition: modelfilter.hpp:56
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
bool _error_filter_enabled
Definition: modelfilter.hpp:61
void timeMinMaxUpdated(TimePoint min, TimePoint max)
Definition: modelfilter.cpp:92
FilterMode _source_mode
Definition: modelfilter.hpp:66
bool _time_filter_enabled
Definition: modelfilter.hpp:57
QString _msg_text
Definition: modelfilter.hpp:69
bool _debug_filter_enabled
Definition: modelfilter.hpp:59
std::chrono::high_resolution_clock::time_point TimePoint
Definition: modelfilter.hpp:10
void setSourceFilterEnabled(bool enabled)
Definition: modelfilter.cpp:31
void sourceFilterUpdated(FilterMode mode, const QString &text)
Definition: modelfilter.cpp:76
FilterMode _msg_mode
Definition: modelfilter.hpp:65
QRegExpValidator _source_validator
Definition: modelfilter.hpp:74
void setNodeFilterEnabled(bool enabled)
Definition: modelfilter.cpp:25
void messageFilterUpdated(FilterMode mode, const QString &text)
Definition: modelfilter.cpp:43
void setSeverityInfoEnabled(bool enabled)
Definition: modelfilter.cpp:99
void setSeverityErrorEnabled(bool enabled)
bool _info_filter_enabled
Definition: modelfilter.hpp:60
bool _source_filter_enabled
Definition: modelfilter.hpp:55
void setTimeFilterEnabled(bool enabled)
Definition: modelfilter.cpp:37
QRegExpValidator _node_validator
Definition: modelfilter.hpp:72
void nodeFilterUpdated(FilterMode mode, const QString &text)
Definition: modelfilter.cpp:60
void setSeverityDebugEnabled(bool enabled)
void setSeverityWarningsEnabled(bool enabled)
TimePoint _max
Definition: modelfilter.hpp:52
bool applyFilter(const QString &filter, ModelFilter::FilterMode mode, const QString &text_to_parse, const QRegExpValidator *validator) const
void setMessageFilterEnabled(bool enabled)
Definition: modelfilter.cpp:19
TimePoint _min
Definition: modelfilter.hpp:51
QString _node_text
Definition: modelfilter.hpp:68
bool _warn_filter_enabled
Definition: modelfilter.hpp:62
ModelFilter(QObject *parent=0)
Definition: modelfilter.cpp:5
bool _node_filter_enabled
Definition: modelfilter.hpp:54
QString _source_text
Definition: modelfilter.hpp:70


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17