changed the voip icons, disable the voip buttons when friend is offline.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6857 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2013-10-20 16:59:29 +00:00
parent 4cf86c52a1
commit 06f6f1949d
3 changed files with 71 additions and 14 deletions

View File

@ -4,9 +4,14 @@
#include "AudioPopupChatDialog.h" #include "AudioPopupChatDialog.h"
#include "interface/rsvoip.h" #include "interface/rsvoip.h"
#include "gui/SoundManager.h" #include "gui/SoundManager.h"
#include "util/HandleRichText.h"
#include "gui/common/StatusDefs.h"
#include <retroshare/rsstatus.h>
#define CALL_START ":/images/call-start-22.png" #define CALL_START ":/images/call-start-22.png"
#define CALL_STOP ":/images/call-stop-22.png" #define CALL_STOP ":/images/call-stop-22.png"
#define CALL_HOLD ":/images/call-hold-22.png"
AudioPopupChatDialog::AudioPopupChatDialog(QWidget *parent) AudioPopupChatDialog::AudioPopupChatDialog(QWidget *parent)
: PopupChatDialog(parent) : PopupChatDialog(parent)
@ -20,11 +25,11 @@ AudioPopupChatDialog::AudioPopupChatDialog(QWidget *parent)
std::cerr << "****** VOIPLugin: Creating new AudioPopupChatDialog !!" << std::endl; std::cerr << "****** VOIPLugin: Creating new AudioPopupChatDialog !!" << std::endl;
QIcon icon ; QIcon icon ;
icon.addPixmap(QPixmap(":/images/deafened_self.svg")) ; icon.addPixmap(QPixmap(":/images/audio-volume-muted-22.png")) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Normal,QIcon::On) ; icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Normal,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Disabled,QIcon::On) ; icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Disabled,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Active,QIcon::On) ; icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Active,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Selected,QIcon::On) ; icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Selected,QIcon::On) ;
audioListenToggleButton->setIcon(icon) ; audioListenToggleButton->setIcon(icon) ;
audioListenToggleButton->setIconSize(QSize(22,22)) ; audioListenToggleButton->setIconSize(QSize(22,22)) ;
@ -39,21 +44,33 @@ AudioPopupChatDialog::AudioPopupChatDialog(QWidget *parent)
QIcon icon2 ; QIcon icon2 ;
icon2.addPixmap(QPixmap(":/images/call-start-22.png")) ; icon2.addPixmap(QPixmap(":/images/call-start-22.png")) ;
icon2.addPixmap(QPixmap(":/images/call-stop-22.png"),QIcon::Normal,QIcon::On) ; icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Normal,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/call-stop-22.png"),QIcon::Disabled,QIcon::On) ; icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Disabled,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/call-stop-22.png"),QIcon::Active,QIcon::On) ; icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Active,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/call-stop-22.png"),QIcon::Selected,QIcon::On) ; icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Selected,QIcon::On) ;
audioMuteCaptureToggleButton->setIcon(icon2) ; audioMuteCaptureToggleButton->setIcon(icon2) ;
audioMuteCaptureToggleButton->setIconSize(QSize(22,22)) ; audioMuteCaptureToggleButton->setIconSize(QSize(22,22)) ;
audioMuteCaptureToggleButton->setAutoRaise(true) ; audioMuteCaptureToggleButton->setAutoRaise(true) ;
audioMuteCaptureToggleButton->setCheckable(true) ; audioMuteCaptureToggleButton->setCheckable(true) ;
hangupButton = new QToolButton ;
hangupButton->setIcon(QIcon(":/images/call-stop-22.png")) ;
hangupButton->setIconSize(QSize(22,22)) ;
hangupButton->setMinimumSize(QSize(28,28)) ;
hangupButton->setMaximumSize(QSize(28,28)) ;
hangupButton->setCheckable(false) ;
hangupButton->setAutoRaise(true) ;
hangupButton->setText(QString()) ;
hangupButton->setToolTip(tr("Hangup Call"));
connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen())); connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen()));
connect(audioMuteCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioMuteCapture())); connect(audioMuteCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioMuteCapture()));
connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall()));
addChatBarWidget(audioListenToggleButton) ; addChatBarWidget(audioListenToggleButton) ;
addChatBarWidget(audioMuteCaptureToggleButton) ; addChatBarWidget(audioMuteCaptureToggleButton) ;
addChatBarWidget(hangupButton) ;
//ui.chatWidget->resetStatusBar(); //ui.chatWidget->resetStatusBar();
@ -67,7 +84,9 @@ void AudioPopupChatDialog::toggleAudioListen()
{ {
std::cerr << "******** VOIPLugin: Toggling audio listen!" << std::endl; std::cerr << "******** VOIPLugin: Toggling audio listen!" << std::endl;
if (audioListenToggleButton->isChecked()) { if (audioListenToggleButton->isChecked()) {
audioListenToggleButton->setToolTip(tr("Mute yourself"));
} else { } else {
audioListenToggleButton->setToolTip(tr("Unmute yourself"));
//audioListenToggleButton->setChecked(false); //audioListenToggleButton->setChecked(false);
/*if (outputDevice) { /*if (outputDevice) {
outputDevice->stop(); outputDevice->stop();
@ -75,13 +94,30 @@ void AudioPopupChatDialog::toggleAudioListen()
} }
} }
void AudioPopupChatDialog::hangupCall()
{
std::cerr << "******** VOIPLugin: Hangup call!" << std::endl;
disconnect(inputProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData()));
if (inputDevice) {
inputDevice->stop();
}
if (outputDevice) {
outputDevice->stop();
}
audioListenToggleButton->setChecked(false);
audioMuteCaptureToggleButton->setChecked(false);
}
void AudioPopupChatDialog::toggleAudioMuteCapture() void AudioPopupChatDialog::toggleAudioMuteCapture()
{ {
std::cerr << "******** VOIPLugin: Toggling audio mute capture!" << std::endl; std::cerr << "******** VOIPLugin: Toggling audio mute capture!" << std::endl;
if (audioMuteCaptureToggleButton->isChecked()) { if (audioMuteCaptureToggleButton->isChecked()) {
//activate audio output //activate audio output
audioListenToggleButton->setChecked(true); audioListenToggleButton->setChecked(true);
audioMuteCaptureToggleButton->setToolTip(tr("Stop Call")); audioMuteCaptureToggleButton->setToolTip(tr("Hold Call"));
ChatWidget *cw = getChatWidget();
//activate audio input //activate audio input
if (!inputProcessor) { if (!inputProcessor) {
@ -96,12 +132,19 @@ void AudioPopupChatDialog::toggleAudioMuteCapture()
} }
connect(inputProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData())); connect(inputProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData()));
inputDevice->start(inputProcessor); inputDevice->start(inputProcessor);
if (cw) {
cw->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("Outgoing Call is started..."), ChatWidget::TYPE_SYSTEM);
}
} else { } else {
disconnect(inputProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData())); disconnect(inputProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData()));
if (inputDevice) { if (inputDevice) {
inputDevice->stop(); inputDevice->stop();
} }
audioMuteCaptureToggleButton->setToolTip(tr("Start Call")); audioMuteCaptureToggleButton->setToolTip(tr("Resume Call"));
} }
} }
@ -179,6 +222,15 @@ void AudioPopupChatDialog::updateStatus(int status)
{ {
audioListenToggleButton->setEnabled(true); audioListenToggleButton->setEnabled(true);
audioMuteCaptureToggleButton->setEnabled(true); audioMuteCaptureToggleButton->setEnabled(true);
hangupButton->setEnabled(true);
switch (status) {
case RS_STATUS_OFFLINE:
audioListenToggleButton->setEnabled(false);
audioMuteCaptureToggleButton->setEnabled(false);
hangupButton->setEnabled(false);
break;
}
PopupChatDialog::updateStatus(status) ; PopupChatDialog::updateStatus(status) ;
} }

View File

@ -25,6 +25,8 @@ class AudioPopupChatDialog: public PopupChatDialog
private slots: private slots:
void toggleAudioListen(); void toggleAudioListen();
void toggleAudioMuteCapture(); void toggleAudioMuteCapture();
void hangupCall() ;
public slots: public slots:
void sendAudioData(); void sendAudioData();
@ -39,5 +41,7 @@ class AudioPopupChatDialog: public PopupChatDialog
QToolButton *audioListenToggleButton ; QToolButton *audioListenToggleButton ;
QToolButton *audioMuteCaptureToggleButton ; QToolButton *audioMuteCaptureToggleButton ;
QToolButton *hangupButton ;
}; };

View File

@ -1,12 +1,13 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>images/deafened_self.svg</file> <file>images/audio-volume-medium-22.png</file>
<file>images/muted_self.svg</file> <file>images/muted_self.svg</file>
<file>images/self_undeafened.svg</file> <file>images/audio-volume-muted-22.png</file>
<file>images/talking_on.svg</file> <file>images/talking_on.svg</file>
<file>images/talking_off.svg</file> <file>images/talking_off.svg</file>
<file>images/call-start-22.png</file> <file>images/call-start-22.png</file>
<file>images/call-stop-22.png</file> <file>images/call-stop-22.png</file>
<file>images/call-hold-22.png</file>
</qresource> </qresource>
</RCC> </RCC>