2012-01-04 22:13:01 +00:00
|
|
|
/* packet_list_model.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-01-04 22:13:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PACKET_LIST_MODEL_H
|
|
|
|
#define PACKET_LIST_MODEL_H
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
#include "packet_list_record.h"
|
|
|
|
|
|
|
|
#include "cfile.h"
|
|
|
|
|
|
|
|
class PacketListModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-10-30 19:21:24 +00:00
|
|
|
explicit PacketListModel(QObject *parent = 0, capture_file *cf = NULL);
|
|
|
|
void setCaptureFile(capture_file *cf);
|
2012-01-04 22:13:01 +00:00
|
|
|
QModelIndex index(int row, int column,
|
|
|
|
const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
QModelIndex parent(const QModelIndex &index) const;
|
2013-09-07 00:33:41 +00:00
|
|
|
int packetNumberToRow(int packet_num) const;
|
2012-08-23 17:29:05 +00:00
|
|
|
guint recreateVisibleRows();
|
|
|
|
void setColorEnabled(bool enable_color);
|
2012-01-04 22:13:01 +00:00
|
|
|
void clear();
|
|
|
|
|
2012-08-23 17:29:05 +00:00
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
2012-01-04 22:13:01 +00:00
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
2012-08-23 17:29:05 +00:00
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
2012-01-04 22:13:01 +00:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const;
|
2012-08-23 17:29:05 +00:00
|
|
|
|
|
|
|
gint appendPacket(frame_data *fdata);
|
|
|
|
frame_data *getRowFdata(int row);
|
2012-01-04 22:13:01 +00:00
|
|
|
int visibleIndexOf(frame_data *fdata) const;
|
2013-07-23 08:56:20 +00:00
|
|
|
void resetColumns();
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
private:
|
2012-10-30 19:21:24 +00:00
|
|
|
capture_file *cap_file_;
|
2012-08-23 17:29:05 +00:00
|
|
|
QList<QString> col_names_;
|
|
|
|
QVector<PacketListRecord *> visible_rows_;
|
|
|
|
QVector<PacketListRecord *> physical_rows_;
|
2013-09-07 00:33:41 +00:00
|
|
|
QMap<int, int> number_to_row_;
|
2012-08-23 17:29:05 +00:00
|
|
|
QFont pl_font_;
|
|
|
|
|
|
|
|
int header_height_;
|
|
|
|
bool enable_color_;
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PACKET_LIST_MODEL_H
|
2012-09-04 08:18:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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:
|
|
|
|
*/
|