Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
EventManager Class Reference

#include </tmp/quassel/src/common/eventmanager.h>

Inheritance diagram for EventManager:

Classes

struct  Handler

Public Slots

void registerObject (QObject *object, Priority priority=NormalPriority, const QString &methodPrefix="process", const QString &filterPrefix="filter")
void registerEventHandler (EventType event, QObject *object, const char *slot, Priority priority=NormalPriority, bool isFilter=false)
void registerEventHandler (QList< EventType > events, QObject *object, const char *slot, Priority priority=NormalPriority, bool isFilter=false)
void registerEventFilter (EventType event, QObject *object, const char *slot)
void registerEventFilter (QList< EventType > events, QObject *object, const char *slot)
void postEvent (Event *event)
 Send an event to the registered handlers.

Protected Member Functions

virtual NetworknetworkById (NetworkId id) const =0
virtual void customEvent (QEvent *event)

Private Types

enum  Priority {
  VeryLowPriority, LowPriority, NormalPriority, HighPriority,
  HighestPriority
}
enum  EventFlag {
  Self = 0x01, Fake = 0x08, Netsplit = 0x10, Backlog = 0x20,
  Silent = 0x40, Stopped = 0x80
}
typedef QHash< uint, QList
< Handler > > 
HandlerHash

Private Member Functions

 Q_FLAGS (EventFlag EventFlags) Q_ENUMS(EventType) public
 Q_DECLARE_FLAGS (EventFlags, EventFlag) enum EventType
 EventManager (QObject *parent=0)
EventcreateEvent (const QVariantMap &map)
const HandlerHashregisteredHandlers () const
HandlerHashregisteredHandlers ()
const HandlerHashregisteredFilters () const
HandlerHashregisteredFilters ()
void insertHandlers (const QList< Handler > &newHandlers, QList< Handler > &existing, bool checkDupes=false)
 Add handlers to an existing sorted (by priority) handler list.
void insertFilters (const QList< Handler > &newFilters, QHash< QObject *, Handler > &existing)
 Add filters to an existing filter hash.
int findEventType (const QString &methodSignature, const QString &methodPrefix) const
void processEvent (Event *event)
void dispatchEvent (Event *event)

Static Private Member Functions

static EventType eventTypeByName (const QString &name)
static EventType eventGroupByName (const QString &name)
static QString enumName (EventType type)
static QString enumName (int type)
static QMetaEnum eventEnum ()

Private Attributes

HandlerHash _registeredHandlers
HandlerHash _registeredFilters
QList< Event * > _eventQueue

Static Private Attributes

static QMetaEnum _enum

Detailed Description

Definition at line 31 of file eventmanager.h.

Member Typedef Documentation

typedef QHash<uint, QList<Handler> > HandlerHash
private

Definition at line 166 of file eventmanager.h.

Member Enumeration Documentation

enum Priority
private
Enumerator:
VeryLowPriority 
LowPriority 
NormalPriority 
HighPriority 
HighestPriority 

Definition at line 44 of file eventmanager.h.

enum EventFlag
private
Enumerator:
Self 

Self-generated (user input) event.

Fake 

Ignore this in CoreSessionEventProcessor.

Netsplit 

Netsplit join/part, ignore on display.

Backlog 
Silent 

Don't generate a MessageEvent.

Stopped 

Definition at line 52 of file eventmanager.h.

Constructor & Destructor Documentation

EventManager ( QObject *  parent = 0)
private

Definition at line 45 of file eventmanager.cpp.

Member Function Documentation

Q_FLAGS ( EventFlag  EventFlags)
inlineprivate

Definition at line 34 of file eventmanager.h.

Q_DECLARE_FLAGS ( EventFlags  ,
EventFlag   
)
inlineprivate

< Undecoded privmsg (still needs CTCP parsing)

< Undecoded notice (still needs CTCP parsing)

< Unknown non-numeric cmd

< Stringified event suitable for converting to Message

Definition at line 60 of file eventmanager.h.

EventManager::EventType eventTypeByName ( const QString &  name)
staticprivate

Definition at line 63 of file eventmanager.cpp.

References eventEnum().

Referenced by eventGroupByName(), and IrcParser::processNetworkIncoming().

EventManager::EventType eventGroupByName ( const QString &  name)
staticprivate

Definition at line 70 of file eventmanager.cpp.

References eventTypeByName().

QString enumName ( EventType  type)
staticprivate
QString enumName ( int  type)
staticprivate

Definition at line 83 of file eventmanager.cpp.

References eventEnum().

Event * createEvent ( const QVariantMap &  map)
private

Definition at line 89 of file eventmanager.cpp.

References Event::fromVariantMap(), and networkById().

void registerObject ( QObject *  object,
Priority  priority = NormalPriority,
const QString &  methodPrefix = "process",
const QString &  filterPrefix = "filter" 
)
slot

Definition at line 148 of file eventmanager.cpp.

References findEventType(), registeredFilters(), and registeredHandlers().

Referenced by CoreSession::CoreSession().

void registerEventHandler ( EventType  event,
QObject *  object,
const char *  slot,
Priority  priority = NormalPriority,
bool  isFilter = false 
)
slot

Definition at line 185 of file eventmanager.cpp.

Referenced by registerEventFilter().

void registerEventHandler ( QList< EventType >  events,
QObject *  object,
const char *  slot,
Priority  priority = NormalPriority,
bool  isFilter = false 
)
slot

Definition at line 191 of file eventmanager.cpp.

References registeredFilters(), and registeredHandlers().

void registerEventFilter ( EventType  event,
QObject *  object,
const char *  slot 
)
slot

Definition at line 173 of file eventmanager.cpp.

References NormalPriority, and registerEventHandler().

void registerEventFilter ( QList< EventType >  events,
QObject *  object,
const char *  slot 
)
slot

Definition at line 179 of file eventmanager.cpp.

References NormalPriority, and registerEventHandler().

void postEvent ( Event event)
slot

Send an event to the registered handlers.

The EventManager takes ownership of the event and will delete it once it's processed.

Parameters
eventThe event to be dispatched

Definition at line 212 of file eventmanager.cpp.

References _eventQueue, and processEvent().

virtual Network* networkById ( NetworkId  id) const
protectedpure virtual

Implemented in CoreEventManager.

Referenced by createEvent().

void customEvent ( QEvent *  event)
protectedvirtual

Definition at line 228 of file eventmanager.cpp.

References QueuedQuasselEvent::event, and processEvent().

const HandlerHash& registeredHandlers ( ) const
inlineprivate

Definition at line 168 of file eventmanager.h.

References _registeredHandlers.

Referenced by dispatchEvent(), registerEventHandler(), and registerObject().

HandlerHash& registeredHandlers ( )
inlineprivate

Definition at line 169 of file eventmanager.h.

References _registeredHandlers.

const HandlerHash& registeredFilters ( ) const
inlineprivate

Definition at line 171 of file eventmanager.h.

References _registeredFilters.

Referenced by dispatchEvent(), registerEventHandler(), and registerObject().

HandlerHash& registeredFilters ( )
inlineprivate

Definition at line 172 of file eventmanager.h.

References _registeredFilters.

void insertHandlers ( const QList< Handler > &  newHandlers,
QList< Handler > &  existing,
bool  checkDupes = false 
)
private

Add handlers to an existing sorted (by priority) handler list.

Definition at line 318 of file eventmanager.cpp.

References EventManager::Handler::object, and EventManager::Handler::priority.

Referenced by dispatchEvent().

void insertFilters ( const QList< Handler > &  newFilters,
QHash< QObject *, Handler > &  existing 
)
private

Add filters to an existing filter hash.

Definition at line 347 of file eventmanager.cpp.

References EventManager::Handler::object.

Referenced by dispatchEvent().

int findEventType ( const QString &  methodSignature,
const QString &  methodPrefix 
) const
private

Definition at line 112 of file eventmanager.cpp.

References eventEnum().

Referenced by registerObject().

void processEvent ( Event event)
private

Definition at line 238 of file eventmanager.cpp.

References _eventQueue, and dispatchEvent().

Referenced by customEvent(), and postEvent().

void dispatchEvent ( Event event)
private
QMetaEnum eventEnum ( )
staticprivate
Returns
the EventType enum

Definition at line 51 of file eventmanager.cpp.

References _enum.

Referenced by enumName(), eventTypeByName(), and findEventType().

Member Data Documentation

HandlerHash _registeredHandlers
private

Definition at line 187 of file eventmanager.h.

Referenced by registeredHandlers().

HandlerHash _registeredFilters
private

Definition at line 188 of file eventmanager.h.

Referenced by registeredFilters().

QList<Event *> _eventQueue
private

Definition at line 189 of file eventmanager.h.

Referenced by postEvent(), and processEvent().

QMetaEnum _enum
staticprivate

Definition at line 190 of file eventmanager.h.

Referenced by eventEnum().


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