|
|
@ -199,7 +199,7 @@ void ChatForm::onFileRecvRequest(ToxFile file) |
|
|
|
|
|
|
|
|
|
|
|
ChatMessage* msg = chatWidget->addFileTransferMessage(name, file, QDateTime::currentDateTime(), false); |
|
|
|
ChatMessage* msg = chatWidget->addFileTransferMessage(name, file, QDateTime::currentDateTime(), false); |
|
|
|
if (!Settings::getInstance().getAutoAcceptDir(f->getToxID()).isEmpty() |
|
|
|
if (!Settings::getInstance().getAutoAcceptDir(f->getToxID()).isEmpty() |
|
|
|
|| Settings::getInstance().getAutoSaveEnabled()) |
|
|
|
|| Settings::getInstance().getAutoSaveEnabled()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FileTransferWidget* tfWidget = dynamic_cast<FileTransferWidget*>(msg->getContent(1)); |
|
|
|
FileTransferWidget* tfWidget = dynamic_cast<FileTransferWidget*>(msg->getContent(1)); |
|
|
|
if(tfWidget) |
|
|
|
if(tfWidget) |
|
|
@ -703,7 +703,6 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered) |
|
|
|
std::swap(storedPrevId, previousId); |
|
|
|
std::swap(storedPrevId, previousId); |
|
|
|
QList<ChatMessage*> historyMessages; |
|
|
|
QList<ChatMessage*> historyMessages; |
|
|
|
|
|
|
|
|
|
|
|
//TODO: possibly broken
|
|
|
|
|
|
|
|
QDate lastDate(1,0,0); |
|
|
|
QDate lastDate(1,0,0); |
|
|
|
for (const auto &it : msgs) |
|
|
|
for (const auto &it : msgs) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -720,12 +719,11 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered) |
|
|
|
ToxID msgSender = ToxID::fromString(it.sender); |
|
|
|
ToxID msgSender = ToxID::fromString(it.sender); |
|
|
|
|
|
|
|
|
|
|
|
bool isAction = it.message.startsWith("/me "); |
|
|
|
bool isAction = it.message.startsWith("/me "); |
|
|
|
ChatMessage* msg; |
|
|
|
|
|
|
|
QString authorStr = (msgSender.isMine() ? Core::getInstance()->getUsername() : resolveToxID(msgSender)); |
|
|
|
ChatMessage* msg = addMessage(msgSender, |
|
|
|
if (!isAction) |
|
|
|
isAction ? it.message.right(it.message.length() - 4) : it.message, |
|
|
|
msg = chatWidget->addChatMessage(authorStr, it.message, msgSender.isMine(), false); |
|
|
|
isAction, QDateTime::currentDateTime(), |
|
|
|
else |
|
|
|
false); |
|
|
|
msg = chatWidget->addChatAction(authorStr, it.message.right(it.message.length() - 4)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (it.isSent || !msgSender.isMine()) |
|
|
|
if (it.isSent || !msgSender.isMine()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -747,15 +745,15 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered) |
|
|
|
} |
|
|
|
} |
|
|
|
std::swap(storedPrevId, previousId); |
|
|
|
std::swap(storedPrevId, previousId); |
|
|
|
|
|
|
|
|
|
|
|
// int savedSliderPos = chatWidget->verticalScrollBar()->maximum() - chatWidget->verticalScrollBar()->value();
|
|
|
|
// int savedSliderPos = chatWidget->verticalScrollBar()->maximum() - chatWidget->verticalScrollBar()->value();
|
|
|
|
|
|
|
|
|
|
|
|
// if (earliestMessage != nullptr)
|
|
|
|
// if (earliestMessage != nullptr)
|
|
|
|
// *earliestMessage = since;
|
|
|
|
// *earliestMessage = since;
|
|
|
|
|
|
|
|
|
|
|
|
// chatWidget->insertMessagesTop(historyMessages);
|
|
|
|
// chatWidget->insertMessagesTop(historyMessages);
|
|
|
|
|
|
|
|
|
|
|
|
// savedSliderPos = chatWidget->verticalScrollBar()->maximum() - savedSliderPos;
|
|
|
|
// savedSliderPos = chatWidget->verticalScrollBar()->maximum() - savedSliderPos;
|
|
|
|
// chatWidget->verticalScrollBar()->setValue(savedSliderPos);
|
|
|
|
// chatWidget->verticalScrollBar()->setValue(savedSliderPos);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ChatForm::onLoadHistory() |
|
|
|
void ChatForm::onLoadHistory() |
|
|
@ -786,7 +784,7 @@ void ChatForm::stopCounter() |
|
|
|
if (timer) |
|
|
|
if (timer) |
|
|
|
{ |
|
|
|
{ |
|
|
|
addSystemInfoMessage(tr("Call with %1 ended. %2").arg(f->getDisplayedName(),secondsToDHMS(timeElapsed.elapsed()/1000)), |
|
|
|
addSystemInfoMessage(tr("Call with %1 ended. %2").arg(f->getDisplayedName(),secondsToDHMS(timeElapsed.elapsed()/1000)), |
|
|
|
"white", QDateTime::currentDateTime()); |
|
|
|
"white", QDateTime::currentDateTime()); |
|
|
|
timer->stop(); |
|
|
|
timer->stop(); |
|
|
|
callDuration->setText(""); |
|
|
|
callDuration->setText(""); |
|
|
|
callDuration->hide(); |
|
|
|
callDuration->hide(); |
|
|
|