Renaming all to VOIP in VOIP plugin (patch from Phenom)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8231 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-05-11 19:40:07 +00:00
parent a3b32b92d5
commit b5bf3ce130
29 changed files with 860 additions and 686 deletions

View file

@ -1,10 +1,30 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QToolButton>
#include <QPropertyAnimation>
#include <QIcon>
#include <QLayout>
#include <gui/audiodevicehelper.h>
#include "interface/rsvoip.h"
#include "interface/rsVOIP.h"
#include "gui/SoundManager.h"
#include "util/HandleRichText.h"
#include "gui/common/StatusDefs.h"
@ -135,11 +155,11 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder()
delete inputVideoDevice ;
delete inputVideoProcessor ;
delete outputVideoProcessor ;
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
it = buttonMapTakeVideo.erase(it);
}
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
it = buttonMapTakeVideo.erase(it);
}
}
void VOIPChatWidgetHolder::toggleAudioListen()
@ -209,13 +229,13 @@ void VOIPChatWidgetHolder::toggleAudioCapture()
hangupButton->hide();
}
}
void VOIPChatWidgetHolder::startVideoCapture()
{
videoCaptureToggleButton->setChecked(true);
toggleVideoCapture();
}
void VOIPChatWidgetHolder::startVideoCapture()
{
videoCaptureToggleButton->setChecked(true);
toggleVideoCapture();
}
void VOIPChatWidgetHolder::toggleVideoCapture()
{
if (videoCaptureToggleButton->isChecked())
@ -228,15 +248,15 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
videoCaptureToggleButton->setToolTip(tr("Shut camera off"));
if (mChatWidget)
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("You're now sending video..."), ChatWidget::MSGTYPE_SYSTEM);
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
RSButtonOnText *button = it.value();
delete button;
it = buttonMapTakeVideo.erase(it);
}
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("You're now sending video..."), ChatWidget::MSGTYPE_SYSTEM);
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
RSButtonOnText *button = it.value();
delete button;
it = buttonMapTakeVideo.erase(it);
}
}
else
{
@ -246,69 +266,69 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
videoWidget->hide();
if (mChatWidget)
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM);
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM);
}
}
void VOIPChatWidgetHolder::addVideoData(const QString name, QByteArray* array)
{
outputVideoProcessor->receiveEncodedData((unsigned char *)array->data(),array->size()) ;
if (!videoCaptureToggleButton->isChecked()) {
if (mChatWidget) {
QString buttonName = name;
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call from: %1").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Take Video Call"));
button->setToolTip(tr("Activate camera"));
button->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
button->updateImage();
connect(button,SIGNAL(clicked()),this,SLOT(startVideoCapture()));
connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter()));
connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave()));
buttonMapTakeVideo.insert(buttonName, button);
}
}
}
}
void VOIPChatWidgetHolder::botMouseEnter()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: red;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(true);
}
}
void VOIPChatWidgetHolder::botMouseLeave()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(false);
}
if (!videoCaptureToggleButton->isChecked()) {
if (mChatWidget) {
QString buttonName = name;
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call from: %1").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Take Video Call"));
button->setToolTip(tr("Activate camera"));
button->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
button->updateImage();
connect(button,SIGNAL(clicked()),this,SLOT(startVideoCapture()));
connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter()));
connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave()));
buttonMapTakeVideo.insert(buttonName, button);
}
}
}
}
void VOIPChatWidgetHolder::botMouseEnter()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: red;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(true);
}
}
void VOIPChatWidgetHolder::botMouseLeave()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(false);
}
}
void VOIPChatWidgetHolder::setAcceptedBandwidth(const QString name, uint32_t bytes_per_sec)
@ -377,21 +397,21 @@ void VOIPChatWidgetHolder::addAudioData(const QString name, QByteArray* array)
void VOIPChatWidgetHolder::sendVideoData()
{
RsVoipDataChunk chunk ;
RsVOIPDataChunk chunk ;
while(inputVideoDevice && inputVideoDevice->getNextEncodedPacket(chunk))
rsVoip->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk) ;
rsVOIP->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk) ;
}
void VOIPChatWidgetHolder::sendAudioData()
{
while(inputAudioProcessor && inputAudioProcessor->hasPendingPackets()) {
QByteArray qbarray = inputAudioProcessor->getNetworkPacket();
RsVoipDataChunk chunk;
RsVOIPDataChunk chunk;
chunk.size = qbarray.size();
chunk.data = (void*)qbarray.constData();
chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_AUDIO ;
rsVoip->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk);
chunk.type = RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO ;
rsVOIP->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk);
}
}