summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2020-05-20 16:17:37 +0200
committerRaquel Medina <raquel.medina@konsulko.com>2020-05-22 16:53:23 +0200
commitb70f1326f483fc3e42a95f792c63d8d80ff0ce32 (patch)
treebffaecb50f5b44326eb6dbf8050512df289bfac4 /app
parent35e9e80b883eb84b5e598994e4cd620ea2044af6 (diff)
use MessageEngineFactory
Bug-AGL: SPEC-3112 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I7b601d89db9b31407ac6b99e03946e7c249c58a7
Diffstat (limited to 'app')
-rw-r--r--app/taskmanager.cpp9
-rw-r--r--app/taskmanager.h2
2 files changed, 6 insertions, 5 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()
diff --git a/app/taskmanager.h b/app/taskmanager.h
index 8926639..00a560a 100644
--- a/app/taskmanager.h
+++ b/app/taskmanager.h
@@ -41,7 +41,7 @@ private slots:
void loadAvg();
private:
- MessageEngine *m_loop;
+ std::shared_ptr<MessageEngine> m_loop;
std::vector<ProcInfo> m_procinfos;
unsigned int inOctets, outOctets;