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-12-19 10:26:26 +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
|
|
|
|
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:
|
2016-12-30 06:14:48 +08:00
|
|
|
Friend(uint32_t FriendId, const ToxPk& FriendPk);
|
2016-08-24 08:13:26 +08:00
|
|
|
Friend(const Friend& other) = delete;
|
2014-06-25 04:11:11 +08:00
|
|
|
~Friend();
|
2016-08-24 08:13:26 +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
|
|
|
|
2016-08-22 05:30:07 +08:00
|
|
|
void setEventFlag(bool f);
|
|
|
|
bool getEventFlag() const;
|
2014-11-06 23:26:22 +08:00
|
|
|
|
2016-12-30 06:14:48 +08:00
|
|
|
const ToxPk& getPublicKey() const;
|
2016-08-22 05:30:07 +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
|
|
|
|
2015-03-12 08:23:22 +08:00
|
|
|
signals:
|
2016-08-24 08:13:26 +08:00
|
|
|
// 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:
|
2015-03-12 08:23:22 +08:00
|
|
|
|
2014-11-06 23:26:22 +08:00
|
|
|
private:
|
2016-08-22 05:30:07 +08:00
|
|
|
QString userName;
|
|
|
|
QString userAlias;
|
|
|
|
QString statusMessage;
|
2016-12-30 06:14:48 +08:00
|
|
|
ToxPk friendPk;
|
2015-04-20 05:12:44 +08:00
|
|
|
uint32_t friendId;
|
2016-08-22 05:30:07 +08:00
|
|
|
bool 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
|