10 #ifndef IO_GRAPH_DIALOG_H
11 #define IO_GRAPH_DIALOG_H
31 #include <QTextStream>
37 class QAbstractButton;
44 class QCPAxisTickerDateTime;
55 const int max_io_items_ = 1 << 25;
62 enum PlotStyles { psLine, psDotLine, psStepLine, psDotStepLine, psImpulse, psBar, psStackedBar, psDot, psSquare, psDiamond, psCross, psPlus, psCircle };
64 explicit IOGraph(QCustomPlot *parent);
66 QString configError()
const {
return config_err_; }
67 QString name()
const {
return name_; }
68 void setName(
const QString &name);
69 QString filter()
const {
return filter_; }
70 bool setFilter(
const QString &filter);
71 void applyCurrentColor();
72 bool visible()
const {
return visible_; }
73 void setVisible(
bool visible);
74 bool needRetap()
const {
return need_retap_; }
75 void setNeedRetap(
bool retap);
77 void setColor(
const QRgb color);
78 void setPlotStyle(
int style);
79 QString valueUnitLabel()
const;
81 void setValueUnits(
int val_units);
82 QString valueUnitField()
const {
return vu_field_; }
83 void setValueUnitField(
const QString &vu_field);
84 unsigned int movingAveragePeriod()
const {
return moving_avg_period_; }
85 void setInterval(
int interval);
87 bool removeFromLegend();
88 QCPGraph *graph()
const {
return graph_; }
89 QCPBars *bars()
const {
return bars_; }
90 double startOffset()
const;
92 int packetFromTime(
double ts)
const;
93 bool hasItemToShow(
int idx,
double value)
const;
94 double getItemValue(
int idx,
const capture_file *cap_file)
const;
95 int maxInterval ()
const {
return cur_idx_; }
99 unsigned int moving_avg_period_;
100 unsigned int y_axis_factor_;
105 void reloadValueUnitField();
108 void requestReplot();
109 void requestRecalc();
114 static void tapReset(
void *iog_ptr);
116 static void tapDraw(
void *iog_ptr);
118 void removeTapListener();
120 bool showsZero()
const;
122 template<
class DataMap>
double maxValueFromGraphData(
const DataMap &map);
123 template<
class DataMap>
void scaleGraphData(DataMap &map,
int scalar);
125 QCustomPlot *parent_;
128 bool tap_registered_;
134 QString full_filter_;
136 io_graph_item_unit_t val_units_;
144 std::vector<io_graph_item_t> items_;
160 enum UatColumns { colEnabled = 0, colName, colDFilter, colColor, colStyle, colYAxis, colYField, colSMAPeriod, colYAxisFactor, colMaxNum};
162 void addGraph(
bool checked, QString name, QString dfilter, QRgb color_idx, IOGraph::PlotStyles style,
163 io_graph_item_unit_t value_units, QString yfield,
int moving_average,
int yaxisfactor);
164 void addGraph(
bool copy_from_current =
false);
165 void addDefaultGraph(
bool enabled,
int idx = 0);
166 void syncGraphSettings(
int row);
169 void scheduleReplot(
bool now =
false);
170 void scheduleRecalc(
bool now =
false);
171 void scheduleRetap(
bool now =
false);
175 void keyPressEvent(QKeyEvent *event);
179 void modelDataChanged(
const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles);
180 void modelRowsReset();
181 void modelRowsInserted(
const QModelIndex &parent,
int first,
int last);
182 void modelRowsRemoved(
const QModelIndex &parent,
int first,
int last);
183 void modelRowsMoved(
const QModelIndex &sourceParent,
int sourceStart,
int sourceEnd,
const QModelIndex &destinationParent,
int destinationRow);
186 void goToPacket(
int packet_num);
188 void intervalChanged(
int interval);
189 void reloadValueUnitFields();
192 Ui::IOGraphDialog *ui;
196 QPointer<UatModel> uat_model_;
200 QVector<IOGraph*> ioGraphs_;
203 QCPGraph *base_graph_;
204 QCPItemTracer *tracer_;
205 uint32_t packet_num_;
208 QRubberBand *rubber_band_;
218 QSharedPointer<QCPAxisTicker> number_ticker_;
219 QSharedPointer<QCPAxisTickerDateTime> datetime_ticker_;
223 void zoomAxes(
bool in);
224 void zoomXAxis(
bool in);
225 void zoomYAxis(
bool in);
226 void panAxes(
int x_pixels,
int y_pixels);
227 void toggleTracerStyle(
bool force_default =
false);
231 QRectF getZoomRanges(QRect zoom_rect);
232 void createIOGraph(
int currentRow);
233 void loadProfileGraphs();
234 void makeCsv(QTextStream &
stream)
const;
235 bool saveCsv(
const QString &file_name)
const;
236 IOGraph *currentActiveGraph()
const;
237 bool graphIsEnabled(
int row)
const;
240 static void applyChanges();
242 void copyFromProfile(QString filename);
243 void updateWidgets();
244 void showContextMenu(
const QPoint &pos);
245 void graphClicked(QMouseEvent *event);
246 void mouseMoved(QMouseEvent *event);
247 void mouseReleased(QMouseEvent *event);
248 void selectedFrameChanged(QList<int> frames);
251 void updateStatistics(
void);
252 void copyAsCsvClicked();
254 void on_intervalComboBox_currentIndexChanged(
int index);
255 void on_todCheckBox_toggled(
bool checked);
256 void on_graphUat_currentItemChanged(
const QModelIndex ¤t,
const QModelIndex &previous);
258 void on_logCheckBox_toggled(
bool checked);
259 void on_automaticUpdateCheckBox_toggled(
bool checked);
260 void on_enableLegendCheckBox_toggled(
bool checked);
261 void on_newToolButton_clicked();
262 void on_deleteToolButton_clicked();
263 void on_copyToolButton_clicked();
264 void on_clearToolButton_clicked();
265 void on_moveUpwardsToolButton_clicked();
266 void on_moveDownwardsToolButton_clicked();
267 void on_dragRadioButton_toggled(
bool checked);
268 void on_zoomRadioButton_toggled(
bool checked);
269 void on_actionReset_triggered();
270 void on_actionZoomIn_triggered();
271 void on_actionZoomInX_triggered();
272 void on_actionZoomInY_triggered();
273 void on_actionZoomOut_triggered();
274 void on_actionZoomOutX_triggered();
275 void on_actionZoomOutY_triggered();
276 void on_actionMoveUp10_triggered();
277 void on_actionMoveLeft10_triggered();
278 void on_actionMoveRight10_triggered();
279 void on_actionMoveDown10_triggered();
280 void on_actionMoveUp1_triggered();
281 void on_actionMoveLeft1_triggered();
282 void on_actionMoveRight1_triggered();
283 void on_actionMoveDown1_triggered();
284 void on_actionGoToPacket_triggered();
285 void on_actionDragZoom_triggered();
286 void on_actionToggleTimeOrigin_triggered();
287 void on_actionCrosshairs_triggered();
288 void on_buttonBox_helpRequested();
289 void on_buttonBox_accepted();
290 void buttonBoxClicked(QAbstractButton *button);
Definition: capture_event.h:21
Definition: capture_file.h:21
Definition: io_graph_dialog.h:153
Definition: io_graph_dialog.h:58
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