forked from Aseman-Land/TelegramQML
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelegramimageelement.h
More file actions
151 lines (122 loc) · 5.08 KB
/
telegramimageelement.h
File metadata and controls
151 lines (122 loc) · 5.08 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#ifndef TELEGRAMIMAGEELEMENT_H
#define TELEGRAMIMAGEELEMENT_H
#include <QQuickItem>
#include <QSizeF>
#include <telegram/objects/telegramtypeqobject.h>
#include "telegramqml_global.h"
#include "telegramtools.h"
#include "tqbaseobject.cpp"
class TelegramEngine;
class TelegramImageElementPrivate;
class TELEGRAMQMLSHARED_EXPORT TelegramImageElement : public QQuickItem, public TqBaseObject
{
Q_OBJECT
Q_PROPERTY(TelegramTypeQObject* source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(TelegramEngine* engine READ engine WRITE setEngine NOTIFY engineChanged)
Q_PROPERTY(QString qtQuickVersion READ qtQuickVersion WRITE setQtQuickVersion NOTIFY qtQuickVersionChanged)
Q_PROPERTY(qint32 fileSize READ fileSize NOTIFY fileSizeChanged)
Q_PROPERTY(qint32 downloadedSize READ downloadedSize NOTIFY downloadedSizeChanged)
Q_PROPERTY(bool downloading READ downloading NOTIFY downloadingChanged)
Q_PROPERTY(bool downloaded READ downloaded NOTIFY downloadedChanged)
Q_PROPERTY(bool thumbnailDownloaded READ thumbnailDownloaded NOTIFY thumbnailDownloadedChanged)
Q_PROPERTY(QUrl destination READ destination NOTIFY destinationChanged)
Q_PROPERTY(QUrl thumbnail READ thumbnail NOTIFY thumbnailChanged)
Q_PROPERTY(QUrl currentImage READ currentImage NOTIFY currentImageChanged)
Q_PROPERTY(QSizeF imageSize READ imageSize NOTIFY imageSizeChanged)
Q_PROPERTY(QString errorText READ errorText NOTIFY errorChanged)
Q_PROPERTY(qint32 errorCode READ errorCode NOTIFY errorChanged)
Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
Q_PROPERTY(bool autoTransform READ autoTransform WRITE setAutoTransform NOTIFY autoTransformChanged)
Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged)
Q_PROPERTY(int fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
Q_PROPERTY(int horizontalAlignment READ horizontalAlignment WRITE setHorizontalAlignment NOTIFY horizontalAlignmentChanged)
Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged)
Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged)
Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedHeightChanged)
Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedWidthChanged)
Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
Q_PROPERTY(QSizeF sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged)
Q_PROPERTY(int verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged)
public:
TelegramImageElement(QQuickItem *parent = 0);
~TelegramImageElement();
void setSource(TelegramTypeQObject *object);
TelegramTypeQObject *source() const;
void setEngine(TelegramEngine *engine);
TelegramEngine *engine() const;
void setQtQuickVersion(const QString& version);
const QString& qtQuickVersion() const;
bool asynchronous();
void setAsynchronous(bool asynchronous);
bool autoTransform();
void setAutoTransform(bool autoTransform);
bool cache();
void setCache(bool cache);
int fillMode();
void setFillMode(int fillMode);
int horizontalAlignment();
void setHorizontalAlignment(int horizontalAlignment);
bool mipmap();
void setMipmap(bool mipmap);
bool mirror();
void setMirror(bool mirror);
qreal paintedHeight();
qreal paintedWidth();
bool smooth();
void setSmooth(bool smooth);
QSizeF sourceSize();
void setSourceSize(const QSizeF &sourceSize);
int verticalAlignment();
void setVerticalAlignment(int verticalAlignment);
QSizeF imageSize() const;
qint32 fileSize() const;
qint32 downloadedSize() const;
bool downloading() const;
bool downloaded() const;
bool thumbnailDownloaded() const;
QUrl destination() const;
QUrl thumbnail() const;
QUrl currentImage() const;
QString errorText() const;
qint32 errorCode() const;
static QStringList requiredProperties();
Q_SIGNALS:
void sourceChanged();
void engineChanged();
void qtQuickVersionChanged();
void imageSizeChanged();
void fileSizeChanged();
void downloadedSizeChanged();
void downloadingChanged();
void destinationChanged();
void thumbnailChanged();
void currentImageChanged();
void asynchronousChanged();
void autoTransformChanged();
void cacheChanged();
void fillModeChanged();
void horizontalAlignmentChanged();
void mipmapChanged();
void mirrorChanged();
void paintedHeightChanged();
void paintedWidthChanged();
void smoothChanged();
void sourceSizeChanged();
void verticalAlignmentChanged();
void downloadedChanged();
void thumbnailDownloadedChanged();
void errorChanged();
public Q_SLOTS:
bool download();
bool check();
void stop();
private:
void initImage();
protected:
void setImage(const QString &image);
virtual void destinationChangeEvent();
virtual void thumbnailChangeEvent();
private:
TelegramImageElementPrivate *p;
};
#endif // TELEGRAMIMAGEELEMENT_H