mirror-chatterino2/src/singletons/NativeMessaging.hpp

39 lines
648 B
C++
Raw Normal View History

2018-04-09 22:59:19 +02:00
#pragma once
#include <QThread>
2018-08-02 14:23:27 +02:00
class Application;
class Paths;
2018-04-09 22:59:19 +02:00
namespace chatterino {
2018-08-02 14:23:27 +02:00
void registerNmHost(Application &app);
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