umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Static Private Attributes | List of all members
Tracer Class Reference

The singleton class for switching on or off debug messages. More...

#include <debug_utils.h>

Inheritance diagram for Tracer:
Collaboration diagram for Tracer:

Classes

class  MapEntry
 

Public Member Functions

 ~Tracer ()
 
bool isEnabled (const QString &name) const
 
void enable (const QString &name)
 
void disable (const QString &name)
 
void enableAll ()
 
void disableAll ()
 
bool logToConsole ()
 

Static Public Member Functions

static Tracerinstance ()
 
static void registerClass (const char *name, bool state=true, const char *filePath=0)
 

Protected Member Functions

void update (const QString &name)
 
void updateParentItemCheckBox (QTreeWidgetItem *parent)
 
virtual void showEvent (QShowEvent *)
 

Private Types

typedef QMap< QString, MapEntryMapType
 
typedef QMap< QString, Qt::CheckState > StateMap
 

Private Slots

void slotParentItemClicked (QTreeWidgetItem *parent)
 
void slotItemClicked (QTreeWidgetItem *item, int column)
 

Private Member Functions

 Tracer (QWidget *parent=0)
 

Static Private Attributes

static Tracers_instance = nullptr
 
static MapType s_classes
 
static StateMap s_states
 
static bool s_logToConsole
 

Detailed Description

The singleton class for switching on or off debug messages.

This class provides a user controllable way to enable class related debug output.

Classes could be registered with the static method registerClass().

With show() a dialog will be shown, in which the user is able to enable/disable debug output for each registered class.

Class related debug output implementation

To register classes independent from related object instantiation time one of the macros

DEBUG_REGISTER(className) DEBUG_REGISTER_DISABLED(className)

should be placed in the implementation part of a class before the first class methods. The first macro enables debug output for the related class, while the latter macro disables it by default.

Debug output in class methods should use

Member Typedef Documentation

◆ MapType

typedef QMap<QString, MapEntry> Tracer::MapType
private

◆ StateMap

typedef QMap<QString,Qt::CheckState> Tracer::StateMap
private

Constructor & Destructor Documentation

◆ ~Tracer()

Tracer::~Tracer ( )

Destructor.

◆ Tracer()

Tracer::Tracer ( QWidget *  parent = 0)
explicitprivate

Constructor.

Parameters
parentthe parent widget
Here is the call graph for this function:

Member Function Documentation

◆ disable()

void Tracer::disable ( const QString &  name)

Disable debug output for the given class.

Parameters
nameclass name
Here is the call graph for this function:

◆ disableAll()

void Tracer::disableAll ( )

◆ enable()

void Tracer::enable ( const QString &  name)

Enable debug output for the given class.

Parameters
nameclass name
Here is the call graph for this function:

◆ enableAll()

void Tracer::enableAll ( )

◆ instance()

Tracer * Tracer::instance ( )
static
Here is the call graph for this function:

◆ isEnabled()

bool Tracer::isEnabled ( const QString &  name) const

Return debugging state for a given class

Parameters
namethe class name to check

◆ logToConsole()

bool Tracer::logToConsole ( )

◆ registerClass()

void Tracer::registerClass ( const char *  name,
bool  state = true,
const char *  filePath = 0 
)
static

Register class for debug output

Parameters
nameclass name
stateinitial enabled state
filePathpath qualified source filename of class

◆ showEvent()

void Tracer::showEvent ( QShowEvent *  e)
protectedvirtual

Fill tree widget with collected classes.

Here is the call graph for this function:

◆ slotItemClicked

void Tracer::slotItemClicked ( QTreeWidgetItem *  item,
int  column 
)
privateslot

handle tree widget item selection signal

Parameters
itemtree widget item
columnselected column
Here is the call graph for this function:

◆ slotParentItemClicked

void Tracer::slotParentItemClicked ( QTreeWidgetItem *  parent)
privateslot
Here is the call graph for this function:

◆ update()

void Tracer::update ( const QString &  name)
protected

Transfer class state into tree widget.

Parameters
nameclass name

◆ updateParentItemCheckBox()

void Tracer::updateParentItemCheckBox ( QTreeWidgetItem *  parent)
protected

Update check box of parent items.

Parameters
parentparent widget item

Member Data Documentation

◆ s_classes

Tracer::MapType Tracer::s_classes
staticprivate

◆ s_instance

Tracer * Tracer::s_instance = nullptr
staticprivate

◆ s_logToConsole

bool Tracer::s_logToConsole
staticprivate

◆ s_states

Tracer::StateMap Tracer::s_states
staticprivate

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