2015-05-26 11:19:57 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 RetroShare Team
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
/*VOIP*/
|
|
|
|
#include "VOIPToasterItem.h"
|
|
|
|
#include "VOIPGUIHandler.h"
|
|
|
|
|
|
|
|
/*libRetroshare*/
|
|
|
|
#include <retroshare/rspeers.h>
|
|
|
|
|
|
|
|
/*Retroshare-Gui*/
|
|
|
|
#include "gui/chat/ChatDialog.h"
|
|
|
|
#include "gui/notifyqt.h"
|
|
|
|
#include "util/HandleRichText.h"
|
|
|
|
|
|
|
|
VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, const voipToasterItem_Type type)
|
|
|
|
: QWidget(NULL), mPeerId(peer_id), mMsg(msg), mType(type)
|
|
|
|
{
|
|
|
|
/* Invoke the Qt Designer generated object setup routine */
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
switch (mType){
|
|
|
|
case AudioCall:
|
2015-10-27 13:52:01 -04:00
|
|
|
//acceptButton->setIcon(QIcon("://images/call-start.png"));
|
|
|
|
acceptButton->setText(tr("Answer"));
|
2015-05-26 11:19:57 -04:00
|
|
|
break;
|
|
|
|
case VideoCall:
|
2015-10-27 13:52:01 -04:00
|
|
|
acceptButton->setIcon(QIcon("://images/video-icon-on.png"));
|
|
|
|
acceptButton->setText(tr("Answer with video"));
|
2015-05-26 11:19:57 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ChatDialog::chatFriend(ChatId(mPeerId));
|
|
|
|
}
|
|
|
|
|
2015-10-27 13:52:01 -04:00
|
|
|
connect(acceptButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
|
|
|
|
connect(declineButton, SIGNAL(clicked()), SLOT(declineButtonSlot()));
|
2015-05-26 11:19:57 -04:00
|
|
|
connect(closeButton, SIGNAL(clicked()), SLOT(hide()));
|
|
|
|
|
|
|
|
/* set informations */
|
2017-01-20 17:00:05 -05:00
|
|
|
// emoticons disabled because of crazy cost
|
|
|
|
//textLabel->setText(RsHtml().formatText(NULL, msg, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
|
|
|
|
textLabel->setText(RsHtml().formatText(NULL, msg, RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
|
2015-05-28 09:59:20 -04:00
|
|
|
//toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(mPeerId).c_str()));
|
2015-05-26 11:19:57 -04:00
|
|
|
avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
|
|
|
avatarWidget->setId(ChatId(mPeerId));
|
|
|
|
}
|
|
|
|
|
|
|
|
VOIPToasterItem::~VOIPToasterItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPToasterItem::chatButtonSlot()
|
|
|
|
{
|
|
|
|
switch (mType){
|
|
|
|
case AudioCall:
|
|
|
|
VOIPGUIHandler::AnswerAudioCall(mPeerId);
|
|
|
|
break;
|
|
|
|
case VideoCall:
|
|
|
|
VOIPGUIHandler::AnswerVideoCall(mPeerId);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ChatDialog::chatFriend(ChatId(mPeerId));
|
|
|
|
}
|
|
|
|
hide();
|
|
|
|
}
|
|
|
|
|
2015-10-27 13:52:01 -04:00
|
|
|
void VOIPToasterItem::declineButtonSlot()
|
|
|
|
{
|
|
|
|
switch (mType){
|
|
|
|
case AudioCall:
|
|
|
|
VOIPGUIHandler::HangupAudioCall(mPeerId);
|
|
|
|
break;
|
|
|
|
case VideoCall:
|
|
|
|
VOIPGUIHandler::HangupVideoCall(mPeerId);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ChatDialog::chatFriend(ChatId(mPeerId));
|
|
|
|
}
|
|
|
|
hide();
|
|
|
|
}
|
|
|
|
|
2015-10-10 09:21:59 -04:00
|
|
|
#ifdef VOIPTOASTERNOTIFY_ALL
|
|
|
|
void VOIPToasterItem::voipAcceptReceived(const RsPeerId &, int )
|
2015-05-26 11:19:57 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPToasterItem::voipBandwidthInfoReceived(const RsPeerId &, int )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPToasterItem::voipDataReceived(const RsPeerId &)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-10 09:21:59 -04:00
|
|
|
void VOIPToasterItem::voipHangUpReceived(const RsPeerId &, int )
|
2015-05-26 11:19:57 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-10 09:21:59 -04:00
|
|
|
void VOIPToasterItem::voipInvitationReceived(const RsPeerId &, int )
|
2015-05-26 11:19:57 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPToasterItem::voipAudioCallReceived(const RsPeerId &)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPToasterItem::voipVideoCallReceived(const RsPeerId &)
|
|
|
|
{
|
|
|
|
}
|
2015-10-10 09:21:59 -04:00
|
|
|
#endif
|