2015-05-11 15:40:07 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
2015-10-10 09:21:59 -04:00
|
|
|
//Qt
|
2014-07-13 09:57:25 -04:00
|
|
|
#include <QObject>
|
|
|
|
#include <QGraphicsEffect>
|
2015-10-10 09:21:59 -04:00
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QTimer>
|
|
|
|
//VOIP
|
|
|
|
#include "gui/VOIPNotify.h"
|
2014-07-13 09:57:25 -04:00
|
|
|
#include <gui/SpeexProcessor.h>
|
2015-10-10 09:21:59 -04:00
|
|
|
#include "services/rsVOIPItems.h"
|
|
|
|
//retroshare-gui
|
2014-07-13 09:57:25 -04:00
|
|
|
#include <gui/chat/ChatWidget.h>
|
2015-05-11 15:40:07 -04:00
|
|
|
#include <gui/common/RsButtonOnText.h>
|
2014-07-13 09:57:25 -04:00
|
|
|
|
|
|
|
class QToolButton;
|
|
|
|
class QAudioInput;
|
|
|
|
class QAudioOutput;
|
|
|
|
class QVideoInputDevice ;
|
|
|
|
class QVideoOutputDevice ;
|
2015-08-14 16:44:20 -04:00
|
|
|
class VideoProcessor ;
|
2014-07-13 09:57:25 -04:00
|
|
|
|
2015-10-12 12:25:03 -04:00
|
|
|
#define VOIP_SOUND_INCOMING_AUDIO_CALL "VOIP_incoming_audio_call"
|
|
|
|
#define VOIP_SOUND_INCOMING_VIDEO_CALL "VOIP_incoming_video_call"
|
|
|
|
#define VOIP_SOUND_OUTGOING_AUDIO_CALL "VOIP_outgoing_audio_call"
|
|
|
|
#define VOIP_SOUND_OUTGOING_VIDEO_CALL "VOIP_outgoing_video_call"
|
2014-07-13 09:57:25 -04:00
|
|
|
|
|
|
|
class VOIPChatWidgetHolder : public QObject, public ChatWidgetHolder
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-05-26 11:19:57 -04:00
|
|
|
VOIPChatWidgetHolder(ChatWidget *chatWidget, VOIPNotify *notify);
|
2014-07-13 09:57:25 -04:00
|
|
|
virtual ~VOIPChatWidgetHolder();
|
|
|
|
|
|
|
|
virtual void updateStatus(int status);
|
|
|
|
|
2015-05-26 11:19:57 -04:00
|
|
|
void addAudioData(const RsPeerId &peer_id, QByteArray* array) ;
|
|
|
|
void addVideoData(const RsPeerId &peer_id, QByteArray* array) ;
|
|
|
|
void setAcceptedBandwidth(uint32_t bytes_per_sec) ;
|
|
|
|
|
2015-10-10 09:21:59 -04:00
|
|
|
void ReceivedInvitation(const RsPeerId &peer_id, int flags) ;
|
|
|
|
void ReceivedVoipHangUp(const RsPeerId &peer_id, int flags) ;
|
|
|
|
void ReceivedVoipAccept(const RsPeerId &peer_id, int flags) ;
|
|
|
|
|
2015-05-26 11:19:57 -04:00
|
|
|
public slots:
|
|
|
|
void sendAudioData();
|
|
|
|
void sendVideoData();
|
|
|
|
void startAudioCapture();
|
|
|
|
void startVideoCapture();
|
2014-07-13 09:57:25 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void toggleAudioListen();
|
2015-10-04 08:12:20 -04:00
|
|
|
void toggleAudioListenFS();
|
2014-07-13 09:57:25 -04:00
|
|
|
void toggleAudioCapture();
|
2015-10-04 08:12:20 -04:00
|
|
|
void toggleAudioCaptureFS();
|
2014-07-13 09:57:25 -04:00
|
|
|
void toggleVideoCapture();
|
2015-10-04 08:12:20 -04:00
|
|
|
void toggleVideoCaptureFS();
|
2015-10-01 17:41:34 -04:00
|
|
|
void toggleHideChatText();
|
2015-10-04 08:12:20 -04:00
|
|
|
void toggleFullScreen();
|
|
|
|
void toggleFullScreenFS();
|
2014-07-13 09:57:25 -04:00
|
|
|
void hangupCall() ;
|
2015-10-10 09:21:59 -04:00
|
|
|
void hangupCallAudio() ;
|
|
|
|
void hangupCallVideo() ;
|
|
|
|
void botMouseEnterTake();
|
|
|
|
void botMouseLeaveTake();
|
|
|
|
void botMouseEnterDecline();
|
|
|
|
void botMouseLeaveDecline();
|
|
|
|
void timerAudioRingTimeOut();
|
|
|
|
void timerVideoRingTimeOut();
|
2014-07-13 09:57:25 -04:00
|
|
|
|
2015-10-04 08:12:20 -04:00
|
|
|
private:
|
2015-10-10 09:21:59 -04:00
|
|
|
void deleteButtonMap(int flags = RS_VOIP_FLAGS_AUDIO_DATA | RS_VOIP_FLAGS_VIDEO_DATA);
|
|
|
|
void addNewVideoButtonMap(const RsPeerId &peer_id);
|
|
|
|
void addNewAudioButtonMap(const RsPeerId &peer_id);
|
2015-10-04 08:12:20 -04:00
|
|
|
void replaceFullscreenWidget();
|
|
|
|
void showNormalView();
|
|
|
|
|
2014-07-13 09:57:25 -04:00
|
|
|
protected:
|
2015-10-02 20:11:52 -04:00
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
|
2014-07-13 09:57:25 -04:00
|
|
|
// Audio input/output
|
|
|
|
QAudioInput* inputAudioDevice;
|
|
|
|
QAudioOutput* outputAudioDevice;
|
|
|
|
|
|
|
|
QtSpeex::SpeexInputProcessor* inputAudioProcessor;
|
|
|
|
QtSpeex::SpeexOutputProcessor* outputAudioProcessor;
|
|
|
|
|
|
|
|
// Video input/output
|
|
|
|
QVideoOutputDevice *outputVideoDevice;
|
|
|
|
QVideoOutputDevice *echoVideoDevice;
|
|
|
|
QVideoInputDevice *inputVideoDevice;
|
|
|
|
|
2015-10-02 20:11:52 -04:00
|
|
|
//For FullScreen Mode
|
|
|
|
QFrame *fullScreenFrame;
|
|
|
|
QVideoOutputDevice *outputVideoDeviceFS;
|
|
|
|
QVideoOutputDevice *echoVideoDeviceFS;
|
|
|
|
Qt::WindowFlags outputVideoDeviceFlags;
|
|
|
|
|
2014-07-13 09:57:25 -04:00
|
|
|
QWidget *videoWidget ; // pointer to call show/hide
|
|
|
|
|
2015-08-14 16:44:20 -04:00
|
|
|
VideoProcessor *videoProcessor;
|
2014-07-13 09:57:25 -04:00
|
|
|
|
|
|
|
// Additional buttons to the chat bar
|
|
|
|
QToolButton *audioListenToggleButton ;
|
2015-10-04 08:12:20 -04:00
|
|
|
QToolButton *audioListenToggleButtonFS ;
|
2014-07-13 09:57:25 -04:00
|
|
|
QToolButton *audioCaptureToggleButton ;
|
2015-10-04 08:12:20 -04:00
|
|
|
QToolButton *audioCaptureToggleButtonFS ;
|
2014-07-13 09:57:25 -04:00
|
|
|
QToolButton *videoCaptureToggleButton ;
|
2015-10-04 08:12:20 -04:00
|
|
|
QToolButton *videoCaptureToggleButtonFS ;
|
2015-10-01 17:41:34 -04:00
|
|
|
QToolButton *hideChatTextToggleButton ;
|
2015-10-04 08:12:20 -04:00
|
|
|
QToolButton *fullscreenToggleButton ;
|
|
|
|
QToolButton *fullscreenToggleButtonFS ;
|
2014-07-13 09:57:25 -04:00
|
|
|
QToolButton *hangupButton ;
|
2015-10-04 08:12:20 -04:00
|
|
|
QToolButton *hangupButtonFS ;
|
|
|
|
QFrame *toolBarFS;
|
2015-05-11 15:40:07 -04:00
|
|
|
|
2015-10-10 09:21:59 -04:00
|
|
|
typedef QMap<QString, QPair<RSButtonOnText*, RSButtonOnText*> > button_map;
|
|
|
|
button_map buttonMapTakeCall;
|
|
|
|
|
|
|
|
//Waiting for peer accept
|
|
|
|
QProgressBar *pbAudioRing;
|
|
|
|
QProgressBar *pbVideoRing;
|
|
|
|
QTimer *timerAudioRing;
|
|
|
|
QTimer *timerVideoRing;
|
|
|
|
int sendAudioRingTime; //(-2 connected, -1 reseted, >=0 in progress)
|
|
|
|
int sendVideoRingTime; //(-2 connected, -1 reseted, >=0 in progress)
|
|
|
|
int recAudioRingTime; //(-2 connected, -1 reseted, >=0 in progress)
|
|
|
|
int recVideoRingTime; //(-2 connected, -1 reseted, >=0 in progress)
|
2015-05-26 11:19:57 -04:00
|
|
|
|
2015-10-12 12:25:03 -04:00
|
|
|
//TODO, remove this when soundManager can manage multi events.
|
|
|
|
int lastTimePlayOccurs;
|
|
|
|
|
2015-05-26 11:19:57 -04:00
|
|
|
VOIPNotify *mVOIPNotify;
|
2014-07-13 09:57:25 -04:00
|
|
|
};
|
|
|
|
|