Mantid
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::TrackedAction Class Reference

TrackedAction : This is a version of QAction that tracks usage through the Mantid usage service. More...

#include <TrackedAction.h>

Inheritance diagram for MantidQt::MantidWidgets::TrackedAction:

Public Slots

void trackActivation (const bool checked)
 Registers the feature usage if usage is enabled.
 

Public Member Functions

bool getIsTracking () const
 Gets whether this action is tracking usage.
 
std::vector< std::string > getTrackingName () const
 Gets the tracking name for this action If the tacking name is not set a default name will be generated using generateTrackingName.
 
void setIsTracking (const bool enableTracking)
 Sets whether this action is tracking usage.
 
void setTrackingName (const std::vector< std::string > &name)
 Sets the tracking name for this action.
 
 TrackedAction (const QIcon &icon, const QString &text, QObject *parent)
 Constructor.
 
 TrackedAction (const QString &text, QObject *parent)
 Constructor.
 
 TrackedAction (QObject *parent)
 Constructor.
 
virtual ~TrackedAction ()=default
 

Protected Member Functions

virtual std::vector< std::string > generateTrackingName () const
 Creates a tracking name from the action text.
 
virtual void registerUsage (const std::vector< std::string > &name)
 Registers the feature usage with the usage service.
 

Private Member Functions

void setupTracking ()
 Sets up tracking for the class.
 

Private Attributes

bool m_isTracking
 
std::vector< std::string > m_trackingName
 

Detailed Description

TrackedAction : This is a version of QAction that tracks usage through the Mantid usage service.

Definition at line 18 of file TrackedAction.h.

Constructor & Destructor Documentation

◆ TrackedAction() [1/3]

MantidQt::MantidWidgets::TrackedAction::TrackedAction ( QObject *  parent)

Constructor.

Parameters
parentThe parent of this action

Definition at line 17 of file TrackedAction.cpp.

References setupTracking().

◆ TrackedAction() [2/3]

MantidQt::MantidWidgets::TrackedAction::TrackedAction ( const QString &  text,
QObject *  parent 
)

Constructor.

Parameters
textThe text for the action
parentThe parent of this action

Definition at line 25 of file TrackedAction.cpp.

References setupTracking().

◆ TrackedAction() [3/3]

MantidQt::MantidWidgets::TrackedAction::TrackedAction ( const QIcon &  icon,
const QString &  text,
QObject *  parent 
)

Constructor.

Parameters
iconThe icon for the action
textThe text for the action
parentThe parent of this action

Definition at line 35 of file TrackedAction.cpp.

References setupTracking().

◆ ~TrackedAction()

virtual MantidQt::MantidWidgets::TrackedAction::~TrackedAction ( )
virtualdefault

Member Function Documentation

◆ generateTrackingName()

std::vector< std::string > MantidQt::MantidWidgets::TrackedAction::generateTrackingName ( ) const
protectedvirtual

Creates a tracking name from the action text.

Returns
A generated name using ApplicationName->ActionText

Definition at line 74 of file TrackedAction.cpp.

Referenced by getTrackingName().

◆ getIsTracking()

bool MantidQt::MantidWidgets::TrackedAction::getIsTracking ( ) const

Gets whether this action is tracking usage.

Returns
True if the action is tracking usage

Definition at line 65 of file TrackedAction.cpp.

References m_isTracking.

◆ getTrackingName()

std::vector< std::string > MantidQt::MantidWidgets::TrackedAction::getTrackingName ( ) const

Gets the tracking name for this action If the tacking name is not set a default name will be generated using generateTrackingName.

Returns
The tracking name for this action

Definition at line 50 of file TrackedAction.cpp.

References generateTrackingName(), and m_trackingName.

Referenced by trackActivation().

◆ registerUsage()

void MantidQt::MantidWidgets::TrackedAction::registerUsage ( const std::vector< std::string > &  name)
protectedvirtual

Registers the feature usage with the usage service.

Parameters
nameThe name to use when registering usage

Definition at line 92 of file TrackedAction.cpp.

References Mantid::Kernel::Feature, and name.

Referenced by trackActivation().

◆ setIsTracking()

void MantidQt::MantidWidgets::TrackedAction::setIsTracking ( const bool  enableTracking)

Sets whether this action is tracking usage.

Parameters
enableTrackingTrue if the action should tracking usage

Definition at line 60 of file TrackedAction.cpp.

References m_isTracking.

◆ setTrackingName()

void MantidQt::MantidWidgets::TrackedAction::setTrackingName ( const std::vector< std::string > &  name)

Sets the tracking name for this action.

Parameters
namethe tracking name for this action

Definition at line 43 of file TrackedAction.cpp.

References m_trackingName, and name.

◆ setupTracking()

void MantidQt::MantidWidgets::TrackedAction::setupTracking ( )
private

Sets up tracking for the class.

Definition at line 69 of file TrackedAction.cpp.

References trackActivation().

Referenced by TrackedAction(), TrackedAction(), and TrackedAction().

◆ trackActivation

void MantidQt::MantidWidgets::TrackedAction::trackActivation ( const bool  checked)
slot

Registers the feature usage if usage is enabled.

Parameters
checkedWhether the QAction is checked

Definition at line 81 of file TrackedAction.cpp.

References getTrackingName(), m_isTracking, registerUsage(), and UNUSED_ARG.

Referenced by setupTracking().

Member Data Documentation

◆ m_isTracking

bool MantidQt::MantidWidgets::TrackedAction::m_isTracking
private

Definition at line 38 of file TrackedAction.h.

Referenced by getIsTracking(), setIsTracking(), and trackActivation().

◆ m_trackingName

std::vector<std::string> MantidQt::MantidWidgets::TrackedAction::m_trackingName
mutableprivate

Definition at line 39 of file TrackedAction.h.

Referenced by getTrackingName(), and setTrackingName().


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