xref: /glogg/src/socketexternalcom.h (revision 0374f408d6901d76d0f8276791479179a8fc215d)
1 #ifndef SOCKETEXTERNALCOM_H
2 #define SOCKETEXTERNALCOM_H
3 
4 #include "externalcom.h"
5 
6 #include <QLocalServer>
7 #include <QSharedMemory>
8 
9 class SocketExternalInstance : public ExternalInstance
10 {
11 public:
12     SocketExternalInstance();
13 
14     void loadFile( const QString& file_name ) const override;
15     uint32_t getVersion() const override;
16 private:
17     QSharedMemory* memory_;
18 };
19 
20 class SocketExternalCommunicator : public ExternalCommunicator
21 {
22     Q_OBJECT
23 public:
24     SocketExternalCommunicator();
25     ~SocketExternalCommunicator();
26 
27     ExternalInstance* otherInstance() const override;
28     void startListening() override;
29 
30 public slots:
31     qint32 version() const override;
32 
33 private slots:
34     void onConnection();
35 
36 private:
37      QSharedMemory* memory_;
38      QLocalServer* server_;
39 };
40 
41 #endif // SOCKETEXTERNALCOM_H
42