@ -58,7 +58,7 @@ ChatForm::ChatForm(Friend* chatFriend)
@@ -58,7 +58,7 @@ ChatForm::ChatForm(Friend* chatFriend)
statusMessageLabel - > setFont ( Style : : getFont ( Style : : Medium ) ) ;
statusMessageLabel - > setMinimumHeight ( Style : : getFont ( Style : : Medium ) . pixelSize ( ) ) ;
statusMessageLabel - > setTextFormat ( Qt : : PlainText ) ;
callConfirm = nullptr ;
offlineEngine = new OfflineMsgEngine ( f ) ;
@ -116,6 +116,8 @@ void ChatForm::onSendTriggered()
@@ -116,6 +116,8 @@ void ChatForm::onSendTriggered()
if ( msg . isEmpty ( ) )
return ;
msgEdit - > setLastMessage ( msg ) ; //set last message only when sending it
bool isAction = msg . startsWith ( " /me " ) ;
if ( isAction )
msg = msg = msg . right ( msg . length ( ) - 4 ) ;
@ -123,8 +125,6 @@ void ChatForm::onSendTriggered()
@@ -123,8 +125,6 @@ void ChatForm::onSendTriggered()
QList < CString > splittedMsg = Core : : splitMessage ( msg , TOX_MAX_MESSAGE_LENGTH ) ;
QDateTime timestamp = QDateTime : : currentDateTime ( ) ;
msgEdit - > setLastMessage ( msg ) ; //set last message only when sending it
bool status = ! Settings : : getInstance ( ) . getFauxOfflineMessaging ( ) ;
for ( CString & c_msg : splittedMsg )
@ -298,7 +298,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
@@ -298,7 +298,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
}
callButton - > style ( ) - > polish ( callButton ) ;
videoButton - > style ( ) - > polish ( videoButton ) ;
insertChatMessage ( ChatMessage : : createChatInfoMessage ( tr ( " %1 calling " ) . arg ( f - > getDisplayedName ( ) ) , ChatMessage : : INFO , QDateTime : : currentDateTime ( ) ) ) ;
Widget * w = Widget : : getInstance ( ) ;
@ -357,7 +357,7 @@ void ChatForm::onAvStart(uint32_t FriendId, int CallId, bool video)
@@ -357,7 +357,7 @@ void ChatForm::onAvStart(uint32_t FriendId, int CallId, bool video)
this , SLOT ( onMicMuteToggle ( ) ) ) ;
connect ( volButton , SIGNAL ( clicked ( ) ) ,
this , SLOT ( onVolMuteToggle ( ) ) ) ;
startCounter ( ) ;
}
@ -375,7 +375,7 @@ void ChatForm::onAvCancel(uint32_t FriendId, int)
@@ -375,7 +375,7 @@ void ChatForm::onAvCancel(uint32_t FriendId, int)
stopCounter ( ) ;
netcam - > hide ( ) ;
addSystemInfoMessage ( tr ( " %1 stopped calling " ) . arg ( f - > getDisplayedName ( ) ) , ChatMessage : : INFO , QDateTime : : currentDateTime ( ) ) ;
}
@ -395,7 +395,7 @@ void ChatForm::onAvEnd(uint32_t FriendId, int)
@@ -395,7 +395,7 @@ void ChatForm::onAvEnd(uint32_t FriendId, int)
}
void ChatForm : : onAvRinging ( uint32_t FriendId , int CallId , bool video )
{
{
if ( FriendId ! = f - > getFriendID ( ) )
return ;
@ -426,7 +426,7 @@ void ChatForm::onAvRinging(uint32_t FriendId, int CallId, bool video)
@@ -426,7 +426,7 @@ void ChatForm::onAvRinging(uint32_t FriendId, int CallId, bool video)
connect ( callButton , SIGNAL ( clicked ( ) ) ,
this , SLOT ( onCancelCallTriggered ( ) ) ) ;
}
addSystemInfoMessage ( tr ( " Calling to %1 " ) . arg ( f - > getDisplayedName ( ) ) , ChatMessage : : INFO , QDateTime : : currentDateTime ( ) ) ;
}
@ -461,7 +461,7 @@ void ChatForm::onAvStarting(uint32_t FriendId, int CallId, bool video)
@@ -461,7 +461,7 @@ void ChatForm::onAvStarting(uint32_t FriendId, int CallId, bool video)
videoButton - > setToolTip ( " " ) ;
connect ( callButton , SIGNAL ( clicked ( ) ) , this , SLOT ( onHangupCallTriggered ( ) ) ) ;
}
startCounter ( ) ;
}
@ -477,7 +477,7 @@ void ChatForm::onAvEnding(uint32_t FriendId, int)
@@ -477,7 +477,7 @@ void ChatForm::onAvEnding(uint32_t FriendId, int)
enableCallButtons ( ) ;
stopCounter ( ) ;
netcam - > hide ( ) ;
}
@ -493,7 +493,7 @@ void ChatForm::onAvRequestTimeout(uint32_t FriendId, int)
@@ -493,7 +493,7 @@ void ChatForm::onAvRequestTimeout(uint32_t FriendId, int)
enableCallButtons ( ) ;
stopCounter ( ) ;
netcam - > hide ( ) ;
}
@ -506,10 +506,10 @@ void ChatForm::onAvPeerTimeout(uint32_t FriendId, int)
@@ -506,10 +506,10 @@ void ChatForm::onAvPeerTimeout(uint32_t FriendId, int)
delete callConfirm ;
callConfirm = nullptr ;
enableCallButtons ( ) ;
stopCounter ( ) ;
netcam - > hide ( ) ;
}
@ -524,7 +524,7 @@ void ChatForm::onAvRejected(uint32_t FriendId, int)
@@ -524,7 +524,7 @@ void ChatForm::onAvRejected(uint32_t FriendId, int)
callConfirm = nullptr ;
enableCallButtons ( ) ;
insertChatMessage ( ChatMessage : : createChatInfoMessage ( tr ( " Call rejected " ) , ChatMessage : : INFO , QDateTime : : currentDateTime ( ) ) ) ;
netcam - > hide ( ) ;
@ -586,7 +586,7 @@ void ChatForm::onRejectCallTriggered()
@@ -586,7 +586,7 @@ void ChatForm::onRejectCallTriggered()
audioInputFlag = false ;
audioOutputFlag = false ;
emit rejectCall ( callId ) ;
enableCallButtons ( ) ;
}
@ -638,19 +638,19 @@ void ChatForm::onCancelCallTriggered()
@@ -638,19 +638,19 @@ void ChatForm::onCancelCallTriggered()
void ChatForm : : enableCallButtons ( )
{
qDebug ( ) < < " enableCallButtons " ;
audioInputFlag = false ;
audioOutputFlag = false ;
micButton - > setObjectName ( " grey " ) ;
micButton - > style ( ) - > polish ( micButton ) ;
micButton - > setToolTip ( " " ) ;
micButton - > disconnect ( ) ;
micButton - > disconnect ( ) ;
volButton - > setObjectName ( " grey " ) ;
volButton - > style ( ) - > polish ( volButton ) ;
volButton - > setToolTip ( " " ) ;
volButton - > disconnect ( ) ;
callButton - > setObjectName ( " grey " ) ;
callButton - > style ( ) - > polish ( callButton ) ;
callButton - > setToolTip ( " " ) ;
@ -659,7 +659,7 @@ void ChatForm::enableCallButtons()
@@ -659,7 +659,7 @@ void ChatForm::enableCallButtons()
videoButton - > style ( ) - > polish ( videoButton ) ;
videoButton - > setToolTip ( " " ) ;
videoButton - > disconnect ( ) ;
if ( disableCallButtonsTimer = = nullptr )
{
disableCallButtonsTimer = new QTimer ( ) ;
@ -668,7 +668,7 @@ void ChatForm::enableCallButtons()
@@ -668,7 +668,7 @@ void ChatForm::enableCallButtons()
disableCallButtonsTimer - > start ( 1500 ) ; // 1.5sec
qDebug ( ) < < " timer started!! " ;
}
}
void ChatForm : : onEnableCallButtons ( )
@ -683,7 +683,7 @@ void ChatForm::onEnableCallButtons()
@@ -683,7 +683,7 @@ void ChatForm::onEnableCallButtons()
videoButton - > setObjectName ( " green " ) ;
videoButton - > style ( ) - > polish ( videoButton ) ;
videoButton - > setToolTip ( tr ( " Start video call " ) ) ;
connect ( callButton , SIGNAL ( clicked ( ) ) ,
this , SLOT ( onCallTriggered ( ) ) ) ;
connect ( videoButton , SIGNAL ( clicked ( ) ) ,
@ -824,7 +824,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
@@ -824,7 +824,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
// Show the date every new day
QDateTime msgDateTime = it . timestamp . toLocalTime ( ) ;
QDate msgDate = msgDateTime . date ( ) ;
if ( msgDate > lastDate )
{
lastDate = msgDate ;
@ -860,7 +860,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
@@ -860,7 +860,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
rec = Core : : getInstance ( ) - > sendMessage ( f - > getFriendID ( ) , msg - > toString ( ) ) ;
else
rec = Core : : getInstance ( ) - > sendAction ( f - > getFriendID ( ) , msg - > toString ( ) ) ;
getOfflineMsgEngine ( ) - > registerReceipt ( rec , it . id , msg ) ;
}
}
@ -910,7 +910,7 @@ void ChatForm::stopCounter()
@@ -910,7 +910,7 @@ void ChatForm::stopCounter()
callDurationTimer - > stop ( ) ;
callDuration - > setText ( " " ) ;
callDuration - > hide ( ) ;
delete callDurationTimer ;
callDurationTimer = nullptr ;
}
@ -931,13 +931,13 @@ QString ChatForm::secondsToDHMS(quint32 duration)
@@ -931,13 +931,13 @@ QString ChatForm::secondsToDHMS(quint32 duration)
duration / = 60 ;
int hours = ( int ) ( duration % 24 ) ;
int days = ( int ) ( duration / 24 ) ;
if ( minutes = = 0 )
return cD + res . sprintf ( " %02ds " , seconds ) ;
if ( hours = = 0 & & days = = 0 )
return cD + res . sprintf ( " %02dm %02ds " , minutes , seconds ) ;
if ( days = = 0 )
return cD + res . sprintf ( " %02dh %02dm %02ds " , hours , minutes , seconds ) ;
//I assume no one will ever have call longer than ~30days