From 8a7e359557364d6b1ae62b5ce1500c04a408bfca Mon Sep 17 00:00:00 2001 From: Phenom Date: Thu, 1 Oct 2015 23:41:34 +0200 Subject: [PATCH 1/4] Add a button on VOIP to hide text when video is on. --- plugins/VOIP/gui/VOIPChatWidgetHolder.cpp | 45 +- plugins/VOIP/gui/VOIPChatWidgetHolder.h | 2 + retroshare-gui/src/gui/chat/ChatWidget.cpp | 11 +- retroshare-gui/src/gui/chat/ChatWidget.h | 5 +- retroshare-gui/src/gui/chat/ChatWidget.ui | 1000 ++++++++++---------- 5 files changed, 578 insertions(+), 485 deletions(-) diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp index f8760132d..f44752205 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp @@ -107,15 +107,35 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n videoCaptureToggleButton->setAutoRaise(true) ; videoCaptureToggleButton->setCheckable(true) ; - connect(videoCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleVideoCapture())); + 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->setMinimumSize(QSize(44,44)) ; + hideChatTextToggleButton->setMaximumSize(QSize(44,44)) ; + hideChatTextToggleButton->setText(QString()) ; + hideChatTextToggleButton->setToolTip(tr("Hide Chat Text")); + hideChatTextToggleButton->setIcon(icon4) ; + hideChatTextToggleButton->setIconSize(QSize(42,42)) ; + hideChatTextToggleButton->setAutoRaise(true) ; + hideChatTextToggleButton->setCheckable(true) ; + hideChatTextToggleButton->setEnabled(false) ; + connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen())); connect(audioCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioCapture())); connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall())); + connect(videoCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleVideoCapture())); + connect(hideChatTextToggleButton, SIGNAL(clicked()), this , SLOT(toggleHideChatText())); - mChatWidget->addVOIPBarWidget(audioListenToggleButton) ; - mChatWidget->addVOIPBarWidget(audioCaptureToggleButton) ; - mChatWidget->addVOIPBarWidget(hangupButton) ; - mChatWidget->addVOIPBarWidget(videoCaptureToggleButton) ; + mChatWidget->addTitleBarWidget(audioListenToggleButton) ; + mChatWidget->addTitleBarWidget(audioCaptureToggleButton) ; + mChatWidget->addTitleBarWidget(hangupButton) ; + mChatWidget->addTitleBarWidget(videoCaptureToggleButton) ; + mChatWidget->addTitleBarWidget(hideChatTextToggleButton) ; outputAudioProcessor = NULL ; outputAudioDevice = NULL ; @@ -252,6 +272,7 @@ void VOIPChatWidgetHolder::toggleVideoCapture() { if (videoCaptureToggleButton->isChecked()) { + hideChatTextToggleButton->setEnabled(true); //activate video input // videoWidget->show(); @@ -272,6 +293,9 @@ void VOIPChatWidgetHolder::toggleVideoCapture() } else { + hideChatTextToggleButton->setEnabled(false); + hideChatTextToggleButton->setChecked(false); + toggleHideChatText(); inputVideoDevice->stop() ; videoCaptureToggleButton->setToolTip(tr("Activate camera")); outputVideoDevice->showFrameOff(); @@ -331,6 +355,17 @@ void VOIPChatWidgetHolder::addVideoData(const RsPeerId &peer_id, QByteArray* arr } } +void VOIPChatWidgetHolder::toggleHideChatText() +{ + if (hideChatTextToggleButton->isChecked()) { + mChatWidget->hideChatText(true); + hideChatTextToggleButton->setToolTip(tr("Show Chat Text")); + } else { + mChatWidget->hideChatText(false); + hideChatTextToggleButton->setToolTip(tr("Hide Chat Text")); + } +} + void VOIPChatWidgetHolder::botMouseEnter() { RSButtonOnText *source = qobject_cast(QObject::sender()); diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.h b/plugins/VOIP/gui/VOIPChatWidgetHolder.h index 350f49f2c..d0dd82e61 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.h +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.h @@ -62,6 +62,7 @@ private slots: void toggleAudioListen(); void toggleAudioCapture(); void toggleVideoCapture(); + void toggleHideChatText(); void hangupCall() ; void botMouseEnter(); void botMouseLeave(); @@ -87,6 +88,7 @@ protected: QToolButton *audioListenToggleButton ; QToolButton *audioCaptureToggleButton ; QToolButton *videoCaptureToggleButton ; + QToolButton *hideChatTextToggleButton ; QToolButton *hangupButton ; typedef QMap button_map; diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index ba9a6b484..3aa2b5189 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -214,7 +214,7 @@ void ChatWidget::setDefaultExtraFileFlags(TransferRequestFlags fl) void ChatWidget::addChatHorizontalWidget(QWidget *w) { - ui->verticalLayout_2->addWidget(w) ; + ui->vl_Plugins->addWidget(w) ; update() ; } @@ -223,9 +223,14 @@ void ChatWidget::addChatBarWidget(QWidget *w) ui->pluginButtonFrame->layout()->addWidget(w) ; } -void ChatWidget::addVOIPBarWidget(QWidget *w) +void ChatWidget::addTitleBarWidget(QWidget *w) { - ui->titleBarFrame->layout()->addWidget(w) ; + ui->pluginTitleFrame->layout()->addWidget(w) ; +} + +void ChatWidget::hideChatText(bool hidden) +{ + ui->frame_ChatText->setHidden(hidden); ; } RSButtonOnText* ChatWidget::getNewButtonOnTextBrowser() diff --git a/retroshare-gui/src/gui/chat/ChatWidget.h b/retroshare-gui/src/gui/chat/ChatWidget.h index 312f9d879..6d041e493 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.h +++ b/retroshare-gui/src/gui/chat/ChatWidget.h @@ -108,9 +108,8 @@ public: // Adds one widget in the chat bar. Used to add e.g. new buttons. The widget should be // small enough in size. void addChatBarWidget(QWidget *w) ; - - - void addVOIPBarWidget(QWidget *w); + void addTitleBarWidget(QWidget *w); + void hideChatText(bool hidden); RSButtonOnText* getNewButtonOnTextBrowser(); RSButtonOnText* getNewButtonOnTextBrowser(QString text); diff --git a/retroshare-gui/src/gui/chat/ChatWidget.ui b/retroshare-gui/src/gui/chat/ChatWidget.ui index 02b3f9afc..4fe128b8d 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.ui +++ b/retroshare-gui/src/gui/chat/ChatWidget.ui @@ -17,13 +17,522 @@ 0 - - + + + + 2 + + + + + + 20 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 178 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 178 + + + + + + + + + 255 + 255 + 178 + + + + + + + 255 + 255 + 178 + + + + + + + + true + + + QFrame::Box + + + + 6 + + + + + + 16 + 16 + + + + + + + :/images/info16.png + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + TextLabel + + + + + + + + 16 + 16 + + + + Qt::NoFocus + + + Close + + + QToolButton +{ + border-image: url(:/images/closenormal.png) +} + +QToolButton:hover +{ +border-image: url(:/images/closehover.png) +} + +QToolButton:pressed { +border-image: url(:/images/closepressed.png) +} + + + true + + + + + + + + + + Qt::Vertical + + + 2 + + + false + + + + + 0 + 0 + + + + + 0 + 30 + + + + Qt::CustomContextMenu + + + + + + 0 + + + + + + + + 18 + 18 + + + + + 18 + 18 + + + + T + + + Qt::AlignCenter + + + + + + + + 400 + 18 + + + + 0 + + + 3 + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + Type a message here + + + + + + + + + + + QFrame::Box + + + QFrame::Sunken + + + + 2 + + + + + + 0 + 0 + + + + + 28 + 28 + + + + + 28 + 28 + + + + Qt::NoFocus + + + + :/images/emoticons/kopete/kopete020.png:/images/emoticons/kopete/kopete020.png + + + + 24 + 24 + + + + true + + + + + + + + 32 + 28 + + + + + 32 + 28 + + + + Qt::TabFocus + + + Set text font & color + + + + :/images/textedit/format-text-color.png:/images/textedit/format-text-color.png + + + + 24 + 24 + + + + QToolButton::InstantPopup + + + true + + + + + + + + 28 + 28 + + + + + 28 + 28 + + + + Qt::NoFocus + + + Attach a Picture + + + + :/images/add_image24.png:/images/add_image24.png + + + + 24 + 24 + + + + true + + + + + + + + 28 + 28 + + + + Qt::NoFocus + + + Attach a File + + + + :/images/attach.png:/images/attach.png + + + + 24 + 24 + + + + true + + + + + + + + 28 + 28 + + + + + 28 + 28 + + + + Qt::NoFocus + + + + :/images/configure.png:/images/configure.png + + + + 24 + 24 + + + + QToolButton::InstantPopup + + + true + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 2 + + + + + + + + Qt::Horizontal + + + + 190 + 25 + + + + + + + + Send + + + + + + + + + + true + + + + + + + + + + + + QLayout::SetMaximumSize + + + + 0 + 0 + + + + + 16777215 + 64 + + QFrame::Box @@ -103,6 +612,21 @@ + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 2 + + + + @@ -295,478 +819,6 @@ - - - - true - - - - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 178 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 178 - - - - - - - - - 255 - 255 - 178 - - - - - - - 255 - 255 - 178 - - - - - - - - true - - - QFrame::Box - - - - 6 - - - - - - 16 - 16 - - - - - - - :/images/info16.png - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - TextLabel - - - - - - - - 16 - 16 - - - - Qt::NoFocus - - - Close - - - QToolButton -{ - border-image: url(:/images/closenormal.png) -} - -QToolButton:hover -{ -border-image: url(:/images/closehover.png) -} - -QToolButton:pressed { -border-image: url(:/images/closepressed.png) -} - - - true - - - - - - - - - - Qt::Vertical - - - 2 - - - false - - - - - 0 - 0 - - - - - 0 - 30 - - - - Qt::CustomContextMenu - - - - - - 0 - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - 18 - 18 - - - - - 18 - 18 - - - - T - - - Qt::AlignCenter - - - - - - - 0 - - - 3 - - - - 400 - 18 - - - - - - - - - - - 0 - 0 - - - - - 0 - 30 - - - - Type a message here - - - - - - - - - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - - 0 - 0 - - - - - 28 - 28 - - - - - 28 - 28 - - - - Qt::NoFocus - - - - :/images/emoticons/kopete/kopete020.png:/images/emoticons/kopete/kopete020.png - - - - 24 - 24 - - - - true - - - - - - - - 32 - 28 - - - - - 32 - 28 - - - - Qt::TabFocus - - - Set text font & color - - - - :/images/textedit/format-text-color.png:/images/textedit/format-text-color.png - - - - 24 - 24 - - - - QToolButton::InstantPopup - - - true - - - - - - - - 28 - 28 - - - - - 28 - 28 - - - - Qt::NoFocus - - - Attach a Picture - - - - :/images/add_image24.png:/images/add_image24.png - - - - 24 - 24 - - - - true - - - - - - - - 28 - 28 - - - - Qt::NoFocus - - - Attach a File - - - - :/images/attach.png:/images/attach.png - - - - 24 - 24 - - - - true - - - - - - - - 28 - 28 - - - - - 28 - 28 - - - - Qt::NoFocus - - - - :/images/configure.png:/images/configure.png - - - - 24 - 24 - - - - QToolButton::InstantPopup - - - true - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 2 - - - - - - - - Qt::Horizontal - - - - 190 - 25 - - - - - - - - Send - - - - - - From 5d8972e82dc38a2b47d1e8ea05541489f4dad5ed Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 3 Oct 2015 02:11:52 +0200 Subject: [PATCH 2/4] Add real FullScreen Mode --- plugins/VOIP/gui/QVideoDevice.cpp | 2 +- plugins/VOIP/gui/VOIPChatWidgetHolder.cpp | 83 +++++++++++++++++++++-- plugins/VOIP/gui/VOIPChatWidgetHolder.h | 11 +++ 3 files changed, 90 insertions(+), 6 deletions(-) diff --git a/plugins/VOIP/gui/QVideoDevice.cpp b/plugins/VOIP/gui/QVideoDevice.cpp index 5a355e085..bcbcbf9c2 100644 --- a/plugins/VOIP/gui/QVideoDevice.cpp +++ b/plugins/VOIP/gui/QVideoDevice.cpp @@ -125,7 +125,7 @@ QVideoOutputDevice::QVideoOutputDevice(QWidget *parent) void QVideoOutputDevice::showFrameOff() { - setPixmap(QPixmap(":/images/video-icon-big.png").scaled(320,256,Qt::KeepAspectRatio,Qt::SmoothTransformation)) ; + setPixmap(QPixmap(":/images/video-icon-big.png").scaled(QSize(height()*4/3,height()),Qt::KeepAspectRatio,Qt::SmoothTransformation)) ; } void QVideoOutputDevice::showFrame(const QImage& img) diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp index f44752205..930a2900e 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp @@ -18,10 +18,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ -#include -#include #include #include +#include +#include #include #include "interface/rsVOIP.h" @@ -154,12 +154,45 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n connect(inputVideoDevice, SIGNAL(networkPacketReady()), this, SLOT(sendVideoData())); - echoVideoDevice->setMinimumSize(320,256) ; - outputVideoDevice->setMinimumSize(320,256) ; + echoVideoDevice->setMinimumSize(320,240) ;//4/3 + outputVideoDevice->setMinimumSize(320,240) ;//4/3 + + echoVideoDevice->showFrameOff(); + outputVideoDevice->showFrameOff(); echoVideoDevice->setStyleSheet("border: 4px solid #CCCCCC; border-radius: 4px;"); outputVideoDevice->setStyleSheet("border: 4px solid #CCCCCC; border-radius: 4px;"); + /// FULLSCREEN /// + fullScreenFrame = new QFrame(); + + outputVideoDeviceFS = new QVideoOutputDevice(fullScreenFrame); + outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size())); + outputVideoDeviceFS->showFrameOff(); + + hideChatTextToggleButtonFS = new QToolButton(fullScreenFrame); + hideChatTextToggleButtonFS->setMinimumSize(QSize(44,44)); + hideChatTextToggleButtonFS->setMaximumSize(QSize(44,44)); + hideChatTextToggleButtonFS->setText(QString()); + hideChatTextToggleButtonFS->setToolTip(tr("Hide Chat Text")); + hideChatTextToggleButtonFS->setIcon(icon4); + hideChatTextToggleButtonFS->setIconSize(QSize(42,42)); + hideChatTextToggleButtonFS->setAutoRaise(true); + hideChatTextToggleButtonFS->setCheckable(true); + hideChatTextToggleButtonFS->setEnabled(false); + connect(hideChatTextToggleButtonFS, SIGNAL(clicked()), this , SLOT(toggleHideChatTextFS())); + + echoVideoDeviceFS = new QVideoOutputDevice(fullScreenFrame); + echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240))); + echoVideoDeviceFS->showFrameOff(); + + fullScreenFrame->setParent(0); + fullScreenFrame->setWindowFlags( Qt::WindowStaysOnTopHint ); + fullScreenFrame->setFocusPolicy( Qt::StrongFocus ); + fullScreenFrame->setWindowState(Qt::WindowFullScreen); + fullScreenFrame->hide(); + fullScreenFrame->installEventFilter(this); + mChatWidget->addChatHorizontalWidget(videoWidget) ; inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ; @@ -180,6 +213,23 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder() it = buttonMapTakeVideo.erase(it); } } +bool VOIPChatWidgetHolder::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == fullScreenFrame) { + if (event->type() == QEvent::Close || event->type() == QEvent::MouseButtonDblClick) { + showChatText(); + } + if (event->type() == QEvent::Resize) { + outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size())); + outputVideoDeviceFS->showFrameOff(); + echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240))); + echoVideoDeviceFS->showFrameOff(); + } + + } + // pass the event on to the parent class + return QObject::eventFilter(obj, event); +} void VOIPChatWidgetHolder::toggleAudioListen() { @@ -273,6 +323,7 @@ void VOIPChatWidgetHolder::toggleVideoCapture() if (videoCaptureToggleButton->isChecked()) { hideChatTextToggleButton->setEnabled(true); + hideChatTextToggleButtonFS->setEnabled(true); //activate video input // videoWidget->show(); @@ -295,6 +346,8 @@ void VOIPChatWidgetHolder::toggleVideoCapture() { hideChatTextToggleButton->setEnabled(false); hideChatTextToggleButton->setChecked(false); + hideChatTextToggleButtonFS->setEnabled(false); + hideChatTextToggleButtonFS->setChecked(false); toggleHideChatText(); inputVideoDevice->stop() ; videoCaptureToggleButton->setToolTip(tr("Activate camera")); @@ -355,15 +408,35 @@ void VOIPChatWidgetHolder::addVideoData(const RsPeerId &peer_id, QByteArray* arr } } +void VOIPChatWidgetHolder::toggleHideChatTextFS() +{ + hideChatTextToggleButton->setChecked(hideChatTextToggleButtonFS->isChecked()); + toggleHideChatText(); +} + void VOIPChatWidgetHolder::toggleHideChatText() { if (hideChatTextToggleButton->isChecked()) { - mChatWidget->hideChatText(true); hideChatTextToggleButton->setToolTip(tr("Show Chat Text")); + inputVideoDevice->setEchoVideoTarget(echoVideoDeviceFS) ; + videoProcessor->setDisplayTarget(outputVideoDeviceFS) ; + fullScreenFrame->show(); } else { mChatWidget->hideChatText(false); hideChatTextToggleButton->setToolTip(tr("Hide Chat Text")); + inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ; + videoProcessor->setDisplayTarget(outputVideoDevice) ; + fullScreenFrame->hide(); } + hideChatTextToggleButtonFS->setChecked(hideChatTextToggleButton->isChecked()); + hideChatTextToggleButtonFS->setToolTip(fullScreenFrame->toolTip()); +} + +void VOIPChatWidgetHolder::showChatText() +{ + hideChatTextToggleButton->setChecked(false); + hideChatTextToggleButtonFS->setChecked(false); + toggleHideChatText(); } void VOIPChatWidgetHolder::botMouseEnter() diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.h b/plugins/VOIP/gui/VOIPChatWidgetHolder.h index d0dd82e61..f55cbea15 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.h +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.h @@ -63,11 +63,15 @@ private slots: void toggleAudioCapture(); void toggleVideoCapture(); void toggleHideChatText(); + void toggleHideChatTextFS(); + void showChatText(); void hangupCall() ; void botMouseEnter(); void botMouseLeave(); protected: + bool eventFilter(QObject *obj, QEvent *event); + // Audio input/output QAudioInput* inputAudioDevice; QAudioOutput* outputAudioDevice; @@ -80,6 +84,12 @@ protected: QVideoOutputDevice *echoVideoDevice; QVideoInputDevice *inputVideoDevice; + //For FullScreen Mode + QFrame *fullScreenFrame; + QVideoOutputDevice *outputVideoDeviceFS; + QVideoOutputDevice *echoVideoDeviceFS; + Qt::WindowFlags outputVideoDeviceFlags; + QWidget *videoWidget ; // pointer to call show/hide VideoProcessor *videoProcessor; @@ -89,6 +99,7 @@ protected: QToolButton *audioCaptureToggleButton ; QToolButton *videoCaptureToggleButton ; QToolButton *hideChatTextToggleButton ; + QToolButton *hideChatTextToggleButtonFS ; QToolButton *hangupButton ; typedef QMap button_map; From 2b1d39cea13b702d753fbfd9925b849dbfd9de65 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sun, 4 Oct 2015 14:12:20 +0200 Subject: [PATCH 3/4] Add HideChat Button. Change layout of video when text is hidden. Add toolbar in fullscreen. --- plugins/VOIP/gui/VOIPChatWidgetHolder.cpp | 377 +++++++++++++++------ plugins/VOIP/gui/VOIPChatWidgetHolder.h | 19 +- retroshare-gui/src/gui/chat/ChatWidget.cpp | 1 + 3 files changed, 283 insertions(+), 114 deletions(-) diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp index 930a2900e..480b09b10 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp @@ -45,97 +45,117 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *notify) : QObject(), ChatWidgetHolder(chatWidget), mVOIPNotify(notify) { - QIcon icon ; - icon.addPixmap(QPixmap(":/images/audio-volume-muted.png")) ; - icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Normal,QIcon::On) ; - icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Disabled,QIcon::On) ; - icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Active,QIcon::On) ; - icon.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Selected,QIcon::On) ; + QIcon iconaudioListenToggleButton ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-muted.png")) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Normal,QIcon::On) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Disabled,QIcon::On) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Active,QIcon::On) ; + iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Selected,QIcon::On) ; audioListenToggleButton = new QToolButton ; - audioListenToggleButton->setIcon(icon) ; + audioListenToggleButton->setIcon(iconaudioListenToggleButton) ; audioListenToggleButton->setIconSize(QSize(42,42)) ; - audioListenToggleButton->setAutoRaise(true) ; - audioListenToggleButton->setCheckable(true); audioListenToggleButton->setMinimumSize(QSize(44,44)) ; audioListenToggleButton->setMaximumSize(QSize(44,44)) ; + audioListenToggleButton->setCheckable(true); + audioListenToggleButton->setAutoRaise(true) ; audioListenToggleButton->setText(QString()) ; audioListenToggleButton->setToolTip(tr("Mute")); - QIcon icon2 ; - icon2.addPixmap(QPixmap(":/images/call-start.png")) ; - icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Normal,QIcon::On) ; - icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Disabled,QIcon::On) ; - icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Active,QIcon::On) ; - icon2.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Selected,QIcon::On) ; + QIcon iconaudioCaptureToggleButton ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-start.png")) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Normal,QIcon::On) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Disabled,QIcon::On) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Active,QIcon::On) ; + iconaudioCaptureToggleButton.addPixmap(QPixmap(":/images/call-hold.png"),QIcon::Selected,QIcon::On) ; audioCaptureToggleButton = new QToolButton ; + audioCaptureToggleButton->setIcon(iconaudioCaptureToggleButton) ; + audioCaptureToggleButton->setIconSize(QSize(42,42)) ; audioCaptureToggleButton->setMinimumSize(QSize(44,44)) ; audioCaptureToggleButton->setMaximumSize(QSize(44,44)) ; + audioCaptureToggleButton->setCheckable(true) ; + audioCaptureToggleButton->setAutoRaise(true) ; audioCaptureToggleButton->setText(QString()) ; audioCaptureToggleButton->setToolTip(tr("Start Call")); - audioCaptureToggleButton->setIcon(icon2) ; - audioCaptureToggleButton->setIconSize(QSize(42,42)) ; - audioCaptureToggleButton->setAutoRaise(true) ; - audioCaptureToggleButton->setCheckable(true) ; - + + QIcon iconvideoCaptureToggleButton ; + iconvideoCaptureToggleButton.addPixmap(QPixmap(":/images/video-icon-on.png")) ; + 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->setIcon(QIcon(":/images/call-stop.png")) ; hangupButton->setIconSize(QSize(42,42)) ; hangupButton->setMinimumSize(QSize(44,44)) ; hangupButton->setMaximumSize(QSize(44,44)) ; hangupButton->setCheckable(false) ; - hangupButton->setAutoRaise(true) ; + hangupButton->setAutoRaise(true) ; hangupButton->setText(QString()) ; hangupButton->setToolTip(tr("Hangup Call")); - hangupButton->hide(); + hangupButton->hide(); - QIcon icon3 ; - icon3.addPixmap(QPixmap(":/images/video-icon-on.png")) ; - icon3.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Normal,QIcon::On) ; - icon3.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Disabled,QIcon::On) ; - icon3.addPixmap(QPixmap(":/images/video-icon-off.png"),QIcon::Active,QIcon::On) ; - icon3.addPixmap(QPixmap(":/images/video-icon-off.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) ; + QIcon iconhideChatTextToggleButton ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/orange-bubble-64.png")) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Normal,QIcon::On) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Disabled,QIcon::On) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Active,QIcon::On) ; + iconhideChatTextToggleButton.addPixmap(QPixmap(":/images/white-bubble-64.png"),QIcon::Selected,QIcon::On) ; hideChatTextToggleButton = new QToolButton ; + hideChatTextToggleButton->setIcon(iconhideChatTextToggleButton) ; + hideChatTextToggleButton->setIconSize(QSize(42,42)) ; hideChatTextToggleButton->setMinimumSize(QSize(44,44)) ; hideChatTextToggleButton->setMaximumSize(QSize(44,44)) ; + hideChatTextToggleButton->setCheckable(true) ; + hideChatTextToggleButton->setAutoRaise(true) ; hideChatTextToggleButton->setText(QString()) ; hideChatTextToggleButton->setToolTip(tr("Hide Chat Text")); - hideChatTextToggleButton->setIcon(icon4) ; - hideChatTextToggleButton->setIconSize(QSize(42,42)) ; - hideChatTextToggleButton->setAutoRaise(true) ; - hideChatTextToggleButton->setCheckable(true) ; 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(audioCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioCapture())); - connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall())); connect(videoCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleVideoCapture())); + connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall())); connect(hideChatTextToggleButton, SIGNAL(clicked()), this , SLOT(toggleHideChatText())); + connect(fullscreenToggleButton, SIGNAL(clicked()), this , SLOT(toggleFullScreen())); mChatWidget->addTitleBarWidget(audioListenToggleButton) ; mChatWidget->addTitleBarWidget(audioCaptureToggleButton) ; - mChatWidget->addTitleBarWidget(hangupButton) ; mChatWidget->addTitleBarWidget(videoCaptureToggleButton) ; + mChatWidget->addTitleBarWidget(hangupButton) ; mChatWidget->addTitleBarWidget(hideChatTextToggleButton) ; + mChatWidget->addTitleBarWidget(fullscreenToggleButton) ; outputAudioProcessor = NULL ; outputAudioDevice = NULL ; @@ -170,17 +190,76 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size())); outputVideoDeviceFS->showFrameOff(); - hideChatTextToggleButtonFS = new QToolButton(fullScreenFrame); - hideChatTextToggleButtonFS->setMinimumSize(QSize(44,44)); - hideChatTextToggleButtonFS->setMaximumSize(QSize(44,44)); - hideChatTextToggleButtonFS->setText(QString()); - hideChatTextToggleButtonFS->setToolTip(tr("Hide Chat Text")); - hideChatTextToggleButtonFS->setIcon(icon4); - hideChatTextToggleButtonFS->setIconSize(QSize(42,42)); - hideChatTextToggleButtonFS->setAutoRaise(true); - hideChatTextToggleButtonFS->setCheckable(true); - hideChatTextToggleButtonFS->setEnabled(false); - connect(hideChatTextToggleButtonFS, SIGNAL(clicked()), this , SLOT(toggleHideChatTextFS())); + toolBarFS = new QFrame(fullScreenFrame); + QHBoxLayout *toolBarFSLayout = new QHBoxLayout(toolBarFS); + + audioListenToggleButtonFS = new QToolButton(fullScreenFrame) ; + audioListenToggleButtonFS->setIcon(iconaudioListenToggleButton) ; + audioListenToggleButtonFS->setIconSize(QSize(42,42)) ; + audioListenToggleButtonFS->setMinimumSize(QSize(44,44)) ; + audioListenToggleButtonFS->setMaximumSize(QSize(44,44)) ; + audioListenToggleButtonFS->setCheckable(true); + audioListenToggleButtonFS->setAutoRaise(true) ; + 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->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240))); @@ -213,17 +292,15 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder() it = buttonMapTakeVideo.erase(it); } } + bool VOIPChatWidgetHolder::eventFilter(QObject *obj, QEvent *event) { if (obj == fullScreenFrame) { if (event->type() == QEvent::Close || event->type() == QEvent::MouseButtonDblClick) { - showChatText(); + showNormalView(); } if (event->type() == QEvent::Resize) { - outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size())); - outputVideoDeviceFS->showFrameOff(); - echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240))); - echoVideoDeviceFS->showFrameOff(); + replaceFullscreenWidget(); } } @@ -231,6 +308,34 @@ bool VOIPChatWidgetHolder::eventFilter(QObject *obj, QEvent *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() { if (audioListenToggleButton->isChecked()) { @@ -242,25 +347,8 @@ void VOIPChatWidgetHolder::toggleAudioListen() outputAudioDevice->stop(); }*/ } -} - -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(); + audioListenToggleButtonFS->setChecked(audioListenToggleButton->isChecked()); + audioListenToggleButtonFS->setToolTip(audioListenToggleButton->toolTip()); } void VOIPChatWidgetHolder::startAudioCapture() @@ -269,13 +357,21 @@ void VOIPChatWidgetHolder::startAudioCapture() toggleAudioCapture(); } +void VOIPChatWidgetHolder::toggleAudioCaptureFS() +{ + audioCaptureToggleButton->setChecked(audioCaptureToggleButtonFS->isChecked()); + toggleAudioCapture(); +} + void VOIPChatWidgetHolder::toggleAudioCapture() { if (audioCaptureToggleButton->isChecked()) { //activate audio output audioListenToggleButton->setChecked(true); + audioListenToggleButtonFS->setChecked(true); audioCaptureToggleButton->setToolTip(tr("Hold Call")); hangupButton->show(); + hangupButtonFS->show(); //activate audio input if (!inputAudioProcessor) { @@ -307,9 +403,15 @@ void VOIPChatWidgetHolder::toggleAudioCapture() if (inputAudioDevice) { 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")); hangupButton->hide(); + hangupButtonFS->hide(); } + audioCaptureToggleButtonFS->setChecked(audioCaptureToggleButton->isChecked()); + audioCaptureToggleButtonFS->setToolTip(audioCaptureToggleButton->toolTip()); } void VOIPChatWidgetHolder::startVideoCapture() @@ -318,12 +420,21 @@ void VOIPChatWidgetHolder::startVideoCapture() toggleVideoCapture(); } +void VOIPChatWidgetHolder::toggleVideoCaptureFS() +{ + videoCaptureToggleButton->setChecked(videoCaptureToggleButtonFS->isChecked()); + toggleVideoCapture(); +} + void VOIPChatWidgetHolder::toggleVideoCapture() { if (videoCaptureToggleButton->isChecked()) { hideChatTextToggleButton->setEnabled(true); - hideChatTextToggleButtonFS->setEnabled(true); + fullscreenToggleButton->setEnabled(true); + fullscreenToggleButtonFS->setEnabled(true); + hangupButton->show(); + hangupButtonFS->show(); //activate video input // videoWidget->show(); @@ -346,9 +457,15 @@ void VOIPChatWidgetHolder::toggleVideoCapture() { hideChatTextToggleButton->setEnabled(false); hideChatTextToggleButton->setChecked(false); - hideChatTextToggleButtonFS->setEnabled(false); - hideChatTextToggleButtonFS->setChecked(false); toggleHideChatText(); + fullscreenToggleButton->setEnabled(false); + fullscreenToggleButton->setChecked(false); + fullscreenToggleButtonFS->setEnabled(false); + fullscreenToggleButtonFS->setChecked(false); + toggleFullScreen(); + hangupButton->hide(); + hangupButtonFS->hide(); + inputVideoDevice->stop() ; videoCaptureToggleButton->setToolTip(tr("Activate camera")); outputVideoDevice->showFrameOff(); @@ -358,6 +475,8 @@ void VOIPChatWidgetHolder::toggleVideoCapture() mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() , tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM); } + videoCaptureToggleButtonFS->setChecked(videoCaptureToggleButton->isChecked()); + videoCaptureToggleButtonFS->setToolTip(videoCaptureToggleButton->toolTip()); } 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() { + QBoxLayout *layout = static_cast(videoWidget->layout()); + if (hideChatTextToggleButton->isChecked()) { + mChatWidget->hideChatText(true); + if (layout) layout->setDirection(QBoxLayout::LeftToRight); 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) ; videoProcessor->setDisplayTarget(outputVideoDeviceFS) ; fullScreenFrame->show(); } else { mChatWidget->hideChatText(false); - hideChatTextToggleButton->setToolTip(tr("Hide Chat Text")); + fullscreenToggleButton->setToolTip(tr("Fullscreen mode")); inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ; videoProcessor->setDisplayTarget(outputVideoDevice) ; fullScreenFrame->hide(); } - hideChatTextToggleButtonFS->setChecked(hideChatTextToggleButton->isChecked()); - hideChatTextToggleButtonFS->setToolTip(fullScreenFrame->toolTip()); + fullscreenToggleButtonFS->setChecked(fullscreenToggleButton->isChecked()); + 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); - hideChatTextToggleButtonFS->setChecked(false); toggleHideChatText(); + fullscreenToggleButton->setChecked(false); + fullscreenToggleButtonFS->setChecked(false); + toggleFullScreen(); } void VOIPChatWidgetHolder::botMouseEnter() @@ -587,15 +740,17 @@ void VOIPChatWidgetHolder::sendAudioData() void VOIPChatWidgetHolder::updateStatus(int status) { - audioListenToggleButton->setEnabled(true); - audioCaptureToggleButton->setEnabled(true); - hangupButton->setEnabled(true); - - switch (status) { - case RS_STATUS_OFFLINE: - audioListenToggleButton->setEnabled(false); - audioCaptureToggleButton->setEnabled(false); - hangupButton->setEnabled(false); - break; - } + bool enabled = (status != RS_STATUS_OFFLINE); + + audioListenToggleButton->setEnabled(enabled); + audioListenToggleButtonFS->setEnabled(enabled); + audioCaptureToggleButton->setEnabled(enabled); + audioCaptureToggleButtonFS->setEnabled(enabled); + videoCaptureToggleButton->setEnabled(enabled); + videoCaptureToggleButtonFS->setEnabled(enabled); + hideChatTextToggleButton->setEnabled(videoCaptureToggleButton->isChecked() && enabled); + fullscreenToggleButton->setEnabled(videoCaptureToggleButton->isChecked() && enabled); + fullscreenToggleButtonFS->setEnabled(videoCaptureToggleButton->isChecked() && enabled); + hangupButton->setEnabled(enabled); + hangupButtonFS->setEnabled(enabled); } diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.h b/plugins/VOIP/gui/VOIPChatWidgetHolder.h index f55cbea15..ccea1167a 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.h +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.h @@ -60,15 +60,22 @@ public slots: private slots: void toggleAudioListen(); + void toggleAudioListenFS(); void toggleAudioCapture(); + void toggleAudioCaptureFS(); void toggleVideoCapture(); + void toggleVideoCaptureFS(); void toggleHideChatText(); - void toggleHideChatTextFS(); - void showChatText(); + void toggleFullScreen(); + void toggleFullScreenFS(); void hangupCall() ; void botMouseEnter(); void botMouseLeave(); +private: + void replaceFullscreenWidget(); + void showNormalView(); + protected: bool eventFilter(QObject *obj, QEvent *event); @@ -96,11 +103,17 @@ protected: // Additional buttons to the chat bar QToolButton *audioListenToggleButton ; + QToolButton *audioListenToggleButtonFS ; QToolButton *audioCaptureToggleButton ; + QToolButton *audioCaptureToggleButtonFS ; QToolButton *videoCaptureToggleButton ; + QToolButton *videoCaptureToggleButtonFS ; QToolButton *hideChatTextToggleButton ; - QToolButton *hideChatTextToggleButtonFS ; + QToolButton *fullscreenToggleButton ; + QToolButton *fullscreenToggleButtonFS ; QToolButton *hangupButton ; + QToolButton *hangupButtonFS ; + QFrame *toolBarFS; typedef QMap button_map; button_map buttonMapTakeVideo; diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 3aa2b5189..825ddfb31 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -231,6 +231,7 @@ void ChatWidget::addTitleBarWidget(QWidget *w) void ChatWidget::hideChatText(bool hidden) { ui->frame_ChatText->setHidden(hidden); ; + ui->searchframe->setVisible(ui->actionSearch_History->isChecked() && !hidden); ; } RSButtonOnText* ChatWidget::getNewButtonOnTextBrowser() From 05d95d3ffdc31f67a44e58eac30819185ac623d3 Mon Sep 17 00:00:00 2001 From: Phenom Date: Mon, 5 Oct 2015 21:04:20 +0200 Subject: [PATCH 4/4] Use QFontMetricsF to define Icon size. --- plugins/VOIP/gui/VOIPChatWidgetHolder.cpp | 88 +++++++++++++---------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp index 480b09b10..cb33a19fb 100644 --- a/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp +++ b/plugins/VOIP/gui/VOIPChatWidgetHolder.cpp @@ -45,6 +45,10 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *notify) : QObject(), ChatWidgetHolder(chatWidget), mVOIPNotify(notify) { + int S = QFontMetricsF(chatWidget->font()).height() ; + QSize iconSize = QSize(2*S,2*S); + QSize buttonSize = QSize(iconSize + QSize(2,2)); + QIcon iconaudioListenToggleButton ; iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-muted.png")) ; iconaudioListenToggleButton.addPixmap(QPixmap(":/images/audio-volume-high.png"),QIcon::Normal,QIcon::On) ; @@ -54,9 +58,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n audioListenToggleButton = new QToolButton ; audioListenToggleButton->setIcon(iconaudioListenToggleButton) ; - audioListenToggleButton->setIconSize(QSize(42,42)) ; - audioListenToggleButton->setMinimumSize(QSize(44,44)) ; - audioListenToggleButton->setMaximumSize(QSize(44,44)) ; + audioListenToggleButton->setIconSize(iconSize) ; + audioListenToggleButton->setMinimumSize(buttonSize) ; + audioListenToggleButton->setMaximumSize(buttonSize) ; audioListenToggleButton->setCheckable(true); audioListenToggleButton->setAutoRaise(true) ; audioListenToggleButton->setText(QString()) ; @@ -71,9 +75,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n audioCaptureToggleButton = new QToolButton ; audioCaptureToggleButton->setIcon(iconaudioCaptureToggleButton) ; - audioCaptureToggleButton->setIconSize(QSize(42,42)) ; - audioCaptureToggleButton->setMinimumSize(QSize(44,44)) ; - audioCaptureToggleButton->setMaximumSize(QSize(44,44)) ; + audioCaptureToggleButton->setIconSize(iconSize) ; + audioCaptureToggleButton->setMinimumSize(buttonSize) ; + audioCaptureToggleButton->setMaximumSize(buttonSize) ; audioCaptureToggleButton->setCheckable(true) ; audioCaptureToggleButton->setAutoRaise(true) ; audioCaptureToggleButton->setText(QString()) ; @@ -88,9 +92,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n videoCaptureToggleButton = new QToolButton ; videoCaptureToggleButton->setIcon(iconvideoCaptureToggleButton) ; - videoCaptureToggleButton->setIconSize(QSize(42,42)) ; - videoCaptureToggleButton->setMinimumSize(QSize(44,44)) ; - videoCaptureToggleButton->setMaximumSize(QSize(44,44)) ; + videoCaptureToggleButton->setIconSize(iconSize) ; + videoCaptureToggleButton->setMinimumSize(buttonSize) ; + videoCaptureToggleButton->setMaximumSize(buttonSize) ; videoCaptureToggleButton->setCheckable(true) ; videoCaptureToggleButton->setAutoRaise(true) ; videoCaptureToggleButton->setText(QString()) ; @@ -98,9 +102,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n hangupButton = new QToolButton ; hangupButton->setIcon(QIcon(":/images/call-stop.png")) ; - hangupButton->setIconSize(QSize(42,42)) ; - hangupButton->setMinimumSize(QSize(44,44)) ; - hangupButton->setMaximumSize(QSize(44,44)) ; + hangupButton->setIconSize(iconSize) ; + hangupButton->setMinimumSize(buttonSize) ; + hangupButton->setMaximumSize(buttonSize) ; hangupButton->setCheckable(false) ; hangupButton->setAutoRaise(true) ; hangupButton->setText(QString()) ; @@ -116,9 +120,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n hideChatTextToggleButton = new QToolButton ; hideChatTextToggleButton->setIcon(iconhideChatTextToggleButton) ; - hideChatTextToggleButton->setIconSize(QSize(42,42)) ; - hideChatTextToggleButton->setMinimumSize(QSize(44,44)) ; - hideChatTextToggleButton->setMaximumSize(QSize(44,44)) ; + hideChatTextToggleButton->setIconSize(iconSize) ; + hideChatTextToggleButton->setMinimumSize(buttonSize) ; + hideChatTextToggleButton->setMaximumSize(buttonSize) ; hideChatTextToggleButton->setCheckable(true) ; hideChatTextToggleButton->setAutoRaise(true) ; hideChatTextToggleButton->setText(QString()) ; @@ -134,9 +138,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n fullscreenToggleButton = new QToolButton ; fullscreenToggleButton->setIcon(iconfullscreenToggleButton) ; - fullscreenToggleButton->setIconSize(QSize(42,42)) ; - fullscreenToggleButton->setMinimumSize(QSize(44,44)) ; - fullscreenToggleButton->setMaximumSize(QSize(44,44)) ; + fullscreenToggleButton->setIconSize(iconSize) ; + fullscreenToggleButton->setMinimumSize(buttonSize) ; + fullscreenToggleButton->setMaximumSize(buttonSize) ; fullscreenToggleButton->setCheckable(true) ; fullscreenToggleButton->setAutoRaise(true) ; fullscreenToggleButton->setText(QString()) ; @@ -190,14 +194,18 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n outputVideoDeviceFS->setGeometry(QRect(QPoint(0,0),fullScreenFrame->geometry().size())); outputVideoDeviceFS->showFrameOff(); + echoVideoDeviceFS = new QVideoOutputDevice(fullScreenFrame); + echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240))); + echoVideoDeviceFS->showFrameOff(); + toolBarFS = new QFrame(fullScreenFrame); QHBoxLayout *toolBarFSLayout = new QHBoxLayout(toolBarFS); audioListenToggleButtonFS = new QToolButton(fullScreenFrame) ; audioListenToggleButtonFS->setIcon(iconaudioListenToggleButton) ; - audioListenToggleButtonFS->setIconSize(QSize(42,42)) ; - audioListenToggleButtonFS->setMinimumSize(QSize(44,44)) ; - audioListenToggleButtonFS->setMaximumSize(QSize(44,44)) ; + audioListenToggleButtonFS->setIconSize(iconSize*2) ; + audioListenToggleButtonFS->setMinimumSize(buttonSize*2) ; + audioListenToggleButtonFS->setMaximumSize(buttonSize*2) ; audioListenToggleButtonFS->setCheckable(true); audioListenToggleButtonFS->setAutoRaise(true) ; audioListenToggleButtonFS->setText(QString()) ; @@ -205,9 +213,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n audioCaptureToggleButtonFS = new QToolButton(fullScreenFrame) ; audioCaptureToggleButtonFS->setIcon(iconaudioCaptureToggleButton) ; - audioCaptureToggleButtonFS->setIconSize(QSize(42,42)) ; - audioCaptureToggleButtonFS->setMinimumSize(QSize(44,44)) ; - audioCaptureToggleButtonFS->setMaximumSize(QSize(44,44)) ; + audioCaptureToggleButtonFS->setIconSize(iconSize*2) ; + audioCaptureToggleButtonFS->setMinimumSize(buttonSize*2) ; + audioCaptureToggleButtonFS->setMaximumSize(buttonSize*2) ; audioCaptureToggleButtonFS->setCheckable(true) ; audioCaptureToggleButtonFS->setAutoRaise(true) ; audioCaptureToggleButtonFS->setText(QString()) ; @@ -215,9 +223,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n videoCaptureToggleButtonFS = new QToolButton(fullScreenFrame) ; videoCaptureToggleButtonFS->setIcon(iconvideoCaptureToggleButton) ; - videoCaptureToggleButtonFS->setIconSize(QSize(42,42)) ; - videoCaptureToggleButtonFS->setMinimumSize(QSize(44,44)) ; - videoCaptureToggleButtonFS->setMaximumSize(QSize(44,44)) ; + videoCaptureToggleButtonFS->setIconSize(iconSize*2) ; + videoCaptureToggleButtonFS->setMinimumSize(buttonSize*2) ; + videoCaptureToggleButtonFS->setMaximumSize(buttonSize*2) ; videoCaptureToggleButtonFS->setCheckable(true) ; videoCaptureToggleButtonFS->setAutoRaise(true) ; videoCaptureToggleButtonFS->setText(QString()) ; @@ -225,9 +233,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n 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->setIconSize(iconSize*2) ; + hangupButtonFS->setMinimumSize(buttonSize*2) ; + hangupButtonFS->setMaximumSize(buttonSize*2) ; hangupButtonFS->setCheckable(false) ; hangupButtonFS->setAutoRaise(true) ; hangupButtonFS->setText(QString()) ; @@ -236,9 +244,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n fullscreenToggleButtonFS = new QToolButton(fullScreenFrame); fullscreenToggleButtonFS->setIcon(iconfullscreenToggleButton); - fullscreenToggleButtonFS->setIconSize(QSize(42,42)); - fullscreenToggleButtonFS->setMinimumSize(QSize(44,44)); - fullscreenToggleButtonFS->setMaximumSize(QSize(44,44)); + fullscreenToggleButtonFS->setIconSize(iconSize*2); + fullscreenToggleButtonFS->setMinimumSize(buttonSize*2); + fullscreenToggleButtonFS->setMaximumSize(buttonSize*2); fullscreenToggleButtonFS->setCheckable(true); fullscreenToggleButtonFS->setAutoRaise(true); fullscreenToggleButtonFS->setText(QString()); @@ -261,13 +269,9 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n toolBarFSLayout->addWidget(fullscreenToggleButtonFS); toolBarFS->setLayout(toolBarFSLayout); - echoVideoDeviceFS = new QVideoOutputDevice(fullScreenFrame); - echoVideoDeviceFS->setGeometry(QRect(QPoint(fullScreenFrame->width(), fullScreenFrame->height()) - QPoint(320,240), QSize(320,240))); - echoVideoDeviceFS->showFrameOff(); - fullScreenFrame->setParent(0); - fullScreenFrame->setWindowFlags( Qt::WindowStaysOnTopHint ); - fullScreenFrame->setFocusPolicy( Qt::StrongFocus ); + fullScreenFrame->setWindowFlags(Qt::WindowStaysOnTopHint); + fullScreenFrame->setFocusPolicy(Qt::StrongFocus); fullScreenFrame->setWindowState(Qt::WindowFullScreen); fullScreenFrame->hide(); fullScreenFrame->installEventFilter(this); @@ -570,6 +574,12 @@ void VOIPChatWidgetHolder::toggleFullScreen() void VOIPChatWidgetHolder::replaceFullscreenWidget() { + if (QSize(toolBarFS->geometry().size() - fullScreenFrame->geometry().size()).isValid()){ + QRect fsRect = fullScreenFrame->geometry(); + fsRect.setSize(toolBarFS->geometry().size()); + fullScreenFrame->setGeometry(fsRect); + } + 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