-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpeer_p.h
44 lines (43 loc) · 1.3 KB
/
peer_p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef LAFDUP_PEER_PH
#define LAFDUP_PEER_PH
#include "peer.h"
struct PasteHashKey
{
PasteHashKey(QString _name, QDateTime _time)
{
name = _name;
time = _time;
};
QString name;
QDateTime time;
};
class LafdupRemoteStub : public QObject
{
Q_OBJECT
public:
LafdupRemoteStub(LafdupPeer *parent);
public slots:
bool pasteText(const QDateTime ×tamp, const QString &text);
bool pasteFiles(const QDateTime ×tamp, QSharedPointer<lafrpc::RpcDir> rpcDir);
bool pasteImage(const QDateTime ×tamp, QSharedPointer<lafrpc::RpcFile> image);
bool pasteCompText(const QDateTime ×tamp, const QString &text);
bool pasteCompImage(const QDateTime ×tamp, QSharedPointer<lafrpc::RpcFile> image);
bool pasteCompFiles(const QDateTime ×tamp, QSharedPointer<lafrpc::RpcDir> rpcDir);
bool pasteEnd(const QDateTime &time);
bool ping();
QDateTime getCurrentTime();
private:
LafdupPeer *parent;
QHash<PasteHashKey, CopyPaste> pasteHash;
};
inline bool operator==(const PasteHashKey &p1, const PasteHashKey &p2)
{
return (p1.name == p2.name) && (p1.time == p2.time);
};
inline uint qHash(const PasteHashKey &key, uint seed) noexcept
{
uint hash = qHash(key.name, seed);
hash ^= qHash(key.time, hash);
return hash;
}
#endif