2025-02-06 12:03:51 +00:00
|
|
|
/*
|
|
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-12-05 16:31:30 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2025-2026 Symless Ltd.
|
2025-02-06 12:03:51 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "DaemonIpcClient.h"
|
|
|
|
|
|
2025-03-19 22:14:27 +00:00
|
|
|
#include "common/Constants.h"
|
2025-02-06 12:03:51 +00:00
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
namespace deskflow::gui::ipc {
|
|
|
|
|
|
2026-03-31 09:06:00 +00:00
|
|
|
DaemonIpcClient::DaemonIpcClient(QObject *parent) : IpcClient(parent, kDaemonIpcName, "daemon")
|
2025-02-06 12:03:51 +00:00
|
|
|
{
|
2025-02-07 17:02:20 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-26 12:34:18 +00:00
|
|
|
void DaemonIpcClient::sendLogLevel(const QString &logLevel)
|
2025-02-07 17:02:20 +00:00
|
|
|
{
|
|
|
|
|
sendMessage("logLevel=" + logLevel);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-26 12:34:18 +00:00
|
|
|
void DaemonIpcClient::sendStartProcess(const QString &command, bool elevate)
|
2025-02-06 13:31:18 +00:00
|
|
|
{
|
2026-03-26 12:34:18 +00:00
|
|
|
const auto elevateStr = elevate ? QStringLiteral("yes") : QStringLiteral("no");
|
|
|
|
|
sendMessage("elevate=" + elevateStr);
|
|
|
|
|
sendMessage("command=" + command);
|
|
|
|
|
sendMessage("start");
|
2025-02-10 11:22:04 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-26 12:34:18 +00:00
|
|
|
void DaemonIpcClient::sendStopProcess()
|
2025-02-10 11:22:04 +00:00
|
|
|
{
|
2026-03-26 12:34:18 +00:00
|
|
|
sendMessage("stop");
|
2025-02-06 13:31:18 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-26 12:34:18 +00:00
|
|
|
void DaemonIpcClient::sendClearSettings()
|
2025-02-06 13:31:18 +00:00
|
|
|
{
|
2026-03-26 12:34:18 +00:00
|
|
|
sendMessage("clearSettings");
|
|
|
|
|
}
|
2025-02-10 12:58:23 +00:00
|
|
|
|
2026-03-26 12:34:18 +00:00
|
|
|
void DaemonIpcClient::requestLogPath()
|
|
|
|
|
{
|
|
|
|
|
sendMessage("logPath");
|
2025-02-06 12:03:51 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-26 12:34:18 +00:00
|
|
|
void DaemonIpcClient::processCommand(const QString &command, const QStringList &parts)
|
2025-03-03 18:01:32 +00:00
|
|
|
{
|
2026-03-26 12:34:18 +00:00
|
|
|
if (command == "logPath" && parts.size() == 2) {
|
|
|
|
|
Q_EMIT logPathReceived(parts[1]);
|
|
|
|
|
}
|
2025-03-03 18:01:32 +00:00
|
|
|
}
|
|
|
|
|
|
2025-02-06 12:03:51 +00:00
|
|
|
} // namespace deskflow::gui::ipc
|