mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(friend): Small refactoring
Method renamed to be same with `Group` i.e. `getGroupId`, changed Friend eventFlag type on bool
This commit is contained in:
parent
6bad4ad3ba
commit
29bb319025
|
@ -175,8 +175,8 @@ bool CoreAV::anyActiveCalls() const
|
||||||
*/
|
*/
|
||||||
bool CoreAV::isCallActive(const Friend* f) const
|
bool CoreAV::isCallActive(const Friend* f) const
|
||||||
{
|
{
|
||||||
return f && calls.contains(f->getFriendID())
|
return f && calls.contains(f->getFriendId())
|
||||||
? !(calls[f->getFriendID()].inactive)
|
? !(calls[f->getFriendId()].inactive)
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,8 +194,8 @@ bool CoreAV::isCallActive(const Group* g) const
|
||||||
|
|
||||||
bool CoreAV::isCallVideoEnabled(const Friend* f) const
|
bool CoreAV::isCallVideoEnabled(const Friend* f) const
|
||||||
{
|
{
|
||||||
return f && calls.contains(f->getFriendID())
|
return f && calls.contains(f->getFriendId())
|
||||||
? calls[f->getFriendID()].videoEnabled
|
? calls[f->getFriendId()].videoEnabled
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,9 +422,9 @@ void CoreAV::sendCallVideo(uint32_t callId, std::shared_ptr<VideoFrame> vframe)
|
||||||
*/
|
*/
|
||||||
void CoreAV::toggleMuteCallInput(const Friend* f)
|
void CoreAV::toggleMuteCallInput(const Friend* f)
|
||||||
{
|
{
|
||||||
if (f && calls.contains(f->getFriendID()))
|
if (f && calls.contains(f->getFriendId()))
|
||||||
{
|
{
|
||||||
ToxCall& call = calls[f->getFriendID()];
|
ToxCall& call = calls[f->getFriendId()];
|
||||||
call.muteMic = !call.muteMic;
|
call.muteMic = !call.muteMic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,9 +435,9 @@ void CoreAV::toggleMuteCallInput(const Friend* f)
|
||||||
*/
|
*/
|
||||||
void CoreAV::toggleMuteCallOutput(const Friend* f)
|
void CoreAV::toggleMuteCallOutput(const Friend* f)
|
||||||
{
|
{
|
||||||
if (f && calls.contains(f->getFriendID()))
|
if (f && calls.contains(f->getFriendId()))
|
||||||
{
|
{
|
||||||
ToxCall& call = calls[f->getFriendID()];
|
ToxCall& call = calls[f->getFriendId()];
|
||||||
call.muteVol = !call.muteVol;
|
call.muteVol = !call.muteVol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,8 +618,8 @@ bool CoreAV::isGroupAvEnabled(int groupId) const
|
||||||
*/
|
*/
|
||||||
bool CoreAV::isCallInputMuted(const Friend* f) const
|
bool CoreAV::isCallInputMuted(const Friend* f) const
|
||||||
{
|
{
|
||||||
return f && calls.contains(f->getFriendID())
|
return f && calls.contains(f->getFriendId())
|
||||||
? calls[f->getFriendID()].muteMic
|
? calls[f->getFriendId()].muteMic
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,8 +630,8 @@ bool CoreAV::isCallInputMuted(const Friend* f) const
|
||||||
*/
|
*/
|
||||||
bool CoreAV::isCallOutputMuted(const Friend* f) const
|
bool CoreAV::isCallOutputMuted(const Friend* f) const
|
||||||
{
|
{
|
||||||
return f && calls.contains(f->getFriendID())
|
return f && calls.contains(f->getFriendId())
|
||||||
? calls[f->getFriendID()].muteVol
|
? calls[f->getFriendId()].muteVol
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,8 @@
|
||||||
|
|
||||||
|
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
#include "friendlist.h"
|
|
||||||
#include "widget/friendwidget.h"
|
|
||||||
#include "widget/form/chatform.h"
|
#include "widget/form/chatform.h"
|
||||||
|
#include "widget/friendwidget.h"
|
||||||
#include "widget/gui.h"
|
#include "widget/gui.h"
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include "src/persistence/settings.h"
|
#include "src/persistence/settings.h"
|
||||||
|
@ -30,16 +29,20 @@
|
||||||
#include "src/grouplist.h"
|
#include "src/grouplist.h"
|
||||||
#include "src/group.h"
|
#include "src/group.h"
|
||||||
|
|
||||||
Friend::Friend(uint32_t FriendId, const ToxPk& FriendPk)
|
Friend::Friend(uint32_t friendId, const ToxPk& friendPk)
|
||||||
: userName{Core::getInstance()->getPeerName(FriendPk)}
|
: userName{Core::getInstance()->getPeerName(friendPk)}
|
||||||
, friendPk(FriendPk), friendId(FriendId)
|
, userAlias(Settings::getInstance().getFriendAlias(friendPk))
|
||||||
, hasNewEvents(0), friendStatus(Status::Offline)
|
, friendPk(friendPk)
|
||||||
|
, friendId(friendId)
|
||||||
|
, hasNewEvents(false)
|
||||||
|
, friendStatus(Status::Offline)
|
||||||
{
|
{
|
||||||
if (userName.size() == 0)
|
if (userName.isEmpty())
|
||||||
userName = FriendPk.toString();
|
{
|
||||||
|
userName = friendPk.toString();
|
||||||
|
}
|
||||||
|
|
||||||
userAlias = Settings::getInstance().getFriendAlias(FriendPk);
|
userAlias = Settings::getInstance().getFriendAlias(friendPk);
|
||||||
|
|
||||||
chatForm = new ChatForm(this);
|
chatForm = new ChatForm(this);
|
||||||
}
|
}
|
||||||
|
@ -129,17 +132,17 @@ const ToxPk& Friend::getPublicKey() const
|
||||||
return friendPk;
|
return friendPk;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Friend::getFriendID() const
|
uint32_t Friend::getFriendId() const
|
||||||
{
|
{
|
||||||
return friendId;
|
return friendId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Friend::setEventFlag(int f)
|
void Friend::setEventFlag(bool flag)
|
||||||
{
|
{
|
||||||
hasNewEvents = f;
|
hasNewEvents = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Friend::getEventFlag() const
|
bool Friend::getEventFlag() const
|
||||||
{
|
{
|
||||||
return hasNewEvents;
|
return hasNewEvents;
|
||||||
}
|
}
|
||||||
|
|
12
src/friend.h
12
src/friend.h
|
@ -47,11 +47,11 @@ public:
|
||||||
void setStatusMessage(QString message);
|
void setStatusMessage(QString message);
|
||||||
QString getStatusMessage();
|
QString getStatusMessage();
|
||||||
|
|
||||||
void setEventFlag(int f);
|
void setEventFlag(bool f);
|
||||||
int getEventFlag() const;
|
bool getEventFlag() const;
|
||||||
|
|
||||||
const ToxPk& getPublicKey() const;
|
const ToxPk& getPublicKey() const;
|
||||||
uint32_t getFriendID() const;
|
uint32_t getFriendId() const;
|
||||||
|
|
||||||
void setStatus(Status s);
|
void setStatus(Status s);
|
||||||
Status getStatus() const;
|
Status getStatus() const;
|
||||||
|
@ -66,10 +66,12 @@ signals:
|
||||||
void displayedNameChanged(FriendWidget* widget, Status s, int hasNewEvents);
|
void displayedNameChanged(FriendWidget* widget, Status s, int hasNewEvents);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString userAlias, userName, statusMessage;
|
QString userName;
|
||||||
|
QString userAlias;
|
||||||
|
QString statusMessage;
|
||||||
ToxPk friendPk;
|
ToxPk friendPk;
|
||||||
uint32_t friendId;
|
uint32_t friendId;
|
||||||
int hasNewEvents;
|
bool hasNewEvents;
|
||||||
Status friendStatus;
|
Status friendStatus;
|
||||||
|
|
||||||
FriendWidget* widget;
|
FriendWidget* widget;
|
||||||
|
|
|
@ -107,9 +107,13 @@ void OfflineMsgEngine::deliverOfflineMsgs()
|
||||||
QString messageText = val.msg->toString();
|
QString messageText = val.msg->toString();
|
||||||
int rec;
|
int rec;
|
||||||
if (val.msg->isAction())
|
if (val.msg->isAction())
|
||||||
rec = Core::getInstance()->sendAction(f->getFriendID(), messageText);
|
{
|
||||||
|
rec = Core::getInstance()->sendAction(f->getFriendId(), messageText);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rec = Core::getInstance()->sendMessage(f->getFriendID(), messageText);
|
{
|
||||||
|
rec = Core::getInstance()->sendMessage(f->getFriendId(), messageText);
|
||||||
|
}
|
||||||
|
|
||||||
registerReceipt(rec, key, val.msg);
|
registerReceipt(rec, key, val.msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,7 +545,7 @@ void ContentDialog::dragEnterEvent(QDragEnterEvent *event)
|
||||||
if (!contact)
|
if (!contact)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int friendId = contact->getFriendID();
|
int friendId = contact->getFriendId();
|
||||||
auto iter = friendList.find(friendId);
|
auto iter = friendList.find(friendId);
|
||||||
|
|
||||||
// If friend is already in a dialog then you can't drop friend where it already is.
|
// If friend is already in a dialog then you can't drop friend where it already is.
|
||||||
|
@ -580,7 +580,7 @@ void ContentDialog::dropEvent(QDropEvent *event)
|
||||||
if (!contact)
|
if (!contact)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int friendId = contact->getFriendID();
|
int friendId = contact->getFriendId();
|
||||||
auto iter = friendList.find(friendId);
|
auto iter = friendList.find(friendId);
|
||||||
if (iter != friendList.end())
|
if (iter != friendList.end())
|
||||||
std::get<0>(iter.value())->removeFriend(friendId);
|
std::get<0>(iter.value())->removeFriend(friendId);
|
||||||
|
@ -644,7 +644,7 @@ void ContentDialog::onChatroomWidgetClicked(GenericChatroomWidget *widget, bool
|
||||||
|
|
||||||
if (widget->getFriend() != nullptr)
|
if (widget->getFriend() != nullptr)
|
||||||
{
|
{
|
||||||
removeFriend(widget->getFriend()->getFriendID());
|
removeFriend(widget->getFriend()->getFriendId());
|
||||||
Widget::getInstance()->addFriendDialog(widget->getFriend(), contentDialog);
|
Widget::getInstance()->addFriendDialog(widget->getFriend(), contentDialog);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -160,7 +160,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&typingTimer, &QTimer::timeout, this, [=] {
|
connect(&typingTimer, &QTimer::timeout, this, [=] {
|
||||||
Core::getInstance()->sendTyping(f->getFriendID(), false);
|
Core::getInstance()->sendTyping(f->getFriendId(), false);
|
||||||
isTyping = false;
|
isTyping = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ void ChatForm::onTextEditChanged()
|
||||||
if (!Settings::getInstance().getTypingNotification())
|
if (!Settings::getInstance().getTypingNotification())
|
||||||
{
|
{
|
||||||
if (isTyping)
|
if (isTyping)
|
||||||
Core::getInstance()->sendTyping(f->getFriendID(), false);
|
Core::getInstance()->sendTyping(f->getFriendId(), false);
|
||||||
|
|
||||||
isTyping = false;
|
isTyping = false;
|
||||||
return;
|
return;
|
||||||
|
@ -210,11 +210,11 @@ void ChatForm::onTextEditChanged()
|
||||||
{
|
{
|
||||||
typingTimer.start(3000);
|
typingTimer.start(3000);
|
||||||
if (!isTyping)
|
if (!isTyping)
|
||||||
Core::getInstance()->sendTyping(f->getFriendID(), (isTyping = true));
|
Core::getInstance()->sendTyping(f->getFriendId(), (isTyping = true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Core::getInstance()->sendTyping(f->getFriendID(), (isTyping = false));
|
Core::getInstance()->sendTyping(f->getFriendId(), (isTyping = false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,14 +254,13 @@ void ChatForm::onAttachClicked()
|
||||||
file.close();
|
file.close();
|
||||||
QFileInfo fi(path);
|
QFileInfo fi(path);
|
||||||
|
|
||||||
core->sendFile(f->getFriendID(), fi.fileName(), path,
|
core->sendFile(f->getFriendId(), fi.fileName(), path, filesize);
|
||||||
filesize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::startFileSend(ToxFile file)
|
void ChatForm::startFileSend(ToxFile file)
|
||||||
{
|
{
|
||||||
if (file.friendId != f->getFriendID())
|
if (file.friendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -280,7 +279,7 @@ void ChatForm::startFileSend(ToxFile file)
|
||||||
|
|
||||||
void ChatForm::onFileRecvRequest(ToxFile file)
|
void ChatForm::onFileRecvRequest(ToxFile file)
|
||||||
{
|
{
|
||||||
if (file.friendId != f->getFriendID())
|
if (file.friendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Widget::getInstance()->newFriendMessageAlert(file.friendId);
|
Widget::getInstance()->newFriendMessageAlert(file.friendId);
|
||||||
|
@ -315,7 +314,7 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
||||||
|
|
||||||
void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
||||||
{
|
{
|
||||||
if (friendId != f->getFriendID())
|
if (friendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
callConfirm = new CallConfirmWidget(video ? videoButton : callButton, *f);
|
callConfirm = new CallConfirmWidget(video ? videoButton : callButton, *f);
|
||||||
|
@ -326,7 +325,7 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
||||||
if ((video && Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(Settings::AutoAcceptCall::Video)) ||
|
if ((video && Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(Settings::AutoAcceptCall::Video)) ||
|
||||||
(!video && Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(Settings::AutoAcceptCall::Audio)))
|
(!video && Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(Settings::AutoAcceptCall::Audio)))
|
||||||
{
|
{
|
||||||
uint32_t friendId = f->getFriendID();
|
uint32_t friendId = f->getFriendId();
|
||||||
qDebug() << "automatic call answer";
|
qDebug() << "automatic call answer";
|
||||||
CoreAV* coreav = Core::getInstance()->getAv();
|
CoreAV* coreav = Core::getInstance()->getAv();
|
||||||
QMetaObject::invokeMethod(coreav, "answerCall", Qt::QueuedConnection, Q_ARG(uint32_t, friendId));
|
QMetaObject::invokeMethod(coreav, "answerCall", Qt::QueuedConnection, Q_ARG(uint32_t, friendId));
|
||||||
|
@ -355,7 +354,7 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
||||||
|
|
||||||
void ChatForm::onAvStart(uint32_t FriendId, bool video)
|
void ChatForm::onAvStart(uint32_t FriendId, bool video)
|
||||||
{
|
{
|
||||||
if (FriendId != f->getFriendID())
|
if (FriendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (video)
|
if (video)
|
||||||
|
@ -369,7 +368,7 @@ void ChatForm::onAvStart(uint32_t FriendId, bool video)
|
||||||
|
|
||||||
void ChatForm::onAvEnd(uint32_t FriendId)
|
void ChatForm::onAvEnd(uint32_t FriendId)
|
||||||
{
|
{
|
||||||
if (FriendId != f->getFriendID())
|
if (FriendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
delete callConfirm;
|
delete callConfirm;
|
||||||
|
@ -416,7 +415,7 @@ void ChatForm::onAnswerCallTriggered()
|
||||||
updateCallButtons();
|
updateCallButtons();
|
||||||
|
|
||||||
CoreAV* av = Core::getInstance()->getAv();
|
CoreAV* av = Core::getInstance()->getAv();
|
||||||
if (!av->answerCall(f->getFriendID()))
|
if (!av->answerCall(f->getFriendId()))
|
||||||
{
|
{
|
||||||
updateCallButtons();
|
updateCallButtons();
|
||||||
stopCounter();
|
stopCounter();
|
||||||
|
@ -424,7 +423,7 @@ void ChatForm::onAnswerCallTriggered()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onAvStart(f->getFriendID(), av->isCallVideoEnabled(f));
|
onAvStart(f->getFriendId(), av->isCallVideoEnabled(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onRejectCallTriggered()
|
void ChatForm::onRejectCallTriggered()
|
||||||
|
@ -434,7 +433,7 @@ void ChatForm::onRejectCallTriggered()
|
||||||
Audio::getInstance().stopLoop();
|
Audio::getInstance().stopLoop();
|
||||||
|
|
||||||
CoreAV* av = Core::getInstance()->getAv();
|
CoreAV* av = Core::getInstance()->getAv();
|
||||||
av->cancelCall(f->getFriendID());
|
av->cancelCall(f->getFriendId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onCallTriggered()
|
void ChatForm::onCallTriggered()
|
||||||
|
@ -442,9 +441,9 @@ void ChatForm::onCallTriggered()
|
||||||
CoreAV* av = Core::getInstance()->getAv();
|
CoreAV* av = Core::getInstance()->getAv();
|
||||||
if (av->isCallActive(f))
|
if (av->isCallActive(f))
|
||||||
{
|
{
|
||||||
av->cancelCall(f->getFriendID());
|
av->cancelCall(f->getFriendId());
|
||||||
}
|
}
|
||||||
else if (av->startCall(f->getFriendID(), false))
|
else if (av->startCall(f->getFriendId(), false))
|
||||||
{
|
{
|
||||||
showOutgoingCall(false);
|
showOutgoingCall(false);
|
||||||
}
|
}
|
||||||
|
@ -457,9 +456,11 @@ void ChatForm::onVideoCallTriggered()
|
||||||
{
|
{
|
||||||
// TODO: We want to activate video on the active call.
|
// TODO: We want to activate video on the active call.
|
||||||
if (av->isCallVideoEnabled(f))
|
if (av->isCallVideoEnabled(f))
|
||||||
av->cancelCall(f->getFriendID());
|
{
|
||||||
|
av->cancelCall(f->getFriendId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (av->startCall(f->getFriendID(), true))
|
else if (av->startCall(f->getFriendId(), true))
|
||||||
{
|
{
|
||||||
showOutgoingCall(true);
|
showOutgoingCall(true);
|
||||||
}
|
}
|
||||||
|
@ -523,7 +524,7 @@ void ChatForm::onVolMuteToggle()
|
||||||
|
|
||||||
void ChatForm::onFileSendFailed(uint32_t friendId, const QString &fname)
|
void ChatForm::onFileSendFailed(uint32_t friendId, const QString &fname)
|
||||||
{
|
{
|
||||||
if (friendId != f->getFriendID())
|
if (friendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
addSystemInfoMessage(tr("Failed to send file \"%1\"").arg(fname), ChatMessage::ERROR, QDateTime::currentDateTime());
|
addSystemInfoMessage(tr("Failed to send file \"%1\"").arg(fname), ChatMessage::ERROR, QDateTime::currentDateTime());
|
||||||
|
@ -532,7 +533,7 @@ void ChatForm::onFileSendFailed(uint32_t friendId, const QString &fname)
|
||||||
void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
|
void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
|
||||||
{
|
{
|
||||||
// Disable call buttons if friend is offline
|
// Disable call buttons if friend is offline
|
||||||
if(friendId != f->getFriendID())
|
if(friendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (status == Status::Offline)
|
if (status == Status::Offline)
|
||||||
|
@ -570,7 +571,7 @@ void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
|
||||||
|
|
||||||
void ChatForm::onFriendTypingChanged(quint32 friendId, bool isTyping)
|
void ChatForm::onFriendTypingChanged(quint32 friendId, bool isTyping)
|
||||||
{
|
{
|
||||||
if (friendId == f->getFriendID())
|
if (friendId == f->getFriendId())
|
||||||
setFriendTyping(isTyping);
|
setFriendTyping(isTyping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,8 +584,10 @@ void ChatForm::onFriendNameChanged(const QString& name)
|
||||||
void ChatForm::onFriendMessageReceived(quint32 friendId, const QString& message,
|
void ChatForm::onFriendMessageReceived(quint32 friendId, const QString& message,
|
||||||
bool isAction)
|
bool isAction)
|
||||||
{
|
{
|
||||||
if (friendId != f->getFriendID())
|
if (friendId != f->getFriendId())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QDateTime timestamp = QDateTime::currentDateTime();
|
QDateTime timestamp = QDateTime::currentDateTime();
|
||||||
addMessage(f->getPublicKey(), message, isAction, timestamp, true);
|
addMessage(f->getPublicKey(), message, isAction, timestamp, true);
|
||||||
|
@ -593,19 +596,25 @@ void ChatForm::onFriendMessageReceived(quint32 friendId, const QString& message,
|
||||||
void ChatForm::onStatusMessage(const QString& message)
|
void ChatForm::onStatusMessage(const QString& message)
|
||||||
{
|
{
|
||||||
if (sender() == f)
|
if (sender() == f)
|
||||||
|
{
|
||||||
setStatusMessage(message);
|
setStatusMessage(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onReceiptReceived(quint32 friendId, int receipt)
|
void ChatForm::onReceiptReceived(quint32 friendId, int receipt)
|
||||||
{
|
{
|
||||||
if (friendId == f->getFriendID())
|
if (friendId == f->getFriendId())
|
||||||
|
{
|
||||||
f->getChatForm()->getOfflineMsgEngine()->dischargeReceipt(receipt);
|
f->getChatForm()->getOfflineMsgEngine()->dischargeReceipt(receipt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onAvatarChange(uint32_t friendId, const QPixmap &pic)
|
void ChatForm::onAvatarChange(uint32_t friendId, const QPixmap &pic)
|
||||||
{
|
{
|
||||||
if (friendId != f->getFriendID())
|
if (friendId != f->getFriendId())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
avatar->setPixmap(pic);
|
avatar->setPixmap(pic);
|
||||||
}
|
}
|
||||||
|
@ -613,15 +622,19 @@ void ChatForm::onAvatarChange(uint32_t friendId, const QPixmap &pic)
|
||||||
GenericNetCamView *ChatForm::createNetcam()
|
GenericNetCamView *ChatForm::createNetcam()
|
||||||
{
|
{
|
||||||
qDebug() << "creating netcam";
|
qDebug() << "creating netcam";
|
||||||
NetCamView* view = new NetCamView(f->getFriendID(), this);
|
uint32_t friendId = f->getFriendId();
|
||||||
view->show(Core::getInstance()->getAv()->getVideoSourceFromCall(f->getFriendID()), f->getDisplayedName());
|
NetCamView* view = new NetCamView(friendId, this);
|
||||||
|
CoreAV* av = Core::getInstance()->getAv();
|
||||||
|
view->show(av->getVideoSourceFromCall(friendId), f->getDisplayedName());
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::dragEnterEvent(QDragEnterEvent *ev)
|
void ChatForm::dragEnterEvent(QDragEnterEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->mimeData()->hasUrls())
|
if (ev->mimeData()->hasUrls())
|
||||||
|
{
|
||||||
ev->acceptProposedAction();
|
ev->acceptProposedAction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::dropEvent(QDropEvent *ev)
|
void ChatForm::dropEvent(QDropEvent *ev)
|
||||||
|
@ -665,15 +678,17 @@ void ChatForm::dropEvent(QDropEvent *ev)
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
if (info.exists())
|
if (info.exists())
|
||||||
core->sendFile(f->getFriendID(), info.fileName(),
|
{
|
||||||
|
core->sendFile(f->getFriendId(), info.fileName(),
|
||||||
info.absoluteFilePath(), info.size());
|
info.absoluteFilePath(), info.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onAvatarRemoved(uint32_t FriendId)
|
void ChatForm::onAvatarRemoved(uint32_t FriendId)
|
||||||
{
|
{
|
||||||
if (FriendId != f->getFriendID())
|
if (FriendId != f->getFriendId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
avatar->setPixmap(QPixmap(":/img/contact_dark.svg"));
|
avatar->setPixmap(QPixmap(":/img/contact_dark.svg"));
|
||||||
|
@ -781,9 +796,9 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
||||||
{
|
{
|
||||||
int rec;
|
int rec;
|
||||||
if (!isAction)
|
if (!isAction)
|
||||||
rec = Core::getInstance()->sendMessage(f->getFriendID(), msg->toString());
|
rec = Core::getInstance()->sendMessage(f->getFriendId(), msg->toString());
|
||||||
else
|
else
|
||||||
rec = Core::getInstance()->sendAction(f->getFriendID(), msg->toString());
|
rec = Core::getInstance()->sendAction(f->getFriendId(), msg->toString());
|
||||||
|
|
||||||
getOfflineMsgEngine()->registerReceipt(rec, it.id, msg);
|
getOfflineMsgEngine()->registerReceipt(rec, it.id, msg);
|
||||||
}
|
}
|
||||||
|
@ -844,13 +859,14 @@ void ChatForm::onScreenshotTaken(const QPixmap &pixmap) {
|
||||||
file.close();
|
file.close();
|
||||||
QFileInfo fi(file);
|
QFileInfo fi(file);
|
||||||
|
|
||||||
Core::getInstance()->sendFile(f->getFriendID(), fi.fileName(),
|
Core::getInstance()->sendFile(f->getFriendId(), fi.fileName(),
|
||||||
fi.filePath(), filesize);
|
fi.filePath(), filesize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this,
|
QMessageBox::warning(this,
|
||||||
tr("Failed to open temporary file", "Temporary file for screenshot"),
|
tr("Failed to open temporary file",
|
||||||
|
"Temporary file for screenshot"),
|
||||||
tr("qTox wasn't able to save the screenshot"));
|
tr("qTox wasn't able to save the screenshot"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -858,7 +874,9 @@ void ChatForm::onScreenshotTaken(const QPixmap &pixmap) {
|
||||||
void ChatForm::onLoadHistory()
|
void ChatForm::onLoadHistory()
|
||||||
{
|
{
|
||||||
if (!Nexus::getProfile()->isHistoryEnabled())
|
if (!Nexus::getProfile()->isHistoryEnabled())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LoadHistoryDialog dlg;
|
LoadHistoryDialog dlg;
|
||||||
|
|
||||||
|
@ -874,7 +892,9 @@ void ChatForm::insertChatMessage(ChatMessage::Ptr msg)
|
||||||
GenericChatForm::insertChatMessage(msg);
|
GenericChatForm::insertChatMessage(msg);
|
||||||
|
|
||||||
if (netcam && bodySplitter->sizes()[1] == 0)
|
if (netcam && bodySplitter->sizes()[1] == 0)
|
||||||
|
{
|
||||||
netcam->setShowMessages(true, true);
|
netcam->setShowMessages(true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onCopyStatusMessage()
|
void ChatForm::onCopyStatusMessage()
|
||||||
|
@ -942,6 +962,7 @@ void ChatForm::startCounter()
|
||||||
callDurationTimer = new QTimer();
|
callDurationTimer = new QTimer();
|
||||||
connect(callDurationTimer, &QTimer::timeout,
|
connect(callDurationTimer, &QTimer::timeout,
|
||||||
this, &ChatForm::onUpdateTime);
|
this, &ChatForm::onUpdateTime);
|
||||||
|
|
||||||
callDurationTimer->start(1000);
|
callDurationTimer->start(1000);
|
||||||
timeElapsed.start();
|
timeElapsed.start();
|
||||||
callDuration->show();
|
callDuration->show();
|
||||||
|
@ -952,8 +973,11 @@ void ChatForm::stopCounter()
|
||||||
{
|
{
|
||||||
if (callDurationTimer)
|
if (callDurationTimer)
|
||||||
{
|
{
|
||||||
addSystemInfoMessage(tr("Call with %1 ended. %2").arg(f->getDisplayedName(),secondsToDHMS(timeElapsed.elapsed()/1000)),
|
QString dhms = secondsToDHMS(timeElapsed.elapsed()/1000);
|
||||||
|
QString name = f->getDisplayedName();
|
||||||
|
addSystemInfoMessage(tr("Call with %1 ended. %2").arg(name, dhms),
|
||||||
ChatMessage::INFO, QDateTime::currentDateTime());
|
ChatMessage::INFO, QDateTime::currentDateTime());
|
||||||
|
|
||||||
callDurationTimer->stop();
|
callDurationTimer->stop();
|
||||||
callDuration->setText("");
|
callDuration->setText("");
|
||||||
callDuration->hide();
|
callDuration->hide();
|
||||||
|
@ -995,7 +1019,8 @@ void ChatForm::setFriendTyping(bool isTyping)
|
||||||
chatWidget->setTypingNotificationVisible(isTyping);
|
chatWidget->setTypingNotificationVisible(isTyping);
|
||||||
|
|
||||||
Text* text = static_cast<Text*>(chatWidget->getTypingNotification()->getContent(1));
|
Text* text = static_cast<Text*>(chatWidget->getTypingNotification()->getContent(1));
|
||||||
text->setText("<div class=typing>" + tr("%1 is typing").arg(f->getDisplayedName().toHtmlEscaped()) + "</div>");
|
QString name = f->getDisplayedName();
|
||||||
|
text->setText("<div class=typing>" + tr("%1 is typing").arg(name) + "</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::show(ContentLayout* contentLayout)
|
void ChatForm::show(ContentLayout* contentLayout)
|
||||||
|
@ -1003,13 +1028,17 @@ void ChatForm::show(ContentLayout* contentLayout)
|
||||||
GenericChatForm::show(contentLayout);
|
GenericChatForm::show(contentLayout);
|
||||||
|
|
||||||
if (callConfirm)
|
if (callConfirm)
|
||||||
|
{
|
||||||
callConfirm->show();
|
callConfirm->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::showEvent(QShowEvent* event)
|
void ChatForm::showEvent(QShowEvent* event)
|
||||||
{
|
{
|
||||||
if (callConfirm)
|
if (callConfirm)
|
||||||
|
{
|
||||||
callConfirm->show();
|
callConfirm->show();
|
||||||
|
}
|
||||||
|
|
||||||
GenericChatForm::showEvent(event);
|
GenericChatForm::showEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -1017,7 +1046,9 @@ void ChatForm::showEvent(QShowEvent* event)
|
||||||
void ChatForm::hideEvent(QHideEvent* event)
|
void ChatForm::hideEvent(QHideEvent* event)
|
||||||
{
|
{
|
||||||
if (callConfirm)
|
if (callConfirm)
|
||||||
|
{
|
||||||
callConfirm->hide();
|
callConfirm->hide();
|
||||||
|
}
|
||||||
|
|
||||||
GenericChatForm::hideEvent(event);
|
GenericChatForm::hideEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -1030,11 +1061,15 @@ OfflineMsgEngine *ChatForm::getOfflineMsgEngine()
|
||||||
void ChatForm::SendMessageStr(QString msg)
|
void ChatForm::SendMessageStr(QString msg)
|
||||||
{
|
{
|
||||||
if (msg.isEmpty())
|
if (msg.isEmpty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool isAction = msg.startsWith(ACTION_PREFIX, Qt::CaseInsensitive);
|
bool isAction = msg.startsWith(ACTION_PREFIX, Qt::CaseInsensitive);
|
||||||
if (isAction)
|
if (isAction)
|
||||||
|
{
|
||||||
msg.remove(0, ACTION_PREFIX.length());
|
msg.remove(0, ACTION_PREFIX.length());
|
||||||
|
}
|
||||||
|
|
||||||
QList<CString> splittedMsg = Core::splitMessage(msg, TOX_MAX_MESSAGE_LENGTH);
|
QList<CString> splittedMsg = Core::splitMessage(msg, TOX_MAX_MESSAGE_LENGTH);
|
||||||
QDateTime timestamp = QDateTime::currentDateTime();
|
QDateTime timestamp = QDateTime::currentDateTime();
|
||||||
|
@ -1044,7 +1079,9 @@ void ChatForm::SendMessageStr(QString msg)
|
||||||
QString qt_msg = CString::toString(c_msg.data(), c_msg.size());
|
QString qt_msg = CString::toString(c_msg.data(), c_msg.size());
|
||||||
QString qt_msg_hist = qt_msg;
|
QString qt_msg_hist = qt_msg;
|
||||||
if (isAction)
|
if (isAction)
|
||||||
|
{
|
||||||
qt_msg_hist = ACTION_PREFIX + qt_msg;
|
qt_msg_hist = ACTION_PREFIX + qt_msg;
|
||||||
|
}
|
||||||
|
|
||||||
bool status = !Settings::getInstance().getFauxOfflineMessaging();
|
bool status = !Settings::getInstance().getFauxOfflineMessaging();
|
||||||
|
|
||||||
|
@ -1052,9 +1089,9 @@ void ChatForm::SendMessageStr(QString msg)
|
||||||
|
|
||||||
int rec;
|
int rec;
|
||||||
if (isAction)
|
if (isAction)
|
||||||
rec = Core::getInstance()->sendAction(f->getFriendID(), qt_msg);
|
rec = Core::getInstance()->sendAction(f->getFriendId(), qt_msg);
|
||||||
else
|
else
|
||||||
rec = Core::getInstance()->sendMessage(f->getFriendID(), qt_msg);
|
rec = Core::getInstance()->sendMessage(f->getFriendId(), qt_msg);
|
||||||
|
|
||||||
|
|
||||||
Profile* profile = Nexus::getProfile();
|
Profile* profile = Nexus::getProfile();
|
||||||
|
|
|
@ -295,7 +295,7 @@ void GroupChatForm::dropEvent(QDropEvent *ev)
|
||||||
if (!frnd)
|
if (!frnd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int friendId = frnd->getFriendID();
|
int friendId = frnd->getFriendId();
|
||||||
int groupId = group->getGroupId();
|
int groupId = group->getGroupId();
|
||||||
Core::getInstance()->groupInviteFriend(friendId, groupId);
|
Core::getInstance()->groupInviteFriend(friendId, groupId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,21 +295,21 @@ void FriendWidget::updateStatusLight()
|
||||||
Friend* f = FriendList::findFriend(friendId);
|
Friend* f = FriendList::findFriend(friendId);
|
||||||
Status status = f->getStatus();
|
Status status = f->getStatus();
|
||||||
|
|
||||||
if (status == Status::Online && f->getEventFlag() == 0)
|
if (status == Status::Online && !f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_online.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_online.svg"));
|
||||||
else if (status == Status::Online && f->getEventFlag() == 1)
|
else if (status == Status::Online && f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.svg"));
|
||||||
else if (status == Status::Away && f->getEventFlag() == 0)
|
else if (status == Status::Away && !f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_away.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_away.svg"));
|
||||||
else if (status == Status::Away && f->getEventFlag() == 1)
|
else if (status == Status::Away && f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_away_notification.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_away_notification.svg"));
|
||||||
else if (status == Status::Busy && f->getEventFlag() == 0)
|
else if (status == Status::Busy && !f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_busy.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_busy.svg"));
|
||||||
else if (status == Status::Busy && f->getEventFlag() == 1)
|
else if (status == Status::Busy && f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_busy_notification.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_busy_notification.svg"));
|
||||||
else if (status == Status::Offline && f->getEventFlag() == 0)
|
else if (status == Status::Offline && !f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_offline.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_offline.svg"));
|
||||||
else if (status == Status::Offline && f->getEventFlag() == 1)
|
else if (status == Status::Offline && f->getEventFlag())
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_offline_notification.svg"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_offline_notification.svg"));
|
||||||
|
|
||||||
if (f->getEventFlag())
|
if (f->getEventFlag())
|
||||||
|
@ -332,7 +332,7 @@ QString FriendWidget::getStatusString() const
|
||||||
Friend* f = FriendList::findFriend(friendId);
|
Friend* f = FriendList::findFriend(friendId);
|
||||||
Status status = f->getStatus();
|
Status status = f->getStatus();
|
||||||
|
|
||||||
if (f->getEventFlag() == 1)
|
if (f->getEventFlag())
|
||||||
return tr("New message");
|
return tr("New message");
|
||||||
else if (status == Status::Online)
|
else if (status == Status::Online)
|
||||||
return tr("Online");
|
return tr("Online");
|
||||||
|
|
|
@ -257,7 +257,7 @@ void GroupWidget::dropEvent(QDropEvent *ev)
|
||||||
if (!frnd)
|
if (!frnd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int friendId = frnd->getFriendID();
|
int friendId = frnd->getFriendId();
|
||||||
Core::getInstance()->groupInviteFriend(friendId, groupId);
|
Core::getInstance()->groupInviteFriend(friendId, groupId);
|
||||||
|
|
||||||
if (!active)
|
if (!active)
|
||||||
|
|
|
@ -1253,16 +1253,16 @@ void Widget::onReceiptRecieved(int friendId, int receipt)
|
||||||
|
|
||||||
void Widget::addFriendDialog(Friend *frnd, ContentDialog *dialog)
|
void Widget::addFriendDialog(Friend *frnd, ContentDialog *dialog)
|
||||||
{
|
{
|
||||||
ContentDialog *contentDialog = ContentDialog::getFriendDialog(frnd->getFriendID());
|
ContentDialog *contentDialog = ContentDialog::getFriendDialog(frnd->getFriendId());
|
||||||
bool isSeparate = Settings::getInstance().getSeparateWindow();
|
bool isSeparate = Settings::getInstance().getSeparateWindow();
|
||||||
FriendWidget* widget = friendWidgets[frnd->getFriendID()];
|
FriendWidget* widget = friendWidgets[frnd->getFriendId()];
|
||||||
|
bool isCurrent = activeChatroomWidget == widget;
|
||||||
if (!contentDialog && !isSeparate && activeChatroomWidget == widget)
|
if (!contentDialog && !isSeparate && isCurrent)
|
||||||
{
|
{
|
||||||
onAddClicked();
|
onAddClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendWidget* friendWidget = dialog->addFriend(frnd->getFriendID(), frnd->getDisplayedName());
|
FriendWidget* friendWidget = dialog->addFriend(frnd->getFriendId(), frnd->getDisplayedName());
|
||||||
|
|
||||||
friendWidget->setStatusMsg(widget->getStatusMsg());
|
friendWidget->setStatusMsg(widget->getStatusMsg());
|
||||||
|
|
||||||
|
@ -1280,7 +1280,7 @@ void Widget::addFriendDialog(Friend *frnd, ContentDialog *dialog)
|
||||||
QPixmap avatar = Nexus::getProfile()->loadAvatar(frnd->getPublicKey().toString());
|
QPixmap avatar = Nexus::getProfile()->loadAvatar(frnd->getPublicKey().toString());
|
||||||
if (!avatar.isNull())
|
if (!avatar.isNull())
|
||||||
{
|
{
|
||||||
friendWidget->onAvatarChange(frnd->getFriendID(), avatar);
|
friendWidget->onAvatarChange(frnd->getFriendId(), avatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1289,7 +1289,8 @@ void Widget::addGroupDialog(Group *group, ContentDialog *dialog)
|
||||||
int groupId = group->getGroupId();
|
int groupId = group->getGroupId();
|
||||||
ContentDialog* groupDialog = ContentDialog::getGroupDialog(groupId);
|
ContentDialog* groupDialog = ContentDialog::getGroupDialog(groupId);
|
||||||
bool separated = Settings::getInstance().getSeparateWindow();
|
bool separated = Settings::getInstance().getSeparateWindow();
|
||||||
bool isCurrentWindow = activeChatroomWidget == group->getGroupWidget();
|
GroupWidget* widget = group->getGroupWidget();
|
||||||
|
bool isCurrentWindow = activeChatroomWidget == widget;
|
||||||
if (!groupDialog && !separated && isCurrentWindow)
|
if (!groupDialog && !separated && isCurrentWindow)
|
||||||
{
|
{
|
||||||
onAddClicked();
|
onAddClicked();
|
||||||
|
@ -1479,13 +1480,15 @@ void Widget::onFriendRequestReceived(const ToxPk& friendPk, const QString& messa
|
||||||
|
|
||||||
void Widget::updateFriendActivity(Friend *frnd)
|
void Widget::updateFriendActivity(Friend *frnd)
|
||||||
{
|
{
|
||||||
QDate date = Settings::getInstance().getFriendActivity(frnd->getPublicKey());
|
const ToxPk &pk = frnd->getPublicKey();
|
||||||
|
QDate date = Settings::getInstance().getFriendActivity(pk);
|
||||||
if (date != QDate::currentDate())
|
if (date != QDate::currentDate())
|
||||||
{
|
{
|
||||||
// Update old activity before after new one. Store old date first.
|
// Update old activity before after new one. Store old date first.
|
||||||
QDate oldDate = Settings::getInstance().getFriendActivity(frnd->getPublicKey());
|
QDate oldDate = Settings::getInstance().getFriendActivity(pk);
|
||||||
Settings::getInstance().setFriendActivity(frnd->getPublicKey(), QDate::currentDate());
|
Settings::getInstance().setFriendActivity(pk, QDate::currentDate());
|
||||||
contactListWidget->moveWidget(friendWidgets[frnd->getFriendID()], frnd->getStatus());
|
FriendWidget* widget = friendWidgets[frnd->getFriendId()];
|
||||||
|
contactListWidget->moveWidget(widget, frnd->getStatus());
|
||||||
contactListWidget->updateActivityDate(oldDate);
|
contactListWidget->updateActivityDate(oldDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1508,7 +1511,7 @@ void Widget::removeFriend(Friend* f, bool fake)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendWidget *widget = friendWidgets[f->getFriendID()];
|
FriendWidget *widget = friendWidgets[f->getFriendId()];
|
||||||
widget->setAsInactiveChatroom();
|
widget->setAsInactiveChatroom();
|
||||||
if (widget == activeChatroomWidget)
|
if (widget == activeChatroomWidget)
|
||||||
{
|
{
|
||||||
|
@ -1518,15 +1521,15 @@ void Widget::removeFriend(Friend* f, bool fake)
|
||||||
|
|
||||||
contactListWidget->removeFriendWidget(widget);
|
contactListWidget->removeFriendWidget(widget);
|
||||||
|
|
||||||
ContentDialog* lastDialog = ContentDialog::getFriendDialog(f->getFriendID());
|
ContentDialog* lastDialog = ContentDialog::getFriendDialog(f->getFriendId());
|
||||||
|
|
||||||
if (lastDialog != nullptr)
|
if (lastDialog != nullptr)
|
||||||
{
|
{
|
||||||
lastDialog->removeFriend(f->getFriendID());
|
lastDialog->removeFriend(f->getFriendId());
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendList::removeFriend(f->getFriendID(), fake);
|
FriendList::removeFriend(f->getFriendId(), fake);
|
||||||
Nexus::getCore()->removeFriend(f->getFriendID(), fake);
|
Nexus::getCore()->removeFriend(f->getFriendId(), fake);
|
||||||
|
|
||||||
delete f;
|
delete f;
|
||||||
if (contentLayout != nullptr && contentLayout->mainHead->layout()->isEmpty())
|
if (contentLayout != nullptr && contentLayout->mainHead->layout()->isEmpty())
|
||||||
|
@ -1570,7 +1573,7 @@ void Widget::onDialogShown(GenericChatroomWidget* widget)
|
||||||
|
|
||||||
void Widget::onFriendDialogShown(Friend* f)
|
void Widget::onFriendDialogShown(Friend* f)
|
||||||
{
|
{
|
||||||
int friendId = f->getFriendID();
|
int friendId = f->getFriendId();
|
||||||
onDialogShown(friendWidgets[friendId]);
|
onDialogShown(friendWidgets[friendId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1668,7 +1671,8 @@ void Widget::copyFriendIdToClipboard(int friendId)
|
||||||
if (f != nullptr)
|
if (f != nullptr)
|
||||||
{
|
{
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
clipboard->setText(Nexus::getCore()->getFriendPublicKey(f->getFriendID()).toString(), QClipboard::Clipboard);
|
const ToxPk& pk = Nexus::getCore()->getFriendPublicKey(f->getFriendId());
|
||||||
|
clipboard->setText(pk.toString(), QClipboard::Clipboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2203,7 +2207,7 @@ void Widget::reloadTheme()
|
||||||
|
|
||||||
for (Friend* f : FriendList::getAllFriends())
|
for (Friend* f : FriendList::getAllFriends())
|
||||||
{
|
{
|
||||||
int friendId = f->getFriendID();
|
int friendId = f->getFriendId();
|
||||||
friendWidgets[friendId]->reloadTheme();
|
friendWidgets[friendId]->reloadTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user