예제 #1
0
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) ;

	audioListenToggleButton = new QToolButton ;
	audioListenToggleButton->setIcon(icon) ;
	audioListenToggleButton->setIconSize(QSize(42,42)) ;
	audioListenToggleButton->setAutoRaise(true) ;
	audioListenToggleButton->setCheckable(true);
	audioListenToggleButton->setMinimumSize(QSize(44,44)) ;
	audioListenToggleButton->setMaximumSize(QSize(44,44)) ;
	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) ;

	audioCaptureToggleButton = new QToolButton ;
	audioCaptureToggleButton->setMinimumSize(QSize(44,44)) ;
	audioCaptureToggleButton->setMaximumSize(QSize(44,44)) ;
	audioCaptureToggleButton->setText(QString()) ;
	audioCaptureToggleButton->setToolTip(tr("Start Call"));
	audioCaptureToggleButton->setIcon(icon2) ;
	audioCaptureToggleButton->setIconSize(QSize(42,42)) ;
	audioCaptureToggleButton->setAutoRaise(true) ;
	audioCaptureToggleButton->setCheckable(true) ;
	
	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->setText(QString()) ;
	hangupButton->setToolTip(tr("Hangup Call"));
	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) ;

	connect(videoCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleVideoCapture()));
	connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen()));
	connect(audioCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioCapture()));
	connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall()));

	mChatWidget->addVOIPBarWidget(audioListenToggleButton) ;
	mChatWidget->addVOIPBarWidget(audioCaptureToggleButton) ;
	mChatWidget->addVOIPBarWidget(hangupButton) ;
	mChatWidget->addVOIPBarWidget(videoCaptureToggleButton) ;

	outputAudioProcessor = NULL ;
	outputAudioDevice = NULL ;
	inputAudioProcessor = NULL ;
	inputAudioDevice = NULL ;

	inputVideoDevice = new QVideoInputDevice(mChatWidget) ; // not started yet ;-)
	inputVideoProcessor = new JPEGVideoEncoder ;
	outputVideoProcessor = new JPEGVideoDecoder ;

	// Make a widget with two video devices, one for echo, and one for the talking peer.
	videoWidget = new QWidget(mChatWidget) ;
	videoWidget->setLayout(new QVBoxLayout()) ;
	videoWidget->layout()->addWidget(outputVideoDevice = new QVideoOutputDevice(videoWidget)) ;
	videoWidget->layout()->addWidget(echoVideoDevice = new QVideoOutputDevice(videoWidget)) ;
	videoWidget->hide();

	connect(inputVideoDevice, SIGNAL(networkPacketReady()), this, SLOT(sendVideoData()));

	echoVideoDevice->setMinimumSize(320,256) ;
	outputVideoDevice->setMinimumSize(320,256) ;
	
	echoVideoDevice->setStyleSheet("border: 4px solid #CCCCCC; border-radius: 4px;");
	outputVideoDevice->setStyleSheet("border: 4px solid #CCCCCC; border-radius: 4px;");

	mChatWidget->addChatHorizontalWidget(videoWidget) ;

	inputVideoDevice->setEchoVideoTarget(echoVideoDevice) ;
	inputVideoDevice->setVideoEncoder(inputVideoProcessor) ;
	outputVideoProcessor->setDisplayTarget(outputVideoDevice) ;
}
예제 #2
0
AudioChatWidgetHolder::AudioChatWidgetHolder(ChatWidget *chatWidget)
	: QObject(), ChatWidgetHolder(chatWidget)
{
	audioListenToggleButton = new QToolButton ;
	audioListenToggleButton->setMinimumSize(QSize(28,28)) ;
	audioListenToggleButton->setMaximumSize(QSize(28,28)) ;
	audioListenToggleButton->setText(QString()) ;
	audioListenToggleButton->setToolTip(tr("Mute yourself"));

	std::cerr << "****** VOIPLugin: Creating new AudioChatWidgetHolder !!" << std::endl;

	QIcon icon ;
	icon.addPixmap(QPixmap(":/images/audio-volume-muted-22.png")) ;
	icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Normal,QIcon::On) ;
	icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Disabled,QIcon::On) ;
	icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Active,QIcon::On) ;
	icon.addPixmap(QPixmap(":/images/audio-volume-medium-22.png"),QIcon::Selected,QIcon::On) ;

	audioListenToggleButton->setIcon(icon) ;
	audioListenToggleButton->setIconSize(QSize(22,22)) ;
	audioListenToggleButton->setAutoRaise(true) ;
	audioListenToggleButton->setCheckable(true);

	audioMuteCaptureToggleButton = new QToolButton ;
	audioMuteCaptureToggleButton->setMinimumSize(QSize(28,28)) ;
	audioMuteCaptureToggleButton->setMaximumSize(QSize(28,28)) ;
	audioMuteCaptureToggleButton->setText(QString()) ;
	audioMuteCaptureToggleButton->setToolTip(tr("Start Call"));

	QIcon icon2 ;
	icon2.addPixmap(QPixmap(":/images/call-start-22.png")) ;
	icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Normal,QIcon::On) ;
	icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Disabled,QIcon::On) ;
	icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Active,QIcon::On) ;
	icon2.addPixmap(QPixmap(":/images/call-hold-22.png"),QIcon::Selected,QIcon::On) ;

	audioMuteCaptureToggleButton->setIcon(icon2) ;
	audioMuteCaptureToggleButton->setIconSize(QSize(22,22)) ;
	audioMuteCaptureToggleButton->setAutoRaise(true) ;
	audioMuteCaptureToggleButton->setCheckable(true) ;
	
	hangupButton = new QToolButton ;
	hangupButton->setIcon(QIcon(":/images/call-stop-22.png")) ;
	hangupButton->setIconSize(QSize(22,22)) ;
	hangupButton->setMinimumSize(QSize(28,28)) ;
	hangupButton->setMaximumSize(QSize(28,28)) ;
	hangupButton->setCheckable(false) ;
	hangupButton->setAutoRaise(true) ;		
	hangupButton->setText(QString()) ;
	hangupButton->setToolTip(tr("Hangup Call"));

	connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen()));
	connect(audioMuteCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioMuteCapture()));
	connect(hangupButton, SIGNAL(clicked()), this , SLOT(hangupCall()));

	mChatWidget->addChatBarWidget(audioListenToggleButton) ;
	mChatWidget->addChatBarWidget(audioMuteCaptureToggleButton) ;
	mChatWidget->addChatBarWidget(hangupButton) ;

	outputProcessor = NULL ;
	outputDevice = NULL ;
	inputProcessor = NULL ;
	inputDevice = NULL ;
}