QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RLocalPeer.h
Go to the documentation of this file.
1 
20 #ifndef RLOCALPEER_H
21 #define RLOCALPEER_H
22 
23 #include "core_global.h"
24 
25 #include <QLocalServer>
26 #include <QLocalSocket>
27 #include <QDir>
28 
29 #include "RLockedFile.h"
30 
31 class QCADCORE_EXPORT RLocalPeer : public QObject {
32  Q_OBJECT
33 
34 public:
35  RLocalPeer(QObject* parent=0, const QString& appId = QString());
36  bool isClient();
37  bool sendMessage(const QString &message, int timeout);
38  QString applicationId() const {
39  return id;
40  }
41 
42 signals:
43  void messageReceived(const QString& message);
44 
45 protected slots:
46  void receiveConnection();
47 
48 protected:
49  QString id;
50  QString socketName;
51  QLocalServer* server;
53 
54 private:
55  static const char* ack;
56 };
57 
58 #endif