blob: 67a0d42e2c90565759c33cc67a081018f9b0b4f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <qtlockedfile.h>
#include <QLocalServer>
#include <QLocalSocket>
#include <QDir>
namespace SharedTools {
class QtLocalPeer : public QObject
{
Q_OBJECT
public:
explicit QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
bool isClient();
bool sendMessage(const QString &message, int timeout, bool block);
QString applicationId() const
{ return id; }
static QString appSessionId(const QString &appId);
Q_SIGNALS:
void messageReceived(const QString &message, QObject *socket);
protected:
void receiveConnection();
QString id;
QString socketName;
QLocalServer* server;
QtLockedFile lockFile;
};
} // namespace SharedTools
|