| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
coloring_rules_model.h
Go to the documentation of this file.
1
12#ifndef COLORING_RULES_MODEL_H
13#define COLORING_RULES_MODEL_H
14
15#include <config.h>
16
17#include <epan/color_filters.h>
18
19#include <ui/qt/models/tree_model_helpers.h>
20
21#include <QList>
22#include <QColor>
23#include <QAbstractTableModel>
24#include <QSortFilterProxyModel>
25
26 class ColoringRuleItem : public ModelHelperTreeItem<ColoringRuleItem>
27{
28 public:
29 ColoringRuleItem(bool disabled, QString name, QString filter, QColor foreground, QColor background, ColoringRuleItem* parent);
30 virtual ~ColoringRuleItem();
31
32 ColoringRuleItem(color_filter_t *colorf, ColoringRuleItem* parent);
33 ColoringRuleItem(const ColoringRuleItem& item);
34
35 bool disabled_;
36 QString name_;
37 QString filter_;
38 QColor foreground_;
39 QColor background_;
40
41 ColoringRuleItem& operator=(ColoringRuleItem& rhs);
42
43};
44
45 class ColoringRulesModel : public QAbstractItemModel
46{
47 Q_OBJECT
48
49 public:
50 ColoringRulesModel(QColor defaultForeground, QColor defaultBackground, QObject *parent);
51 virtual ~ColoringRulesModel();
52
53 enum ColoringRulesColumn {
54 colName = 0,
55 colFilter,
56 colColoringRulesMax
57 };
58
59 void addColor(color_filter_t* colorf);
60 void addColor(bool disabled, QString filter, QColor foreground, QColor background);
61 bool importColors(QString filename, QString& err);
62 bool exportColors(QString filename, QString& err);
63 bool writeColors(QString& err);
64
65 Qt::ItemFlags flags(const QModelIndex &index) const;
66 QVariant data(const QModelIndex &index, int role) const;
67 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
68 QVariant headerData(int section, Qt::Orientation orientation,
69 int role = Qt::DisplayRole) const;
70 QModelIndex index(int row, int column,
71 const QModelIndex & = QModelIndex()) const;
72 QModelIndex parent(const QModelIndex &) const;
73
74 //Drag & drop functionality
75 Qt::DropActions supportedDropActions() const;
76 QStringList mimeTypes() const;
77 QMimeData* mimeData(const QModelIndexList &indexes) const;
78 bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
79
80 int rowCount(const QModelIndex &parent = QModelIndex()) const;
81 int columnCount(const QModelIndex &parent = QModelIndex()) const;
82
83 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
84 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
85 bool copyRow(int dst_row, int src_row);
86
87 private:
88 void populate();
89 struct _GSList *createColorFilterList();
90
91 ColoringRuleItem* root_;
92 //Save off the conversation colors, do not include in dialog
93 struct _GSList *conversation_colors_;
94
95 QColor defaultForeground_;
96 QColor defaultBackground_;
97
98 QList<int> dragDropRows_;
99};
100
101#endif // COLORING_RULES_MODEL_H
ColoringRuleItem
Definition coloring_rules_model.h:27
ColoringRulesModel
Definition coloring_rules_model.h:46
ModelHelperTreeItem
Definition tree_model_helpers.h:23
color_filters.h
_color_filter
Definition color_filters.h:34
tree_model_helpers.h