1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: Remove deprecated methods to get id

This commit is contained in:
Diadlo 2017-08-02 08:39:37 +03:00
parent 0adf026b4b
commit 99ebb73562
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
12 changed files with 91 additions and 103 deletions

View File

@ -179,7 +179,7 @@ bool CoreAV::anyActiveCalls() const
*/
bool CoreAV::isCallStarted(const Friend* f) const
{
return f && calls.contains(f->getFriendId());
return f && calls.contains(f->getId());
}
/**
@ -189,7 +189,7 @@ bool CoreAV::isCallStarted(const Friend* f) const
*/
bool CoreAV::isCallStarted(const Group* g) const
{
return g && groupCalls.contains(g->getGroupId());
return g && groupCalls.contains(g->getId());
}
/**
@ -199,7 +199,7 @@ bool CoreAV::isCallStarted(const Group* g) const
*/
bool CoreAV::isCallActive(const Friend* f) const
{
return isCallStarted(f) ? !(calls[f->getFriendId()].inactive) : false;
return isCallStarted(f) ? !(calls[f->getId()].inactive) : false;
}
/**
@ -209,12 +209,12 @@ bool CoreAV::isCallActive(const Friend* f) const
*/
bool CoreAV::isCallActive(const Group* g) const
{
return isCallStarted(g) ? !(groupCalls[g->getGroupId()].inactive) : false;
return isCallStarted(g) ? !(groupCalls[g->getId()].inactive) : false;
}
bool CoreAV::isCallVideoEnabled(const Friend* f) const
{
return isCallStarted(f) ? calls[f->getFriendId()].videoEnabled : false;
return isCallStarted(f) ? calls[f->getId()].videoEnabled : false;
}
bool CoreAV::answerCall(uint32_t friendNum)
@ -412,8 +412,8 @@ void CoreAV::sendCallVideo(uint32_t callId, std::shared_ptr<VideoFrame> vframe)
*/
void CoreAV::toggleMuteCallInput(const Friend* f)
{
if (f && calls.contains(f->getFriendId())) {
ToxCall& call = calls[f->getFriendId()];
if (f && calls.contains(f->getId())) {
ToxCall& call = calls[f->getId()];
call.muteMic = !call.muteMic;
}
}
@ -424,8 +424,8 @@ void CoreAV::toggleMuteCallInput(const Friend* f)
*/
void CoreAV::toggleMuteCallOutput(const Friend* f)
{
if (f && calls.contains(f->getFriendId())) {
ToxCall& call = calls[f->getFriendId()];
if (f && calls.contains(f->getId())) {
ToxCall& call = calls[f->getId()];
call.muteVol = !call.muteVol;
}
}
@ -545,8 +545,8 @@ bool CoreAV::sendGroupCallAudio(int groupId, const int16_t* pcm, size_t samples,
*/
void CoreAV::muteCallInput(const Group* g, bool mute)
{
if (g && groupCalls.contains(g->getGroupId()))
groupCalls[g->getGroupId()].muteMic = mute;
if (g && groupCalls.contains(g->getId()))
groupCalls[g->getId()].muteMic = mute;
}
/**
@ -556,8 +556,8 @@ void CoreAV::muteCallInput(const Group* g, bool mute)
*/
void CoreAV::muteCallOutput(const Group* g, bool mute)
{
if (g && groupCalls.contains(g->getGroupId()))
groupCalls[g->getGroupId()].muteVol = mute;
if (g && groupCalls.contains(g->getId()))
groupCalls[g->getId()].muteVol = mute;
}
/**
@ -567,7 +567,7 @@ void CoreAV::muteCallOutput(const Group* g, bool mute)
*/
bool CoreAV::isGroupCallInputMuted(const Group* g) const
{
return g && groupCalls.contains(g->getGroupId()) ? groupCalls[g->getGroupId()].muteMic : false;
return g && groupCalls.contains(g->getId()) ? groupCalls[g->getId()].muteMic : false;
}
/**
@ -577,7 +577,7 @@ bool CoreAV::isGroupCallInputMuted(const Group* g) const
*/
bool CoreAV::isGroupCallOutputMuted(const Group* g) const
{
return g && groupCalls.contains(g->getGroupId()) ? groupCalls[g->getGroupId()].muteVol : false;
return g && groupCalls.contains(g->getId()) ? groupCalls[g->getId()].muteVol : false;
}
/**
@ -610,7 +610,7 @@ bool CoreAV::isGroupAvEnabled(int groupId) const
*/
bool CoreAV::isCallInputMuted(const Friend* f) const
{
return f && calls.contains(f->getFriendId()) ? calls[f->getFriendId()].muteMic : false;
return f && calls.contains(f->getId()) ? calls[f->getId()].muteMic : false;
}
/**
@ -620,7 +620,7 @@ bool CoreAV::isCallInputMuted(const Friend* f) const
*/
bool CoreAV::isCallOutputMuted(const Friend* f) const
{
return f && calls.contains(f->getFriendId()) ? calls[f->getFriendId()].muteVol : false;
return f && calls.contains(f->getId()) ? calls[f->getId()].muteVol : false;
}
/**

View File

@ -109,14 +109,9 @@ const ToxPk& Friend::getPublicKey() const
return friendPk;
}
uint32_t Friend::getFriendId() const
{
return friendId;
}
uint32_t Friend::getId() const
{
return getFriendId();
return friendId;
}
void Friend::setEventFlag(bool flag)

View File

@ -51,7 +51,6 @@ public:
bool getEventFlag() const override;
const ToxPk& getPublicKey() const;
uint32_t getFriendId() const;
uint32_t getId() const override;
void setStatus(Status s);

View File

@ -123,14 +123,9 @@ bool Group::isAvGroupchat() const
return avGroupchat;
}
int Group::getGroupId() const
{
return groupId;
}
uint32_t Group::getId() const
{
return getGroupId();
return groupId;
}
int Group::getPeersCount() const

View File

@ -40,7 +40,6 @@ public:
~Group() override;
bool isAvGroupchat() const;
int getGroupId() const;
uint32_t getId() const override;
int getPeersCount() const;
void regeneratePeerList();

View File

@ -104,9 +104,9 @@ void OfflineMsgEngine::deliverOfflineMsgs()
QString messageText = val.msg->toString();
int rec;
if (val.msg->isAction()) {
rec = Core::getInstance()->sendAction(f->getFriendId(), messageText);
rec = Core::getInstance()->sendAction(f->getId(), messageText);
} else {
rec = Core::getInstance()->sendMessage(f->getFriendId(), messageText);
rec = Core::getInstance()->sendMessage(f->getId(), messageText);
}
registerReceipt(rec, key, val.msg);

View File

@ -164,7 +164,7 @@ ContentDialog::~ContentDialog()
FriendWidget* ContentDialog::addFriend(const Friend* frnd)
{
bool compact = Settings::getInstance().getCompactLayout();
uint32_t friendId = frnd->getFriendId();
uint32_t friendId = frnd->getId();
FriendWidget* friendWidget = new FriendWidget(frnd, compact);
friendLayout->addFriendWidget(friendWidget, frnd->getStatus());
@ -592,7 +592,7 @@ void ContentDialog::dragEnterEvent(QDragEnterEvent* event)
return;
}
int friendId = contact->getFriendId();
int friendId = contact->getId();
auto iter = friendList.find(friendId);
// If friend is already in a dialog then you can't drop friend where it already is.
@ -629,7 +629,7 @@ void ContentDialog::dropEvent(QDropEvent* event)
return;
}
int friendId = contact->getFriendId();
int friendId = contact->getId();
auto iter = friendList.find(friendId);
if (iter != friendList.end()) {
std::get<0>(iter.value())->removeFriend(friendId);
@ -698,10 +698,10 @@ void ContentDialog::openNewDialog(GenericChatroomWidget* widget)
contentDialog->show();
if (widget->getFriend()) {
removeFriend(widget->getFriend()->getFriendId());
removeFriend(widget->getFriend()->getId());
Widget::getInstance()->addFriendDialog(widget->getFriend(), contentDialog);
} else {
removeGroup(widget->getGroup()->getGroupId());
removeGroup(widget->getGroup()->getId());
Widget::getInstance()->addGroupDialog(widget->getGroup(), contentDialog);
}

View File

@ -187,7 +187,7 @@ ChatForm::ChatForm(Friend* chatFriend)
});
connect(&typingTimer, &QTimer::timeout, this, [=] {
Core::getInstance()->sendTyping(f->getFriendId(), false);
Core::getInstance()->sendTyping(f->getId(), false);
isTyping = false;
});
@ -227,14 +227,14 @@ void ChatForm::onTextEditChanged()
if (!Settings::getInstance().getTypingNotification()) {
if (isTyping) {
isTyping = false;
Core::getInstance()->sendTyping(f->getFriendId(), false);
Core::getInstance()->sendTyping(f->getId(), false);
}
return;
}
bool isTypingNow = !msgEdit->toPlainText().isEmpty();
if (isTyping != isTypingNow) {
Core::getInstance()->sendTyping(f->getFriendId(), isTypingNow);
Core::getInstance()->sendTyping(f->getId(), isTypingNow);
if (isTypingNow) {
typingTimer.start(TYPING_NOTIFICATION_DURATION);
}
@ -270,13 +270,13 @@ void ChatForm::onAttachClicked()
}
qint64 filesize = file.size();
core->sendFile(f->getFriendId(), fileName, path, filesize);
core->sendFile(f->getId(), fileName, path, filesize);
}
}
void ChatForm::startFileSend(ToxFile file)
{
if (file.friendId != f->getFriendId()) {
if (file.friendId != f->getId()) {
return;
}
@ -295,7 +295,7 @@ void ChatForm::startFileSend(ToxFile file)
void ChatForm::onFileRecvRequest(ToxFile file)
{
if (file.friendId != f->getFriendId()) {
if (file.friendId != f->getId()) {
return;
}
@ -330,7 +330,7 @@ void ChatForm::onFileRecvRequest(ToxFile file)
void ChatForm::onAvInvite(uint32_t friendId, bool video)
{
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -343,7 +343,7 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
auto testedFlag = video ? Settings::AutoAcceptCall::Video : Settings::AutoAcceptCall::Audio;
// AutoAcceptCall is set for this friend
if (Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(testedFlag)) {
uint32_t friendId = f->getFriendId();
uint32_t friendId = f->getId();
qDebug() << "automatic call answer";
CoreAV* coreav = Core::getInstance()->getAv();
QMetaObject::invokeMethod(coreav, "answerCall", Qt::QueuedConnection,
@ -363,7 +363,7 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
void ChatForm::onAvStart(uint32_t friendId, bool video)
{
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -380,7 +380,7 @@ void ChatForm::onAvStart(uint32_t friendId, bool video)
void ChatForm::onAvEnd(uint32_t friendId, bool error)
{
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -411,7 +411,7 @@ void ChatForm::showOutgoingCall(bool video)
void ChatForm::onAnswerCallTriggered()
{
delete callConfirm;
uint32_t friendId = f->getFriendId();
uint32_t friendId = f->getId();
emit acceptCall(friendId);
updateCallButtons();
@ -429,13 +429,13 @@ void ChatForm::onAnswerCallTriggered()
void ChatForm::onRejectCallTriggered()
{
delete callConfirm;
emit rejectCall(f->getFriendId());
emit rejectCall(f->getId());
}
void ChatForm::onCallTriggered()
{
CoreAV* av = Core::getInstance()->getAv();
uint32_t friendId = f->getFriendId();
uint32_t friendId = f->getId();
if (av->isCallStarted(f)) {
av->cancelCall(friendId);
} else if (av->startCall(friendId, false)) {
@ -446,7 +446,7 @@ void ChatForm::onCallTriggered()
void ChatForm::onVideoCallTriggered()
{
CoreAV* av = Core::getInstance()->getAv();
uint32_t friendId = f->getFriendId();
uint32_t friendId = f->getId();
if (av->isCallStarted(f)) {
// TODO: We want to activate video on the active call.
if (av->isCallVideoEnabled(f)) {
@ -506,7 +506,7 @@ void ChatForm::onVolMuteToggle()
void ChatForm::onFileSendFailed(uint32_t friendId, const QString& fname)
{
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -517,7 +517,7 @@ void ChatForm::onFileSendFailed(uint32_t friendId, const QString& fname)
void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
{
// Disable call buttons if friend is offline
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -541,7 +541,7 @@ void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
void ChatForm::onFriendTypingChanged(quint32 friendId, bool isTyping)
{
if (friendId == f->getFriendId()) {
if (friendId == f->getId()) {
setFriendTyping(isTyping);
}
}
@ -555,7 +555,7 @@ void ChatForm::onFriendNameChanged(const QString& name)
void ChatForm::onFriendMessageReceived(quint32 friendId, const QString& message, bool isAction)
{
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -572,14 +572,14 @@ void ChatForm::onStatusMessage(const QString& message)
void ChatForm::onReceiptReceived(quint32 friendId, int receipt)
{
if (friendId == f->getFriendId()) {
if (friendId == f->getId()) {
offlineEngine->dischargeReceipt(receipt);
}
}
void ChatForm::onAvatarChange(uint32_t friendId, const QPixmap& pic)
{
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -589,7 +589,7 @@ void ChatForm::onAvatarChange(uint32_t friendId, const QPixmap& pic)
GenericNetCamView* ChatForm::createNetcam()
{
qDebug() << "creating netcam";
uint32_t friendId = f->getFriendId();
uint32_t friendId = f->getId();
NetCamView* view = new NetCamView(friendId, this);
CoreAV* av = Core::getInstance()->getAv();
VideoSource* source = av->getVideoSourceFromCall(friendId);
@ -641,14 +641,14 @@ void ChatForm::dropEvent(QDropEvent* ev)
}
if (info.exists()) {
core->sendFile(f->getFriendId(), fileName, info.absoluteFilePath(), info.size());
core->sendFile(f->getId(), fileName, info.absoluteFilePath(), info.size());
}
}
}
void ChatForm::onAvatarRemoved(uint32_t friendId)
{
if (friendId != f->getFriendId()) {
if (friendId != f->getId()) {
return;
}
@ -752,7 +752,7 @@ void ChatForm::loadHistory(const QDateTime& since, bool processUndelivered)
if (needSending && processUndelivered) {
Core* core = Core::getInstance();
uint32_t friendId = f->getFriendId();
uint32_t friendId = f->getId();
QString stringMsg = msg->toString();
int receipt = isAction ? core->sendAction(friendId, stringMsg)
: core->sendMessage(friendId, stringMsg);
@ -806,7 +806,7 @@ void ChatForm::onScreenshotTaken(const QPixmap& pixmap)
qint64 filesize = file.size();
file.close();
QFileInfo fi(file);
Core::getInstance()->sendFile(f->getFriendId(), fi.fileName(), fi.filePath(), filesize);
Core::getInstance()->sendFile(f->getId(), fi.fileName(), fi.filePath(), filesize);
} else {
QMessageBox::warning(this,
tr("Failed to open temporary file", "Temporary file for screenshot"),
@ -979,7 +979,7 @@ void ChatForm::SendMessageStr(QString msg)
bool status = !Settings::getInstance().getFauxOfflineMessaging();
ChatMessage::Ptr ma = createSelfMessage(part, timestamp, isAction, false);
Core* core = Core::getInstance();
uint32_t friendId = f->getFriendId();
uint32_t friendId = f->getId();
int rec = isAction ? core->sendAction(friendId, part) : core->sendMessage(friendId, part);
Profile* profile = Nexus::getProfile();

View File

@ -107,7 +107,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
connect(nameLabel, &CroppingLabel::editFinished, this, [=](const QString& newName) {
if (!newName.isEmpty()) {
nameLabel->setText(newName);
emit groupTitleChanged(group->getGroupId(), newName.left(128));
emit groupTitleChanged(group->getId(), newName.left(128));
}
});
@ -147,9 +147,9 @@ void GroupChatForm::onSendTriggered()
if (group->getPeersCount() != 1) {
if (msg.startsWith(ChatForm::ACTION_PREFIX, Qt::CaseInsensitive)) {
msg.remove(0, ChatForm::ACTION_PREFIX.length());
emit sendAction(group->getGroupId(), msg);
emit sendAction(group->getId(), msg);
} else {
emit sendMessage(group->getGroupId(), msg);
emit sendMessage(group->getId(), msg);
}
} else {
if (msg.startsWith(ChatForm::ACTION_PREFIX, Qt::CaseInsensitive))
@ -224,7 +224,7 @@ void GroupChatForm::onUserListChanged()
callButton->setObjectName("grey");
callButton->style()->polish(callButton);
callButton->setToolTip("");
Core::getInstance()->getAv()->leaveGroupCall(group->getGroupId());
Core::getInstance()->getAv()->leaveGroupCall(group->getId());
hideNetcam();
}
}
@ -270,8 +270,8 @@ void GroupChatForm::dropEvent(QDropEvent* ev)
if (!frnd)
return;
int friendId = frnd->getFriendId();
int groupId = group->getGroupId();
int friendId = frnd->getId();
int groupId = group->getId();
if (frnd->getStatus() != Status::Offline) {
Core::getInstance()->groupInviteFriend(friendId, groupId);
}
@ -316,7 +316,7 @@ void GroupChatForm::onVolMuteToggle()
void GroupChatForm::onCallClicked()
{
if (!inCall) {
Core::getInstance()->getAv()->joinGroupCall(group->getGroupId());
Core::getInstance()->getAv()->joinGroupCall(group->getId());
audioInputFlag = true;
audioOutputFlag = true;
callButton->setObjectName("red");
@ -331,7 +331,7 @@ void GroupChatForm::onCallClicked()
inCall = true;
showNetcam();
} else {
Core::getInstance()->getAv()->leaveGroupCall(group->getGroupId());
Core::getInstance()->getAv()->leaveGroupCall(group->getId());
audioInputFlag = false;
audioOutputFlag = false;
callButton->setObjectName("green");
@ -350,7 +350,7 @@ void GroupChatForm::onCallClicked()
GenericNetCamView* GroupChatForm::createNetcam()
{
GroupNetCamView* view = new GroupNetCamView(group->getGroupId(), this);
GroupNetCamView* view = new GroupNetCamView(group->getId(), this);
QStringList names = group->getPeerList();
for (int i = 0; i < names.size(); ++i) {

View File

@ -100,7 +100,7 @@ void FriendWidget::onContextMenuCalled(QContextMenuEvent* event)
QAction* openChatWindow = nullptr;
QAction* removeChatWindow = nullptr;
const uint32_t friendId = frnd->getFriendId();
const uint32_t friendId = frnd->getId();
const ContentDialog* contentDialog = ContentDialog::getFriendDialog(friendId);
if (!contentDialog || contentDialog->chatroomWidgetCount() > 1) {
@ -246,7 +246,7 @@ void FriendWidget::onContextMenuCalled(QContextMenuEvent* event)
}
} else if (groupActions.contains(selectedItem)) {
const Group* group = groupActions[selectedItem];
Core::getInstance()->groupInviteFriend(friendId, group->getGroupId());
Core::getInstance()->groupInviteFriend(friendId, group->getId());
} else if (removeCircleAction != nullptr && selectedItem == removeCircleAction) {
if (friendList) {
friendList->moveWidget(this, frnd->getStatus(), true);
@ -368,13 +368,13 @@ void FriendWidget::setChatForm(ContentLayout* contentLayout)
void FriendWidget::resetEventFlags()
{
// Hack to avoid edit const Friend. TODO: Repalce on emit
Friend* f = FriendList::findFriend(frnd->getFriendId());
Friend* f = FriendList::findFriend(frnd->getId());
f->setEventFlag(false);
}
void FriendWidget::onAvatarChange(int friendId, const QPixmap& pic)
{
if (friendId != frnd->getFriendId()) {
if (friendId != frnd->getId()) {
return;
}
@ -384,7 +384,7 @@ void FriendWidget::onAvatarChange(int friendId, const QPixmap& pic)
void FriendWidget::onAvatarRemoved(int friendId)
{
if (friendId != frnd->getFriendId()) {
if (friendId != frnd->getId()) {
return;
}
@ -425,7 +425,7 @@ void FriendWidget::setAlias(const QString& _alias)
{
QString alias = _alias.left(tox_max_name_length());
// Hack to avoid edit const Friend. TODO: Repalce on emit
Friend* f = FriendList::findFriend(frnd->getFriendId());
Friend* f = FriendList::findFriend(frnd->getId());
f->setAlias(alias);
Settings& s = Settings::getInstance();

View File

@ -235,7 +235,7 @@ void GroupWidget::dropEvent(QDropEvent* ev)
if (!frnd)
return;
int friendId = frnd->getFriendId();
int friendId = frnd->getId();
if (frnd->getStatus() != Status::Offline) {
Core::getInstance()->groupInviteFriend(friendId, groupId);
}

View File

@ -919,7 +919,7 @@ void Widget::reloadHistory()
{
QDateTime weekAgo = QDateTime::currentDateTime().addDays(-7);
for (auto f : FriendList::getAllFriends()) {
chatForms[f->getFriendId()]->loadHistory(weekAgo, true);
chatForms[f->getId()]->loadHistory(weekAgo, true);
}
}
@ -1119,12 +1119,12 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
GenericChatForm* form;
const Friend* frnd = widget->getFriend();
if (frnd) {
form = chatForms[frnd->getFriendId()];
id = frnd->getFriendId();
form = chatForms[frnd->getId()];
id = frnd->getId();
} else {
Group* g = widget->getGroup();
form = g->getChatForm();
id = g->getGroupId();
id = g->getId();
}
ContentDialog::focusFriend(id);
@ -1158,7 +1158,7 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
} else {
hideMainForms(widget);
if (frnd) {
chatForms[frnd->getFriendId()]->show(contentLayout);
chatForms[frnd->getId()]->show(contentLayout);
} else {
widget->setChatForm(contentLayout);
}
@ -1201,9 +1201,9 @@ void Widget::onReceiptRecieved(int friendId, int receipt)
void Widget::addFriendDialog(const Friend* frnd, ContentDialog* dialog)
{
ContentDialog* contentDialog = ContentDialog::getFriendDialog(frnd->getFriendId());
ContentDialog* contentDialog = ContentDialog::getFriendDialog(frnd->getId());
bool isSeparate = Settings::getInstance().getSeparateWindow();
FriendWidget* widget = friendWidgets[frnd->getFriendId()];
FriendWidget* widget = friendWidgets[frnd->getId()];
bool isCurrent = activeChatroomWidget == widget;
if (!contentDialog && !isSeparate && isCurrent) {
onAddClicked();
@ -1242,13 +1242,13 @@ void Widget::addFriendDialog(const Friend* frnd, ContentDialog* dialog)
QPixmap avatar = Nexus::getProfile()->loadAvatar(frnd->getPublicKey().toString());
if (!avatar.isNull()) {
friendWidget->onAvatarChange(frnd->getFriendId(), avatar);
friendWidget->onAvatarChange(frnd->getId(), avatar);
}
}
void Widget::addGroupDialog(Group* group, ContentDialog* dialog)
{
int groupId = group->getGroupId();
int groupId = group->getId();
ContentDialog* groupDialog = ContentDialog::getGroupDialog(groupId);
bool separated = Settings::getInstance().getSeparateWindow();
GroupWidget* widget = group->getGroupWidget();
@ -1434,7 +1434,7 @@ void Widget::updateFriendActivity(const Friend* frnd)
// Update old activity before after new one. Store old date first.
QDate oldDate = Settings::getInstance().getFriendActivity(pk);
Settings::getInstance().setFriendActivity(pk, QDate::currentDate());
FriendWidget* widget = friendWidgets[frnd->getFriendId()];
FriendWidget* widget = friendWidgets[frnd->getId()];
contactListWidget->moveWidget(widget, frnd->getStatus());
contactListWidget->updateActivityDate(oldDate);
}
@ -1455,7 +1455,7 @@ void Widget::removeFriend(Friend* f, bool fake)
}
}
FriendWidget* widget = friendWidgets[f->getFriendId()];
FriendWidget* widget = friendWidgets[f->getId()];
widget->setAsInactiveChatroom();
if (widget == activeChatroomWidget) {
activeChatroomWidget = nullptr;
@ -1464,14 +1464,14 @@ void Widget::removeFriend(Friend* f, bool fake)
contactListWidget->removeFriendWidget(widget);
ContentDialog* lastDialog = ContentDialog::getFriendDialog(f->getFriendId());
ContentDialog* lastDialog = ContentDialog::getFriendDialog(f->getId());
if (lastDialog != nullptr) {
lastDialog->removeFriend(f->getFriendId());
lastDialog->removeFriend(f->getId());
}
FriendList::removeFriend(f->getFriendId(), fake);
Nexus::getCore()->removeFriend(f->getFriendId(), fake);
FriendList::removeFriend(f->getId(), fake);
Nexus::getCore()->removeFriend(f->getId(), fake);
delete widget;
delete f;
@ -1513,7 +1513,7 @@ void Widget::onDialogShown(GenericChatroomWidget* widget)
void Widget::onFriendDialogShown(const Friend* f)
{
int friendId = f->getFriendId();
int friendId = f->getId();
onDialogShown(friendWidgets[friendId]);
}
@ -1628,7 +1628,7 @@ void Widget::copyFriendIdToClipboard(int friendId)
Friend* f = FriendList::findFriend(friendId);
if (f != nullptr) {
QClipboard* clipboard = QApplication::clipboard();
const ToxPk& pk = Nexus::getCore()->getFriendPublicKey(f->getFriendId());
const ToxPk& pk = Nexus::getCore()->getFriendPublicKey(f->getId());
clipboard->setText(pk.toString(), QClipboard::Clipboard);
}
}
@ -1685,7 +1685,7 @@ void Widget::onGroupMessageReceived(int groupnumber, int peernumber, const QStri
g->getChatForm()->addMessage(author, message, QDateTime::currentDateTime(), isAction);
}
newGroupMessageAlert(g->getGroupId(), targeted || Settings::getInstance().getGroupAlwaysNotify());
newGroupMessageAlert(g->getId(), targeted || Settings::getInstance().getGroupAlwaysNotify());
}
void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Change)
@ -1761,7 +1761,7 @@ void Widget::removeGroup(Group* g, bool fake)
onAddClicked();
}
int groupId = g->getGroupId();
int groupId = g->getId();
GroupList::removeGroup(groupId, fake);
ContentDialog* contentDialog = ContentDialog::getGroupDialog(groupId);
@ -2095,7 +2095,7 @@ void Widget::processOfflineMsgs()
if (OfflineMsgEngine::globalMutex.tryLock()) {
QList<Friend*> frnds = FriendList::getAllFriends();
for (Friend* f : frnds) {
chatForms[f->getFriendId()]->getOfflineMsgEngine()->deliverOfflineMsgs();
chatForms[f->getId()]->getOfflineMsgEngine()->deliverOfflineMsgs();
}
OfflineMsgEngine::globalMutex.unlock();
@ -2106,7 +2106,7 @@ void Widget::clearAllReceipts()
{
QList<Friend*> frnds = FriendList::getAllFriends();
for (Friend* f : frnds) {
chatForms[f->getFriendId()]->getOfflineMsgEngine()->removeAllReceipts();
chatForms[f->getId()]->getOfflineMsgEngine()->removeAllReceipts();
}
}
@ -2121,7 +2121,7 @@ void Widget::reloadTheme()
contactListWidget->reDraw();
for (Friend* f : FriendList::getAllFriends()) {
int friendId = f->getFriendId();
int friendId = f->getId();
friendWidgets[friendId]->reloadTheme();
}
@ -2427,7 +2427,7 @@ void Widget::focusChatInput()
{
if (activeChatroomWidget) {
if (const Friend* f = activeChatroomWidget->getFriend()) {
chatForms[f->getFriendId()]->focusInput();
chatForms[f->getId()]->focusInput();
} else if (Group* g = activeChatroomWidget->getGroup()) {
g->getChatForm()->focusInput();
}