diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-15 21:58:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-15 21:58:18 (GMT) |
commit | b5bdebeeba862e6d0f541d203fed3bd0bc5cef5d (patch) | |
tree | 1bd0d9286ffbda3e197126b36b777c27b77c5e72 /Swiften/EventLoop/Qt | |
parent | 44bc44dee791570909b4b3d5f6f6f9f9ac07bba7 (diff) | |
download | swift-contrib-b5bdebeeba862e6d0f541d203fed3bd0bc5cef5d.zip swift-contrib-b5bdebeeba862e6d0f541d203fed3bd0bc5cef5d.tar.bz2 |
Moved QtEventLoop to the Swift namespace.
Diffstat (limited to 'Swiften/EventLoop/Qt')
-rw-r--r-- | Swiften/EventLoop/Qt/QtEventLoop.h | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/Swiften/EventLoop/Qt/QtEventLoop.h b/Swiften/EventLoop/Qt/QtEventLoop.h index b42b916..8f6c709 100644 --- a/Swiften/EventLoop/Qt/QtEventLoop.h +++ b/Swiften/EventLoop/Qt/QtEventLoop.h @@ -12,34 +12,36 @@ #include "Swiften/EventLoop/EventLoop.h" -class QtEventLoop : public QObject, public Swift::EventLoop { - public: - QtEventLoop() {} - ~QtEventLoop() { - QCoreApplication::removePostedEvents(this); - } - - virtual void post(const Swift::Event& event) { - QCoreApplication::postEvent(this, new Event(event)); - } - - virtual bool event(QEvent* qevent) { - Event* event = dynamic_cast<Event*>(qevent); - if (event) { - handleEvent(event->event_); - //event->deleteLater(); FIXME: Leak? - return true; +namespace Swift { + class QtEventLoop : public QObject, public EventLoop { + public: + QtEventLoop() {} + ~QtEventLoop() { + QCoreApplication::removePostedEvents(this); } - return false; - } - - private: - struct Event : public QEvent { - Event(const Swift::Event& event) : - QEvent(QEvent::User), event_(event) { + virtual void post(const Swift::Event& event) { + QCoreApplication::postEvent(this, new Event(event)); + } + + virtual bool event(QEvent* qevent) { + Event* event = dynamic_cast<Event*>(qevent); + if (event) { + handleEvent(event->event_); + //event->deleteLater(); FIXME: Leak? + return true; } - Swift::Event event_; - }; -}; + return false; + } + + private: + struct Event : public QEvent { + Event(const Swift::Event& event) : + QEvent(QEvent::User), event_(event) { + } + + Swift::Event event_; + }; + }; +} |