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

refactor(friend): Remove Settings from Friend

This commit is contained in:
Diadlo 2017-04-17 23:35:32 +03:00
parent f0b970870d
commit b3015ab0a8
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 9 additions and 9 deletions

View File

@ -24,16 +24,15 @@
#include "src/grouplist.h" #include "src/grouplist.h"
#include "src/nexus.h" #include "src/nexus.h"
#include "src/persistence/profile.h" #include "src/persistence/profile.h"
#include "src/persistence/settings.h"
#include "src/widget/form/chatform.h" #include "src/widget/form/chatform.h"
Friend::Friend(uint32_t friendId, const ToxPk& friendPk) Friend::Friend(uint32_t friendId, const ToxPk& friendPk, const QString& userAlias)
: userName{Core::getInstance()->getPeerName(friendPk)} : userName{Core::getInstance()->getPeerName(friendPk)}
, userAlias(Settings::getInstance().getFriendAlias(friendPk)) , userAlias{userAlias}
, friendPk(friendPk) , friendPk{friendPk}
, friendId(friendId) , friendId{friendId}
, hasNewEvents(false) , hasNewEvents{false}
, friendStatus(Status::Offline) , friendStatus{Status::Offline}
{ {
if (userName.isEmpty()) { if (userName.isEmpty()) {
userName = friendPk.toString(); userName = friendPk.toString();

View File

@ -32,7 +32,7 @@ class Friend : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
Friend(uint32_t FriendId, const ToxPk& FriendPk); Friend(uint32_t FriendId, const ToxPk& FriendPk, const QString& userAlias);
Friend(const Friend& other) = delete; Friend(const Friend& other) = delete;
~Friend(); ~Friend();
Friend& operator=(const Friend& other) = delete; Friend& operator=(const Friend& other) = delete;

View File

@ -33,7 +33,8 @@ Friend* FriendList::addFriend(int friendId, const ToxPk& friendPk)
if (friendChecker != friendList.end()) if (friendChecker != friendList.end())
qWarning() << "addFriend: friendId already taken"; qWarning() << "addFriend: friendId already taken";
Friend* newfriend = new Friend(friendId, friendPk); QString alias = Settings::getInstance().getFriendAlias(friendPk);
Friend* newfriend = new Friend(friendId, friendPk, alias);
friendList[friendId] = newfriend; friendList[friendId] = newfriend;
key2id[friendPk.getKey()] = friendId; key2id[friendPk.getKey()] = friendId;