2014-07-07 00:19:45 +08:00
|
|
|
/*
|
2016-11-28 21:33:38 +08:00
|
|
|
Copyright © 2014-2015 by The qTox Project Contributors
|
2015-06-06 09:40:08 +08:00
|
|
|
|
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>
|
2016-11-15 16:00:23 +08:00
|
|
|
#include "core/corestructs.h"
|
2015-05-18 04:55:50 +08:00
|
|
|
#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
|
|
|
{
|
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
|
|
|
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;
|
|
|
|
|
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();
|
2016-08-18 17:38:22 +08:00
|
|
|
|
|
|
|
void setFriendWidget(FriendWidget* widget);
|
2014-11-06 23:26:22 +08:00
|
|
|
FriendWidget *getFriendWidget();
|
2015-06-09 03:31:40 +08:00
|
|
|
const FriendWidget *getFriendWidget() const;
|
2014-11-06 23:26:22 +08:00
|
|
|
|
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:
|
2015-11-10 04:53:24 +08:00
|
|
|
QString userAlias, userName, statusMessage;
|
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
|