put a header that requires the boost libs into a #ifdef

This commit is contained in:
fourtf 2018-04-12 00:33:55 +02:00
parent a221b0757b
commit accb88b78e
2 changed files with 8 additions and 2 deletions

View file

@ -36,6 +36,8 @@ Application::Application()
// XXX // XXX
singletons::SettingManager::getInstance().updateWordTypeMask(); singletons::SettingManager::getInstance().updateWordTypeMask();
singletons::NativeMessagingManager::getInstance().openGuiMessageQueue();
} }
Application::~Application() Application::~Application()

View file

@ -8,7 +8,9 @@
#include <QJsonObject> #include <QJsonObject>
#include <QJsonValue> #include <QJsonValue>
#ifdef BOOSTLIBS
#include <boost/interprocess/ipc/message_queue.hpp> #include <boost/interprocess/ipc/message_queue.hpp>
#endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <QProcess> #include <QProcess>
@ -79,6 +81,7 @@ void NativeMessagingManager::registerHost()
void NativeMessagingManager::openGuiMessageQueue() void NativeMessagingManager::openGuiMessageQueue()
{ {
#ifdef BOOSTLIBS
static ReceiverThread thread; static ReceiverThread thread;
if (thread.isRunning()) { if (thread.isRunning()) {
@ -86,13 +89,14 @@ void NativeMessagingManager::openGuiMessageQueue()
} }
thread.start(); thread.start();
#endif
} }
void NativeMessagingManager::sendToGuiProcess(const QByteArray &array) void NativeMessagingManager::sendToGuiProcess(const QByteArray &array)
{ {
#ifdef BOOSTLIBS #ifdef BOOSTLIBS
writeByteArray("{\"b\": 1}"); writeByteArray("{\"b\": 1}");
ipc::message_queue messageQueue(ipc::open_only, "chatterino_gui"); ipc::message_queue messageQueue(ipc::open_or_create, "chatterino_gui", 100, MESSAGE_SIZE);
writeByteArray("{\"b\": 2}"); writeByteArray("{\"b\": 2}");
try { try {
@ -108,7 +112,7 @@ void NativeMessagingManager::ReceiverThread::run()
#ifdef BOOSTLIBS #ifdef BOOSTLIBS
ipc::message_queue::remove("chatterino_gui"); ipc::message_queue::remove("chatterino_gui");
ipc::message_queue messageQueue(ipc::create_only, "chatterino_gui", 100, MESSAGE_SIZE); ipc::message_queue messageQueue(ipc::open_or_create, "chatterino_gui", 100, MESSAGE_SIZE);
while (true) { while (true) {
try { try {