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

79 lines
2.0 KiB
C
Raw Normal View History

2014-07-07 00:19:45 +08:00
/*
Copyright © 2014-2015 by The qTox Project
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 ToxId &UserId);
2015-01-30 04:23:33 +08:00
Friend(const Friend& other)=delete;
2014-06-25 04:11:11 +08:00
~Friend();
2015-01-30 04:23:33 +08:00
Friend& operator=(const Friend& other)=delete;
2014-11-06 23:26:22 +08:00
/// Loads the friend's chat history if enabled
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
2014-11-06 23:26:22 +08:00
void setEventFlag(int f);
int getEventFlag() const;
const ToxId &getToxId() const;
uint32_t getFriendID() const;
2014-11-06 23:26:22 +08:00
void setStatus(Status s);
Status getStatus() const;
ChatForm *getChatForm();
FriendWidget *getFriendWidget();
2015-06-09 03:31:40 +08:00
const FriendWidget *getFriendWidget() const;
2014-11-06 23:26:22 +08:00
signals:
void displayedNameChanged(FriendWidget* widget, Status s, int hasNewEvents);
2014-11-06 23:26:22 +08:00
private:
2015-11-10 04:53:24 +08:00
QString userAlias, userName, statusMessage;
ToxId userID;
uint32_t friendId;
int 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