/***************************************************************************
- * Copyright (C) 2005-2010 by the Quassel Project *
+ * Copyright (C) 2005-2012 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
};
EventManager(QObject *parent = 0);
- virtual ~EventManager();
- EventType eventTypeByName(const QString &name) const;
- EventType eventGroupByName(const QString &name) const;
-
- QString enumName(EventType type) const;
+ static EventType eventTypeByName(const QString &name);
+ static EventType eventGroupByName(const QString &name);
+ static QString enumName(EventType type);
+ static QString enumName(int type); // for sanity tests
public slots:
void registerObject(QObject *object, Priority priority = NormalPriority,
//! Send an event to the registered handlers
/**
The EventManager takes ownership of the event and will delete it once it's processed.
- NOTE: This method is not threadsafe!
@param event The event to be dispatched
*/
- void sendEvent(Event *event);
-
-signals:
- void eventQueueEmptied();
+ void postEvent(Event *event);
protected:
virtual void customEvent(QEvent *event);
int findEventType(const QString &methodSignature, const QString &methodPrefix) const;
- void processEvents();
+ void processEvent(Event *event);
void dispatchEvent(Event *event);
//! @return the EventType enum
- QMetaEnum eventEnum() const;
+ static QMetaEnum eventEnum();
HandlerHash _registeredHandlers;
HandlerHash _registeredFilters;
- mutable QMetaEnum _enum;
-
QList<Event *> _eventQueue;
+ static QMetaEnum _enum;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(EventManager::EventFlags);