Wireshark 4.7.0
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:
StratosharkMainWindow WiresharkMainWindow

Public Slots

void setDisplayFilter (QString filter, FilterAction::Action action, FilterAction::ActionType filterType)
 Sets the display filter and performs an action.
 
virtual void filterPackets (QString new_filter, bool force)=0
 Filters the packets.
 
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_dataframeDataForRow (int row) const
 Retrieves frame data for a specific row.
 
QString getFilter ()
 Retrieves the current display filter.
 
MainStatusBarstatusBar ()
 Retrieves the main status bar.
 
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.
 

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_tmenu_groups_
 
QStackedWidget * main_stack_
 
WelcomePagewelcome_page_
 
QSplitter master_split_
 
QSplitter extra_split_
 
QWidget empty_pane_
 
QVector< unsigned > cur_layout_
 
PacketListpacket_list_
 
ProtoTreeproto_tree_
 
QWidget * proto_container_
 
DataSourceTabdata_source_tab_
 
PacketDiagrampacket_diagram_
 
DisplayFilterCombodf_combo_box_
 
MainStatusBarmain_status_bar_
 
ProfileSwitcherprofile_switcher_
 
bool use_capturing_title_
 
QMap< QString, QTextCodec * > 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

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
parentThe parent widget, defaults to nullptr.

Member Function Documentation

◆ addDisplayFilterTranslationActions

void MainWindow::addDisplayFilterTranslationActions ( QMenu *  copy_menu)
protectedslot

Adds translation actions for the display filter to a menu.

Parameters
copy_menuThe 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_menuThe context menu to add to.
finfo_arrayArray 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_actionPointer to the funnel action to append.

◆ captureActive

void MainWindow::captureActive ( int  active)
signal

Signal emitted when a capture becomes active.

Parameters
activeIndicator of capture activity.

◆ cyclePane

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

Cycles the focus through the available panes.

Parameters
reverseTrue to cycle in reverse order.

◆ displayFilterSuccess

void MainWindow::displayFilterSuccess ( bool  success)
signal

Signal emitted when a display filter is successfully applied.

Parameters
successTrue if the display filter was valid and applied.

◆ fieldHighlight

void MainWindow::fieldHighlight ( FieldInformation finfo)
signal

Signal emitted when a field is highlighted.

Parameters
finfoPointer to the highlighted field information.

◆ fieldSelected

void MainWindow::fieldSelected ( FieldInformation finfo)
signal

Signal emitted when a field is selected.

Parameters
finfoPointer 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
filterThe filter string.
actionThe filter action.
typeThe filter action type.

◆ filterPackets

virtual void MainWindow::filterPackets ( QString  new_filter,
bool  force 
)
pure virtualslot

Filters the packets.

Parameters
new_filterThe filter string.
forceTrue to force the filter application.

◆ frameDataForRow()

frame_data * MainWindow::frameDataForRow ( int  row) const

Retrieves frame data for a specific row.

Parameters
rowThe 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
framesList 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
typeThe 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_numThe 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
nameThe name of the column.
abbrevThe abbreviation of the column.
posThe position to insert at, defaults to -1 (append).

◆ openRecentCaptureFile()

virtual void MainWindow::openRecentCaptureFile ( const QString &  filename)
protectedpure virtual

Open a capture file from the recent files menu.

Parameters
filenamePath to the file to open.

Implemented in WiresharkMainWindow, and StratosharkMainWindow.

◆ 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
useFrameNumTrue 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
cfPointer 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
filterThe filter string.
actionThe filter action to perform.
filterTypeThe 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_progressTrue if a capture is active.

◆ setMainWindowTitle()

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

Sets the title of the main window.

Parameters
titleThe title string to set, defaults to an empty string.

◆ setMenusForCaptureFile()

virtual void MainWindow::setMenusForCaptureFile ( bool  force_disable = false)
protectedpure virtual

Sets up the menus for the active capture file.

Parameters
force_disableTrue to force menus to be disabled.

◆ showIOGraphDialog

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

Shows the IO graph dialog.

Parameters
value_unitsThe unit for the IO graph.
yfieldThe field to display on the y-axis.

◆ showPlotDialog

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

Shows a plot dialog.

Parameters
y_fieldThe field to display on the y-axis.
filteredTrue if the plot should be filtered.

◆ showPreferencesDialog

virtual void MainWindow::showPreferencesDialog ( QString  module_name)
pure virtualslot

Shows the preferences dialog for a specific module.

Parameters
module_nameThe 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 
)
protectedpure virtual

Tries to safely close the current capture file.

Parameters
before_whatDescription of the operation occurring after the close.
contextContext of the file closure.
Returns
True if the file closed successfully, false if the user canceled.

Implemented in WiresharkMainWindow, and StratosharkMainWindow.

◆ updateDisplayFilterTranslationActions

void MainWindow::updateDisplayFilterTranslationActions ( const QString &  df_text)
protectedslot

Updates the available translation actions based on filter text.

Parameters
df_textThe 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_

DisplayFilterCombo* 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.

◆ 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_container_

QWidget* MainWindow::proto_container_
protected

Wraps proto_tree_ + in-packet find bar

◆ 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, QTextCodec *> MainWindow::text_codec_map_
protected

Map of text codecs used for different strings.

◆ 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: