diff options
author | Raquel Medina <raquel.medina@konsulko.com> | 2020-05-20 16:17:37 +0200 |
---|---|---|
committer | Raquel Medina <raquel.medina@konsulko.com> | 2020-05-22 16:53:23 +0200 |
commit | b70f1326f483fc3e42a95f792c63d8d80ff0ce32 (patch) | |
tree | bffaecb50f5b44326eb6dbf8050512df289bfac4 /app/taskmanager.cpp | |
parent | 35e9e80b883eb84b5e598994e4cd620ea2044af6 (diff) |
use MessageEngineFactory
Bug-AGL: SPEC-3112
Signed-off-by: Raquel Medina <raquel.medina@konsulko.com>
Change-Id: I7b601d89db9b31407ac6b99e03946e7c249c58a7
Diffstat (limited to 'app/taskmanager.cpp')
-rw-r--r-- | app/taskmanager.cpp | 9 |
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() |