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:
parent
f0b970870d
commit
b3015ab0a8
|
@ -24,16 +24,15 @@
|
|||
#include "src/grouplist.h"
|
||||
#include "src/nexus.h"
|
||||
#include "src/persistence/profile.h"
|
||||
#include "src/persistence/settings.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)}
|
||||
, userAlias(Settings::getInstance().getFriendAlias(friendPk))
|
||||
, friendPk(friendPk)
|
||||
, friendId(friendId)
|
||||
, hasNewEvents(false)
|
||||
, friendStatus(Status::Offline)
|
||||
, userAlias{userAlias}
|
||||
, friendPk{friendPk}
|
||||
, friendId{friendId}
|
||||
, hasNewEvents{false}
|
||||
, friendStatus{Status::Offline}
|
||||
{
|
||||
if (userName.isEmpty()) {
|
||||
userName = friendPk.toString();
|
||||
|
|
|
@ -32,7 +32,7 @@ class Friend : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Friend(uint32_t FriendId, const ToxPk& FriendPk);
|
||||
Friend(uint32_t FriendId, const ToxPk& FriendPk, const QString& userAlias);
|
||||
Friend(const Friend& other) = delete;
|
||||
~Friend();
|
||||
Friend& operator=(const Friend& other) = delete;
|
||||
|
|
|
@ -33,7 +33,8 @@ Friend* FriendList::addFriend(int friendId, const ToxPk& friendPk)
|
|||
if (friendChecker != friendList.end())
|
||||
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;
|
||||
key2id[friendPk.getKey()] = friendId;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user