| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
MainWindow Class Referenceabstract

The main window of the application. More...

`#include <main_window.h>`

Inheritance diagram for MainWindow:

## Public Slots
void | setDisplayFilter (QString filter, FilterAction::Action action, FilterAction::ActionType filterType)
| Sets the display filter and performs an action.
void | filterPackets (QString new_filter=QString(), bool force=true)
| Sets and applies a new display filter to the open capture file.
virtual void | showPreferencesDialog (QString module_name)=0
| Shows the preferences dialog for a specific module.
virtual void | showIOGraphDialog (io_graph_item_unit_t value_units, QString yfield)=0
| Shows the IO graph dialog.
virtual void | showPlotDialog (const QString &y_field, bool filtered)=0
| Shows a plot dialog.
void | layoutPanes ()
| Recalculates and lays out the panes.
void | applyRecentPaneGeometry ()
| Applies the most recent pane geometry settings.
void | updateForUnsavedChanges ()
| Updates the UI to reflect unsaved changes.
void | cyclePane (bool reverse=false)
| Cycles the focus through the available panes.

## Signals
void | setCaptureFile (capture_file *cf)
| Signal emitted to set a new capture file.
void | captureActive (int active)
| Signal emitted when a capture becomes active.
void | fieldSelected (FieldInformation *finfo)
| Signal emitted when a field is selected.
void | fieldHighlight (FieldInformation *finfo)
| Signal emitted when a field is highlighted.
void | framesSelected (QList< int > frames)
| Signal emitted when frames are selected.
void | filterAction (QString filter, FilterAction::Action action, FilterAction::ActionType type)
| Signal emitted to perform a filter action.
void | displayFilterSuccess (bool success)
| Signal emitted when a display filter is successfully applied.

## Public Member Functions
| MainWindow (QWidget *parent=nullptr)
| Constructs a new MainWindow.
| ~MainWindow ()
| Destroys the MainWindow.
void | setMainWindowTitle (QString title=QString())
| Sets the title of the main window.
bool | hasSelection ()
| Checks if there is a current selection.
bool | hasUniqueSelection ()
| Checks if the current selection is unique.
QList< int > | selectedRows (bool useFrameNum=false)
| Retrieves the selected rows.
void | insertColumn (QString name, QString abbrev, int pos=-1)
| Inserts a column into the view.
void | gotoFrame (int packet_num)
| Navigates to a specific frame number.
frame_data * | frameDataForRow (int row) const
| Retrieves frame data for a specific row.
QString | getFilter ()
| Retrieves the current display filter.
MainStatusBar * | statusBar ()
| Retrieves the main status bar.
CaptureFile * | captureFile ()
| Returns a pointer to the current capture file object.
InterfaceListManager * | interfaceListManager () const
| Returns the local interface enumeration/statistics coordinator.
void | appendPacketMenu (FunnelAction *funnel_action)
| Appends a custom packet menu action.
QList< QAction * > | getPacketMenuActions ()
| Retrieves the list of custom packet menu actions.
void | clearAddedPacketMenus ()
| Clears the recently added custom packet menus.
bool | addPacketMenus (QMenu *ctx_menu, GPtrArray *finfo_array)
| Adds packet menus to the given context menu.

## Protected Types
enum | CopySelected { CopyAllVisibleItems , CopyAllVisibleSelectedTreeItems , CopySelectedDescription , CopySelectedFieldName , CopySelectedValue , CopyListAsText , CopyListAsCSV , CopyListAsYAML , CopyListAsHTML }
| Enumeration for determining what to copy when items are selected. More...
enum | FileCloseContext { Default , Quit , Restart , Reload , Update , Export }
| Context under which a capture file is being closed. More...

## Protected Slots
void | addDisplayFilterTranslationActions (QMenu *copy_menu)
| Adds translation actions for the display filter to a menu.
void | updateDisplayFilterTranslationActions (const QString &df_text)
| Updates the available translation actions based on filter text.
void | updateTitlebar ()
| Updates the main title bar text.
virtual void | applyFilter (QString new_filter, bool force)=0
| Applies a new display filter to the open capture file.

## Protected Member Functions
void | showWelcome ()
| Displays the welcome screen.
void | showCapture ()
| Displays the main capture view.
void | setTitlebarForCaptureInProgress ()
| Sets the title bar text for when a capture is in progress.
void | setIconForCaptureInProgress (bool capture_in_progress)
| Sets the window icon to indicate if a capture is in progress.
virtual void | setMenusForCaptureFile (bool force_disable=false)=0
| Sets up the menus for the active capture file.
QWidget * | getLayoutWidget (layout_pane_content_e type)
| Retrieves the widget corresponding to a layout pane content type.
void | populateRecentCapturesMenu ()
| Populate the recent captures menu. Calls openRecentCaptureFile() for each menu item action.
void | retranslateUiElements ()
| Handle retranslation of UI elements in MainWindow.
virtual void | openRecentCaptureFile (const QString &filename)=0
| Open a capture file from the recent files menu.
virtual bool | tryClosingCaptureFile (QString before_what, FileCloseContext context=Default)=0
| Tries to safely close the current capture file.

## Protected Attributes
CaptureFile | capture_file_
QList< register_stat_group_t > | menu_groups_
QStackedWidget * | main_stack_
WelcomePage * | welcome_page_
QSplitter | master_split_
QSplitter | extra_split_
QWidget | empty_pane_
QVector< unsigned > | cur_layout_
PacketList * | packet_list_
ProtoTree * | proto_tree_
DataSourceTab * | data_source_tab_
PacketDiagram * | packet_diagram_
DisplayFilterEntry * | df_combo_box_
MainStatusBar * | main_status_bar_
ProfileSwitcher * | profile_switcher_
InterfaceListManager * | interface_list_manager_
bool | use_capturing_title_
QMap< QString, const char * > | text_codec_map_
QMenu * | recent_captures_menu_
QAction * | no_recent_files_action_

## Detailed Description

The main window of the application.

## Member Enumeration Documentation

## ◆ CopySelected

enum MainWindow::CopySelected
| protected

Enumeration for determining what to copy when items are selected.

Enumerator
CopyAllVisibleItems | Copy all visible items.
CopyAllVisibleSelectedTreeItems | Copy all visible items within the selected tree.
CopySelectedDescription | Copy the selected description.
CopySelectedFieldName | Copy the selected field name.
CopySelectedValue | Copy the selected value.
CopyListAsText | Copy the list formatted as text.
CopyListAsCSV | Copy the list formatted as CSV.
CopyListAsYAML | Copy the list formatted as YAML.
CopyListAsHTML | Copy the list formatted as HTML.

## ◆ FileCloseContext

enum MainWindow::FileCloseContext
| protected

Context under which a capture file is being closed.

Enumerator
Default | Default closing context.
Quit | Closing because the application is quitting.
Restart | Closing because the application is restarting.
Reload | Closing to reload the file.
Update | Closing as part of an update.
Export | Closing to export the file.

## Constructor & Destructor Documentation

## ◆ MainWindow()

MainWindow::MainWindow | ( | QWidget * | parent = nullptr | ) |
| explicit

Constructs a new MainWindow.

Parameters

  parent | The parent widget, defaults to nullptr.

## Member Function Documentation

## ◆ addDisplayFilterTranslationActions

void MainWindow::addDisplayFilterTranslationActions | ( | QMenu * | copy_menu | ) |
| protected slot

Adds translation actions for the display filter to a menu.

Parameters

  copy_menu | The menu to add the actions to.

## ◆ addPacketMenus()

bool MainWindow::addPacketMenus | ( | QMenu * | ctx_menu,
|  | GPtrArray * | finfo_array )

Adds packet menus to the given context menu.

Parameters

  ctx_menu | The context menu to add to.
  finfo_array | Array of field information.

Returns
  True if menus were successfully added, false otherwise.

## ◆ appendPacketMenu()

void MainWindow::appendPacketMenu | ( | FunnelAction * | funnel_action | ) |

Appends a custom packet menu action.

Parameters

  funnel_action | Pointer to the funnel action to append.

## ◆ applyFilter

virtual void MainWindow::applyFilter | ( | QString | new_filter,
|  | bool | force )
| protected pure virtual slot

Applies a new display filter to the open capture file.

Parameters

  new_filter | New filter expression; empty string shows all packets.
  force | `true` to reapply even if the filter is unchanged.

## ◆ captureActive

void MainWindow::captureActive | ( | int | active | ) |
| signal

Signal emitted when a capture becomes active.

Parameters

  active | Indicator of capture activity.

## ◆ captureFile()

CaptureFile * MainWindow::captureFile | ( |  | ) |
| inline

Returns a pointer to the current capture file object.

Returns
  Pointer to the internal CaptureFile instance.

## ◆ cyclePane

void MainWindow::cyclePane | ( | bool | reverse = false | ) |
| slot

Cycles the focus through the available panes.

Parameters

  reverse | True to cycle in reverse order.

## ◆ displayFilterSuccess

void MainWindow::displayFilterSuccess | ( | bool | success | ) |
| signal

Signal emitted when a display filter is successfully applied.

Parameters

  success | True if the display filter was valid and applied.

## ◆ fieldHighlight

void MainWindow::fieldHighlight | ( | FieldInformation * | finfo | ) |
| signal

Signal emitted when a field is highlighted.

Parameters

  finfo | Pointer to the highlighted field information.

## ◆ fieldSelected

void MainWindow::fieldSelected | ( | FieldInformation * | finfo | ) |
| signal

Signal emitted when a field is selected.

Parameters

  finfo | Pointer to the field information.

## ◆ filterAction

void MainWindow::filterAction | ( | QString | filter,
|  | FilterAction::Action | action,
|  | FilterAction::ActionType | type )
| signal

Signal emitted to perform a filter action.

Parameters

  filter | The filter string.
  action | The filter action.
  type | The filter action type.

## ◆ filterPackets

void MainWindow::filterPackets | ( | QString | new_filter = QString(),
|  | bool | force = true )
| slot

Sets and applies a new display filter to the open capture file.

Parameters

  new_filter | New filter expression; empty string shows all packets.
  force | `true` to reapply even if the filter is unchanged.

Note
  The force parameter is currently ignored.

## ◆ frameDataForRow()

frame_data * MainWindow::frameDataForRow | ( | int | row | ) | const

Retrieves frame data for a specific row.

Parameters

  row | The index of the row.

Returns
  Pointer to the frame data for the specified row.

## ◆ framesSelected

void MainWindow::framesSelected | ( | QList< int > | frames | ) |
| signal

Signal emitted when frames are selected.

Parameters

  frames | List of selected frame numbers.

## ◆ getFilter()

QString MainWindow::getFilter | ( |  | ) |

Retrieves the current display filter.

Returns
  The filter string.

## ◆ getLayoutWidget()

QWidget * MainWindow::getLayoutWidget | ( | layout_pane_content_e | type | ) |
| protected

Retrieves the widget corresponding to a layout pane content type.

Parameters

  type | The layout pane content type.

Returns
  Pointer to the layout widget.

## ◆ getPacketMenuActions()

QList< QAction * > MainWindow::getPacketMenuActions | ( |  | ) |

Retrieves the list of custom packet menu actions.

Returns
  A list of QAction pointers representing the packet menus.

## ◆ gotoFrame()

void MainWindow::gotoFrame | ( | int | packet_num | ) |

Navigates to a specific frame number.

Parameters

  packet_num | The packet number to jump to.

## ◆ hasSelection()

bool MainWindow::hasSelection | ( |  | ) |

Checks if there is a current selection.

Returns
  True if there is a selection, false otherwise.

## ◆ hasUniqueSelection()

bool MainWindow::hasUniqueSelection | ( |  | ) |

Checks if the current selection is unique.

Returns
  True if the selection is unique, false otherwise.

## ◆ insertColumn()

void MainWindow::insertColumn | ( | QString | name,
|  | QString | abbrev,
|  | int | pos = -1 )

Inserts a column into the view.

Parameters

  name | The name of the column.
  abbrev | The abbreviation of the column.
  pos | The position to insert at, defaults to -1 (append).

## ◆ interfaceListManager()

InterfaceListManager * MainWindow::interfaceListManager | ( |  | ) | const

Returns the local interface enumeration/statistics coordinator.

The manager owns the live InterfaceStatistics; reach it via interfaceListManager()->statistics().

Returns
  Pointer to the InterfaceListManager owned by this window.

## ◆ openRecentCaptureFile()

virtual void MainWindow::openRecentCaptureFile | ( | const QString & | filename | ) |
| protected pure virtual

Open a capture file from the recent files menu.

Parameters

  filename | Path to the file to open.

Implemented in StratosharkMainWindow, and WiresharkMainWindow.

## ◆ populateRecentCapturesMenu()

void MainWindow::populateRecentCapturesMenu | ( |  | ) |
| protected

Populate the recent captures menu. Calls openRecentCaptureFile() for each menu item action.

Populate the recent captures menu with files from WorkspaceState. Calls openRecentCaptureFile() (pure virtual) when user selects a file.

## ◆ retranslateUiElements()

void MainWindow::retranslateUiElements | ( |  | ) |
| protected

Handle retranslation of UI elements in MainWindow.

This function is called when the application language changes and usually handles elements like menu items and labels that need to be updated to reflect the new language.

## ◆ selectedRows()

QList< int > MainWindow::selectedRows | ( | bool | useFrameNum = false | ) |

Retrieves the selected rows.

Parameters

  useFrameNum | True to return frame numbers, false for row indices.

Returns
  A list of selected row numbers or frame numbers.

## ◆ setCaptureFile

void MainWindow::setCaptureFile | ( | capture_file * | cf | ) |
| signal

Signal emitted to set a new capture file.

Parameters

  cf | Pointer to the capture file.

## ◆ setDisplayFilter

void MainWindow::setDisplayFilter | ( | QString | filter,
|  | FilterAction::Action | action,
|  | FilterAction::ActionType | filterType )
| slot

Sets the display filter and performs an action.

Parameters

  filter | The filter string.
  action | The filter action to perform.
  filterType | The type of the filter action.

## ◆ setIconForCaptureInProgress()

void MainWindow::setIconForCaptureInProgress | ( | bool | capture_in_progress | ) |
| protected

Sets the window icon to indicate if a capture is in progress.

Parameters

  capture_in_progress | True if a capture is active.

## ◆ setMainWindowTitle()

void MainWindow::setMainWindowTitle | ( | QString | title = QString() | ) |

Sets the title of the main window.

Parameters

  title | The title string to set, defaults to an empty string.

## ◆ setMenusForCaptureFile()

virtual void MainWindow::setMenusForCaptureFile | ( | bool | force_disable = false | ) |
| protected pure virtual

Sets up the menus for the active capture file.

Parameters

  force_disable | True to force menus to be disabled.

## ◆ showIOGraphDialog

virtual void MainWindow::showIOGraphDialog | ( | io_graph_item_unit_t | value_units,
|  | QString | yfield )
| pure virtual slot

Shows the IO graph dialog.

Parameters

  value_units | The unit for the IO graph.
  yfield | The field to display on the y-axis.

## ◆ showPlotDialog

virtual void MainWindow::showPlotDialog | ( | const QString & | y_field,
|  | bool | filtered )
| pure virtual slot

Shows a plot dialog.

Parameters

  y_field | The field to display on the y-axis.
  filtered | True if the plot should be filtered.

## ◆ showPreferencesDialog

virtual void MainWindow::showPreferencesDialog | ( | QString | module_name | ) |
| pure virtual slot

Shows the preferences dialog for a specific module.

Parameters

  module_name | The name of the module.

## ◆ statusBar()

MainStatusBar * MainWindow::statusBar | ( |  | ) |

Retrieves the main status bar.

Returns
  Pointer to the MainStatusBar.

## ◆ tryClosingCaptureFile()

virtual bool MainWindow::tryClosingCaptureFile | ( | QString | before_what,
|  | FileCloseContext | context = Default )
| protected pure virtual

Tries to safely close the current capture file.

Parameters

  before_what | Description of the operation occurring after the close.
  context | Context of the file closure.

Returns
  True if the file closed successfully, false if the user canceled.

Implemented in StratosharkMainWindow, and WiresharkMainWindow.

## ◆ updateDisplayFilterTranslationActions

void MainWindow::updateDisplayFilterTranslationActions | ( | const QString & | df_text | ) |
| protected slot

Updates the available translation actions based on filter text.

Parameters

  df_text | The current display filter text.

## Member Data Documentation

## ◆ capture_file_

CaptureFile MainWindow::capture_file_
| protected

The active capture file.

## ◆ cur_layout_

QVector<unsigned> MainWindow::cur_layout_
| protected

Vector storing the current layout configuration.

## ◆ data_source_tab_

DataSourceTab* MainWindow::data_source_tab_
| protected

Pointer to the data source tab widget.

## ◆ df_combo_box_

DisplayFilterEntry* MainWindow::df_combo_box_
| protected

Pointer to the display filter combo box.

## ◆ empty_pane_

QWidget MainWindow::empty_pane_
| protected

An empty pane widget used as a placeholder.

## ◆ extra_split_

QSplitter MainWindow::extra_split_
| protected

Extra splitter for additional pane layout.

## ◆ interface_list_manager_

InterfaceListManager* MainWindow::interface_list_manager_
| protected

Coordinator for local interface enumeration; owns the live statistics.

## ◆ main_stack_

QStackedWidget* MainWindow::main_stack_
| protected

Main stacked widget for central views.

## ◆ main_status_bar_

MainStatusBar* MainWindow::main_status_bar_
| protected

Pointer to the main status bar.

## ◆ master_split_

QSplitter MainWindow::master_split_
| protected

Master splitter for the main layout.

## ◆ menu_groups_

QList<register_stat_group_t> MainWindow::menu_groups_
| protected

List of register stat groups for the menu.

## ◆ no_recent_files_action_

QAction* MainWindow::no_recent_files_action_
| protected

Action representing no recent files available.

## ◆ packet_diagram_

PacketDiagram* MainWindow::packet_diagram_
| protected

Pointer to the packet diagram widget.

## ◆ packet_list_

PacketList* MainWindow::packet_list_
| protected

Pointer to the packet list widget.

## ◆ profile_switcher_

ProfileSwitcher* MainWindow::profile_switcher_
| protected

Pointer to the profile switcher widget.

## ◆ proto_tree_

ProtoTree* MainWindow::proto_tree_
| protected

Pointer to the protocol tree widget.

## ◆ recent_captures_menu_

QMenu* MainWindow::recent_captures_menu_
| protected

Menu containing recently opened capture files.

## ◆ text_codec_map_

QMap<QString, const char *> MainWindow::text_codec_map_
| protected

Map of display name to iconv encoding name.

## ◆ use_capturing_title_

bool MainWindow::use_capturing_title_
| protected

Flag indicating if the capturing title is used.

## ◆ welcome_page_

WelcomePage* MainWindow::welcome_page_
| protected

Pointer to the welcome page widget.

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

- /builds/wireshark/wireshark/ui/qt/main_window.h
- /builds/wireshark/wireshark/ui/qt/main_window.cpp
- /builds/wireshark/wireshark/ui/qt/main_window_layout.cpp