Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
io_graph_dialog.h
Go to the documentation of this file.
1
10#ifndef IO_GRAPH_DIALOG_H
11#define IO_GRAPH_DIALOG_H
12
13#include <config.h>
14#include "io_graph.h"
15
16#include <epan/epan_dissect.h>
17#include <epan/prefs.h>
18#include <epan/uat.h>
19
20#include <wsutil/str_util.h>
21
22#include <ui/preference_utils.h>
23#include <ui/io_graph_item.h>
26
27#include "wireshark_dialog.h"
28
29#include <QPointer>
30#include <QMenu>
31#include <QTextStream>
32#include <QItemSelection>
33
34#include <vector>
35
36class QRubberBand;
37class QTimer;
38class QAbstractButton;
40
41class QCPGraph;
42class QCPItemTracer;
43class QCPAxisTicker;
44class QCPAxisTickerDateTime;
45
46// Saved graph settings
47typedef struct _io_graph_settings_t {
48 bool enabled;
49 bool asAOT;
50 char* name;
51 char* dfilter;
52 unsigned color;
53 uint32_t style;
54 uint32_t yaxis;
55 char* yfield;
56 uint32_t sma_period;
57 double y_axis_factor;
59
60
61extern const value_string moving_avg_vs[];
62
63/* define I/O Graph specific UAT columns */
64enum UatColumnsIOG {colEnabled = 0, colName, colDFilter, colColor, colStyle, colYAxis, colYField, colSMAPeriod, colYAxisFactor, colAOT, colMaxNum};
65
66namespace Ui {
67class IOGraphDialog;
68}
69
70static const value_string io_graph_style_vs[] = {
71 { IOGraph::psLine, "Line" },
72 { IOGraph::psDotLine, "Dot Line" },
73 { IOGraph::psStepLine, "Step Line" },
74 { IOGraph::psDotStepLine, "Dot Step Line" },
75 { IOGraph::psImpulse, "Impulse" },
76 { IOGraph::psBar, "Bar" },
77 { IOGraph::psStackedBar, "Stacked Bar" },
78 { IOGraph::psDot, "Dot" },
79 { IOGraph::psSquare, "Square" },
80 { IOGraph::psDiamond, "Diamond" },
81 { IOGraph::psCross, "Cross" },
82 { IOGraph::psCircle, "Circle" },
83 { IOGraph::psPlus, "Plus" },
84 { 0, NULL }
85};
86
88{
89 Q_OBJECT
90
91public:
92 explicit IOGraphDialog(QWidget &parent, CaptureFile &cf, uat_field_t* io_graph_fields, const char* type_unit_name, QString displayFilter = QString(),
93 io_graph_item_unit_t value_units = IOG_ITEM_UNIT_PACKETS,
94 QString yfield = QString(),
95 bool is_sibling_dialog = false,
96 const QVector<QString> convFilters = QVector<QString>() );
98
99 void addGraph(bool checked, bool asAOT, QString name, QString dfilter, QRgb color_idx, IOGraph::PlotStyles style,
100 io_graph_item_unit_t value_units, QString yfield, int moving_average, double yaxisfactor);
101 void addGraph(bool checked, bool asAOT, QString dfilter, io_graph_item_unit_t value_units, QString yfield);
102 void addGraph(bool copy_from_current = false);
103 void addDefaultGraph(bool enabled, int idx = 0);
104 void syncGraphSettings(int row);
105 qsizetype graphCount() const;
106
107public slots:
108 void scheduleReplot(bool now = false);
109 void scheduleRecalc(bool now = false);
110 void scheduleRetap(bool now = false);
111 void reloadFields();
112
113protected:
114 void captureFileClosing();
115 void keyPressEvent(QKeyEvent *event);
116 void reject();
117
118protected slots:
119 void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
120 void modelRowsReset();
121 void modelRowsInserted(const QModelIndex &parent, int first, int last);
122 void modelRowsRemoved(const QModelIndex &parent, int first, int last);
123 void modelRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow);
124
125signals:
126 void goToPacket(int packet_num);
127 void recalcGraphData(capture_file *cap_file);
128 void intervalChanged(int interval);
129 void reloadValueUnitFields();
130
131private:
132 Ui::IOGraphDialog *ui;
133 CopyFromProfileButton *copy_profile_bt_;
134
135 //Model and delegate were chosen over UatFrame because add/remove/copy
136 //buttons would need realignment (UatFrame has its own)
137 QPointer<UatModel> uat_model_;
138 UatDelegate *uat_delegate_;
139
140 // XXX - This needs to stay synced with UAT index
141 QVector<IOGraph*> ioGraphs_;
142
143 QString hint_err_;
144 QCPGraph *base_graph_;
145 QCPItemTracer *tracer_;
146 uint32_t packet_num_;
147 nstime_t start_time_;
148 bool mouse_drags_;
149 QRubberBand *rubber_band_;
150 QPoint rb_origin_;
151 QMenu ctx_menu_;
152 QTimer *stat_timer_;
153 bool need_replot_; // Light weight: tell QCP to replot existing data
154 bool need_recalc_; // Medium weight: recalculate values, then replot
155 bool need_retap_; // Heavy weight: re-read packet data
156 bool auto_axes_;
157 int precision_;
158 const char* type_unit_name_;
159
160 QSharedPointer<QCPAxisTicker> number_ticker_;
161 QSharedPointer<QCPAxisTickerDateTime> datetime_ticker_;
162
163
164// void fillGraph();
165 void zoomAxes(bool in);
166 void zoomXAxis(bool in);
167 void zoomYAxis(bool in);
168 void panAxes(int x_pixels, int y_pixels);
169 void toggleTracerStyle(bool force_default = false);
170 void getGraphInfo();
171 void updateHint();
172 void updateLegend();
173 QRectF getZoomRanges(QRect zoom_rect);
174 void createIOGraph(int currentRow);
175 void loadProfileGraphs(uat_field_t* io_graph_fields);
176 void makeCsv(QTextStream &stream) const;
177 bool saveCsv(const QString &file_name) const;
178 IOGraph *currentActiveGraph() const;
179 bool graphIsEnabled(int row) const;
180 bool graphAsAOT(int row) const;
181
182private slots:
183 static void applyChanges();
184
185 void copyFromProfile(QString filename);
186 void updateWidgets();
187 void showContextMenu(const QPoint &pos);
188 void graphClicked(QMouseEvent *event);
189 void mouseMoved(QMouseEvent *event);
190 void mouseReleased(QMouseEvent *event);
191 void selectedFrameChanged(QList<int> frames);
192 void moveLegend();
193
194 void resetAxes();
195 void updateStatistics(void);
196 void copyAsCsvClicked();
197
198 void graphUatSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
199 void on_intervalComboBox_currentIndexChanged(int index);
200 void on_graphUat_currentItemChanged(const QModelIndex &current, const QModelIndex &previous);
201
202 void on_automaticUpdateCheckBox_toggled(bool checked);
203 void on_newToolButton_clicked();
204 void on_deleteToolButton_clicked();
205 void on_copyToolButton_clicked();
206 void on_clearToolButton_clicked();
207 void on_moveUpwardsToolButton_clicked();
208 void on_moveDownwardsToolButton_clicked();
209 void on_dragRadioButton_toggled(bool checked);
210 void on_zoomRadioButton_toggled(bool checked);
211 void on_actionReset_triggered();
212 void on_actionZoomIn_triggered();
213 void on_actionZoomInX_triggered();
214 void on_actionZoomInY_triggered();
215 void on_actionZoomOut_triggered();
216 void on_actionZoomOutX_triggered();
217 void on_actionZoomOutY_triggered();
218 void on_actionMoveUp10_triggered();
219 void on_actionMoveLeft10_triggered();
220 void on_actionMoveRight10_triggered();
221 void on_actionMoveDown10_triggered();
222 void on_actionMoveUp1_triggered();
223 void on_actionMoveLeft1_triggered();
224 void on_actionMoveRight1_triggered();
225 void on_actionMoveDown1_triggered();
226 void on_actionGoToPacket_triggered();
227 void on_actionDragZoom_triggered();
228 void on_actionToggleTimeOrigin_triggered();
229 void on_actionCrosshairs_triggered();
230 void on_buttonBox_helpRequested();
231 void on_buttonBox_accepted();
232 void buttonBoxClicked(QAbstractButton *button);
233 void actionLegendTriggered(bool checked);
234 void actionTimeOfDayTriggered(bool checked);
235 void actionLogScaleTriggered(bool checked);
236};
237
238#endif // IO_GRAPH_DIALOG_H
Definition capture_file.h:21
Definition copy_from_profile_button.h:21
Definition io_graph_dialog.h:88
void captureFileClosing()
Called when the capture file is about to close. This can be used to disconnect taps and similar actio...
Definition io_graph_dialog.cpp:707
Definition io_graph.h:63
Definition uat_delegate.h:24
Definition wireshark_dialog.h:35
Definition cfile.h:67
Definition io_graph_dialog.h:47
Definition uat.h:235
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
Definition nstime.h:26
Definition stream.c:41