]> git.cworth.org Git - apitrace/blob - gui/apitracefilter.h
Highly optimize searching and fix a crash.
[apitrace] / gui / apitracefilter.h
1 #ifndef APITRACEFILTER_H
2 #define APITRACEFILTER_H
3
4 #include <QSortFilterProxyModel>
5
6 class ApiTraceCall;
7
8 class ApiTraceFilter : public QSortFilterProxyModel
9 {
10     Q_OBJECT
11 public:
12     enum FilterOption {
13         NullFilter        =  0,
14         ExtensionsFilter  = 1 << 0,
15         ResolutionsFilter = 1 << 1,
16         ErrorsQueryFilter = 1 << 2,
17         ExtraStateFilter  = 1 << 3,
18     };
19     Q_DECLARE_FLAGS(FilterOptions, FilterOption)
20 public:
21     ApiTraceFilter(QObject *parent = 0);
22
23     FilterOptions filterOptions() const;
24     void setFilterOptions(FilterOptions opts);
25
26     void setFilterString(const QString &text);
27
28     QModelIndex callIndex(int callNum) const;
29     QModelIndex indexForCall(ApiTraceCall *call) const;
30 protected:
31     bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
32
33 private:
34     QString m_text;
35     FilterOptions m_filters;
36 };
37
38 #endif