summaryrefslogtreecommitdiffstats
path: root/app/taskmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/taskmanager.cpp')
-rw-r--r--app/taskmanager.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/taskmanager.cpp b/app/taskmanager.cpp
index 6c620a9..77ef412 100644
--- a/app/taskmanager.cpp
+++ b/app/taskmanager.cpp
@@ -8,21 +8,22 @@
#include <responsemessage.h>
#include <callmessage.h>
#include <messagefactory.h>
+#include <messageenginefactory.h>
#include "taskmanager.h"
TaskManager::TaskManager(QObject* parent) : QObject(parent), m_loop(nullptr) {
}
TaskManager::~TaskManager() {
- delete m_loop;
}
void TaskManager::open(const QUrl &bindingAddress)
{
qRegisterMetaType<std::shared_ptr<Message>>("std::shared_ptr<Message>");
- m_loop = new MessageEngine(bindingAddress);
- QObject::connect(m_loop, &MessageEngine::connected, this, &TaskManager::onConnected);
- QObject::connect(m_loop, &MessageEngine::messageReceived, this, &TaskManager::onMessageReceived, Qt::QueuedConnection);
+ m_loop.reset();
+ m_loop = MessageEngineFactory::getInstance().getMessageEngine(bindingAddress);
+ QObject::connect(m_loop.get(), &MessageEngine::connected, this, &TaskManager::onConnected);
+ QObject::connect(m_loop.get(), &MessageEngine::messageReceived, this, &TaskManager::onMessageReceived, Qt::QueuedConnection);
}
void TaskManager::onConnected()