Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Static Protected Attributes | List of all members
IOGraphDialog Class Reference

Dialog for configuring and displaying I/O throughput graphs. More...

#include <io_graph_dialog.h>

Inheritance diagram for IOGraphDialog:
WiresharkDialog GeometryStateDialog StratosharkIOGraphDialog

Public Slots

void scheduleReplot (bool now=false)
 Request a lightweight replot of already-computed graph data.
 
void scheduleRecalc (bool now=false)
 Request a medium-weight value recalculation followed by replot.
 
void scheduleRetap (bool now=false)
 Request a heavy-weight retap of all packet data.
 
void reloadFields ()
 Reload the list of available Y-axis field names.
 

Signals

void goToPacket (int packet_num)
 Emitted when the plot should navigate to a specific packet.
 
void recalcGraphData (capture_file *cap_file)
 Emitted to trigger a full recalculation of all graph data.
 
void intervalChanged (int interval)
 Emitted when the time interval selection changes.
 
void reloadValueUnitFields ()
 Emitted to request that Y-axis field combo boxes reload their available field lists.
 

Public Member Functions

 IOGraphDialog (QWidget &parent, CaptureFile &cf, const char *type_unit_name)
 Construct an IOGraphDialog.
 
virtual ~IOGraphDialog ()
 Destroy the dialog.
 
void initialize (QWidget &parent, uat_field_t *io_graph_fields, QString displayFilter=QString(), io_graph_item_unit_t value_units=IOG_ITEM_UNIT_PACKETS, QString yfield=QString(), bool is_sibling_dialog=false, const QVector< QString > convFilters=QVector< QString >())
 Finish initialising the dialog after construction.
 
void addGraph (bool checked, bool asAOT, QString name, QString dfilter, QColor color_idx, IOGraph::PlotStyles style, io_graph_item_unit_t value_units, QString yfield, int moving_average, double yaxisfactor)
 Add a fully-specified graph to the dialog.
 
void addGraph (bool checked, bool asAOT, QString dfilter, io_graph_item_unit_t value_units, QString yfield)
 Add a graph with a minimal set of parameters.
 
void addGraph (bool copy_from_current=false)
 Add a blank graph or copy the currently selected graph.
 
virtual void addDefaultGraph (bool enabled, int idx=0)
 Add the default graph(s) for this dialog type.
 
void syncGraphSettings (int row)
 Synchronise the QCustomPlot graph object for row with its UAT model row data.
 
qsizetype graphCount () const
 Return the number of graphs currently in the dialog.
 
- Public Member Functions inherited from WiresharkDialog
 WiresharkDialog (QWidget &parent, CaptureFile &capture_file)
 Constructs a new WiresharkDialog object.
 
bool fileClosed () const
 Checks if the capture file has been closed.
 
- Public Member Functions inherited from GeometryStateDialog
 GeometryStateDialog (QWidget *parent, Qt::WindowFlags f=Qt::Window)
 Constructs a new GeometryStateDialog with the specified parent and window flags.
 
 ~GeometryStateDialog ()
 Save the geometry and splitter state and then destroy the GeometryStateDialog.
 
void setWindowModality (Qt::WindowModality windowModality)
 Sets the window modality for the dialog. On non-macOS platforms, this also sets the parent to ensure modal dialogs are always on top of their parent.
 

Protected Slots

void modelDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
 Respond to data changes in the UAT model.
 
void modelRowsReset ()
 Respond to a full UAT model reset.
 
void modelRowsInserted (const QModelIndex &parent, int first, int last)
 Respond to new rows being inserted into the UAT model.
 
void modelRowsRemoved (const QModelIndex &parent, int first, int last)
 Respond to rows being removed from the UAT model.
 
void modelRowsMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 Respond to rows being moved within the UAT model.
 
- Protected Slots inherited from WiresharkDialog
void captureEvent (CaptureEvent e)
 Handles capture events.
 

Protected Member Functions

void captureFileClosing ()
 Handle capture file closing.
 
void keyPressEvent (QKeyEvent *event)
 Handle key press events.
 
void reject ()
 Handle dialog rejection (Close button / Escape).
 
virtual QString getFilteredName () const
 Return the display-filter-qualified window/tab title suffix.
 
virtual QString getXAxisName () const
 Return the X-axis label for this graph type.
 
virtual const char * getYAxisName (io_graph_item_unit_t value_units) const
 Return the Y-axis label for a given unit.
 
virtual QString getYFieldName (io_graph_item_unit_t value_units, const QString &yfield) const
 Return the effective Y-axis field expression to use.
 
virtual int getYAxisValue (const QString &data)
 Parse a Y-axis value string from the UAT and return its int value.
 
virtual QString getNoDataHint () const
 Return the hint text shown when no data is available.
 
virtual QString getHintText (unsigned num_items) const
 Return the status-bar hint text shown during normal operation.
 
- Protected Member Functions inherited from WiresharkDialog
virtual void accept ()
 Accepts the dialog.
 
virtual void beginRetapPackets ()
 Mark the start of a code block that retaps packets. If the user closes the dialog while tapping, the dialog will not be destroyed until endRetapPackets is called.
 
virtual void endRetapPackets ()
 Mark the end of a code block that retaps packets. If the user has closed the dialog it will be destroyed at this point.
 
void setWindowSubtitle (const QString &subtitle)
 Set the window subtitle, e.g. "Foo Timeouts". The subtitle and file name will be added to the dialog window title.
 
const QString & windowSubtitle ()
 Retrieves the current window subtitle.
 
virtual void updateWidgets ()
 Updates the state and contents of the dialog's widgets.
 
bool registerTapListener (const char *tap_name, void *tap_data, const char *filter, unsigned flags, tap_reset_cb tap_reset, tap_packet_cb tap_packet, tap_draw_cb tap_draw)
 Convenience wrapper for register_tap_listener. Tap listeners registered via this function are automatically removed during destruction. They can also be explicitly removed using remove_tap_listener or removeTapListeners.
 
virtual void removeTapListeners ()
 Remove all tap listeners registered via registerTapListener.
 
bool dialogClosed () const
 Check to see if the user has closed (and not minimized) the dialog.
 
int retapDepth () const
 Check to see if we're currently retapping. If this is positive, tapping will fail in process_specified_records.
 
virtual void captureFileClosed ()
 Called when the capture file was closed. This can be used to enable or disable widgets according to the state of file_closed_. updateWidgets() is called at the end.
 
- Protected Member Functions inherited from GeometryStateDialog
void loadGeometry (int width=0, int height=0, const QString &dialog_name=QString())
 Loads the geometry and splitter state for the dialog.
 
void loadSplitterState (QSplitter *splitter=nullptr)
 Loads the state of a splitter for the dialog.
 

Static Protected Attributes

static const int DEFAULT_MOVING_AVERAGE = 0
 
static const int DEFAULT_Y_AXIS_FACTOR = 1
 

Additional Inherited Members

- Protected Attributes inherited from WiresharkDialog
CaptureFilecap_file_
 Reference to the underlying capture file.
 
bool file_closed_
 Flag indicating if the capture file has been closed.
 

Detailed Description

Dialog for configuring and displaying I/O throughput graphs.

Presents a QCustomPlot-based line/bar graph of per-interval packet, byte, or calculated-field statistics drawn from a live or saved capture file. Supports multiple overlaid graphs, UAT-backed configuration, CSV export, zoom/pan/crosshair interaction, and a movable legend.

Subclasses may override the virtual helpers to produce specialised graph variants (e.g. flow graphs, conversation graphs) while reusing the core plot and scheduling machinery.

Constructor & Destructor Documentation

◆ IOGraphDialog()

IOGraphDialog::IOGraphDialog ( QWidget &  parent,
CaptureFile cf,
const char *  type_unit_name 
)
explicit

Construct an IOGraphDialog.

Parameters
parentThe parent widget (passed to WiresharkDialog).
cfThe capture file to graph.
type_unit_nameShort name describing the Y-axis unit type, used in window titles and axis labels.

Member Function Documentation

◆ addDefaultGraph()

void IOGraphDialog::addDefaultGraph ( bool  enabled,
int  idx = 0 
)
virtual

Add the default graph(s) for this dialog type.

Called by initialize() to populate an empty graph table. Subclasses may override this to provide a different default set.

Parameters
enabledWhether the default graph should start enabled.
idxIndex hint passed to the default graph factory.

Reimplemented in StratosharkIOGraphDialog.

◆ addGraph() [1/3]

void IOGraphDialog::addGraph ( bool  checked,
bool  asAOT,
QString  dfilter,
io_graph_item_unit_t  value_units,
QString  yfield 
)

Add a graph with a minimal set of parameters.

Convenience overload — name, style, moving average, and Y-axis factor are set to their defaults.

Parameters
checkedWhether the graph is initially enabled.
asAOTWhether to draw as "all other traffic".
dfilterDisplay filter expression for the graph.
value_unitsY-axis unit.
yfieldY-axis field expression.

◆ addGraph() [2/3]

void IOGraphDialog::addGraph ( bool  checked,
bool  asAOT,
QString  name,
QString  dfilter,
QColor  color_idx,
IOGraph::PlotStyles  style,
io_graph_item_unit_t  value_units,
QString  yfield,
int  moving_average,
double  yaxisfactor 
)

Add a fully-specified graph to the dialog.

Parameters
checkedWhether the graph is initially enabled.
asAOTWhether to draw the graph as "all other traffic" (i.e. traffic not matched by any other graph).
nameDisplay name shown in the legend.
dfilterDisplay filter expression for the graph.
color_idxRGB pen colour.
stylePlot style (line, bar, dot, etc.).
value_unitsY-axis unit.
yfieldY-axis field expression.
moving_averageWindow size for the moving average, or 0 to disable.
yaxisfactorMultiplier applied to all Y values before plotting.

◆ addGraph() [3/3]

void IOGraphDialog::addGraph ( bool  copy_from_current = false)

Add a blank graph or copy the currently selected graph.

Parameters
copy_from_currentIf true, duplicate the currently selected graph row; if false, append a new default row.

◆ captureFileClosing()

void IOGraphDialog::captureFileClosing ( )
protectedvirtual

Handle capture file closing.

Stops the stat timer and disables graph controls that require an open capture file.

Reimplemented from WiresharkDialog.

◆ getFilteredName()

QString IOGraphDialog::getFilteredName ( ) const
protectedvirtual

Return the display-filter-qualified window/tab title suffix.

Subclasses override this to report the appropriate filtered name (e.g. "Filtered" vs. a specific filter expression).

Returns
A string appended to the dialog title when a filter is active.

Reimplemented in StratosharkIOGraphDialog.

◆ getHintText()

QString IOGraphDialog::getHintText ( unsigned  num_items) const
protectedvirtual

Return the status-bar hint text shown during normal operation.

Parameters
num_itemsThe number of time intervals currently plotted.
Returns
A localised string summarising the current graph state.

Reimplemented in StratosharkIOGraphDialog.

◆ getNoDataHint()

QString IOGraphDialog::getNoDataHint ( ) const
protectedvirtual

Return the hint text shown when no data is available.

Returns
A localised string such as "No data" or a subclass-specific message explaining how to populate the graph.

Reimplemented in StratosharkIOGraphDialog.

◆ getXAxisName()

QString IOGraphDialog::getXAxisName ( ) const
protectedvirtual

Return the X-axis label for this graph type.

Returns
The human-readable X-axis name (e.g. "Time (s)").

Reimplemented in StratosharkIOGraphDialog.

◆ getYAxisName()

const char * IOGraphDialog::getYAxisName ( io_graph_item_unit_t  value_units) const
protectedvirtual

Return the Y-axis label for a given unit.

Parameters
value_unitsThe active Y-axis unit.
Returns
A C string label for the Y axis (e.g. "Packets/s").

Reimplemented in StratosharkIOGraphDialog.

◆ getYAxisValue()

int IOGraphDialog::getYAxisValue ( const QString &  data)
protectedvirtual

Parse a Y-axis value string from the UAT and return its int value.

Used when the Y-axis unit is IOG_ITEM_UNIT_CALC_FRAMES or similar fixed-value modes.

Parameters
dataThe string value from the UAT row.
Returns
The parsed integer Y value.

Reimplemented in StratosharkIOGraphDialog.

◆ getYFieldName()

QString IOGraphDialog::getYFieldName ( io_graph_item_unit_t  value_units,
const QString &  yfield 
) const
protectedvirtual

Return the effective Y-axis field expression to use.

Subclasses may normalise or replace yfield based on value_units.

Parameters
value_unitsThe active Y-axis unit.
yfieldThe raw field expression from the UAT row.
Returns
The field expression to pass to the tap engine.

Reimplemented in StratosharkIOGraphDialog.

◆ goToPacket

void IOGraphDialog::goToPacket ( int  packet_num)
signal

Emitted when the plot should navigate to a specific packet.

Parameters
packet_numThe 1-based packet number to navigate to.

◆ graphCount()

qsizetype IOGraphDialog::graphCount ( ) const

Return the number of graphs currently in the dialog.

Returns
The size of the ioGraphs_ vector.

◆ initialize()

void IOGraphDialog::initialize ( QWidget &  parent,
uat_field_t io_graph_fields,
QString  displayFilter = QString(),
io_graph_item_unit_t  value_units = IOG_ITEM_UNIT_PACKETS,
QString  yfield = QString(),
bool  is_sibling_dialog = false,
const QVector< QString >  convFilters = QVector<QString>() 
)

Finish initialising the dialog after construction.

Separated from the constructor to allow subclass polymorphism. Loads profile graphs from io_graph_fields, applies displayFilter to the first graph, and configures the Y-axis unit and field.

Parameters
parentThe parent widget.
io_graph_fieldsUAT field descriptors for the graph table.
displayFilterInitial display filter string (empty = none).
value_unitsY-axis unit (default: IOG_ITEM_UNIT_PACKETS).
yfieldY-axis field expression (empty = none).
is_sibling_dialogtrue if this dialog was opened as a companion to another statistics dialog rather than standalone.
convFiltersOptional per-conversation display filters to populate as additional graph rows.

◆ intervalChanged

void IOGraphDialog::intervalChanged ( int  interval)
signal

Emitted when the time interval selection changes.

Parameters
intervalThe new interval in milliseconds.

◆ keyPressEvent()

void IOGraphDialog::keyPressEvent ( QKeyEvent *  event)
protectedvirtual

Handle key press events.

Processes zoom, pan, reset, and other keyboard shortcuts while the plot has focus.

Parameters
eventThe key event.

Reimplemented from WiresharkDialog.

◆ modelDataChanged

void IOGraphDialog::modelDataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight,
const QVector< int > &  roles 
)
protectedslot

Respond to data changes in the UAT model.

Syncs QCustomPlot graph settings for any row whose data changed within the rectangle defined by topLeft and bottomRight, then schedules a retap or recalc as required.

Parameters
topLeftTop-left index of the changed model region.
bottomRightBottom-right index of the changed model region.
rolesThe data roles that changed.

◆ modelRowsInserted

void IOGraphDialog::modelRowsInserted ( const QModelIndex &  parent,
int  first,
int  last 
)
protectedslot

Respond to new rows being inserted into the UAT model.

Creates IOGraph and QCPGraph objects for each inserted row and schedules a retap.

Parameters
parentThe parent model index (always invalid for a flat list).
firstFirst inserted row index.
lastLast inserted row index.

◆ modelRowsMoved

void IOGraphDialog::modelRowsMoved ( const QModelIndex &  sourceParent,
int  sourceStart,
int  sourceEnd,
const QModelIndex &  destinationParent,
int  destinationRow 
)
protectedslot

Respond to rows being moved within the UAT model.

Reorders the ioGraphs_ vector to match the new row order and schedules a replot.

Parameters
sourceParentSource parent index.
sourceStartFirst moved source row.
sourceEndLast moved source row.
destinationParentDestination parent index.
destinationRowDestination insertion row.

◆ modelRowsRemoved

void IOGraphDialog::modelRowsRemoved ( const QModelIndex &  parent,
int  first,
int  last 
)
protectedslot

Respond to rows being removed from the UAT model.

Destroys the IOGraph and QCPGraph objects for the removed rows and schedules a replot.

Parameters
parentThe parent model index.
firstFirst removed row index.
lastLast removed row index.

◆ modelRowsReset

void IOGraphDialog::modelRowsReset ( )
protectedslot

Respond to a full UAT model reset.

Clears and rebuilds the ioGraphs_ vector to match the new model state, then schedules a retap.

◆ recalcGraphData

void IOGraphDialog::recalcGraphData ( capture_file cap_file)
signal

Emitted to trigger a full recalculation of all graph data.

Parameters
cap_fileThe capture file to recalculate from.

◆ reject()

void IOGraphDialog::reject ( )
protectedvirtual

Handle dialog rejection (Close button / Escape).

Applies any pending UAT changes before closing.

Reimplemented from WiresharkDialog.

◆ reloadFields

void IOGraphDialog::reloadFields ( )
slot

Reload the list of available Y-axis field names.

Repopulates any field selector combo boxes after a protocol registration change or profile switch.

◆ scheduleRecalc

void IOGraphDialog::scheduleRecalc ( bool  now = false)
slot

Request a medium-weight value recalculation followed by replot.

Recalculates per-interval Y values from already-tapped packet data, then replots. Does not re-read the capture file.

Parameters
nowIf true, recalculate immediately; otherwise defer.

◆ scheduleReplot

void IOGraphDialog::scheduleReplot ( bool  now = false)
slot

Request a lightweight replot of already-computed graph data.

Tells QCustomPlot to redraw existing data without recalculating values. If the stat timer fires before now, the replot is deferred until the next timer tick.

Parameters
nowIf true, replot immediately; otherwise defer to the next timer tick.

◆ scheduleRetap

void IOGraphDialog::scheduleRetap ( bool  now = false)
slot

Request a heavy-weight retap of all packet data.

Re-reads the capture file through all graph tap listeners, then recalculates and replots. Most expensive of the three schedule calls.

Parameters
nowIf true, retap immediately; otherwise defer.

◆ syncGraphSettings()

void IOGraphDialog::syncGraphSettings ( int  row)

Synchronise the QCustomPlot graph object for row with its UAT model row data.

Called after the UAT model changes a row to push the updated name, filter, colour, style, and unit settings into the corresponding IOGraph and QCPGraph objects.

Parameters
rowThe zero-based UAT model row to sync.

Member Data Documentation

◆ DEFAULT_MOVING_AVERAGE

const int IOGraphDialog::DEFAULT_MOVING_AVERAGE = 0
staticprotected

Moving average disabled.

◆ DEFAULT_Y_AXIS_FACTOR

const int IOGraphDialog::DEFAULT_Y_AXIS_FACTOR = 1
staticprotected

Y-axis multiplier of 1 (no scaling).


The documentation for this class was generated from the following files: