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