![Roland Knall](/assets/img/avatar_default.png)
Change-Id: I5b6f11b3a5736b50c6928081df16f6bdb5125ea8 Reviewed-on: https://code.wireshark.org/review/34881 Petri-Dish: Roland Knall <rknall@gmail.com> Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com> Reviewed-by: Roland Knall <rknall@gmail.com>
78 lines
1.9 KiB
C++
78 lines
1.9 KiB
C++
/* filter_list_model.h
|
|
* Model for all filter types
|
|
*
|
|
* Wireshark - Network traffic analyzer
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
* Copyright 1998 Gerald Combs
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef FILTER_LIST_MODEL_h
|
|
#define FILTER_LIST_MODEL_h
|
|
|
|
#include <config.h>
|
|
|
|
#include <QAbstractListModel>
|
|
#include <QList>
|
|
#include <QStringList>
|
|
|
|
class FilterListModel : public QAbstractListModel
|
|
{
|
|
|
|
public:
|
|
enum FilterListType {
|
|
Display,
|
|
Capture
|
|
};
|
|
|
|
explicit FilterListModel(FilterListType type = FilterListModel::Display, QObject * parent = Q_NULLPTR);
|
|
explicit FilterListModel(QObject * parent = Q_NULLPTR);
|
|
|
|
enum {
|
|
ColumnName,
|
|
ColumnExpression
|
|
};
|
|
|
|
void setFilterType(FilterListModel::FilterListType type);
|
|
FilterListModel::FilterListType filterType() const;
|
|
|
|
QModelIndex findByName(QString name);
|
|
QModelIndex findByExpression(QString expression);
|
|
|
|
QModelIndex addFilter(QString name, QString expression);
|
|
void removeFilter(QModelIndex idx);
|
|
|
|
void saveList();
|
|
|
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
private:
|
|
|
|
FilterListModel::FilterListType type_;
|
|
|
|
QStringList storage;
|
|
|
|
void reload();
|
|
};
|
|
|
|
#endif // FILTER_LIST_MODEL_h
|
|
|
|
/*
|
|
* Editor modelines
|
|
*
|
|
* Local Variables:
|
|
* c-basic-offset: 4
|
|
* tab-width: 8
|
|
* indent-tabs-mode: nil
|
|
* End:
|
|
*
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
*/
|