Deskflow 1.26.0.134
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IpcServer.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2025-2026 Symless Ltd.
4 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
5 */
6
7#pragma once
8
9#include <QObject>
10#include <QSet>
11
12class QLocalServer;
13class QLocalSocket;
14
15namespace deskflow::core::ipc {
16
17class IpcServer : public QObject
18{
19 Q_OBJECT
20
21public:
22 explicit IpcServer(QObject *parent, const QString &serverName, const QString &typeName);
23 ~IpcServer() override;
24
25 void listen();
26 void broadcastCommand(const QString &command, const QString &args = "");
27
28Q_SIGNALS:
29 void logLevelChanged(const QString &logLevel);
30 void elevateModeChanged(bool elevate);
31 void commandChanged(const QString &command);
35
36protected:
43 void writeToClientSocket(QLocalSocket *&clientSocket, const QString &message) const;
44
45private:
46 void processMessage(QLocalSocket *clientSocket, const QString &message);
47 virtual void processCommand(QLocalSocket *clientSocket, const QString &command, const QStringList &parts) = 0;
48 void handleNewConnection();
49 void handleReadyRead();
50 void handleDisconnected();
51 void handleErrorOccurred();
52
53 QLocalServer *m_server;
54 QSet<QLocalSocket *> m_clients;
55 QString m_serverName;
56 QStringList m_pendingMessages;
57 QByteArray m_typeName;
58};
59
60} // namespace deskflow::core::ipc
void commandChanged(const QString &command)
void broadcastCommand(const QString &command, const QString &args="")
Definition IpcServer.cpp:158
IpcServer(QObject *parent, const QString &serverName, const QString &typeName)
Definition IpcServer.cpp:17
void listen()
Definition IpcServer.cpp:31
void logLevelChanged(const QString &logLevel)
~IpcServer() override
Definition IpcServer.cpp:26
void elevateModeChanged(bool elevate)
void writeToClientSocket(QLocalSocket *&clientSocket, const QString &message) const
Definition IpcServer.cpp:180
Definition DaemonApp.h:20