Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
graph_dialog.h
Go to the documentation of this file.
1
9
10#ifndef GRAPH_DIALOG_H
11#define GRAPH_DIALOG_H
12
13#include <config.h>
14
16
17#include "wireshark_dialog.h"
18
19#include <QColor>
20#include <QPointer>
21#include <QVector>
22
37{
38 Q_OBJECT
39
40protected:
47 GraphDialog(QWidget &parent, CaptureFile &cf, int colorColumn);
48
57 void setUatModel(UatModel *model);
58
64 QColor newGraphColor() const;
65
75 template <typename List>
76 static void moveListRows(List &list, int sourceStart, int sourceEnd, int destinationRow)
77 {
78 for (int i = 0; i <= sourceEnd - sourceStart; i++) {
79 if (destinationRow < sourceStart) {
80 // When moving up, moving an earlier item doesn't change the row.
81 list.move(sourceStart + i, destinationRow + i);
82 } else {
83 // When moving down, the next items move up, so the moved rows
84 // are always at sourceStart.
85 list.move(sourceStart, destinationRow - 1);
86 }
87 }
88 }
89
90 QPointer<UatModel> uat_model_;
91
92private slots:
93 void onThemeChanged();
94 void colorRowsReset();
95 void colorRowsInserted(const QModelIndex &parent, int first, int last);
96 void colorRowsRemoved(const QModelIndex &parent, int first, int last);
97 void colorRowsMoved(const QModelIndex &source, int sourceStart, int sourceEnd,
98 const QModelIndex &dest, int destinationRow);
99 void colorDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
100 const QVector<int> &roles);
101
102private:
104 static constexpr int user_color_ = -1;
106 static constexpr int theme_color_role_ = Qt::DecorationRole;
107
108 const int color_column_;
109 QVector<int> color_indexes_;
110};
111
112#endif // GRAPH_DIALOG_H
Manages a capture file and its associated state and operations.
Definition capture_file.h:27
QColor newGraphColor() const
The color for the row about to be appended to uat_model_.
Definition graph_dialog.cpp:37
static void moveListRows(List &list, int sourceStart, int sourceEnd, int destinationRow)
Apply a model rowsMoved signal to a list kept in model row order.
Definition graph_dialog.h:76
GraphDialog(QWidget &parent, CaptureFile &cf, int colorColumn)
Constructs the dialog and follows theme changes.
Definition graph_dialog.cpp:14
QPointer< UatModel > uat_model_
Definition graph_dialog.h:90
void setUatModel(UatModel *model)
Set the uat_model_ and start tracking the rows.
Definition graph_dialog.cpp:22
Table model for representing and managing User Accessible Tables (UAT).
Definition uat_model.h:28
WiresharkDialog(QWidget &parent, CaptureFile &capture_file)
Constructs a new WiresharkDialog object.
Definition wireshark_dialog.cpp:30