Textractor_test/GUI/hostsignaller.cpp

23 lines
773 B
C++
Raw Normal View History

#include "hostsignaller.h"
2018-07-27 13:42:21 +08:00
#include "extensions.h"
void HostSignaller::Initialize()
{
2018-07-26 01:46:59 +08:00
Host::RegisterProcessAttachCallback([&](DWORD pid){ emit AddProcess(pid); });
Host::RegisterProcessDetachCallback([&](DWORD pid){ emit RemoveProcess(pid); });
Host::RegisterThreadCreateCallback([&](TextThread* thread)
{
emit AddThread(thread);
thread->RegisterOutputCallBack([&](TextThread* thread, std::wstring output)
{
2018-07-27 14:16:15 +08:00
output = DispatchSentenceToExtensions(output,
{
{ "current select", ttCombo->currentText().split(":")[0].toInt() == thread->Number() ? 1 : 0 }
});
2018-07-26 01:46:59 +08:00
emit ThreadOutput(thread, QString::fromWCharArray(output.c_str()));
return output;
});
});
Host::RegisterThreadRemoveCallback([&](TextThread* thread){ emit RemoveThread(thread); });
}