summaryrefslogtreecommitdiff
path: root/gui/apitracefilter.h
blob: 35f627df431f8a45f0e2647f04ef2c95447cdef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef APITRACEFILTER_H
#define APITRACEFILTER_H

#include <QRegExp>
#include <QSortFilterProxyModel>

class ApiTraceCall;

class ApiTraceFilter : public QSortFilterProxyModel
{
    Q_OBJECT
public:
    enum FilterOption {
        NullFilter        = 0,
        ExtensionsFilter  = 1 << 0,
        ResolutionsFilter = 1 << 1,
        ErrorsQueryFilter = 1 << 2,
        ExtraStateFilter  = 1 << 3,
        CustomFilter      = 1 << 4,
    };
    Q_DECLARE_FLAGS(FilterOptions, FilterOption)
public:
    ApiTraceFilter(QObject *parent = 0);

    FilterOptions filterOptions() const;
    void setFilterOptions(FilterOptions opts);

    void setFilterRegexp(const QRegExp &regexp);
    QRegExp filterRegexp() const;

    void setCustomFilterRegexp(const QString &str);
    QString customFilterRegexp() const;

    QModelIndex indexForCall(ApiTraceCall *call) const;
protected:
    bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;

private:
    QRegExp m_regexp;
    FilterOptions m_filters;
    QRegExp m_customRegexp;
};

#endif