1 /* 2 * credentials_model.h 3 * 4 * Copyright 2019 - Dario Lombardo <lomato@gmail.com> 5 * 6 * Wireshark - Network traffic analyzer 7 * By Gerald Combs <gerald@wireshark.org> 8 * Copyright 1998 Gerald Combs 9 * 10 * SPDX-License-Identifier: GPL-2.0-or-later 11 */ 12 13 #ifndef CREDENTIALS_MODELS_H 14 #define CREDENTIALS_MODELS_H 15 16 #include <QAbstractListModel> 17 #include <QList> 18 19 #include <epan/tap.h> 20 #include <capture_file.h> 21 #include <ui/tap-credentials.h> 22 23 class CredentialsModel : public QAbstractListModel 24 { 25 Q_OBJECT 26 27 public: 28 CredentialsModel(QObject *parent); 29 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const ; 30 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; 31 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 32 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 33 34 void addRecord(const tap_credential_t *rec); 35 void clear(); 36 37 enum { 38 COL_NUM, 39 COL_PROTO, 40 COL_USERNAME, 41 COL_INFO 42 }; 43 44 enum { 45 ColumnHFID = Qt::UserRole + 1 46 }; 47 48 private: 49 QList<tap_credential_t*> credentials_; 50 51 }; 52 53 #endif // CREDENTIALS_MODELS_H 54