UserMsg Pile   version 0.0.1
UserMsg pile.
UserMsgMan Class Reference

brief description More...

#include <usermsgman.h>

+ Inheritance diagram for UserMsgMan:

Public Types

typedef void(* KbShowMessage) (const UserMsg &um)
 the calback that may be used to be informed about messages
 

Signals

void signalShow (UserMsg um)
 A message should be shown.
 

Static Public Member Functions

static UserMsgMansingleton ()
 Get the singleton.
 
static bool init (bool start_disabled=false)
 Prepares the manager for being used. More...
 
static void end ()
 Terminates the manager (releases resources). More...
 
static bool isInitialized ()
 Tells if the manager has been initialized. More...
 
static const UserMsgStgsettings ()
 Get the settings. More...
 
static void setSettings (const UserMsgStg &value)
 Copy the settings to internal storage.
 
static KbShowMessage callbackShow ()
 Get the callback.
 
static void setCallbackShow (KbShowMessage value)
 Copy the settings to internal storage.
 
static const QString & logFile ()
 The path to the log file.
 
static void setLogFile (const QString &value)
 Set the path to the log file.
 
static void autosetLogFile (const QString &base_name)
 Give me the base name for log file and let me do the rest.
 
static void disable ()
 Sets the cache mode; no messages are being shown.
 
static void enable (bool collapse_messages=false)
 Exist cached mode; cached messages are being shown.
 
static bool isEnabled ()
 Tells if the manager is in cached mode (false).
 
static bool isVisible (UserMsgEntry::Type value)
 tells if a type is visible or not
 
static void setVisible (UserMsgEntry::Type ty, bool b_visible)
 enables or disables the visibility of a type
 
static void setAllVisible (bool include_debug)
 Enable all types (make them visible).
 
static void show (const UserMsg &um)
 Shows an error message. More...
 

Protected Member Functions

void _addMessageToQueue (const UserMsg &um)
 Appends the message to the queue. More...
 
void _showMessage (const UserMsg &um)
 Shows an error message. More...
 
void _showQueue (bool collapse_messages)
 Presents the queue to the user. More...
 
void _openLogFile ()
 Prepares the log file to be used. More...
 
void _logMessage (const UserMsg &um)
 Log the message. More...
 

Static Protected Member Functions

static void autostart ()
 used internally to start the manager if not started already
 

Friends

class LogMsg
 

Detailed Description

brief description

A singleton is created internally and it manages the settings and behaviour of UserMsg.

The manager can be explicitly initialized but it does not have to. Any static function that will be invoked will first check for its existance and it will create it if it does not exist.

Resources can be freed using UserMsgMan::end(), for example at the end of the application.

Initial state for the manager is enabled; to start in disabled state use

at the beginning of your application.

Member Function Documentation

void UserMsgMan::_addMessageToQueue ( const UserMsg um)
protected

Appends the message to the queue.

void UserMsgMan::_logMessage ( const UserMsg um)
protected

Log the message.

If log is available logs the message, otherwise does nothing.

void UserMsgMan::_openLogFile ( )
protected

Prepares the log file to be used.

Warning
The caller must aquire the lock itself.
void UserMsgMan::_showMessage ( const UserMsg um)
protected

Shows an error message.

Presents a message to the user.

void UserMsgMan::_showQueue ( bool  collapse_messages)
protected

Presents the queue to the user.

void UserMsgMan::end ( )
static

Terminates the manager (releases resources).

If the singleton exists is being destroyed.

bool UserMsgMan::init ( bool  start_disabled = false)
static

Prepares the manager for being used.

A new instance is only created if the singleton is NULL.

Returns
true if everything went OK.
bool UserMsgMan::isInitialized ( )
static

Tells if the manager has been initialized.

This is the only static function that will not create the singleton

Returns
true if the singleton is non-NULL.
const UserMsgStg & UserMsgMan::settings ( )
static

Get the settings.

Returns
a constant reference to internal settings.
void UserMsgMan::show ( const UserMsg um)
static

Shows an error message.

Presents a message to the user.


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