mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Add real FullScreen Mode
This commit is contained in:
parent
8a7e359557
commit
5d8972e82d
@ -125,7 +125,7 @@ QVideoOutputDevice::QVideoOutputDevice(QWidget *parent)
|
|||||||
|
|
||||||
void QVideoOutputDevice::showFrameOff()
|
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)
|
void QVideoOutputDevice::showFrame(const QImage& img)
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
#include <QToolButton>
|
|
||||||
#include <QPropertyAnimation>
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
#include <gui/audiodevicehelper.h>
|
#include <gui/audiodevicehelper.h>
|
||||||
#include "interface/rsVOIP.h"
|
#include "interface/rsVOIP.h"
|
||||||
@ -154,12 +154,45 @@ VOIPChatWidgetHolder::VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *n
|
|||||||
|
|
||||||
connect(inputVideoDevice, SIGNAL(networkPacketReady()), this, SLOT(sendVideoData()));
|
connect(inputVideoDevice, SIGNAL(networkPacketReady()), this, SLOT(sendVideoData()));
|
||||||
|
|
||||||
echoVideoDevice->setMinimumSize(320,256) ;
|
echoVideoDevice->setMinimumSize(320,240) ;//4/3
|
||||||
outputVideoDevice->setMinimumSize(320,256) ;
|
outputVideoDevice->setMinimumSize(320,240) ;//4/3
|
||||||
|
|
||||||
|
echoVideoDevice->showFrameOff();
|
||||||
|
outputVideoDevice->showFrameOff();
|
||||||
|
|
||||||
echoVideoDevice->setStyleSheet("border: 4px solid #CCCCCC; border-radius: 4px;");
|
echoVideoDevice->setStyleSheet("border: 4px solid #CCCCCC; border-radius: 4px;");
|
||||||
outputVideoDevice->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) ;
|
mChatWidget->addChatHorizontalWidget(videoWidget) ;
|
||||||
|
|
||||||
inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ;
|
inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ;
|
||||||
@ -180,6 +213,23 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder()
|
|||||||
it = buttonMapTakeVideo.erase(it);
|
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()
|
void VOIPChatWidgetHolder::toggleAudioListen()
|
||||||
{
|
{
|
||||||
@ -273,6 +323,7 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
|
|||||||
if (videoCaptureToggleButton->isChecked())
|
if (videoCaptureToggleButton->isChecked())
|
||||||
{
|
{
|
||||||
hideChatTextToggleButton->setEnabled(true);
|
hideChatTextToggleButton->setEnabled(true);
|
||||||
|
hideChatTextToggleButtonFS->setEnabled(true);
|
||||||
//activate video input
|
//activate video input
|
||||||
//
|
//
|
||||||
videoWidget->show();
|
videoWidget->show();
|
||||||
@ -295,6 +346,8 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
|
|||||||
{
|
{
|
||||||
hideChatTextToggleButton->setEnabled(false);
|
hideChatTextToggleButton->setEnabled(false);
|
||||||
hideChatTextToggleButton->setChecked(false);
|
hideChatTextToggleButton->setChecked(false);
|
||||||
|
hideChatTextToggleButtonFS->setEnabled(false);
|
||||||
|
hideChatTextToggleButtonFS->setChecked(false);
|
||||||
toggleHideChatText();
|
toggleHideChatText();
|
||||||
inputVideoDevice->stop() ;
|
inputVideoDevice->stop() ;
|
||||||
videoCaptureToggleButton->setToolTip(tr("Activate camera"));
|
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()
|
void VOIPChatWidgetHolder::toggleHideChatText()
|
||||||
{
|
{
|
||||||
if (hideChatTextToggleButton->isChecked()) {
|
if (hideChatTextToggleButton->isChecked()) {
|
||||||
mChatWidget->hideChatText(true);
|
|
||||||
hideChatTextToggleButton->setToolTip(tr("Show Chat Text"));
|
hideChatTextToggleButton->setToolTip(tr("Show Chat Text"));
|
||||||
|
inputVideoDevice->setEchoVideoTarget(echoVideoDeviceFS) ;
|
||||||
|
videoProcessor->setDisplayTarget(outputVideoDeviceFS) ;
|
||||||
|
fullScreenFrame->show();
|
||||||
} else {
|
} else {
|
||||||
mChatWidget->hideChatText(false);
|
mChatWidget->hideChatText(false);
|
||||||
hideChatTextToggleButton->setToolTip(tr("Hide Chat Text"));
|
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()
|
void VOIPChatWidgetHolder::botMouseEnter()
|
||||||
|
@ -63,11 +63,15 @@ private slots:
|
|||||||
void toggleAudioCapture();
|
void toggleAudioCapture();
|
||||||
void toggleVideoCapture();
|
void toggleVideoCapture();
|
||||||
void toggleHideChatText();
|
void toggleHideChatText();
|
||||||
|
void toggleHideChatTextFS();
|
||||||
|
void showChatText();
|
||||||
void hangupCall() ;
|
void hangupCall() ;
|
||||||
void botMouseEnter();
|
void botMouseEnter();
|
||||||
void botMouseLeave();
|
void botMouseLeave();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
|
||||||
// Audio input/output
|
// Audio input/output
|
||||||
QAudioInput* inputAudioDevice;
|
QAudioInput* inputAudioDevice;
|
||||||
QAudioOutput* outputAudioDevice;
|
QAudioOutput* outputAudioDevice;
|
||||||
@ -80,6 +84,12 @@ protected:
|
|||||||
QVideoOutputDevice *echoVideoDevice;
|
QVideoOutputDevice *echoVideoDevice;
|
||||||
QVideoInputDevice *inputVideoDevice;
|
QVideoInputDevice *inputVideoDevice;
|
||||||
|
|
||||||
|
//For FullScreen Mode
|
||||||
|
QFrame *fullScreenFrame;
|
||||||
|
QVideoOutputDevice *outputVideoDeviceFS;
|
||||||
|
QVideoOutputDevice *echoVideoDeviceFS;
|
||||||
|
Qt::WindowFlags outputVideoDeviceFlags;
|
||||||
|
|
||||||
QWidget *videoWidget ; // pointer to call show/hide
|
QWidget *videoWidget ; // pointer to call show/hide
|
||||||
|
|
||||||
VideoProcessor *videoProcessor;
|
VideoProcessor *videoProcessor;
|
||||||
@ -89,6 +99,7 @@ protected:
|
|||||||
QToolButton *audioCaptureToggleButton ;
|
QToolButton *audioCaptureToggleButton ;
|
||||||
QToolButton *videoCaptureToggleButton ;
|
QToolButton *videoCaptureToggleButton ;
|
||||||
QToolButton *hideChatTextToggleButton ;
|
QToolButton *hideChatTextToggleButton ;
|
||||||
|
QToolButton *hideChatTextToggleButtonFS ;
|
||||||
QToolButton *hangupButton ;
|
QToolButton *hangupButton ;
|
||||||
|
|
||||||
typedef QMap<QString, RSButtonOnText*> button_map;
|
typedef QMap<QString, RSButtonOnText*> button_map;
|
||||||
|
Loading…
Reference in New Issue
Block a user