UserMsg Pile
version 0.0.1
UserMsg pile.
|
The UserMsg class provides a way to manage and dispatch messages that are intended for the user. The library does not provide the GUI to actually show the messages. Instread, a callback mechanism is employed and the user is expected to provide necessary callbacks. Also, the Qt signal/slot mechanism is also used, so the user has some flexibility in implementing the front-end.
UserMsgMan is the manager class. 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.
The messaging system can be disabled temporarly by calling UserMsgMan::disable(). It will accumulate the messages internaly and show them when UserMsgMan::enable() is called. The messages can be collapsed into one per type.
An initialization sequence that makes use of all the features of the manager may look like so:
The frontend has a range of options to connect and use the library.
Following callbacks are available:
Following signals are available:
A message consists of an optional title, an optional user defined value (payload) and a list of zero or more entries.
Each entry consists of a timestamp, a type and a message.
The informative messages are errors, warnings and general information that is intended to the user. The user is only informed about the event and, depending on the GUI front-end, may need to confirm message acknowledgement.
A message can be shown right away:
Messages can be accumulated in an instance of the class and presented later (or never presented):
To show the content accumulated in the structure, if any, use:
This will present the user with the messages the user elected to see.