added notification for VOIP calls (Patch from Phenom)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8063 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-03-21 21:25:17 +00:00
parent 3f116e0e73
commit ed014b0d34
7 changed files with 377 additions and 4 deletions

View file

@ -135,6 +135,11 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder()
delete inputVideoDevice ;
delete inputVideoProcessor ;
delete outputVideoProcessor ;
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
it = buttonMapTakeVideo.erase(it);
}
}
void VOIPChatWidgetHolder::toggleAudioListen()
@ -204,6 +209,13 @@ void VOIPChatWidgetHolder::toggleAudioCapture()
hangupButton->hide();
}
}
void VOIPChatWidgetHolder::startVideoCapture()
{
videoCaptureToggleButton->setChecked(true);
toggleVideoCapture();
}
void VOIPChatWidgetHolder::toggleVideoCapture()
{
if (videoCaptureToggleButton->isChecked())
@ -216,7 +228,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);
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
{
@ -226,13 +246,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);
}
}
void VOIPChatWidgetHolder::setAcceptedBandwidth(const QString name, uint32_t bytes_per_sec)

View file

@ -2,6 +2,7 @@
#include <QGraphicsEffect>
#include <gui/SpeexProcessor.h>
#include <gui/chat/ChatWidget.h>
#include <gui/common/RsButtonOnText.h>
class QToolButton;
class QAudioInput;
@ -31,7 +32,10 @@ private slots:
void toggleAudioListen();
void toggleAudioCapture();
void toggleVideoCapture();
void startVideoCapture();
void hangupCall() ;
void botMouseEnter();
void botMouseLeave();
public slots:
void sendAudioData();
@ -60,5 +64,8 @@ protected:
QToolButton *audioCaptureToggleButton ;
QToolButton *videoCaptureToggleButton ;
QToolButton *hangupButton ;
typedef QMap<QString, RSButtonOnText*> button_map;
button_map buttonMapTakeVideo;
};