forked from c42f/displaz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHookFormatter.cpp
29 lines (23 loc) · 977 Bytes
/
HookFormatter.cpp
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
// Copyright 2015, Christopher J. Foster and the other displaz contributors.
// Use of this code is governed by the BSD-style license found in LICENSE.txt
#include "HookFormatter.h"
#include "IpcChannel.h"
#include "PointViewerMainWindow.h"
HookFormatter::HookFormatter(PointViewerMainWindow* getPayload, QByteArray hookSpec,
QByteArray hookPayload, QObject* parent)
: QObject(parent),
m_hookSpec(hookSpec),
m_hookPayload(hookPayload),
m_getPayload(getPayload),
m_eventId(0)
{
connect(this, SIGNAL(sendIpcMessage(QByteArray)), parent, SLOT(sendMessage(QByteArray)));
connect(parent, SIGNAL(disconnected()), this, SLOT(channelDisconnected()));
}
/// Get payload and dispatch signal to IpcChannel
void HookFormatter::hookActivated()
{
QByteArray hookPayload = m_getPayload->hookPayload(m_hookPayload);
QByteArray message = m_hookSpec + " " + hookPayload + "\n";
emit sendIpcMessage(message);
}