Changeset View
Changeset View
Standalone View
Standalone View
host/abstractbrowserplugin.cpp
Show All 33 Lines | |||||
34 | } | 34 | } | ||
35 | 35 | | |||
36 | void AbstractBrowserPlugin::handleData(const QString& event, const QJsonObject& data) | 36 | void AbstractBrowserPlugin::handleData(const QString& event, const QJsonObject& data) | ||
37 | { | 37 | { | ||
38 | Q_UNUSED(event); | 38 | Q_UNUSED(event); | ||
39 | Q_UNUSED(data); | 39 | Q_UNUSED(data); | ||
40 | } | 40 | } | ||
41 | 41 | | |||
42 | QJsonObject AbstractBrowserPlugin::handleData(int serial, const QString &event, const QJsonObject &data) | ||||
43 | { | ||||
44 | Q_UNUSED(serial); | ||||
45 | Q_UNUSED(event); | ||||
46 | Q_UNUSED(data); | ||||
47 | return QJsonObject(); | ||||
48 | } | ||||
49 | | ||||
42 | void AbstractBrowserPlugin::sendData(const QString &action, const QJsonObject &payload) | 50 | void AbstractBrowserPlugin::sendData(const QString &action, const QJsonObject &payload) | ||
43 | { | 51 | { | ||
44 | QJsonObject data; | 52 | QJsonObject data; | ||
45 | data[QStringLiteral("subsystem")] = m_subsystem; | 53 | data[QStringLiteral("subsystem")] = m_subsystem; | ||
46 | data[QStringLiteral("action")] = action; | 54 | data[QStringLiteral("action")] = action; | ||
47 | if (!payload.isEmpty()) { | 55 | if (!payload.isEmpty()) { | ||
48 | data[QStringLiteral("payload")] = payload; | 56 | data[QStringLiteral("payload")] = payload; | ||
49 | } | 57 | } | ||
50 | Connection::self()->sendData(data); | 58 | Connection::self()->sendData(data); | ||
51 | } | 59 | } | ||
52 | 60 | | |||
61 | void AbstractBrowserPlugin::sendReply(int requestSerial, const QJsonObject &payload) | ||||
62 | { | ||||
63 | QJsonObject data{ | ||||
64 | {QStringLiteral("replyToSerial"), requestSerial}, | ||||
65 | }; | ||||
66 | | ||||
fvogt: IMO printing a warning and maybe not doing anything is more fitting here than an assert which… | |||||
67 | if (!payload.isEmpty()) { | ||||
68 | data.insert(QStringLiteral("payload"), payload); | ||||
69 | } | ||||
70 | | ||||
71 | Connection::self()->sendData(data); | ||||
72 | } | ||||
73 | | ||||
53 | bool AbstractBrowserPlugin::onLoad() | 74 | bool AbstractBrowserPlugin::onLoad() | ||
54 | { | 75 | { | ||
55 | return true; | 76 | return true; | ||
56 | } | 77 | } | ||
57 | 78 | | |||
58 | bool AbstractBrowserPlugin::onUnload() | 79 | bool AbstractBrowserPlugin::onUnload() | ||
59 | { | 80 | { | ||
60 | return true; | 81 | return true; | ||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |
IMO printing a warning and maybe not doing anything is more fitting here than an assert which only works in debug builds and is then fatal.