Deskflow
1.26.0.418
Keyboard and mouse sharing utility
Toggle main menu visibility
Loading...
Searching...
No Matches
IpcClient.h
Go to the documentation of this file.
1
/*
2
* Deskflow -- mouse and keyboard sharing utility
3
* SPDX-FileCopyrightText: (C) 2025-2026 Synergy App Ltd
4
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
5
*/
6
7
#pragma once
8
9
#include <QObject>
10
11
class
QLocalSocket;
12
13
namespace
deskflow::gui::ipc
{
14
15
class
IpcClient
:
public
QObject
16
{
17
Q_OBJECT
18
19
// Represents underlying socket state and whether the server responded to the hello message.
20
enum class
State
21
{
22
Unconnected,
23
Connecting,
24
Connected,
25
Disconnecting,
26
};
27
28
public
:
29
explicit
IpcClient
(QObject *parent,
const
QString &socketName,
const
QString &typeName);
30
void
connectToServer
();
31
void
disconnectFromServer
();
32
33
bool
isConnected
()
const
34
{
35
return
m_state == State::Connected;
36
}
37
38
Q_SIGNALS:
39
void
connected
();
40
void
connectionFailed
();
41
void
serverShutdown
();
42
void
versionMismatch
();
43
44
private
Q_SLOTS:
45
void
handleDisconnected();
46
void
handleErrorOccurred();
47
void
handleReadyRead();
48
49
protected
:
50
virtual
void
processCommand
(
const
QString &command,
const
QStringList &parts)
51
{
52
Q_UNUSED(command)
53
Q_UNUSED(parts)
54
}
55
56
void
sendMessage
(
const
QString &message);
57
58
private
:
59
void
attemptConnection();
60
void
handleHandshakeMessage(
const
QStringList &parts);
61
62
QLocalSocket *m_socket;
63
State m_state{State::Unconnected};
64
QString m_socketName;
65
QByteArray m_readBuffer;
66
int
m_retryCount{0};
67
QString m_typeName;
68
};
69
70
}
// namespace deskflow::gui::ipc
deskflow::gui::ipc::IpcClient::isConnected
bool isConnected() const
Definition
IpcClient.h:33
deskflow::gui::ipc::IpcClient::versionMismatch
void versionMismatch()
deskflow::gui::ipc::IpcClient::connectToServer
void connectToServer()
Definition
IpcClient.cpp:28
deskflow::gui::ipc::IpcClient::connectionFailed
void connectionFailed()
deskflow::gui::ipc::IpcClient::IpcClient
IpcClient(QObject *parent, const QString &socketName, const QString &typeName)
Definition
IpcClient.cpp:17
deskflow::gui::ipc::IpcClient::disconnectFromServer
void disconnectFromServer()
Definition
IpcClient.cpp:95
deskflow::gui::ipc::IpcClient::serverShutdown
void serverShutdown()
deskflow::gui::ipc::IpcClient::connected
void connected()
deskflow::gui::ipc::IpcClient::processCommand
virtual void processCommand(const QString &command, const QStringList &parts)
Definition
IpcClient.h:50
deskflow::gui::ipc::IpcClient::sendMessage
void sendMessage(const QString &message)
Definition
IpcClient.cpp:206
deskflow::gui::ipc
Definition
CoreProcess.h:22
src
lib
gui
ipc
IpcClient.h
Generated by
1.18.0