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

Stratoshark main application window, extending MainWindow with Stratoshark-specific menus, toolbars, capture session management, and event-driven UI updates. More...

#include <stratoshark_main_window.h>

Inheritance diagram for StratosharkMainWindow:
MainWindow

Public Slots

bool openCaptureFile (QString cf_path, QString display_filter, unsigned int type, bool is_tempfile=false)
 Open a capture file.
 
bool openCaptureFile (QString cf_path=QString(), QString display_filter=QString())
 Convenience overload that auto-detects file type.
 
void filterPackets (QString new_filter=QString(), bool force=false) override
 Applies a new display filter to the open capture file.
 
void updateForUnsavedChanges ()
 Updates title bar, menus, and status bar to reflect unsaved changes.
 
void layoutToolbars ()
 Repositions and resizes toolbars according to current layout settings.
 
void updatePreferenceActions ()
 Refreshes menu items that reflect preference values.
 
void updateRecentActions ()
 Rebuilds the File → Open Recent submenu from the recent-files list.
 
void setTitlebarForCaptureFile ()
 Updates the window title bar to reflect the current capture file name and state.
 
void showCaptureOptionsDialog ()
 Opens the capture options dialog (interface selection, filters, etc.).
 
void captureFileOpened ()
 Updates UI state when a capture file is first opened.
 
void captureFileReadFinished ()
 Updates UI state after a capture file has been fully read.
 
void captureFileClosing ()
 Updates UI state while a capture file is being closed.
 
void captureFileClosed ()
 Resets UI state after a capture file has been fully closed.
 
- Public Slots inherited from MainWindow
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 setDissectedCaptureFile (capture_file *cf)
 Emitted when a dissected capture file becomes the active file.
 
void closePacketDialogs ()
 Emitted to request that all packet-detail dialogs close themselves.
 
void reloadFields ()
 Emitted to request that all views reload their field definitions.
 
void packetInfoChanged (struct _packet_info *pinfo)
 Emitted when the selected packet changes, providing the new packet info.
 
void fieldFilterChanged (const QByteArray field_filter)
 Emitted when the field-based display filter changes.
 
- Signals inherited from MainWindow
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

 StratosharkMainWindow (QWidget *parent=nullptr)
 Constructs the Stratoshark main window and initialises all menus, toolbars, and UI components.
 
 ~StratosharkMainWindow ()
 Destroys the main window and releases all associated resources.
 
QMenu * createPopupMenu () override
 Creates and returns the window's right-click popup menu.
 
CaptureFilecaptureFile ()
 Returns a pointer to the current capture file object.
 
void setFunnelMenus (void)
 Rebuilds the Lua funnel statistics menus from registered funnel entries.
 
void removeAdditionalToolbar (QString toolbarName)
 Removes an additional (plugin/interface) toolbar by name.
 
void addInterfaceToolbar (const iface_toolbar *toolbar_entry)
 Adds an interface toolbar for the given toolbar descriptor.
 
void removeInterfaceToolbar (const char *menu_title)
 Removes the interface toolbar with the given menu title.
 
QString getMwFileName ()
 Returns the file path currently shown in the main window title bar.
 
void setMwFileName (QString fileName)
 Sets the file path shown in the main window title bar.
 
- Public Member Functions inherited from MainWindow
 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 Member Functions

bool eventFilter (QObject *obj, QEvent *event) override
 Filters events on watched objects (e.g. focus changes on child widgets).
 
bool event (QEvent *event) override
 Handles window-level events such as activation changes.
 
void keyPressEvent (QKeyEvent *event) override
 Handles key press events for global keyboard shortcuts.
 
void closeEvent (QCloseEvent *event) override
 Prompts the user to save unsaved changes before closing the window.
 
void dragEnterEvent (QDragEnterEvent *event) override
 Accepts drag-enter events for capture files dragged onto the window.
 
void dropEvent (QDropEvent *event) override
 Opens a capture file dropped onto the window.
 
void changeEvent (QEvent *event) override
 Responds to locale or palette changes by retranslating the UI.
 
void openRecentCaptureFile (const QString &filename) override
 Opens the given recent capture file, handling any necessary prompts.
 
bool tryClosingCaptureFile (QString before_what, FileCloseContext context=Default) override
 Attempts to close the current capture file, prompting the user to save if there are unsaved changes.
 
- Protected Member Functions inherited from MainWindow
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.
 
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.
 

Friends

class MainApplication
 Friend class allowing access to private members.
 

Additional Inherited Members

- Protected Types inherited from MainWindow
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 inherited from MainWindow
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 Attributes inherited from MainWindow
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

Stratoshark main application window, extending MainWindow with Stratoshark-specific menus, toolbars, capture session management, and event-driven UI updates.

Constructor & Destructor Documentation

◆ StratosharkMainWindow()

StratosharkMainWindow::StratosharkMainWindow ( QWidget *  parent = nullptr)
explicit

Constructs the Stratoshark main window and initialises all menus, toolbars, and UI components.

Parameters
parentOptional parent widget.

Member Function Documentation

◆ addInterfaceToolbar()

void StratosharkMainWindow::addInterfaceToolbar ( const iface_toolbar toolbar_entry)

Adds an interface toolbar for the given toolbar descriptor.

Parameters
toolbar_entryDescriptor of the interface toolbar to add.

◆ captureFile()

CaptureFile * StratosharkMainWindow::captureFile ( )
inline

Returns a pointer to the current capture file object.

Returns
Pointer to the internal CaptureFile instance.

◆ changeEvent()

void StratosharkMainWindow::changeEvent ( QEvent *  event)
overrideprotected

Responds to locale or palette changes by retranslating the UI.

Parameters
eventThe change event.

◆ closeEvent()

void StratosharkMainWindow::closeEvent ( QCloseEvent *  event)
overrideprotected

Prompts the user to save unsaved changes before closing the window.

Parameters
eventThe close event; call ignore() to cancel.

◆ createPopupMenu()

QMenu * StratosharkMainWindow::createPopupMenu ( )
override

Creates and returns the window's right-click popup menu.

Returns
Pointer to the newly created QMenu; caller takes ownership.

◆ dragEnterEvent()

void StratosharkMainWindow::dragEnterEvent ( QDragEnterEvent *  event)
overrideprotected

Accepts drag-enter events for capture files dragged onto the window.

Parameters
eventThe drag-enter event.

◆ dropEvent()

void StratosharkMainWindow::dropEvent ( QDropEvent *  event)
overrideprotected

Opens a capture file dropped onto the window.

Parameters
eventThe drop event carrying the file URL(s).

◆ event()

bool StratosharkMainWindow::event ( QEvent *  event)
overrideprotected

Handles window-level events such as activation changes.

Parameters
eventThe event to process.
Returns
true if the event was handled; false otherwise.

◆ eventFilter()

bool StratosharkMainWindow::eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprotected

Filters events on watched objects (e.g. focus changes on child widgets).

Parameters
objObject that received the event.
eventThe event to inspect.
Returns
true to suppress the event; false to pass it on.

◆ fieldFilterChanged

void StratosharkMainWindow::fieldFilterChanged ( const QByteArray  field_filter)
signal

Emitted when the field-based display filter changes.

Parameters
field_filterNew field filter expression as a byte array.

◆ filterPackets

void StratosharkMainWindow::filterPackets ( QString  new_filter = QString(),
bool  force = false 
)
overrideslot

Applies a new display filter to the open capture file.

Parameters
new_filterNew filter expression; empty string shows all packets.
forcetrue to reapply even if the filter is unchanged.

◆ getMwFileName()

QString StratosharkMainWindow::getMwFileName ( )

Returns the file path currently shown in the main window title bar.

Returns
File path string, or an empty string if no file is open.

◆ keyPressEvent()

void StratosharkMainWindow::keyPressEvent ( QKeyEvent *  event)
overrideprotected

Handles key press events for global keyboard shortcuts.

Parameters
eventThe key event to process.

◆ openCaptureFile [1/2]

bool StratosharkMainWindow::openCaptureFile ( QString  cf_path,
QString  display_filter,
unsigned int  type,
bool  is_tempfile = false 
)
slot

Open a capture file.

Parameters
cf_pathPath to the capture file to open.
display_filterDisplay filter to apply after opening; may be empty.
typeWiretap file type hint (use WTAP_TYPE_AUTO for auto-detection).
is_tempfiletrue if the file is a temporary capture file.
Returns
true on success; false on failure.

◆ openCaptureFile [2/2]

bool StratosharkMainWindow::openCaptureFile ( QString  cf_path = QString(),
QString  display_filter = QString() 
)
inlineslot

Convenience overload that auto-detects file type.

Parameters
cf_pathPath to the capture file; empty opens a file dialog.
display_filterDisplay filter to apply; may be empty.
Returns
true on success; false on failure.

◆ openRecentCaptureFile()

void StratosharkMainWindow::openRecentCaptureFile ( const QString &  filename)
overrideprotectedvirtual

Opens the given recent capture file, handling any necessary prompts.

Parameters
filenameAbsolute path of the recent capture file to open.

Implements MainWindow.

◆ packetInfoChanged

void StratosharkMainWindow::packetInfoChanged ( struct _packet_info pinfo)
signal

Emitted when the selected packet changes, providing the new packet info.

Parameters
pinfoPacket info for the newly selected packet.

◆ removeAdditionalToolbar()

void StratosharkMainWindow::removeAdditionalToolbar ( QString  toolbarName)

Removes an additional (plugin/interface) toolbar by name.

Parameters
toolbarNameDisplay name of the toolbar to remove.

◆ removeInterfaceToolbar()

void StratosharkMainWindow::removeInterfaceToolbar ( const char *  menu_title)

Removes the interface toolbar with the given menu title.

Parameters
menu_titleNUL-terminated display title of the toolbar to remove.

◆ setDissectedCaptureFile

void StratosharkMainWindow::setDissectedCaptureFile ( capture_file cf)
signal

Emitted when a dissected capture file becomes the active file.

Parameters
cfPointer to the newly active capture file.

◆ setMwFileName()

void StratosharkMainWindow::setMwFileName ( QString  fileName)

Sets the file path shown in the main window title bar.

Parameters
fileNameNew file path string.

◆ tryClosingCaptureFile()

bool StratosharkMainWindow::tryClosingCaptureFile ( QString  before_what,
FileCloseContext  context = Default 
)
overrideprotectedvirtual

Attempts to close the current capture file, prompting the user to save if there are unsaved changes.

Parameters
before_whatHuman-readable description of the action requiring the close.
contextContext hint that affects the save prompt behaviour.
Returns
true if the file was closed or had no unsaved changes; false if cancelled.

Implements MainWindow.


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