mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Make Contact parent of Friend and Group
This commit is contained in:
parent
90f4750e73
commit
0adf026b4b
|
@ -114,6 +114,11 @@ uint32_t Friend::getFriendId() const
|
|||
return friendId;
|
||||
}
|
||||
|
||||
uint32_t Friend::getId() const
|
||||
{
|
||||
return getFriendId();
|
||||
}
|
||||
|
||||
void Friend::setEventFlag(bool flag)
|
||||
{
|
||||
hasNewEvents = flag;
|
||||
|
|
|
@ -20,38 +20,39 @@
|
|||
#ifndef FRIEND_H
|
||||
#define FRIEND_H
|
||||
|
||||
#include "contact.h"
|
||||
#include "src/core/toxid.h"
|
||||
#include "src/core/corestructs.h"
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class FriendWidget;
|
||||
class ChatForm;
|
||||
|
||||
class Friend : public QObject
|
||||
class Friend : public Contact
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Friend(uint32_t FriendId, const ToxPk& FriendPk, const QString& userAlias);
|
||||
Friend(uint32_t friendId, const ToxPk& friendPk, const QString& userAlias);
|
||||
Friend(const Friend& other) = delete;
|
||||
~Friend();
|
||||
~Friend() override;
|
||||
Friend& operator=(const Friend& other) = delete;
|
||||
|
||||
void loadHistory();
|
||||
|
||||
void setName(const QString& name);
|
||||
void setName(const QString& name) override;
|
||||
void setAlias(const QString& name);
|
||||
QString getDisplayedName() const;
|
||||
QString getDisplayedName() const override;
|
||||
bool hasAlias() const;
|
||||
|
||||
void setStatusMessage(const QString& message);
|
||||
QString getStatusMessage() const;
|
||||
|
||||
void setEventFlag(bool f);
|
||||
bool getEventFlag() const;
|
||||
void setEventFlag(bool f) override;
|
||||
bool getEventFlag() const override;
|
||||
|
||||
const ToxPk& getPublicKey() const;
|
||||
uint32_t getFriendId() const;
|
||||
uint32_t getId() const override;
|
||||
|
||||
void setStatus(Status s);
|
||||
Status getStatus() const;
|
||||
|
|
|
@ -83,6 +83,11 @@ QString Group::getName() const
|
|||
return widget->getName();
|
||||
}
|
||||
|
||||
QString Group::getDisplayedName() const
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
|
||||
void Group::regeneratePeerList()
|
||||
{
|
||||
const Core* core = Core::getInstance();
|
||||
|
@ -123,6 +128,11 @@ int Group::getGroupId() const
|
|||
return groupId;
|
||||
}
|
||||
|
||||
uint32_t Group::getId() const
|
||||
{
|
||||
return getGroupId();
|
||||
}
|
||||
|
||||
int Group::getPeersCount() const
|
||||
{
|
||||
return nPeers;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef GROUP_H
|
||||
#define GROUP_H
|
||||
|
||||
#include "contact.h"
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
@ -31,15 +32,16 @@ class GroupWidget;
|
|||
class GroupChatForm;
|
||||
class ToxPk;
|
||||
|
||||
class Group : public QObject
|
||||
class Group : public Contact
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Group(int GroupId, QString Name, bool IsAvGroupchat);
|
||||
virtual ~Group();
|
||||
~Group() override;
|
||||
|
||||
bool isAvGroupchat() const;
|
||||
int getGroupId() const;
|
||||
uint32_t getId() const override;
|
||||
int getPeersCount() const;
|
||||
void regeneratePeerList();
|
||||
QStringList getPeerList() const;
|
||||
|
@ -48,15 +50,16 @@ public:
|
|||
GroupChatForm* getChatForm();
|
||||
GroupWidget* getGroupWidget();
|
||||
|
||||
void setEventFlag(bool f);
|
||||
bool getEventFlag() const;
|
||||
void setEventFlag(bool f) override;
|
||||
bool getEventFlag() const override;
|
||||
|
||||
void setMentionedFlag(bool f);
|
||||
bool getMentionedFlag() const;
|
||||
|
||||
void updatePeer(int peerId, QString newName);
|
||||
void setName(const QString& name);
|
||||
void setName(const QString& name) override;
|
||||
QString getName() const;
|
||||
QString getDisplayedName() const override;
|
||||
|
||||
QString resolveToxId(const ToxPk& id) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user