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

refactor(core): Merge friendAdded and friendshipChanged

This commit is contained in:
Diadlo 2017-05-06 15:38:35 +03:00
parent 49e9eb8de2
commit b126d21922
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
5 changed files with 2 additions and 11 deletions

View File

@ -560,7 +560,6 @@ void Core::acceptFriendRequest(const ToxPk& friendPk)
} else {
profile.saveToxSave();
emit friendAdded(friendId, friendPk);
emit friendshipChanged(friendId);
}
}
@ -612,7 +611,6 @@ void Core::requestFriendship(const ToxId& friendId, const QString& message)
Settings::getInstance().updateFriendAddress(friendId.toString());
emit friendAdded(friendNumber, friendPk);
emit friendshipChanged(friendNumber);
emit requestSent(friendPk, message);
}

View File

@ -122,7 +122,6 @@ signals:
void friendMessageReceived(uint32_t friendId, const QString& message, bool isAction);
void friendAdded(uint32_t friendId, const ToxPk& friendPk);
void friendshipChanged(uint32_t friendId);
void requestSent(const ToxPk& friendPk, const QString& message);
void friendStatusChanged(uint32_t friendId, Status status);

View File

@ -211,7 +211,6 @@ void Nexus::showMainGUI()
connect(core, &Core::statusMessageSet, widget, &Widget::setStatusMessage);
connect(core, &Core::selfAvatarChanged, widget, &Widget::onSelfAvatarLoaded);
connect(core, &Core::friendAdded, widget, &Widget::addFriend);
connect(core, &Core::friendshipChanged, widget, &Widget::onFriendshipChanged);
connect(core, &Core::failedToAddFriend, widget, &Widget::addFriendFailed);
connect(core, &Core::friendUsernameChanged, widget, &Widget::onFriendUsernameChanged);
connect(core, &Core::friendStatusChanged, widget, &Widget::onFriendStatusChanged);

View File

@ -996,6 +996,8 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
FilterCriteria filter = getFilterCriteria();
widget->search(ui->searchContactText->text(), filterOffline(filter));
updateFriendActivity(newfriend);
}
void Widget::addFriendFailed(const ToxPk&, const QString& errorInfo)
@ -1008,12 +1010,6 @@ void Widget::addFriendFailed(const ToxPk&, const QString& errorInfo)
QMessageBox::critical(0, "Error", info);
}
void Widget::onFriendshipChanged(int friendId)
{
Friend* who = FriendList::findFriend(friendId);
updateFriendActivity(who);
}
void Widget::onFriendStatusChanged(int friendId, Status status)
{
Friend* f = FriendList::findFriend(friendId);

View File

@ -149,7 +149,6 @@ public slots:
void setStatusMessage(const QString& statusMessage);
void addFriend(int friendId, const ToxPk& friendPk);
void addFriendFailed(const ToxPk& userId, const QString& errorInfo = QString());
void onFriendshipChanged(int friendId);
void onFriendStatusChanged(int friendId, Status status);
void onFriendStatusMessageChanged(int friendId, const QString& message);
void onFriendUsernameChanged(int friendId, const QString& username);