10 #ifndef IO_GRAPH_DIALOG_H
11 #define IO_GRAPH_DIALOG_H
31 #include <QTextStream>
37 class QAbstractButton;
45 class QCPAxisTickerDateTime;
56 const int max_io_items_ = 1 << 25;
63 enum PlotStyles { psLine, psDotLine, psStepLine, psDotStepLine, psImpulse, psBar, psStackedBar, psDot, psSquare, psDiamond, psCross, psPlus, psCircle };
65 explicit IOGraph(QCustomPlot *parent);
67 QString configError()
const {
return config_err_; }
68 QString name()
const {
return name_; }
69 void setName(
const QString &name);
70 QString filter()
const {
return filter_; }
71 bool setFilter(
const QString &filter);
72 void applyCurrentColor();
73 bool visible()
const {
return visible_; }
74 void setVisible(
bool visible);
75 bool needRetap()
const {
return need_retap_; }
76 void setNeedRetap(
bool retap);
78 void setColor(
const QRgb color);
79 void setPlotStyle(
int style);
80 QString valueUnitLabel()
const;
82 void setValueUnits(
int val_units);
83 QString valueUnitField()
const {
return vu_field_; }
84 void setValueUnitField(
const QString &vu_field);
85 unsigned int movingAveragePeriod()
const {
return moving_avg_period_; }
86 void setInterval(
int interval);
88 bool removeFromLegend();
89 QCPGraph *graph()
const {
return graph_; }
90 QCPBars *bars()
const {
return bars_; }
91 double startOffset()
const;
93 int packetFromTime(
double ts)
const;
94 bool hasItemToShow(
int idx,
double value)
const;
95 double getItemValue(
int idx,
const capture_file *cap_file)
const;
96 int maxInterval ()
const {
return cur_idx_; }
100 unsigned int moving_avg_period_;
101 unsigned int y_axis_factor_;
106 void reloadValueUnitField();
109 void requestReplot();
110 void requestRecalc();
115 static void tapReset(
void *iog_ptr);
117 static void tapDraw(
void *iog_ptr);
119 void removeTapListener();
121 bool showsZero()
const;
123 template<
class DataMap>
double maxValueFromGraphData(
const DataMap &map);
124 template<
class DataMap>
void scaleGraphData(DataMap &map,
int scalar);
126 QCustomPlot *parent_;
129 bool tap_registered_;
135 QString full_filter_;
137 io_graph_item_unit_t val_units_;
145 std::vector<io_graph_item_t> items_;
161 enum UatColumns { colEnabled = 0, colName, colDFilter, colColor, colStyle, colYAxis, colYField, colSMAPeriod, colYAxisFactor, colMaxNum};
163 void addGraph(
bool checked, QString name, QString dfilter, QRgb color_idx, IOGraph::PlotStyles style,
164 io_graph_item_unit_t value_units, QString yfield,
int moving_average,
int yaxisfactor);
165 void addGraph(
bool copy_from_current =
false);
166 void addDefaultGraph(
bool enabled,
int idx = 0);
167 void syncGraphSettings(
int row);
168 qsizetype graphCount()
const;
171 void scheduleReplot(
bool now =
false);
172 void scheduleRecalc(
bool now =
false);
173 void scheduleRetap(
bool now =
false);
178 void keyPressEvent(QKeyEvent *event);
182 void modelDataChanged(
const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles);
183 void modelRowsReset();
184 void modelRowsInserted(
const QModelIndex &parent,
int first,
int last);
185 void modelRowsRemoved(
const QModelIndex &parent,
int first,
int last);
186 void modelRowsMoved(
const QModelIndex &sourceParent,
int sourceStart,
int sourceEnd,
const QModelIndex &destinationParent,
int destinationRow);
189 void goToPacket(
int packet_num);
191 void intervalChanged(
int interval);
192 void reloadValueUnitFields();
195 Ui::IOGraphDialog *ui;
200 QPointer<UatModel> uat_model_;
204 QVector<IOGraph*> ioGraphs_;
207 QCPGraph *base_graph_;
208 QCPItemTracer *tracer_;
209 uint32_t packet_num_;
212 QRubberBand *rubber_band_;
222 QSharedPointer<QCPAxisTicker> number_ticker_;
223 QSharedPointer<QCPAxisTickerDateTime> datetime_ticker_;
227 void zoomAxes(
bool in);
228 void zoomXAxis(
bool in);
229 void zoomYAxis(
bool in);
230 void panAxes(
int x_pixels,
int y_pixels);
231 void toggleTracerStyle(
bool force_default =
false);
235 QRectF getZoomRanges(QRect zoom_rect);
236 void createIOGraph(
int currentRow);
237 void loadProfileGraphs();
238 void makeCsv(QTextStream &
stream)
const;
239 bool saveCsv(
const QString &file_name)
const;
240 IOGraph *currentActiveGraph()
const;
241 bool graphIsEnabled(
int row)
const;
244 static void applyChanges();
246 void copyFromProfile(QString filename);
247 void updateWidgets();
248 void showContextMenu(
const QPoint &pos);
249 void graphClicked(QMouseEvent *event);
250 void mouseMoved(QMouseEvent *event);
251 void mouseReleased(QMouseEvent *event);
252 void selectedFrameChanged(QList<int> frames);
255 void updateStatistics(
void);
256 void copyAsCsvClicked();
258 void on_intervalComboBox_currentIndexChanged(
int index);
259 void on_todCheckBox_toggled(
bool checked);
260 void on_graphUat_currentItemChanged(
const QModelIndex ¤t,
const QModelIndex &previous);
262 void on_logCheckBox_toggled(
bool checked);
263 void on_automaticUpdateCheckBox_toggled(
bool checked);
264 void on_enableLegendCheckBox_toggled(
bool checked);
265 void on_newToolButton_clicked();
266 void on_deleteToolButton_clicked();
267 void on_copyToolButton_clicked();
268 void on_clearToolButton_clicked();
269 void on_moveUpwardsToolButton_clicked();
270 void on_moveDownwardsToolButton_clicked();
271 void on_dragRadioButton_toggled(
bool checked);
272 void on_zoomRadioButton_toggled(
bool checked);
273 void on_actionReset_triggered();
274 void on_actionZoomIn_triggered();
275 void on_actionZoomInX_triggered();
276 void on_actionZoomInY_triggered();
277 void on_actionZoomOut_triggered();
278 void on_actionZoomOutX_triggered();
279 void on_actionZoomOutY_triggered();
280 void on_actionMoveUp10_triggered();
281 void on_actionMoveLeft10_triggered();
282 void on_actionMoveRight10_triggered();
283 void on_actionMoveDown10_triggered();
284 void on_actionMoveUp1_triggered();
285 void on_actionMoveLeft1_triggered();
286 void on_actionMoveRight1_triggered();
287 void on_actionMoveDown1_triggered();
288 void on_actionGoToPacket_triggered();
289 void on_actionDragZoom_triggered();
290 void on_actionToggleTimeOrigin_triggered();
291 void on_actionCrosshairs_triggered();
292 void on_buttonBox_helpRequested();
293 void on_buttonBox_accepted();
294 void buttonBoxClicked(QAbstractButton *button);
Definition: capture_event.h:21
Definition: capture_file.h:21
Definition: io_graph_dialog.h:154
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:763
Definition: io_graph_dialog.h:59
Definition: uat_delegate.h:24
Definition: wireshark_dialog.h:35
format_size_units_e
Definition: str_util.h:231
Definition: packet_info.h:44
Definition: epan_dissect.h:28
tap_packet_status
Definition: tap.h:25