Now communication using signal and slots

between threads is working rightly
parent 4f7387ef
...@@ -42,12 +42,12 @@ void SkyliveAuth::startPlugin() ...@@ -42,12 +42,12 @@ void SkyliveAuth::startPlugin()
} }
void SkyliveAuth::receiveMessage(std::string &msg) void SkyliveAuth::receiveMessage(std::string msg)
{ {
std::cout << "SkyliveAuth receive" << msg << std::endl; std::cout << "SkyliveAuth receive" << msg << std::endl;
} }
void SkyliveAuth::sendMessage(std::string &msg) void SkyliveAuth::sendMessage(std::string msg)
{ {
emit putMessage(msg); emit putMessage(msg);
} }
......
...@@ -44,11 +44,11 @@ class SkyliveAuth : public QObject, SkylivexPluginInterface ...@@ -44,11 +44,11 @@ class SkyliveAuth : public QObject, SkylivexPluginInterface
public: public:
void startPlugin(); void startPlugin();
void sendMessage(std::string &msg); void sendMessage(std::string msg);
public slots: public slots:
void receiveMessage(std::string &msg); void receiveMessage(std::string msg);
signals: signals:
void putMessage(std::string &msg); void putMessage(std::string msg);
}; };
...@@ -43,12 +43,12 @@ void SkyliveProtocol::startPlugin() ...@@ -43,12 +43,12 @@ void SkyliveProtocol::startPlugin()
sendMessage(prova); sendMessage(prova);
} }
void SkyliveProtocol::receiveMessage(std::string &msg) void SkyliveProtocol::receiveMessage(std::string msg)
{ {
std::cout << "SkyliveProtocol receive" << msg << std::endl; std::cout << "SkyliveProtocol receive" << msg << std::endl;
} }
void SkyliveProtocol::sendMessage(std::string &msg) void SkyliveProtocol::sendMessage(std::string msg)
{ {
emit putMessage(msg); emit putMessage(msg);
} }
......
...@@ -44,10 +44,10 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface ...@@ -44,10 +44,10 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface
public: public:
void startPlugin(); void startPlugin();
void sendMessage(std::string &msg); void sendMessage(std::string msg);
public slots: public slots:
void receiveMessage(std::string &msg); void receiveMessage(std::string msg);
signals: signals:
void putMessage(std::string &msg); void putMessage(std::string msg);
}; };
...@@ -67,5 +67,5 @@ MainWin::~MainWin() ...@@ -67,5 +67,5 @@ MainWin::~MainWin()
void MainWin::msgFromCore(std::string &msg) void MainWin::msgFromCore(std::string &msg)
{ {
//std::cout << "Message from core: " << msg << std::endl; std::cout << "Message from core: " << msg << std::endl;
} }
...@@ -43,12 +43,14 @@ ...@@ -43,12 +43,14 @@
#include "pluginsinterfaces.h" #include "pluginsinterfaces.h"
#include <iostream> #include <iostream>
Q_DECLARE_METATYPE(std::string)
// Load and initialize plugins and shared memory communication // Load and initialize plugins and shared memory communication
void SkyliveX::initialize() void SkyliveX::initialize()
{ {
std::cout << "antani" << std::endl; std::cout << "antani" << std::endl;
qRegisterMetaType<std::string>("std::string");
loadPlugins(); loadPlugins();
} }
...@@ -125,7 +127,7 @@ void SkyliveX::receiveFromMainWin(std::string &msg) ...@@ -125,7 +127,7 @@ void SkyliveX::receiveFromMainWin(std::string &msg)
emit msgForPlugins(msg); emit msgForPlugins(msg);
} }
void SkyliveX::receiveFromPlugins(std::string &msg) void SkyliveX::receiveFromPlugins(std::string msg)
{ {
sendMessage(msg); sendMessage(msg);
} }
...@@ -67,12 +67,12 @@ class SkyliveX : public QObject ...@@ -67,12 +67,12 @@ class SkyliveX : public QObject
void initialize(); void initialize();
void process(); void process();
void receiveFromMainWin(std::string &msg); void receiveFromMainWin(std::string &msg);
void receiveFromPlugins(std::string &msg); void receiveFromPlugins(std::string msg);
signals: signals:
void finished(); void finished();
void msgForMainWin(std::string &msg); void msgForMainWin(std::string &msg);
void msgForPlugins(std::string &msg); void msgForPlugins(std::string msg);
}; };
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment