2014-09-11 21:44:34 +08:00
|
|
|
#ifndef CORESTRUCTS_H
|
|
|
|
#define CORESTRUCTS_H
|
|
|
|
|
|
|
|
// Some headers use Core structs but don't need to include all of core.h
|
|
|
|
// They should include this file directly instead to reduce compilation times
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
class QFile;
|
|
|
|
class QTimer;
|
|
|
|
|
|
|
|
enum class Status : int {Online = 0, Away, Busy, Offline};
|
|
|
|
|
2014-09-12 21:23:20 +08:00
|
|
|
#define TOX_ID_PUBLIC_KEY_LENGTH 64
|
|
|
|
#define TOX_ID_NO_SPAM_LENGTH 8
|
|
|
|
#define TOX_ID_CHECKSUM_LENGTH 4
|
|
|
|
|
|
|
|
struct ToxID
|
|
|
|
{
|
2015-01-30 04:23:33 +08:00
|
|
|
ToxID()=default;
|
|
|
|
ToxID(const ToxID& other);
|
|
|
|
|
2014-09-12 21:23:20 +08:00
|
|
|
QString publicKey;
|
|
|
|
QString noSpam;
|
|
|
|
QString checkSum;
|
|
|
|
|
2014-11-03 01:36:27 +08:00
|
|
|
QString toString() const;
|
2014-11-06 22:12:10 +08:00
|
|
|
static ToxID fromString(QString id);
|
|
|
|
static bool isToxId(const QString& id);
|
2014-09-12 21:23:20 +08:00
|
|
|
|
2014-11-03 01:36:27 +08:00
|
|
|
bool operator==(const ToxID& other) const;
|
|
|
|
bool operator!=(const ToxID& other) const;
|
|
|
|
bool isMine() const;
|
2014-11-16 19:40:44 +08:00
|
|
|
void clear();
|
2014-09-12 21:23:20 +08:00
|
|
|
};
|
|
|
|
|
2014-09-11 21:44:34 +08:00
|
|
|
struct DhtServer
|
|
|
|
{
|
|
|
|
QString name;
|
|
|
|
QString userId;
|
|
|
|
QString address;
|
|
|
|
int port;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ToxFile
|
|
|
|
{
|
|
|
|
enum FileStatus
|
|
|
|
{
|
|
|
|
STOPPED,
|
|
|
|
PAUSED,
|
2014-09-30 00:14:19 +08:00
|
|
|
TRANSMITTING,
|
|
|
|
BROKEN
|
2014-09-11 21:44:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum FileDirection : bool
|
|
|
|
{
|
|
|
|
SENDING,
|
|
|
|
RECEIVING
|
|
|
|
};
|
|
|
|
|
|
|
|
ToxFile()=default;
|
|
|
|
ToxFile(int FileNum, int FriendId, QByteArray FileName, QString FilePath, FileDirection Direction);
|
|
|
|
~ToxFile(){}
|
2014-11-17 23:05:14 +08:00
|
|
|
|
|
|
|
bool operator==(const ToxFile& other) const;
|
|
|
|
bool operator!=(const ToxFile& other) const;
|
|
|
|
|
2014-09-11 21:44:34 +08:00
|
|
|
void setFilePath(QString path);
|
|
|
|
bool open(bool write);
|
|
|
|
|
|
|
|
int fileNum;
|
|
|
|
int friendId;
|
|
|
|
QByteArray fileName;
|
|
|
|
QString filePath;
|
|
|
|
QFile* file;
|
2014-11-17 23:05:14 +08:00
|
|
|
qint64 bytesSent;
|
|
|
|
qint64 filesize;
|
2014-09-11 21:44:34 +08:00
|
|
|
FileStatus status;
|
|
|
|
FileDirection direction;
|
|
|
|
QTimer* sendTimer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CORESTRUCTS_H
|