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

85 lines
2.2 KiB
C
Raw Normal View History

2014-07-07 00:19:45 +08:00
/*
Copyright © 2014-2015 by The qTox Project Contributors
2014-07-07 00:19:45 +08:00
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
2014-07-07 00:19:45 +08:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
2014-07-07 00:19:45 +08:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2014-07-07 00:19:45 +08:00
You should have received a copy of the GNU General Public License
along with qTox. If not, see <http://www.gnu.org/licenses/>.
2014-07-07 00:19:45 +08:00
*/
2014-06-25 04:11:11 +08:00
#ifndef FRIEND_H
#define FRIEND_H
#include <QObject>
2014-06-25 04:11:11 +08:00
#include <QString>
#include "src/core/corestructs.h"
#include "core/toxid.h"
2014-06-25 04:11:11 +08:00
2015-06-05 23:15:59 +08:00
class FriendWidget;
2014-09-11 21:44:34 +08:00
class ChatForm;
2014-06-25 04:11:11 +08:00
2015-03-26 00:27:33 +08:00
class Friend : public QObject
2014-06-25 04:11:11 +08:00
{
Q_OBJECT
2014-06-25 04:11:11 +08:00
public:
Friend(uint32_t FriendId, const ToxPk& FriendPk);
Friend(const Friend& other) = delete;
2014-06-25 04:11:11 +08:00
~Friend();
Friend& operator=(const Friend& other) = delete;
2014-11-06 23:26:22 +08:00
void loadHistory();
2014-06-25 04:11:11 +08:00
void setName(QString name);
2014-11-06 23:26:22 +08:00
void setAlias(QString name);
QString getDisplayedName() const;
2015-09-15 02:25:16 +08:00
bool hasAlias() const;
2014-11-06 23:26:22 +08:00
2014-06-25 04:11:11 +08:00
void setStatusMessage(QString message);
2015-11-10 04:53:24 +08:00
QString getStatusMessage();
2014-06-25 04:11:11 +08:00
void setEventFlag(bool f);
bool getEventFlag() const;
2014-11-06 23:26:22 +08:00
const ToxPk& getPublicKey() const;
uint32_t getFriendId() const;
2014-11-06 23:26:22 +08:00
void setStatus(Status s);
Status getStatus() const;
ChatForm *getChatForm();
signals:
// TODO: move signals to DB object
void nameChanged(uint32_t friendId, const QString& name);
void aliasChanged(uint32_t friendId, QString alias);
void statusChanged(uint32_t friendId, Status status);
void statusMessageChanged(uint32_t friendId, const QString& message);
void loadChatHistory();
public slots:
2014-11-06 23:26:22 +08:00
private:
QString userName;
QString userAlias;
QString statusMessage;
ToxPk friendPk;
uint32_t friendId;
bool hasNewEvents;
Status friendStatus;
2014-11-06 23:26:22 +08:00
FriendWidget* widget;
ChatForm* chatForm;
2014-06-25 04:11:11 +08:00
};
#endif // FRIEND_H