summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/EventLoop')
-rw-r--r--Swiften/EventLoop/EventLoop.cpp4
-rw-r--r--Swiften/EventLoop/MainEventLoop.cpp42
-rw-r--r--Swiften/EventLoop/MainEventLoop.h47
-rw-r--r--Swiften/EventLoop/SConscript1
4 files changed, 0 insertions, 94 deletions
diff --git a/Swiften/EventLoop/EventLoop.cpp b/Swiften/EventLoop/EventLoop.cpp
index 2e9e021..f787e73 100644
--- a/Swiften/EventLoop/EventLoop.cpp
+++ b/Swiften/EventLoop/EventLoop.cpp
@@ -10,16 +10,12 @@
#include <boost/bind.hpp>
#include <iostream>
-#include "Swiften/EventLoop/MainEventLoop.h"
-
namespace Swift {
EventLoop::EventLoop() : nextEventID_(0), handlingEvents_(false) {
- MainEventLoop::setInstance(this);
}
EventLoop::~EventLoop() {
- MainEventLoop::resetInstance();
}
void EventLoop::handleEvent(const Event& event) {
diff --git a/Swiften/EventLoop/MainEventLoop.cpp b/Swiften/EventLoop/MainEventLoop.cpp
deleted file mode 100644
index dae3261..0000000
--- a/Swiften/EventLoop/MainEventLoop.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010 Remko Tronçon
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
- */
-
-#include "Swiften/EventLoop/MainEventLoop.h"
-
-#include <iostream>
-#include <typeinfo>
-
-namespace Swift {
-
-EventLoop* MainEventLoop::getInstance() {
- if (!instance_) {
- std::cerr << "No main event loop instantiated. Please instantiate the appropriate subclass of EventLoop (e.g. SimpleEventLoop, QtEventLoop) at the start of your application." << std::endl;
- exit(-1);
- }
- return instance_;
-}
-
-void MainEventLoop::setInstance(EventLoop* loop) {
- assert(!instance_);
- instance_ = loop;
-}
-
-void MainEventLoop::resetInstance() {
- assert(instance_);
- instance_ = 0;
-}
-
-void MainEventLoop::postEvent(boost::function<void ()> event, boost::shared_ptr<EventOwner> owner) {
- getInstance()->postEvent(event, owner);
-}
-
-void MainEventLoop::removeEventsFromOwner(boost::shared_ptr<EventOwner> owner) {
- getInstance()->removeEventsFromOwner(owner);
-}
-
-EventLoop* MainEventLoop::instance_ = 0;
-
-}
diff --git a/Swiften/EventLoop/MainEventLoop.h b/Swiften/EventLoop/MainEventLoop.h
deleted file mode 100644
index 5789db2..0000000
--- a/Swiften/EventLoop/MainEventLoop.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2010 Remko Tronçon
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
- */
-
-#ifndef SWIFTEN_MainEventLoop_H
-#define SWIFTEN_MainEventLoop_H
-
-#include <boost/function.hpp>
-
-#include "Swiften/EventLoop/Deleter.h"
-#include "Swiften/EventLoop/EventLoop.h"
-
-namespace Swift {
- class EventLoop;
- class EventOwner;
-
- class MainEventLoop {
- friend class EventLoop;
-
- public:
- /**
- * Post an event from the given owner to the event loop.
- * If the owner is destroyed, all events should be removed from the
- * loop using removeEventsFromOwner().
- */
- static void postEvent(boost::function<void ()> event, boost::shared_ptr<EventOwner> owner = boost::shared_ptr<EventOwner>());
-
- static void removeEventsFromOwner(boost::shared_ptr<EventOwner> owner);
-
- template<typename T>
- static void deleteLater(T* t) {
- getInstance()->postEvent(Deleter<T>(t), 0);
- }
-
- private:
- static void setInstance(EventLoop*);
- static void resetInstance();
- static EventLoop* getInstance();
-
- private:
- static EventLoop* instance_;
- };
-}
-
-#endif
diff --git a/Swiften/EventLoop/SConscript b/Swiften/EventLoop/SConscript
index 248d451..a98971f 100644
--- a/Swiften/EventLoop/SConscript
+++ b/Swiften/EventLoop/SConscript
@@ -3,7 +3,6 @@ Import("swiften_env")
sources = [
"EventLoop.cpp",
"EventOwner.cpp",
- "MainEventLoop.cpp",
"SimpleEventLoop.cpp",
]