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-04-08 05:02:16 +00:00
|
|
|
DaemonIpcClient::DaemonIpcClient(QObject *parent) : IpcClient(parent, kDaemonIpcName, QStringLiteral("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
|
|
|
{
|
2026-04-08 05:02:16 +00:00
|
|
|
sendMessage(QStringLiteral("logLevel=%1").arg(logLevel));
|
2025-02-07 17:02:20 +00:00
|
|
|
}
|
|
|
|
|
|
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");
|
2026-04-08 05:02:16 +00:00
|
|
|
sendMessage(QStringLiteral("elevate=%1").arg(elevateStr));
|
|
|
|
|
sendMessage(QStringLiteral("command=%1").arg(command));
|
|
|
|
|
sendMessage(QStringLiteral("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-04-08 05:02:16 +00:00
|
|
|
sendMessage(QStringLiteral("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-04-08 05:02:16 +00:00
|
|
|
sendMessage(QStringLiteral("clearSettings"));
|
2026-03-26 12:34:18 +00:00
|
|
|
}
|
2025-02-10 12:58:23 +00:00
|
|
|
|
2026-03-26 12:34:18 +00:00
|
|
|
void DaemonIpcClient::requestLogPath()
|
|
|
|
|
{
|
2026-04-08 05:02:16 +00:00
|
|
|
sendMessage(QStringLiteral("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-04-08 05:02:16 +00:00
|
|
|
if (command == QStringLiteral("logPath") && parts.size() == 2) {
|
2026-04-08 05:20:02 +00:00
|
|
|
Q_EMIT logPathReceived(parts.at(1));
|
2026-03-26 12:34:18 +00:00
|
|
|
}
|
2025-03-03 18:01:32 +00:00
|
|
|
}
|
|
|
|
|
|
2025-02-06 12:03:51 +00:00
|
|
|
} // namespace deskflow::gui::ipc
|