All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Slots | Public Member Functions
Qtilities::Core::ContextManager Class Reference

A class which represents a context manager. More...

#include <ContextManager.h>

Inheritance diagram for Qtilities::Core::ContextManager:
Inheritance graph
[legend]

List of all members.

Public Slots

void addContexts (QObject *obj)
 Inspects obj and if it implements Qtilities::Core::Interfaces::IContext, the context will be registered.
void appendContext (int context_id, bool notify=true)
 Appends a context to the set of active contexts.
void appendContext (const QString &context_string, bool notify=true)
 Appends a context to the set of active contexts. The context is identified using a string.
void broadcastState ()
 Slot which will emit the current state of the context manager. Use this if you updated your contexts using notify = false.
void removeContext (int context_id, bool notify=true)
 Removes a context from the set of active contexts.
void removeContext (const QString &context_string, bool notify=true)
 Removes a context from the set of active contexts. The context is identified using a string.
void setNewContext (int context_id, bool notify=true)
 Sets a new context. Will clear all current active contexts.
void setNewContext (const QString &context_string, bool notify=true)
 Sets a new context. Will clear all current active contexts. The context is identified using a string.
- Public Slots inherited from Qtilities::Core::Interfaces::IContextManager

Public Member Functions

QStringList activeContextNames () const
 Returns the names of all active contexts.
QList< int > activeContexts () const
 Gets the current context.
QList< int > allContexts () const
 Returns a list of all the contexts currently registered.
QString contextHelpID (int context_id) const
 Returns the context help id for a given context id. QString() is returned if no help id was registered for the given context id.
QString contextHelpID (const QString &context_string) const
 Returns the context help id for a given context string. QString() is returned if no help id was registered for the given context string.
int contextID (const QString &context_string)
 Returns an unique context ID for the given context string. Contexts are stored and identified using integer ID values throughout the library.
QStringList contextNames () const
 Returns the names of all registered contexts.
QString contextString (int context_id) const
 Returns the string which was used to register a context id. If the context id does not exist, QString() is returned.
bool hasContext (QList< int > contexts) const
 Returns true if any of the contexts in the list were registered in the context manager.
bool hasContext (int context) const
 Returns true if the specified context is registered in the context manager.
bool hasContext (const QString &context_string) const
 Returns true if the specified context string is registered in the context manager.
int registerContext (const QString &context, const QString &context_help_id=QString())
 Registers a new context.
bool unregisterContext (int context_id, bool notify=true)
 Unregisters an existing context.
bool unregisterContext (const QString &context_string, bool notify=true)
 Unregisters an existing context.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IContextManager
QObject * objectBase ()
 Returns the QObject* base of the interface.
const QObject * objectBase () const
 Returns a const QObject* base of the interface.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.

Additional Inherited Members

- Signals inherited from Qtilities::Core::Interfaces::IContextManager
void aboutToAppendContext (int context_id)
 Signal which is emitted when the appendContext() is about to append the context.
void aboutToRemoveContext (int context_id)
 Signal which is emitted when the removeContext() is about to remove the context.
void aboutToSetNewContext (int context_id)
 Signal which is emitted when the setNewContext() is about to set the new context.
void aboutToUnregisterContext (int context_id)
 Signal which is emitted when the unregisterContext() is about to unregister the context.
void contextChanged (QList< int > new_contexts)
 Notification that the context changes.
void finishedAppendContext (int context_id)
 Signal which is emitted when the appendContext() function finished appending the context.
void finishedRemoveContext (int context_id)
 Signal which is emitted when the removeContext() is done removing the context.
void finishedSetNewContext (int context_id)
 Signal which is emitted when the setNewContext() finished to set the new context.
void finishedUnregisterContext (int context_id)
 Signal which is emitted when the unregisterContext() is done unregistering the context.

Detailed Description

A class which represents a context manager.

The context manager automatically registers the standard application context, qti_def_CONTEXT_STANDARD.


Member Function Documentation

int Qtilities::Core::ContextManager::registerContext ( const QString &  context,
const QString &  context_help_id = QString() 
)
virtual

Registers a new context.

The recommended way to do this is to let your object implement IContext and then register it with the global object pool which will automate the registration of your context.

Returns:
The unique ID assigned by the context manager for the new context. If the context already existed its existing ID is returned.

Implements Qtilities::Core::Interfaces::IContextManager.

bool Qtilities::Core::ContextManager::unregisterContext ( int  context_id,
bool  notify = true 
)
virtual

Unregisters an existing context.

Parameters:
context_idThe ID of the context to be unregistered.
notifyIndicates if the context manager must notify when the active context(s) changed due to this unregisteration.
Returns:
True if successfull, false otherwise (for example when the context was not present in the context manager).

Implements Qtilities::Core::Interfaces::IContextManager.

bool Qtilities::Core::ContextManager::unregisterContext ( const QString &  context_string,
bool  notify = true 
)
virtual

Unregisters an existing context.

Parameters:
context_stringThe string representation of the context to be unregistered.
notifyIndicates if the context manager must notify when the active context(s) changed due to this unregisteration.
Returns:
True if successfull, false otherwise (for example when the context was not present in the context manager).

Implements Qtilities::Core::Interfaces::IContextManager.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé