-
Notifications
You must be signed in to change notification settings - Fork 13
/
models.h
40 lines (36 loc) · 1.06 KB
/
models.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
#ifndef LAFDUP_MODELS_H
#define LAFDUP_MODELS_H
#include <QtCore/qstring.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qsharedpointer.h>
const QString TextType = "text/plain";
const QString BinaryType = "application/octet-stream";
const QString ImageType = "image/png";
struct CopyPaste
{
public:
enum Direction { Incoming, Outgoing };
public:
CopyPaste(const Direction &direction, const QDateTime ×tamp, const QString &text);
CopyPaste();
public:
Direction direction;
QDateTime timestamp;
QString mimeType;
QString text;
QByteArray image;
QStringList files;
bool ignoreLimits;
public:
bool isText() const { return mimeType == TextType; }
bool isFile() const { return mimeType == BinaryType; }
bool isImage() const { return mimeType == ImageType; }
public:
QVariantMap saveState();
bool restoreState(const QVariantMap &state);
static QString lafrpcKey() { return "lafdup.CopyPaste"; }
};
Q_DECLARE_METATYPE(CopyPaste);
Q_DECLARE_METATYPE(QSharedPointer<CopyPaste>);
#endif