2014-07-07 00:19:45 +08:00
|
|
|
/*
|
2015-06-06 09:40:08 +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.
|
|
|
|
|
2015-06-06 09:40:08 +08:00
|
|
|
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.
|
2015-06-06 09:40:08 +08:00
|
|
|
|
|
|
|
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
|
2015-06-06 09:40:08 +08:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2014-07-07 00:19:45 +08:00
|
|
|
|
2015-06-06 09:40:08 +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
|
|
|
|
|
2015-03-12 08:23:22 +08:00
|
|
|
#include <QObject>
|
2014-06-25 04:11:11 +08:00
|
|
|
#include <QString>
|
2015-04-24 08:32:09 +08:00
|
|
|
#include "src/core/corestructs.h"
|
2015-05-18 04:55:50 +08:00
|
|
|
#include "core/toxid.h"
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-07-01 04:52:03 +08:00
|
|
|
struct 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
|
|
|
{
|
2015-03-12 08:23:22 +08:00
|
|
|
Q_OBJECT
|
2014-06-25 04:11:11 +08:00
|
|
|
public:
|
2015-05-18 04:55:50 +08:00
|
|
|
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
|
|
|
|
2015-04-26 20:40:07 +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;
|
|
|
|
|
2014-06-25 04:11:11 +08:00
|
|
|
void setStatusMessage(QString message);
|
|
|
|
|
2014-11-06 23:26:22 +08:00
|
|
|
void setEventFlag(int f);
|
|
|
|
int getEventFlag() const;
|
|
|
|
|
2015-05-24 02:58:41 +08:00
|
|
|
const ToxId &getToxId() const;
|
2015-04-20 05:12:44 +08:00
|
|
|
uint32_t getFriendID() const;
|
2014-11-06 23:26:22 +08:00
|
|
|
|
|
|
|
void setStatus(Status s);
|
|
|
|
Status getStatus() const;
|
|
|
|
|
|
|
|
ChatForm *getChatForm();
|
|
|
|
FriendWidget *getFriendWidget();
|
|
|
|
|
2015-03-12 08:23:22 +08:00
|
|
|
signals:
|
|
|
|
void displayedNameChanged(FriendWidget* widget, Status s, int hasNewEvents);
|
|
|
|
|
2014-11-06 23:26:22 +08:00
|
|
|
private:
|
|
|
|
QString userAlias, userName;
|
2015-05-18 04:55:50 +08:00
|
|
|
ToxId userID;
|
2015-04-20 05:12:44 +08:00
|
|
|
uint32_t friendId;
|
2014-08-31 22:48:15 +08:00
|
|
|
int hasNewEvents;
|
2014-06-28 00:12:43 +08:00
|
|
|
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
|