diff options
Diffstat (limited to 'weather/weather.cpp')
-rw-r--r-- | weather/weather.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/weather/weather.cpp b/weather/weather.cpp index 298f32c..d4a8173 100644 --- a/weather/weather.cpp +++ b/weather/weather.cpp @@ -21,22 +21,21 @@ #include "eventmessage.h" #include "messagefactory.h" #include "messageengine.h" +#include "messageenginefactory.h" #include "weather.h" Weather::Weather (QUrl &url, QObject * parent) : - QObject(parent), - m_mloop(nullptr) + QObject(parent) { - m_mloop = new MessageEngine(url); - QObject::connect(m_mloop, &MessageEngine::connected, this, &Weather::onConnected); - QObject::connect(m_mloop, &MessageEngine::disconnected, this, &Weather::onDisconnected); - QObject::connect(m_mloop, &MessageEngine::messageReceived, this, &Weather::onMessageReceived); + m_mloop = MessageEngineFactory::getInstance().getMessageEngine(url); + QObject::connect(m_mloop.get(), &MessageEngine::connected, this, &Weather::onConnected); + QObject::connect(m_mloop.get(), &MessageEngine::disconnected, this, &Weather::onDisconnected); + QObject::connect(m_mloop.get(), &MessageEngine::messageReceived, this, &Weather::onMessageReceived); } Weather::~Weather() { - delete m_mloop; } void Weather::onConnected() |