forked from Aseman-Land/TelegramQML
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelegramstatustyping.cpp
More file actions
70 lines (55 loc) · 1.63 KB
/
telegramstatustyping.cpp
File metadata and controls
70 lines (55 loc) · 1.63 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
#include "telegramstatustyping.h"
#include "telegramsharedpointer.h"
#include "tqbaseobject.h"
#include <telegram/objects/sendmessageactionobject.h>
#include <telegram/objects/inputpeerobject.h>
#include <QPointer>
class TelegramStatusTypingPrivate
{
public:
TelegramSharedPointer<InputPeerObject> peer;
QPointer<SendMessageActionObject> action;
};
TelegramStatusTyping::TelegramStatusTyping(QObject *parent) :
QObject(parent)
{
p = new TelegramStatusTypingPrivate;
setAction(new SendMessageActionObject(this));
p->action->setClassType(SendMessageActionObject::TypeSendMessageTypingAction);
connect(this, &TelegramStatusTyping::actionChanged, this, &TelegramStatusTyping::changed);
}
void TelegramStatusTyping::setPeer(InputPeerObject *peer)
{
if(p->peer == peer)
return;
p->peer = peer;
Q_EMIT peerChanged();
Q_EMIT changed();
}
InputPeerObject *TelegramStatusTyping::peer() const
{
return p->peer;
}
void TelegramStatusTyping::setAction(SendMessageActionObject *action)
{
if(p->action == action)
return;
if(p->action)
disconnect(p->action.data(), &SendMessageActionObject::coreChanged, this, &TelegramStatusTyping::actionChanged);
p->action = action;
if(p->action)
connect(p->action.data(), &SendMessageActionObject::coreChanged, this, &TelegramStatusTyping::actionChanged);
Q_EMIT actionChanged();
}
SendMessageActionObject *TelegramStatusTyping::action()
{
return p->action;
}
QStringList TelegramStatusTyping::requiredProperties()
{
return QStringList() << FUNCTION_NAME(peer);
}
TelegramStatusTyping::~TelegramStatusTyping()
{
delete p;
}