-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathstbevent.cpp
More file actions
executable file
·187 lines (167 loc) · 3.6 KB
/
stbevent.cpp
File metadata and controls
executable file
·187 lines (167 loc) · 3.6 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#include "stbevent.h"
#include "macros.h"
#include "magprofile.h"
#include "browser.h"
#include "webpage.h"
using namespace yasem;
StbEvent::StbEvent(MagProfile *profile, SDK::WebPage* page):\
m_profile(profile),
m_event_code(STB_EVENT_NO_ERROR),
m_page(page)
{
this->setObjectName("StbEvent");
Q_ASSERT(page);
}
StbEvent::~StbEvent()
{
STUB();
}
/**
* @brief StbEvent::sendEvent
* @param eventCode @see Events
*/
void StbEvent::sendEvent(int eventCode)
{
STUB() << eventCode << ", name:" << getEventName((Events)eventCode);
if(m_page)
{
Q_ASSERT(m_page);
m_page->evalJs(QString("javascript: stbEvent.onEvent(%1)").arg(eventCode));
}
else {
FIXME() << "WebPage is missing! This is a bug!";
}
this->m_event_code = eventCode;
}
/**
* @brief StbEvent::onEvent
* @param eventCode Type of event
* @param data Associated data in JSON format
*
* The function to be called when getting the player event.
* It is used for processing the events in the portal with the event code as the parameter.
*/
void StbEvent::onEvent(int eventCode, const QString& data = "")
{
STUB() << eventCode << data;
}
void StbEvent::initEvents()
{
STUB();
}
/**
* @brief StbEvent::onBroadcastMessage
* @param windowId
* @param message
* @param data
*
* Receive a broadcast message from a window.
*/
void StbEvent::onBroadcastMessage(int windowId, const QString &message, const QString &data)
{
STUB() << windowId << message << data;
}
/**
* @brief StbEvent::onInternetStateChange
* @param status New network state
*
* Callback fired on lost/restore internet connection.
*/
void StbEvent::onInternetStateChange(bool status)
{
STUB() << status;
}
void StbEvent::onLanguageChange()
{
STUB();
}
/**
* @brief StbEvent::onMediaAvailable
*
* Callback on internet browser link clicked to ask user what to do with link: play or download.
* It is also used to start playing a downloaded item.
*/
void StbEvent::onMediaAvailable()
{
STUB();
}
/**
* @brief StbEvent::onMessage
* @param windowId
* @param message
* @param data
*
* Receive a message from a window.
*/
void StbEvent::onMessage(int windowId, const QString &message, const QString &data)
{
STUB() << windowId << message << data;
}
/**
* @brief StbEvent::onNetworkStateChange
* @param status
*
* USB device mount/unmount.
*/
void StbEvent::onMount(int state)
{
STUB() << state;
}
/**
* @brief StbEvent::onNetworkStateChange
* @param status
*
* Callback fired on lost/restore local network connection.
*/
void StbEvent::onNetworkStateChange(bool status)
{
STUB() << status;
}
/**
* @brief StbEvent::onScreenSaverActivation
* @param mode
*
* Callback on screensaver activation/deactivation.
*/
void StbEvent::onScreenSaverActivation(bool mode)
{
STUB() << mode;
}
/**
* @brief StbEvent::onScreenSaverOverride
*
* Callback on screensaver activation/deactivation.
*/
void StbEvent::onScreenSaverOverride()
{
STUB();
}
/**
* @brief StbEvent::onWebBrowserProgress
* @param progress
*
* Callback on current web document loading.
* Triggers every time the document loading progress changes.
*/
void StbEvent::onWebBrowserProgress(int progress)
{
STUB() << progress;
}
/**
* @brief StbEvent::onWindowActivated
*
* Callback on browser web window activation.
*/
void StbEvent::onWindowActivated()
{
STUB();
}
int StbEvent::getEventCode()
{
return m_event_code;
}
QString StbEvent::getEventName(StbEvent::Events event)
{
int keyEnumIndex = staticMetaObject.indexOfEnumerator("Events");
return staticMetaObject.enumerator(keyEnumIndex).valueToKey(event);
}