mirror-chatterino2/src/singletons/NativeMessaging.hpp

39 lines
644 B
C++
Raw Normal View History

2018-04-09 22:59:19 +02:00
#pragma once
#include <QThread>
2018-09-17 12:51:16 +02:00
namespace chatterino {
2018-08-02 14:23:27 +02:00
class Application;
class Paths;
2018-09-17 12:51:16 +02:00
void registerNmHost(Paths &paths);
2018-08-02 14:23:27 +02:00
std::string &getNmQueueName(Paths &paths);
class NativeMessagingClient final
2018-04-09 22:59:19 +02:00
{
public:
2018-08-02 14:23:27 +02:00
void sendMessage(const QByteArray &array);
void writeToCout(const QByteArray &array);
};
2018-04-09 22:59:19 +02:00
2018-08-02 14:23:27 +02:00
class NativeMessagingServer final
{
public:
void start();
private:
2018-04-09 22:59:19 +02:00
class ReceiverThread : public QThread
{
public:
void run() override;
private:
void handleMessage(const QJsonObject &root);
2018-04-09 22:59:19 +02:00
};
2018-08-02 14:23:27 +02:00
ReceiverThread thread;
2018-04-09 22:59:19 +02:00
};
} // namespace chatterino