nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* packet_list_model.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21  
22 #ifndef PACKET_LIST_MODEL_H
23 #define PACKET_LIST_MODEL_H
24  
25 #include <config.h>
26  
27 #include <stdio.h>
28  
29 #include <glib.h>
30  
31 #include <epan/packet.h>
32  
33 #include <QAbstractItemModel>
34 #include <QFont>
35 #include <QVector>
36  
37 #include "packet_list_record.h"
38  
39 #include "cfile.h"
40  
41 class QElapsedTimer;
42  
43 class PacketListModel : public QAbstractItemModel
44 {
45 Q_OBJECT
46 public:
47 explicit PacketListModel(QObject *parent = 0, capture_file *cf = NULL);
48 ~PacketListModel();
49 void setCaptureFile(capture_file *cf);
50 QModelIndex index(int row, int column,
51 const QModelIndex & = QModelIndex()) const;
52 QModelIndex parent(const QModelIndex &) const;
53 int packetNumberToRow(int packet_num) const;
54 guint recreateVisibleRows();
55 void clear();
56  
57 int rowCount(const QModelIndex &parent = QModelIndex()) const;
58 int columnCount(const QModelIndex & = QModelIndex()) const;
59 QVariant data(const QModelIndex &d_index, int role) const;
60 QVariant headerData(int section, Qt::Orientation orientation,
61 int role = Qt::DisplayRole | Qt::ToolTipRole) const;
62  
63 gint appendPacket(frame_data *fdata);
64 frame_data *getRowFdata(int row);
65 void ensureRowColorized(int row);
66 int visibleIndexOf(frame_data *fdata) const;
67 void resetColumns();
68 void resetColorized();
69 void toggleFrameMark(const QModelIndex &fm_index);
70 void setDisplayedFrameMark(gboolean set);
71 void toggleFrameIgnore(const QModelIndex &i_index);
72 void setDisplayedFrameIgnore(gboolean set);
73 void toggleFrameRefTime(const QModelIndex &rt_index);
74 void unsetAllFrameRefTime();
75 void applyTimeShift();
76  
77 void setMaximiumRowHeight(int height);
78  
79 signals:
80 void goToPacket(int);
81 void maxLineCountChanged(const QModelIndex &ih_index) const;
82 void itemHeightChanged(const QModelIndex &ih_index);
83 void pushBusyStatus(const QString &status);
84 void popBusyStatus();
85  
86 void pushProgressStatus(const QString &status, bool animate, bool terminate_is_stop, gboolean *stop_flag);
87 void updateProgressStatus(int value);
88 void popProgressStatus();
89  
90 public slots:
91 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
92 void flushVisibleRows();
93 void dissectIdle(bool reset = false);
94  
95 private:
96 capture_file *cap_file_;
97 QList<QString> col_names_;
98 QVector<PacketListRecord *> physical_rows_;
99 QVector<PacketListRecord *> visible_rows_;
100 QVector<PacketListRecord *> new_visible_rows_;
101 QVector<int> number_to_row_;
102  
103 int max_row_height_; // px
104 int max_line_count_;
105  
106 static int sort_column_;
107 static int text_sort_column_;
108 static Qt::SortOrder sort_order_;
109 static capture_file *sort_cap_file_;
110 static bool recordLessThan(PacketListRecord *r1, PacketListRecord *r2);
111  
112 QElapsedTimer *idle_dissection_timer_;
113 int idle_dissection_row_;
114  
115  
116 private slots:
117 void emitItemHeightChanged(const QModelIndex &ih_index);
118 };
119  
120 #endif // PACKET_LIST_MODEL_H
121  
122 /*
123 * Editor modelines
124 *
125 * Local Variables:
126 * c-basic-offset: 4
127 * tab-width: 8
128 * indent-tabs-mode: nil
129 * End:
130 *
131 * ex: set shiftwidth=4 tabstop=8 expandtab:
132 * :indentSize=4:tabSize=8:noTabs=true:
133 */