refactor: CoreProcess use FileTail::setWatchedFile if the file to tail changes

This commit is contained in:
sithlord48
2026-01-09 16:58:59 -05:00
committed by Nick Bolton
parent 5e61a2b5ce
commit 7f57d53494

View File

@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2025 - 2026 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2024 - 2025 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
@ -135,13 +135,15 @@ void CoreProcess::daemonIpcClientConnected()
applyLogLevel();
const auto logPath = requestDaemonLogPath();
if (!logPath.isEmpty()) {
if (m_daemonFileTail != nullptr) {
disconnect(m_daemonFileTail, &FileTail::newLine, this, &CoreProcess::handleLogLines);
m_daemonFileTail->deleteLater();
}
if (logPath.isEmpty()) {
qWarning() << "daemon no log path";
return;
}
qDebug() << "daemon log path:" << logPath;
qDebug() << "daemon log path:" << logPath;
if (m_daemonFileTail) {
m_daemonFileTail->setWatchedFile(logPath);
} else {
m_daemonFileTail = new FileTail(logPath, this);
connect(m_daemonFileTail, &FileTail::newLine, this, &CoreProcess::handleLogLines);
}