Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
EnabledProtocolsModel Class Reference

A tree model managing the list of all standard and heuristic protocols. More...

#include <enabled_protocols_model.h>

Inheritance diagram for EnabledProtocolsModel:

Public Types

enum  EnabledProtocolsColumn { colProtocol = 0 , colDescription , colLast }
 Enumerates the columns for the enabled protocols model. More...
 
enum  EnableProtocolData { DATA_ENABLE = Qt::UserRole , DATA_PROTOCOL_TYPE }
 Enumerates the custom data roles for the enabled protocols model. More...
 

Public Member Functions

 EnabledProtocolsModel (QObject *parent=Q_NULLPTR)
 Constructs a new EnabledProtocolsModel.
 
virtual ~EnabledProtocolsModel ()
 Destroys the EnabledProtocolsModel.
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Generates an index for the given row and column.
 
QModelIndex parent (const QModelIndex &index) const
 Retrieves the parent of a given index.
 
Qt::ItemFlags flags (const QModelIndex &index) const
 Retrieves the item flags for a given index.
 
QVariant data (const QModelIndex &index, int role) const
 Retrieves data from the model for a given index and role.
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 Sets data in the model for a given index and role.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Retrieves the header data for a specific section and role.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of rows under a given parent.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of columns under a given parent.
 
void populate ()
 Populates the model with protocols from the core engine.
 
void applyChanges (bool writeChanges=true)
 Applies pending changes to the core protocol definitions.
 

Static Public Member Functions

static void disableProtocol (struct _protocol *protocol)
 Disables a specific protocol directly in the core.
 

Static Protected Member Functions

static void saveChanges (bool writeChanges=true)
 Triggers the core mechanism to save protocol changes.
 

Detailed Description

A tree model managing the list of all standard and heuristic protocols.

Member Enumeration Documentation

◆ EnabledProtocolsColumn

Enumerates the columns for the enabled protocols model.

Enumerator
colProtocol 

Protocol name column.

colDescription 

Protocol description column.

colLast 

End of columns marker.

◆ EnableProtocolData

Enumerates the custom data roles for the enabled protocols model.

Enumerator
DATA_ENABLE 

Role to access the enable state.

DATA_PROTOCOL_TYPE 

Role to access the protocol type.

Constructor & Destructor Documentation

◆ EnabledProtocolsModel()

EnabledProtocolsModel::EnabledProtocolsModel ( QObject *  parent = Q_NULLPTR)
explicit

Constructs a new EnabledProtocolsModel.

Parameters
parentThe parent QObject, defaults to Q_NULLPTR.

Member Function Documentation

◆ applyChanges()

void EnabledProtocolsModel::applyChanges ( bool  writeChanges = true)

Applies pending changes to the core protocol definitions.

Parameters
writeChangesTrue to write changes out to the configuration file (defaults to true).

◆ columnCount()

int EnabledProtocolsModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

Returns the number of columns under a given parent.

Parameters
parentThe parent model index (defaults to an invalid QModelIndex).
Returns
The number of columns.

◆ data()

QVariant EnabledProtocolsModel::data ( const QModelIndex &  index,
int  role 
) const

Retrieves data from the model for a given index and role.

Parameters
indexThe model index.
roleThe data role requested.
Returns
The data associated with the index and role.

◆ disableProtocol()

void EnabledProtocolsModel::disableProtocol ( struct _protocol protocol)
static

Disables a specific protocol directly in the core.

Parameters
protocolPointer to the core protocol structure.

◆ flags()

Qt::ItemFlags EnabledProtocolsModel::flags ( const QModelIndex &  index) const

Retrieves the item flags for a given index.

Parameters
indexThe model index.
Returns
The item flags.

◆ headerData()

QVariant EnabledProtocolsModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

Retrieves the header data for a specific section and role.

Parameters
sectionThe column or row section.
orientationThe orientation of the header.
roleThe data role requested (defaults to Qt::DisplayRole).
Returns
The header data.

◆ index()

QModelIndex EnabledProtocolsModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const

Generates an index for the given row and column.

Parameters
rowThe row index.
columnThe column index.
parentThe parent index (defaults to an invalid QModelIndex).
Returns
The corresponding model index.

◆ parent()

QModelIndex EnabledProtocolsModel::parent ( const QModelIndex &  index) const

Retrieves the parent of a given index.

Parameters
indexThe child model index.
Returns
The parent model index.

◆ rowCount()

int EnabledProtocolsModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Returns the number of rows under a given parent.

Parameters
parentThe parent model index (defaults to an invalid QModelIndex).
Returns
The number of rows.

◆ saveChanges()

void EnabledProtocolsModel::saveChanges ( bool  writeChanges = true)
staticprotected

Triggers the core mechanism to save protocol changes.

Parameters
writeChangesTrue to save to disk (defaults to true).

◆ setData()

bool EnabledProtocolsModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)

Sets data in the model for a given index and role.

Parameters
indexThe model index to update.
valueThe value to set.
roleThe role being edited (defaults to Qt::EditRole).
Returns
True if successful, false otherwise.

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