mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-09 22:05:43 -05:00
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:
parent
12b3ed02f1
commit
db07053214
9 changed files with 107 additions and 7 deletions
13
plugins/VOIP/gui/PluginGUIHandler.cpp
Normal file
13
plugins/VOIP/gui/PluginGUIHandler.cpp
Normal 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;
|
||||
}
|
||||
|
||||
17
plugins/VOIP/gui/PluginGUIHandler.h
Normal file
17
plugins/VOIP/gui/PluginGUIHandler.h
Normal 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) ;
|
||||
};
|
||||
10
plugins/VOIP/gui/PluginNotifier.cpp
Normal file
10
plugins/VOIP/gui/PluginNotifier.cpp
Normal 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)) ;
|
||||
}
|
||||
21
plugins/VOIP/gui/PluginNotifier.h
Normal file
21
plugins/VOIP/gui/PluginNotifier.h
Normal 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
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue