Fix comment end after SPDX identifier
[gd/wireshark/.git] / ui / qt / models / voip_calls_info_model.h
1 /* voip_calls_info_model.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #ifndef VOIP_CALLS_INFO_MODEL_H
11 #define VOIP_CALLS_INFO_MODEL_H
12
13 #include <config.h>
14 #include <glib.h>
15
16 #include "ui/voip_calls.h"
17 #include <ui/qt/utils/variant_pointer.h>
18
19 #include <QAbstractTableModel>
20 #include <QSortFilterProxyModel>
21
22 class VoipCallsInfoModel : public QAbstractTableModel
23 {
24     Q_OBJECT
25
26 public:
27     VoipCallsInfoModel(QObject *parent = 0);
28     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
29     QVariant headerData(int section, Qt::Orientation orientation,
30                         int role = Qt::DisplayRole) const;
31     int rowCount(const QModelIndex &parent = QModelIndex()) const;
32     int columnCount(const QModelIndex &parent = QModelIndex()) const;
33     void setTimeOfDay(bool timeOfDay);
34     void updateCalls(GQueue *callsinfos);
35
36     static voip_calls_info_t *indexToCallInfo(const QModelIndex &index);
37
38     enum Column
39     {
40         StartTime,
41         StopTime,
42         InitialSpeaker,
43         From,
44         To,
45         Protocol,
46         Duration,
47         Packets,
48         State,
49         Comments,
50         ColumnCount /* not an actual column, but used to find max. cols. */
51     };
52
53 private:
54     QList<void *> callinfos_;
55     bool mTimeOfDay_;
56
57     QVariant timeData(nstime_t *abs_ts, nstime_t *rel_ts) const;
58 };
59
60 class VoipCallsInfoSortedModel : public QSortFilterProxyModel
61 {
62     Q_OBJECT
63
64 public:
65     VoipCallsInfoSortedModel(QObject *parent = 0);
66
67 protected:
68     bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
69 };
70
71 #endif // VOIP_CALLS_INFO_MODEL_H
72
73 /*
74  * Editor modelines
75  *
76  * Local Variables:
77  * c-basic-offset: 4
78  * tab-width: 8
79  * indent-tabs-mode: nil
80  * End:
81  *
82  * ex: set shiftwidth=4 tabstop=8 expandtab:
83  * :indentSize=4:tabSize=8:noTabs=true:
84  */