Add HideChat Button.

Change layout of video when text is hidden.
Add toolbar in fullscreen.
This commit is contained in:
Phenom 2015-10-04 14:12:20 +02:00
parent 5d8972e82d
commit 2b1d39cea1
3 changed files with 283 additions and 114 deletions

View File

@ -45,39 +45,56 @@
VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *notify) VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *notify)
: QObject(), ChatWidgetHolder(chatWidget), mVOIPNotify(notify) : QObject(), ChatWidgetHolder(chatWidget), mVOIPNotify(notify)
{ {
QIcon icon ; QIcon iconaudioListenToggleButton ;
icon.addPixmap(QPixmap(":/images/audio-volume-muted.png")) ; iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-muted.png")) ;
icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Normal,QIcon::On) ; iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Normal,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Disabled,QIcon::On) ; iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Disabled,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Active,QIcon::On) ; iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Active,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Selected,QIcon::On) ; iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Selected,QIcon::On) ;
audioListenToggleButton = new QToolButton ; audioListenToggleButton = new QToolButton ;
audioListenToggleButton->setIcon(icon) ; audioListenToggleButton->setIcon(iconaudioListenToggleButton) ;
audioListenToggleButton->setIconSize(QSize(42,42)) ; audioListenToggleButton->setIconSize(QSize(42,42)) ;
audioListenToggleButton->setAutoRaise(true) ;
audioListenToggleButton->setCheckable(true);
audioListenToggleButton->setMinimumSize(QSize(44,44)) ; audioListenToggleButton->setMinimumSize(QSize(44,44)) ;
audioListenToggleButton->setMaximumSize(QSize(44,44)) ; audioListenToggleButton->setMaximumSize(QSize(44,44)) ;
audioListenToggleButton->setCheckable(true);
audioListenToggleButton->setAutoRaise(true) ;
audioListenToggleButton->setText(QString()) ; audioListenToggleButton->setText(QString()) ;
audioListenToggleButton->setToolTip(tr("Mute")); audioListenToggleButton->setToolTip(tr("Mute"));
QIcon icon2 ; QIcon iconaudioCaptureToggleButton ;
icon2.addPixmap(QPixmap(":/images/call-start.png")) ; iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-start.png")) ;
icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Normal,QIcon::On) ; iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Normal,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Disabled,QIcon::On) ; iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Disabled,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Active,QIcon::On) ; iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Active,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Selected,QIcon::On) ; iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Selected,QIcon::On) ;
audioCaptureToggleButton = new QToolButton ; audioCaptureToggleButton = new QToolButton ;
audioCaptureToggleButton->setIcon(iconaudioCaptureToggleButton) ;
audioCaptureToggleButton->setIconSize(QSize(42,42)) ;
audioCaptureToggleButton->setMinimumSize(QSize(44,44)) ; audioCaptureToggleButton->setMinimumSize(QSize(44,44)) ;
audioCaptureToggleButton->setMaximumSize(QSize(44,44)) ; audioCaptureToggleButton->setMaximumSize(QSize(44,44)) ;
audioCaptureToggleButton->setCheckable(true) ;
audioCaptureToggleButton->setAutoRaise(true) ;
audioCaptureToggleButton->setText(QString()) ; audioCaptureToggleButton->setText(QString()) ;
audioCaptureToggleButton->setToolTip(tr("Start Call")); audioCaptureToggleButton->setToolTip(tr("Start Call"));
audioCaptureToggleButton->setIcon(icon2) ;
audioCaptureToggleButton->setIconSize(QSize(42,42)) ; QIcon iconvideoCaptureToggleButton ;
audioCaptureToggleButton->setAutoRaise(true) ; iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-on.png")) ;
audioCaptureToggleButton->setCheckable(true) ; iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Normal,QIcon::On) ;
iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Disabled,QIcon::On) ;
iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Active,QIcon::On) ;
iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Selected,QIcon::On) ;
videoCaptureToggleButton = new QToolButton ;
videoCaptureToggleButton->setIcon(iconvideoCaptureToggleButton) ;
videoCaptureToggleButton->setIconSize(QSize(42,42)) ;
videoCaptureToggleButton->setMinimumSize(QSize(44,44)) ;
videoCaptureToggleButton->setMaximumSize(QSize(44,44)) ;
videoCaptureToggleButton->setCheckable(true) ;
videoCaptureToggleButton->setAutoRaise(true) ;
videoCaptureToggleButton->setText(QString()) ;
videoCaptureToggleButton->setToolTip(tr("Start Video Call"));
hangupButton = new QToolButton ; hangupButton = new QToolButton ;
hangupButton->setIcon(QIcon(":/images/call-stop.png")) ; hangupButton->setIcon(QIcon(":/images/call-stop.png")) ;
@ -90,52 +107,55 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n
hangupButton->setToolTip(tr("Hangup Call")); hangupButton->setToolTip(tr("Hangup Call"));
hangupButton->hide(); hangupButton->hide();
QIcon icon3 ; QIcon iconhideChatTextToggleButton ;
icon3.addPixmap(QPixmap(":/images/video-icon-on.png")) ; iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/orange-bubble-64.png")) ;
icon3.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Normal,QIcon::On) ; iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Normal,QIcon::On) ;
icon3.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Disabled,QIcon::On) ; iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Disabled,QIcon::On) ;
icon3.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Active,QIcon::On) ; iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Active,QIcon::On) ;
icon3.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Selected,QIcon::On) ; iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Selected,QIcon::On) ;
videoCaptureToggleButton = new QToolButton ;
videoCaptureToggleButton->setMinimumSize(QSize(44,44)) ;
videoCaptureToggleButton->setMaximumSize(QSize(44,44)) ;
videoCaptureToggleButton->setText(QString()) ;
videoCaptureToggleButton->setToolTip(tr("Start Video Call"));
videoCaptureToggleButton->setIcon(icon3) ;
videoCaptureToggleButton->setIconSize(QSize(42,42)) ;
videoCaptureToggleButton->setAutoRaise(true) ;
videoCaptureToggleButton->setCheckable(true) ;
QIcon icon4 ;
icon4.addPixmap(QPixmap(":/images/channels32.png")) ;
icon4.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Normal,QIcon::On) ;
icon4.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Disabled,QIcon::On) ;
icon4.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Active,QIcon::On) ;
icon4.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Selected,QIcon::On) ;
hideChatTextToggleButton = new QToolButton ; hideChatTextToggleButton = new QToolButton ;
hideChatTextToggleButton->setIcon(iconhideChatTextToggleButton) ;
hideChatTextToggleButton->setIconSize(QSize(42,42)) ;
hideChatTextToggleButton->setMinimumSize(QSize(44,44)) ; hideChatTextToggleButton->setMinimumSize(QSize(44,44)) ;
hideChatTextToggleButton->setMaximumSize(QSize(44,44)) ; hideChatTextToggleButton->setMaximumSize(QSize(44,44)) ;
hideChatTextToggleButton->setCheckable(true) ;
hideChatTextToggleButton->setAutoRaise(true) ;
hideChatTextToggleButton->setText(QString()) ; hideChatTextToggleButton->setText(QString()) ;
hideChatTextToggleButton->setToolTip(tr("Hide Chat Text")); hideChatTextToggleButton->setToolTip(tr("Hide Chat Text"));
hideChatTextToggleButton->setIcon(icon4) ;
hideChatTextToggleButton->setIconSize(QSize(42,42)) ;
hideChatTextToggleButton->setAutoRaise(true) ;
hideChatTextToggleButton->setCheckable(true) ;
hideChatTextToggleButton->setEnabled(false) ; hideChatTextToggleButton->setEnabled(false) ;
QIcon iconfullscreenToggleButton ;
iconfullscreenToggleButton.addPixmap(QPixmap(":/images/channels32.png")) ;
iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Normal,QIcon::On) ;
iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Disabled,QIcon::On) ;
iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Active,QIcon::On) ;
iconfullscreenToggleButton.addPixmap(QPixmap(":/images/folder-draft24.png"),QIcon::Selected,QIcon::On) ;
fullscreenToggleButton = new QToolButton ;
fullscreenToggleButton->setIcon(iconfullscreenToggleButton) ;
fullscreenToggleButton->setIconSize(QSize(42,42)) ;
fullscreenToggleButton->setMinimumSize(QSize(44,44)) ;
fullscreenToggleButton->setMaximumSize(QSize(44,44)) ;
fullscreenToggleButton->setCheckable(true) ;
fullscreenToggleButton->setAutoRaise(true) ;
fullscreenToggleButton->setText(QString()) ;
fullscreenToggleButton->setToolTip(tr("Fullscreen mode"));
fullscreenToggleButton->setEnabled(false) ;
connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen())); connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen()));
connect(audioCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioCapture())); connect(audioCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioCapture()));
connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall()));
connect(videoCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleVideoCapture())); connect(videoCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleVideoCapture()));
connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall()));
connect(hideChatTextToggleButton, SIGNAL(clicked()), this , SLOT(toggleHideChatText())); connect(hideChatTextToggleButton, SIGNAL(clicked()), this , SLOT(toggleHideChatText()));
connect(fullscreenToggleButton, SIGNAL(clicked()), this , SLOT(toggleFullScreen()));
mChatWidget->addTitleBarWidget(audioListenToggleButton) ; mChatWidget->addTitleBarWidget(audioListenToggleButton) ;
mChatWidget->addTitleBarWidget(audioCaptureToggleButton) ; mChatWidget->addTitleBarWidget(audioCaptureToggleButton) ;
mChatWidget->addTitleBarWidget(hangupButton) ;
mChatWidget->addTitleBarWidget(videoCaptureToggleButton) ; mChatWidget->addTitleBarWidget(videoCaptureToggleButton) ;
mChatWidget->addTitleBarWidget(hangupButton) ;
mChatWidget->addTitleBarWidget(hideChatTextToggleButton) ; mChatWidget->addTitleBarWidget(hideChatTextToggleButton) ;
mChatWidget->addTitleBarWidget(fullscreenToggleButton) ;
outputAudioProcessor = NULL ; outputAudioProcessor = NULL ;
outputAudioDevice = NULL ; outputAudioDevice = NULL ;
@ -170,17 +190,76 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n
outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size())); outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size()));
outputVideoDeviceFS->showFrameOff(); outputVideoDeviceFS->showFrameOff();
hideChatTextToggleButtonFS = new QToolButton(fullScreenFrame); toolBarFS = new QFrame(fullScreenFrame);
hideChatTextToggleButtonFS->setMinimumSize(QSize(44,44)); QHBoxLayout *toolBarFSLayout = new QHBoxLayout(toolBarFS);
hideChatTextToggleButtonFS->setMaximumSize(QSize(44,44));
hideChatTextToggleButtonFS->setText(QString()); audioListenToggleButtonFS = new QToolButton(fullScreenFrame) ;
hideChatTextToggleButtonFS->setToolTip(tr("Hide Chat Text")); audioListenToggleButtonFS->setIcon(iconaudioListenToggleButton) ;
hideChatTextToggleButtonFS->setIcon(icon4); audioListenToggleButtonFS->setIconSize(QSize(42,42)) ;
hideChatTextToggleButtonFS->setIconSize(QSize(42,42)); audioListenToggleButtonFS->setMinimumSize(QSize(44,44)) ;
hideChatTextToggleButtonFS->setAutoRaise(true); audioListenToggleButtonFS->setMaximumSize(QSize(44,44)) ;
hideChatTextToggleButtonFS->setCheckable(true); audioListenToggleButtonFS->setCheckable(true);
hideChatTextToggleButtonFS->setEnabled(false); audioListenToggleButtonFS->setAutoRaise(true) ;
connect(hideChatTextToggleButtonFS, SIGNAL(clicked()), this , SLOT(toggleHideChatTextFS())); audioListenToggleButtonFS->setText(QString()) ;
audioListenToggleButtonFS->setToolTip(tr("Mute"));
audioCaptureToggleButtonFS = new QToolButton(fullScreenFrame) ;
audioCaptureToggleButtonFS->setIcon(iconaudioCaptureToggleButton) ;
audioCaptureToggleButtonFS->setIconSize(QSize(42,42)) ;
audioCaptureToggleButtonFS->setMinimumSize(QSize(44,44)) ;
audioCaptureToggleButtonFS->setMaximumSize(QSize(44,44)) ;
audioCaptureToggleButtonFS->setCheckable(true) ;
audioCaptureToggleButtonFS->setAutoRaise(true) ;
audioCaptureToggleButtonFS->setText(QString()) ;
audioCaptureToggleButtonFS->setToolTip(tr("Start Call"));
videoCaptureToggleButtonFS = new QToolButton(fullScreenFrame) ;
videoCaptureToggleButtonFS->setIcon(iconvideoCaptureToggleButton) ;
videoCaptureToggleButtonFS->setIconSize(QSize(42,42)) ;
videoCaptureToggleButtonFS->setMinimumSize(QSize(44,44)) ;
videoCaptureToggleButtonFS->setMaximumSize(QSize(44,44)) ;
videoCaptureToggleButtonFS->setCheckable(true) ;
videoCaptureToggleButtonFS->setAutoRaise(true) ;
videoCaptureToggleButtonFS->setText(QString()) ;
videoCaptureToggleButtonFS->setToolTip(tr("Start Video Call"));
hangupButtonFS = new QToolButton(fullScreenFrame) ;
hangupButtonFS->setIcon(QIcon(":/images/call-stop.png")) ;
hangupButtonFS->setIconSize(QSize(42,42)) ;
hangupButtonFS->setMinimumSize(QSize(44,44)) ;
hangupButtonFS->setMaximumSize(QSize(44,44)) ;
hangupButtonFS->setCheckable(false) ;
hangupButtonFS->setAutoRaise(true) ;
hangupButtonFS->setText(QString()) ;
hangupButtonFS->setToolTip(tr("Hangup Call"));
hangupButtonFS->hide();
fullscreenToggleButtonFS = new QToolButton(fullScreenFrame);
fullscreenToggleButtonFS->setIcon(iconfullscreenToggleButton);
fullscreenToggleButtonFS->setIconSize(QSize(42,42));
fullscreenToggleButtonFS->setMinimumSize(QSize(44,44));
fullscreenToggleButtonFS->setMaximumSize(QSize(44,44));
fullscreenToggleButtonFS->setCheckable(true);
fullscreenToggleButtonFS->setAutoRaise(true);
fullscreenToggleButtonFS->setText(QString());
fullscreenToggleButtonFS->setToolTip(tr("Fullscreen mode"));
fullscreenToggleButtonFS->setEnabled(false);
connect(audioListenToggleButtonFS, SIGNAL(clicked()), this , SLOT(toggleAudioListenFS()));
connect(audioCaptureToggleButtonFS, SIGNAL(clicked()), this , SLOT(toggleAudioCaptureFS()));
connect(videoCaptureToggleButtonFS, SIGNAL(clicked()), this , SLOT(toggleVideoCaptureFS()));
connect(hangupButtonFS, SIGNAL(clicked()), this , SLOT(hangupCall()));
connect(fullscreenToggleButtonFS, SIGNAL(clicked()), this , SLOT(toggleFullScreenFS()));
toolBarFSLayout->setDirection(QBoxLayout::LeftToRight);
toolBarFSLayout->setSpacing(2);
toolBarFSLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
toolBarFSLayout->addWidget(audioListenToggleButtonFS);
toolBarFSLayout->addWidget(audioCaptureToggleButtonFS);
toolBarFSLayout->addWidget(videoCaptureToggleButtonFS);
toolBarFSLayout->addWidget(hangupButtonFS);
toolBarFSLayout->addWidget(fullscreenToggleButtonFS);
toolBarFS->setLayout(toolBarFSLayout);
echoVideoDeviceFS = new QVideoOutputDevice(fullScreenFrame); echoVideoDeviceFS = new QVideoOutputDevice(fullScreenFrame);
echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240))); echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240)));
@ -213,17 +292,15 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder()
it = buttonMapTakeVideo.erase(it); it = buttonMapTakeVideo.erase(it);
} }
} }
bool VOIPChatWidgetHolder::eventFilter(QObject *obj, QEvent *event) bool VOIPChatWidgetHolder::eventFilter(QObject *obj, QEvent *event)
{ {
if (obj == fullScreenFrame) { if (obj == fullScreenFrame) {
if (event->type() == QEvent::Close || event->type() == QEvent::MouseButtonDblClick) { if (event->type() == QEvent::Close || event->type() == QEvent::MouseButtonDblClick) {
showChatText(); showNormalView();
} }
if (event->type() == QEvent::Resize) { if (event->type() == QEvent::Resize) {
outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size())); replaceFullscreenWidget();
outputVideoDeviceFS->showFrameOff();
echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240)));
echoVideoDeviceFS->showFrameOff();
} }
} }
@ -231,6 +308,34 @@ bool VOIPChatWidgetHolder::eventFilter(QObject *obj, QEvent *event)
return QObject::eventFilter(obj, event); return QObject::eventFilter(obj, event);
} }
void VOIPChatWidgetHolder::hangupCall()
{
if (audioCaptureToggleButton->isChecked()) {
audioCaptureToggleButton->setChecked(false);
toggleAudioCapture();
}
if (videoCaptureToggleButton->isChecked()) {
videoCaptureToggleButton->setChecked(false);
toggleVideoCapture();
}
if (fullscreenToggleButton->isChecked()) {
fullscreenToggleButton->setChecked(false);
toggleFullScreen();
}
if (hideChatTextToggleButton->isChecked()) {
hideChatTextToggleButton->setChecked(false);
toggleHideChatText();
}
hangupButton->hide();
hangupButtonFS->hide();
}
void VOIPChatWidgetHolder::toggleAudioListenFS()
{
audioListenToggleButton->setChecked(audioListenToggleButtonFS->isChecked());
toggleAudioListen();
}
void VOIPChatWidgetHolder::toggleAudioListen() void VOIPChatWidgetHolder::toggleAudioListen()
{ {
if (audioListenToggleButton->isChecked()) { if (audioListenToggleButton->isChecked()) {
@ -242,25 +347,8 @@ void VOIPChatWidgetHolder::toggleAudioListen()
outputAudioDevice->stop(); outputAudioDevice->stop();
}*/ }*/
} }
} audioListenToggleButtonFS->setChecked(audioListenToggleButton->isChecked());
audioListenToggleButtonFS->setToolTip(audioListenToggleButton->toolTip());
void VOIPChatWidgetHolder::hangupCall()
{
disconnect(inputAudioProcessor, SIGNAL(networkPacketReady()), this, SLOT(sendAudioData()));
if (inputAudioDevice) {
inputAudioDevice->stop();
}
if (outputAudioDevice) {
outputAudioDevice->stop();
}
if (mChatWidget) {
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("Outgoing Call stopped."), ChatWidget::MSGTYPE_SYSTEM);
}
audioListenToggleButton->setChecked(false);
audioCaptureToggleButton->setChecked(false);
hangupButton->hide();
} }
void VOIPChatWidgetHolder::startAudioCapture() void VOIPChatWidgetHolder::startAudioCapture()
@ -269,13 +357,21 @@ void VOIPChatWidgetHolder::startAudioCapture()
toggleAudioCapture(); toggleAudioCapture();
} }
void VOIPChatWidgetHolder::toggleAudioCaptureFS()
{
audioCaptureToggleButton->setChecked(audioCaptureToggleButtonFS->isChecked());
toggleAudioCapture();
}
void VOIPChatWidgetHolder::toggleAudioCapture() void VOIPChatWidgetHolder::toggleAudioCapture()
{ {
if (audioCaptureToggleButton->isChecked()) { if (audioCaptureToggleButton->isChecked()) {
//activate audio output //activate audio output
audioListenToggleButton->setChecked(true); audioListenToggleButton->setChecked(true);
audioListenToggleButtonFS->setChecked(true);
audioCaptureToggleButton->setToolTip(tr("Hold Call")); audioCaptureToggleButton->setToolTip(tr("Hold Call"));
hangupButton->show(); hangupButton->show();
hangupButtonFS->show();
//activate audio input //activate audio input
if (!inputAudioProcessor) { if (!inputAudioProcessor) {
@ -307,9 +403,15 @@ void VOIPChatWidgetHolder::toggleAudioCapture()
if (inputAudioDevice) { if (inputAudioDevice) {
inputAudioDevice->stop(); inputAudioDevice->stop();
} }
if (mChatWidget) {
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("Outgoing Audio Call stopped."), ChatWidget::MSGTYPE_SYSTEM);
}
audioCaptureToggleButton->setToolTip(tr("Resume Call")); audioCaptureToggleButton->setToolTip(tr("Resume Call"));
hangupButton->hide(); hangupButton->hide();
hangupButtonFS->hide();
} }
audioCaptureToggleButtonFS->setChecked(audioCaptureToggleButton->isChecked());
audioCaptureToggleButtonFS->setToolTip(audioCaptureToggleButton->toolTip());
} }
void VOIPChatWidgetHolder::startVideoCapture() void VOIPChatWidgetHolder::startVideoCapture()
@ -318,12 +420,21 @@ void VOIPChatWidgetHolder::startVideoCapture()
toggleVideoCapture(); toggleVideoCapture();
} }
void VOIPChatWidgetHolder::toggleVideoCaptureFS()
{
videoCaptureToggleButton->setChecked(videoCaptureToggleButtonFS->isChecked());
toggleVideoCapture();
}
void VOIPChatWidgetHolder::toggleVideoCapture() void VOIPChatWidgetHolder::toggleVideoCapture()
{ {
if (videoCaptureToggleButton->isChecked()) if (videoCaptureToggleButton->isChecked())
{ {
hideChatTextToggleButton->setEnabled(true); hideChatTextToggleButton->setEnabled(true);
hideChatTextToggleButtonFS->setEnabled(true); fullscreenToggleButton->setEnabled(true);
fullscreenToggleButtonFS->setEnabled(true);
hangupButton->show();
hangupButtonFS->show();
//activate video input //activate video input
// //
videoWidget->show(); videoWidget->show();
@ -346,9 +457,15 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
{ {
hideChatTextToggleButton->setEnabled(false); hideChatTextToggleButton->setEnabled(false);
hideChatTextToggleButton->setChecked(false); hideChatTextToggleButton->setChecked(false);
hideChatTextToggleButtonFS->setEnabled(false);
hideChatTextToggleButtonFS->setChecked(false);
toggleHideChatText(); toggleHideChatText();
fullscreenToggleButton->setEnabled(false);
fullscreenToggleButton->setChecked(false);
fullscreenToggleButtonFS->setEnabled(false);
fullscreenToggleButtonFS->setChecked(false);
toggleFullScreen();
hangupButton->hide();
hangupButtonFS->hide();
inputVideoDevice->stop() ; inputVideoDevice->stop() ;
videoCaptureToggleButton->setToolTip(tr("Activate camera")); videoCaptureToggleButton->setToolTip(tr("Activate camera"));
outputVideoDevice->showFrameOff(); outputVideoDevice->showFrameOff();
@ -358,6 +475,8 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM); , tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM);
} }
videoCaptureToggleButtonFS->setChecked(videoCaptureToggleButton->isChecked());
videoCaptureToggleButtonFS->setToolTip(videoCaptureToggleButton->toolTip());
} }
void VOIPChatWidgetHolder::addVideoData(const RsPeerId &peer_id, QByteArray* array) void VOIPChatWidgetHolder::addVideoData(const RsPeerId &peer_id, QByteArray* array)
@ -408,35 +527,69 @@ void VOIPChatWidgetHolder::addVideoData(const RsPeerId &peer_id, QByteArray* arr
} }
} }
void VOIPChatWidgetHolder::toggleHideChatTextFS()
{
hideChatTextToggleButton->setChecked(hideChatTextToggleButtonFS->isChecked());
toggleHideChatText();
}
void VOIPChatWidgetHolder::toggleHideChatText() void VOIPChatWidgetHolder::toggleHideChatText()
{ {
QBoxLayout *layout = static_cast<QBoxLayout*>(videoWidget->layout());
if (hideChatTextToggleButton->isChecked()) { if (hideChatTextToggleButton->isChecked()) {
mChatWidget->hideChatText(true);
if (layout) layout->setDirection(QBoxLayout::LeftToRight);
hideChatTextToggleButton->setToolTip(tr("Show Chat Text")); hideChatTextToggleButton->setToolTip(tr("Show Chat Text"));
} else {
mChatWidget->hideChatText(false);
if (layout) layout->setDirection(QBoxLayout::TopToBottom);
hideChatTextToggleButton->setToolTip(tr("Hide Chat Text"));
fullscreenToggleButton->setChecked(false);
toggleFullScreen();
}
}
void VOIPChatWidgetHolder::toggleFullScreenFS()
{
fullscreenToggleButton->setChecked(fullscreenToggleButtonFS->isChecked());
toggleFullScreen();
}
void VOIPChatWidgetHolder::toggleFullScreen()
{
if (fullscreenToggleButton->isChecked()) {
fullscreenToggleButton->setToolTip(tr("Return to normal view."));
inputVideoDevice->setEchoVideoTarget(echoVideoDeviceFS) ; inputVideoDevice->setEchoVideoTarget(echoVideoDeviceFS) ;
videoProcessor->setDisplayTarget(outputVideoDeviceFS) ; videoProcessor->setDisplayTarget(outputVideoDeviceFS) ;
fullScreenFrame->show(); fullScreenFrame->show();
} else { } else {
mChatWidget->hideChatText(false); mChatWidget->hideChatText(false);
hideChatTextToggleButton->setToolTip(tr("Hide Chat Text")); fullscreenToggleButton->setToolTip(tr("Fullscreen mode"));
inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ; inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ;
videoProcessor->setDisplayTarget(outputVideoDevice) ; videoProcessor->setDisplayTarget(outputVideoDevice) ;
fullScreenFrame->hide(); fullScreenFrame->hide();
} }
hideChatTextToggleButtonFS->setChecked(hideChatTextToggleButton->isChecked()); fullscreenToggleButtonFS->setChecked(fullscreenToggleButton->isChecked());
hideChatTextToggleButtonFS->setToolTip(fullScreenFrame->toolTip()); fullscreenToggleButtonFS->setToolTip(fullscreenToggleButton->toolTip());
} }
void VOIPChatWidgetHolder::showChatText() void VOIPChatWidgetHolder::replaceFullscreenWidget()
{
outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size()));
echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240)));
QRect toolBarFSGeo = QRect( (fullScreenFrame->width() - toolBarFS->geometry().width()) / 2
, fullScreenFrame->height() - toolBarFS->geometry().height()
, toolBarFS->geometry().width(), toolBarFS->geometry().height());
toolBarFS->setGeometry(toolBarFSGeo);
if (!videoCaptureToggleButton->isChecked()) {
outputVideoDeviceFS->showFrameOff();
echoVideoDeviceFS->showFrameOff();
}
}
void VOIPChatWidgetHolder::showNormalView()
{ {
hideChatTextToggleButton->setChecked(false); hideChatTextToggleButton->setChecked(false);
hideChatTextToggleButtonFS->setChecked(false);
toggleHideChatText(); toggleHideChatText();
fullscreenToggleButton->setChecked(false);
fullscreenToggleButtonFS->setChecked(false);
toggleFullScreen();
} }
void VOIPChatWidgetHolder::botMouseEnter() void VOIPChatWidgetHolder::botMouseEnter()
@ -587,15 +740,17 @@ void VOIPChatWidgetHolder::sendAudioData()
void VOIPChatWidgetHolder::updateStatus(int status) void VOIPChatWidgetHolder::updateStatus(int status)
{ {
audioListenToggleButton->setEnabled(true); bool enabled = (status != RS_STATUS_OFFLINE);
audioCaptureToggleButton->setEnabled(true);
hangupButton->setEnabled(true);
switch (status) { audioListenToggleButton->setEnabled(enabled);
case RS_STATUS_OFFLINE: audioListenToggleButtonFS->setEnabled(enabled);
audioListenToggleButton->setEnabled(false); audioCaptureToggleButton->setEnabled(enabled);
audioCaptureToggleButton->setEnabled(false); audioCaptureToggleButtonFS->setEnabled(enabled);
hangupButton->setEnabled(false); videoCaptureToggleButton->setEnabled(enabled);
break; videoCaptureToggleButtonFS->setEnabled(enabled);
} hideChatTextToggleButton->setEnabled(videoCaptureToggleButton->isChecked() && enabled);
fullscreenToggleButton->setEnabled(videoCaptureToggleButton->isChecked() && enabled);
fullscreenToggleButtonFS->setEnabled(videoCaptureToggleButton->isChecked() && enabled);
hangupButton->setEnabled(enabled);
hangupButtonFS->setEnabled(enabled);
} }

View File

@ -60,15 +60,22 @@ public slots:
private slots: private slots:
void toggleAudioListen(); void toggleAudioListen();
void toggleAudioListenFS();
void toggleAudioCapture(); void toggleAudioCapture();
void toggleAudioCaptureFS();
void toggleVideoCapture(); void toggleVideoCapture();
void toggleVideoCaptureFS();
void toggleHideChatText(); void toggleHideChatText();
void toggleHideChatTextFS(); void toggleFullScreen();
void showChatText(); void toggleFullScreenFS();
void hangupCall() ; void hangupCall() ;
void botMouseEnter(); void botMouseEnter();
void botMouseLeave(); void botMouseLeave();
private:
void replaceFullscreenWidget();
void showNormalView();
protected: protected:
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
@ -96,11 +103,17 @@ protected:
// Additional buttons to the chat bar // Additional buttons to the chat bar
QToolButton *audioListenToggleButton ; QToolButton *audioListenToggleButton ;
QToolButton *audioListenToggleButtonFS ;
QToolButton *audioCaptureToggleButton ; QToolButton *audioCaptureToggleButton ;
QToolButton *audioCaptureToggleButtonFS ;
QToolButton *videoCaptureToggleButton ; QToolButton *videoCaptureToggleButton ;
QToolButton *videoCaptureToggleButtonFS ;
QToolButton *hideChatTextToggleButton ; QToolButton *hideChatTextToggleButton ;
QToolButton *hideChatTextToggleButtonFS ; QToolButton *fullscreenToggleButton ;
QToolButton *fullscreenToggleButtonFS ;
QToolButton *hangupButton ; QToolButton *hangupButton ;
QToolButton *hangupButtonFS ;
QFrame *toolBarFS;
typedef QMap<QString, RSButtonOnText*> button_map; typedef QMap<QString, RSButtonOnText*> button_map;
button_map buttonMapTakeVideo; button_map buttonMapTakeVideo;

View File

@ -231,6 +231,7 @@ void ChatWidget::addTitleBarWidget(QWidget *w)
void ChatWidget::hideChatText(bool hidden) void ChatWidget::hideChatText(bool hidden)
{ {
ui->frame_ChatText->setHidden(hidden); ; ui->frame_ChatText->setHidden(hidden); ;
ui->searchframe->setVisible(ui->actionSearch_History->isChecked() && !hidden); ;
} }
RSButtonOnText* ChatWidget::getNewButtonOnTextBrowser() RSButtonOnText* ChatWidget::getNewButtonOnTextBrowser()