mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-09-21 13:24:49 -04:00
fixed VOIP plugin to work with v0.6
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7288 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ca6b463a31
commit
160e04fe9a
10 changed files with 94 additions and 100 deletions
|
@ -22,19 +22,20 @@ void PluginGUIHandler::ReceivedVoipAccept(const QString& /*peer_id*/)
|
|||
std::cerr << "****** Plugin GUI handler: received VoipAccept!" << std::endl;
|
||||
}
|
||||
|
||||
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
|
||||
void PluginGUIHandler::ReceivedVoipData(const QString& qpeer_id)
|
||||
{
|
||||
std::cerr << "****** Plugin GUI handler: received VoipData!" << std::endl;
|
||||
|
||||
RsPeerId peer_id(qpeer_id.toStdString()) ;
|
||||
std::vector<RsVoipDataChunk> chunks ;
|
||||
|
||||
if(!rsVoip->getIncomingData(peer_id.toStdString(),chunks))
|
||||
if(!rsVoip->getIncomingData(peer_id,chunks))
|
||||
{
|
||||
std::cerr << "PluginGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
ChatDialog *di = ChatDialog::getExistingChat(peer_id.toStdString()) ;
|
||||
ChatDialog *di = ChatDialog::getExistingChat(peer_id) ;
|
||||
if (di) {
|
||||
ChatWidget *cw = di->getChatWidget();
|
||||
if (cw) {
|
||||
|
@ -47,7 +48,7 @@ void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
|
|||
for (unsigned int i = 0; i < chunks.size(); ++i) {
|
||||
for (unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++){
|
||||
QByteArray qb(reinterpret_cast<const char *>(chunks[chunkIndex].data),chunks[chunkIndex].size);
|
||||
acwh->addAudioData(peer_id,&qb);
|
||||
acwh->addAudioData(QString::fromStdString(peer_id.toStdString()),&qb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#include "PluginNotifier.h"
|
||||
|
||||
void PluginNotifier::notifyReceivedVoipInvite(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipInvite(const RsPeerId& peer_id)
|
||||
{
|
||||
emit voipInvitationReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipInvitationReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
void PluginNotifier::notifyReceivedVoipData(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipData(const RsPeerId &peer_id)
|
||||
{
|
||||
emit voipDataReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipDataReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
void PluginNotifier::notifyReceivedVoipAccept(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipAccept(const RsPeerId& peer_id)
|
||||
{
|
||||
emit voipAcceptReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipAcceptReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
void PluginNotifier::notifyReceivedVoipHangUp(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipHangUp(const RsPeerId &peer_id)
|
||||
{
|
||||
emit voipHangUpReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipHangUpReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
|
|
|
@ -6,16 +6,17 @@
|
|||
//
|
||||
|
||||
#include <QObject>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
class PluginNotifier: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void notifyReceivedVoipData(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipInvite(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipHangUp(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipAccept(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipData(const RsPeerId& peer_id) ;
|
||||
void notifyReceivedVoipInvite(const RsPeerId &peer_id) ;
|
||||
void notifyReceivedVoipHangUp(const RsPeerId& peer_id) ;
|
||||
void notifyReceivedVoipAccept(const RsPeerId &peer_id) ;
|
||||
|
||||
signals:
|
||||
void voipInvitationReceived(const QString&) ; // signal emitted when an invitation has been received
|
||||
|
|
|
@ -56,7 +56,7 @@ double convertRttToPixels(double maxRTT, double rtt)
|
|||
class VoipLagPlot
|
||||
{
|
||||
public:
|
||||
VoipLagPlot(const std::map<std::string, std::list<RsVoipPongResult> > &info,
|
||||
VoipLagPlot(const std::map<RsPeerId, std::list<RsVoipPongResult> > &info,
|
||||
double refTS, double maxRTT, double minTS, double maxTS)
|
||||
:mInfo(info), mRefTS(refTS), mMaxRTT(maxRTT), mMinTS(minTS), mMaxTS(maxTS) {}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class VoipLagPlot
|
|||
}
|
||||
|
||||
/* draw a different line for each peer */
|
||||
std::map<std::string, std::list<RsVoipPongResult> >::const_iterator mit;
|
||||
std::map<RsPeerId, std::list<RsVoipPongResult> >::const_iterator mit;
|
||||
int i = 0;
|
||||
int nLines = mInfo.size();
|
||||
for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++)
|
||||
|
@ -161,14 +161,14 @@ class VoipLagPlot
|
|||
|
||||
painter->setPen(QColor::fromRgb(0,0,0)) ;
|
||||
painter->drawRect(ox,oy,cellx,celly) ;
|
||||
painter->drawText(ox + cellx + 4,oy + celly / 2,VoipStatistics::getPeerName(mit->first));
|
||||
painter->drawText(ox + cellx + 4,oy + celly / 2,VoipStatistics::getPeerName(mit->first));
|
||||
|
||||
oy += 2 * celly;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const std::map<std::string, std::list<RsVoipPongResult> > &mInfo;
|
||||
const std::map<RsPeerId, std::list<RsVoipPongResult> > &mInfo;
|
||||
double mRefTS;
|
||||
double mMaxRTT;
|
||||
double mMinTS;
|
||||
|
@ -230,15 +230,15 @@ void VoipStatistics::processSettings(bool bLoad)
|
|||
|
||||
void VoipStatistics::updateDisplay()
|
||||
{
|
||||
std::map<std::string, std::list<RsVoipPongResult> > info;
|
||||
std::map<RsPeerId, std::list<RsVoipPongResult> > info;
|
||||
|
||||
if (!rsVoip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<std::string> idList;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<RsPeerId> idList;
|
||||
std::list<RsPeerId>::iterator it;
|
||||
|
||||
rsPeers->getOnlineList(idList);
|
||||
|
||||
|
@ -284,11 +284,11 @@ void VoipStatistics::updateDisplay()
|
|||
_tst_CW->update();
|
||||
}
|
||||
|
||||
QString VoipStatistics::getPeerName(const std::string& peer_id)
|
||||
QString VoipStatistics::getPeerName(const RsPeerId& peer_id)
|
||||
{
|
||||
static std::map<std::string, QString> names ;
|
||||
static std::map<RsPeerId, QString> names ;
|
||||
|
||||
std::map<std::string,QString>::const_iterator it = names.find(peer_id) ;
|
||||
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
|
||||
|
||||
if( it != names.end())
|
||||
return it->second ;
|
||||
|
@ -309,7 +309,7 @@ VoipStatisticsWidget::VoipStatisticsWidget(QWidget *parent)
|
|||
maxHeight = 0 ;
|
||||
}
|
||||
|
||||
void VoipStatisticsWidget::updateVoipStatistics(const std::map<std::string, std::list<RsVoipPongResult> >& info,
|
||||
void VoipStatisticsWidget::updateVoipStatistics(const std::map<RsPeerId, std::list<RsVoipPongResult> >& info,
|
||||
double maxRTT, double minTS, double maxTS)
|
||||
{
|
||||
//static const int cellx = 6 ;
|
||||
|
|
|
@ -37,7 +37,7 @@ class VoipStatistics: public RsAutoUpdatePage, public Ui::VoipStatistics
|
|||
~VoipStatistics();
|
||||
|
||||
// Cache for peer names.
|
||||
static QString getPeerName(const std::string& peer_id) ;
|
||||
static QString getPeerName(const RsPeerId &peer_id) ;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -60,7 +60,7 @@ class VoipStatisticsWidget: public QWidget
|
|||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
|
||||
void updateVoipStatistics(const std::map<std::string, std::list<RsVoipPongResult> >& info,
|
||||
void updateVoipStatistics(const std::map<RsPeerId, std::list<RsVoipPongResult> >& info,
|
||||
double maxRTT, double minTS, double maxTS);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue