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/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();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user