added communitation between service and GUI part of VOIP plugin.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4990 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-02-25 18:15:36 +00:00
parent 12b3ed02f1
commit db07053214
9 changed files with 107 additions and 7 deletions

View file

@ -0,0 +1,13 @@
#include <iostream>
#include "PluginGUIHandler.h"
void PluginGUIHandler::ReceivedInvitation(const QString& peer_id)
{
std::cerr << "****** Plugin GUI handler: received data!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
{
std::cerr << "****** Plugin GUI handler: received invitation!" << std::endl;
}

View file

@ -0,0 +1,17 @@
// This class receives async-ed signals from the plugin notifier,
// and executes GUI requests.
//
// It is never called directly: it is called by Qt signal-received callback,
// in the main GUI thread.
//
#include <QObject>
class PluginGUIHandler: public QObject
{
Q_OBJECT
public slots:
void ReceivedInvitation(const QString& peer_id) ;
void ReceivedVoipData(const QString& peer_id) ;
};

View file

@ -0,0 +1,10 @@
#include "PluginNotifier.h"
void PluginNotifier::notifyReceivedVoipInvite(const std::string& peer_id)
{
emit voipInvitationReceived(QString::fromStdString(peer_id)) ;
}
void PluginNotifier::notifyReceivedVoipData(const std::string& peer_id)
{
emit voipDataReceived(QString::fromStdString(peer_id)) ;
}

View file

@ -0,0 +1,21 @@
// This class is a Qt object to get notification from the plugin's service threads,
// and responsible to pass the info the the GUI part.
//
// Because the GUI part is async-ed with the service, it is crucial to use the
// QObject connect system to communicate between the p3Service and the gui part (handled by Qt)
//
#include <QObject>
class PluginNotifier: public QObject
{
Q_OBJECT
public:
void notifyReceivedVoipData(const std::string& peer_id) ;
void notifyReceivedVoipInvite(const std::string& peer_id) ;
signals:
void voipInvitationReceived(const QString&) ; // signal emitted when an invitation has been received
void voipDataReceived(const QString&) ; // signal emitted when some voip data has been received
};