|
|
|
@ -68,7 +68,8 @@ ChatForm::ChatForm(Friend* chatFriend)
@@ -68,7 +68,8 @@ ChatForm::ChatForm(Friend* chatFriend)
|
|
|
|
|
mainLayout->insertWidget(1, isTypingLabel); |
|
|
|
|
|
|
|
|
|
netcam = new NetCamView(); |
|
|
|
|
timer = nullptr; |
|
|
|
|
callDurationTimer = nullptr; |
|
|
|
|
disableCallButtonsTimer = nullptr; |
|
|
|
|
|
|
|
|
|
headTextLayout->addWidget(statusMessageLabel); |
|
|
|
|
headTextLayout->addStretch(); |
|
|
|
@ -279,9 +280,7 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
@@ -279,9 +280,7 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
|
|
|
|
|
connect(callConfirm, &CallConfirmWidget::rejected, this, &ChatForm::onRejectCallTriggered); |
|
|
|
|
|
|
|
|
|
callButton->setObjectName("grey"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("yellow"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(videoButton, &QPushButton::clicked, this, &ChatForm::onAnswerCallTriggered); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -293,11 +292,11 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
@@ -293,11 +292,11 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
|
|
|
|
|
connect(callConfirm, &CallConfirmWidget::rejected, this, &ChatForm::onRejectCallTriggered); |
|
|
|
|
|
|
|
|
|
callButton->setObjectName("yellow"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("grey"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(callButton, &QPushButton::clicked, this, &ChatForm::onAnswerCallTriggered); |
|
|
|
|
} |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
|
|
|
|
|
addSystemInfoMessage(tr("%1 is calling").arg(f->getDisplayedName()), "white", QDateTime::currentDateTime()); |
|
|
|
|
|
|
|
|
@ -326,21 +325,21 @@ void ChatForm::onAvStart(int FriendId, int CallId, bool video)
@@ -326,21 +325,21 @@ void ChatForm::onAvStart(int FriendId, int CallId, bool video)
|
|
|
|
|
if (video) |
|
|
|
|
{ |
|
|
|
|
callButton->setObjectName("grey"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("red"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onHangupCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onHangupCallTriggered())); |
|
|
|
|
|
|
|
|
|
netcam->show(Core::getInstance()->getVideoSourceFromCall(CallId), f->getDisplayedName()); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
callButton->setObjectName("red"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("grey"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onHangupCallTriggered())); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onHangupCallTriggered())); |
|
|
|
|
} |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
|
|
|
|
|
startCounter(); |
|
|
|
|
} |
|
|
|
@ -357,20 +356,7 @@ void ChatForm::onAvCancel(int FriendId, int)
@@ -357,20 +356,7 @@ void ChatForm::onAvCancel(int FriendId, int)
|
|
|
|
|
|
|
|
|
|
stopCounter(); |
|
|
|
|
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
callButton->setObjectName("green"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("green"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
netcam->hide(); |
|
|
|
|
|
|
|
|
@ -387,21 +373,8 @@ void ChatForm::onAvEnd(int FriendId, int)
@@ -387,21 +373,8 @@ void ChatForm::onAvEnd(int FriendId, int)
|
|
|
|
|
delete callConfirm; |
|
|
|
|
callConfirm = nullptr; |
|
|
|
|
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
callButton->setObjectName("green"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("green"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
|
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
netcam->hide(); |
|
|
|
|
|
|
|
|
|
stopCounter(); |
|
|
|
@ -423,7 +396,8 @@ void ChatForm::onAvRinging(int FriendId, int CallId, bool video)
@@ -423,7 +396,8 @@ void ChatForm::onAvRinging(int FriendId, int CallId, bool video)
|
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("yellow"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onCancelCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onCancelCallTriggered())); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -431,7 +405,8 @@ void ChatForm::onAvRinging(int FriendId, int CallId, bool video)
@@ -431,7 +405,8 @@ void ChatForm::onAvRinging(int FriendId, int CallId, bool video)
|
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
videoButton->setObjectName("grey"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCancelCallTriggered())); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onCancelCallTriggered())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
addSystemInfoMessage(tr("Calling to %1").arg(f->getDisplayedName()), "white", QDateTime::currentDateTime()); |
|
|
|
@ -478,22 +453,7 @@ void ChatForm::onAvEnding(int FriendId, int)
@@ -478,22 +453,7 @@ void ChatForm::onAvEnding(int FriendId, int)
|
|
|
|
|
delete callConfirm; |
|
|
|
|
callConfirm = nullptr; |
|
|
|
|
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
callButton->setObjectName("green"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->setObjectName("green"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
netcam->hide(); |
|
|
|
|
|
|
|
|
@ -510,23 +470,8 @@ void ChatForm::onAvRequestTimeout(int FriendId, int)
@@ -510,23 +470,8 @@ void ChatForm::onAvRequestTimeout(int FriendId, int)
|
|
|
|
|
delete callConfirm; |
|
|
|
|
callConfirm = nullptr; |
|
|
|
|
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
callButton->setObjectName("green"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->setObjectName("green"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
|
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
netcam->hide(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -539,23 +484,8 @@ void ChatForm::onAvPeerTimeout(int FriendId, int)
@@ -539,23 +484,8 @@ void ChatForm::onAvPeerTimeout(int FriendId, int)
|
|
|
|
|
|
|
|
|
|
delete callConfirm; |
|
|
|
|
callConfirm = nullptr; |
|
|
|
|
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
callButton->setObjectName("green"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->setObjectName("green"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
|
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
netcam->hide(); |
|
|
|
|
} |
|
|
|
@ -570,22 +500,7 @@ void ChatForm::onAvRejected(int FriendId, int)
@@ -570,22 +500,7 @@ void ChatForm::onAvRejected(int FriendId, int)
|
|
|
|
|
delete callConfirm; |
|
|
|
|
callConfirm = nullptr; |
|
|
|
|
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
callButton->setObjectName("green"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->setObjectName("green"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
addSystemInfoMessage(tr("Call rejected"), "white", QDateTime::currentDateTime()); |
|
|
|
|
|
|
|
|
@ -631,10 +546,8 @@ void ChatForm::onHangupCallTriggered()
@@ -631,10 +546,8 @@ void ChatForm::onHangupCallTriggered()
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
emit hangupCall(callId); |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
|
|
|
|
|
enableCallButtons(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::onRejectCallTriggered() |
|
|
|
@ -650,10 +563,9 @@ void ChatForm::onRejectCallTriggered()
@@ -650,10 +563,9 @@ void ChatForm::onRejectCallTriggered()
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
emit rejectCall(callId); |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
|
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::onCallTriggered() |
|
|
|
@ -688,37 +600,77 @@ void ChatForm::onAvCallFailed(int FriendId)
@@ -688,37 +600,77 @@ void ChatForm::onAvCallFailed(int FriendId)
|
|
|
|
|
delete callConfirm; |
|
|
|
|
callConfirm = nullptr; |
|
|
|
|
|
|
|
|
|
enableCallButtons(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::onCancelCallTriggered() |
|
|
|
|
{ |
|
|
|
|
qDebug() << "onCancelCallTriggered"; |
|
|
|
|
|
|
|
|
|
enableCallButtons(); |
|
|
|
|
|
|
|
|
|
netcam->hide(); |
|
|
|
|
emit cancelCall(callId, f->getFriendID()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::enableCallButtons() |
|
|
|
|
{ |
|
|
|
|
qDebug() << "enableCallButtons"; |
|
|
|
|
|
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
|
|
|
|
|
micButton->setObjectName("grey"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
micButton->disconnect(); |
|
|
|
|
volButton->setObjectName("grey"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
volButton->disconnect(); |
|
|
|
|
|
|
|
|
|
callButton->setObjectName("grey"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->setObjectName("grey"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
|
|
|
|
|
if(disableCallButtonsTimer == nullptr) |
|
|
|
|
{ |
|
|
|
|
disableCallButtonsTimer = new QTimer(); |
|
|
|
|
connect(disableCallButtonsTimer, SIGNAL(timeout()), |
|
|
|
|
this, SLOT(onEnableCallButtons())); |
|
|
|
|
disableCallButtonsTimer->start(1500); // 1.5sec
|
|
|
|
|
qDebug() << "timer started!!"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::onCancelCallTriggered() |
|
|
|
|
void ChatForm::onEnableCallButtons() |
|
|
|
|
{ |
|
|
|
|
qDebug() << "onCancelCallTriggered"; |
|
|
|
|
|
|
|
|
|
qDebug() << "onEnableCallButtons"; |
|
|
|
|
audioInputFlag = false; |
|
|
|
|
audioOutputFlag = false; |
|
|
|
|
micButton->setObjectName("green"); |
|
|
|
|
micButton->style()->polish(micButton); |
|
|
|
|
volButton->setObjectName("green"); |
|
|
|
|
volButton->style()->polish(volButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
callButton->setObjectName("green"); |
|
|
|
|
callButton->style()->polish(callButton); |
|
|
|
|
callButton->disconnect(); |
|
|
|
|
videoButton->setObjectName("green"); |
|
|
|
|
videoButton->style()->polish(videoButton); |
|
|
|
|
videoButton->disconnect(); |
|
|
|
|
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered())); |
|
|
|
|
|
|
|
|
|
netcam->hide(); |
|
|
|
|
emit cancelCall(callId, f->getFriendID()); |
|
|
|
|
|
|
|
|
|
connect(callButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onCallTriggered())); |
|
|
|
|
connect(videoButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onVideoCallTriggered())); |
|
|
|
|
connect(micButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onMicMuteToggle())); |
|
|
|
|
connect(volButton, SIGNAL(clicked()), |
|
|
|
|
this, SLOT(onVolMuteToggle())); |
|
|
|
|
|
|
|
|
|
disableCallButtonsTimer->stop(); |
|
|
|
|
delete disableCallButtonsTimer; |
|
|
|
|
disableCallButtonsTimer = nullptr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::onMicMuteToggle() |
|
|
|
@ -900,11 +852,11 @@ void ChatForm::onLoadHistory()
@@ -900,11 +852,11 @@ void ChatForm::onLoadHistory()
|
|
|
|
|
|
|
|
|
|
void ChatForm::startCounter() |
|
|
|
|
{ |
|
|
|
|
if (!timer) |
|
|
|
|
if (!callDurationTimer) |
|
|
|
|
{ |
|
|
|
|
timer = new QTimer(); |
|
|
|
|
connect(timer, SIGNAL(timeout()), this, SLOT(updateTime())); |
|
|
|
|
timer->start(1000); |
|
|
|
|
callDurationTimer = new QTimer(); |
|
|
|
|
connect(callDurationTimer, SIGNAL(timeout()), this, SLOT(onUpdateTime())); |
|
|
|
|
callDurationTimer->start(1000); |
|
|
|
|
timeElapsed.start(); |
|
|
|
|
callDuration->show(); |
|
|
|
|
} |
|
|
|
@ -912,20 +864,21 @@ void ChatForm::startCounter()
@@ -912,20 +864,21 @@ void ChatForm::startCounter()
|
|
|
|
|
|
|
|
|
|
void ChatForm::stopCounter() |
|
|
|
|
{ |
|
|
|
|
if (timer) |
|
|
|
|
if (callDurationTimer) |
|
|
|
|
{ |
|
|
|
|
addSystemInfoMessage(tr("Call with %1 ended. %2").arg(f->getDisplayedName(), |
|
|
|
|
secondsToDHMS(timeElapsed.elapsed()/1000)), |
|
|
|
|
"white", QDateTime::currentDateTime()); |
|
|
|
|
timer->stop(); |
|
|
|
|
callDurationTimer->stop(); |
|
|
|
|
callDuration->setText(""); |
|
|
|
|
callDuration->hide(); |
|
|
|
|
timer = nullptr; |
|
|
|
|
delete timer; |
|
|
|
|
|
|
|
|
|
delete callDurationTimer; |
|
|
|
|
callDurationTimer = nullptr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatForm::updateTime() |
|
|
|
|
void ChatForm::onUpdateTime() |
|
|
|
|
{ |
|
|
|
|
callDuration->setText(secondsToDHMS(timeElapsed.elapsed()/1000)); |
|
|
|
|
} |
|
|
|
|