summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
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;