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 * 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-FileCopyrightText: (C) 2024 - 2025 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/ */
@ -135,13 +135,15 @@ void CoreProcess::daemonIpcClientConnected()
applyLogLevel(); applyLogLevel();
const auto logPath = requestDaemonLogPath(); const auto logPath = requestDaemonLogPath();
if (!logPath.isEmpty()) { if (logPath.isEmpty()) {
if (m_daemonFileTail != nullptr) { qWarning() << "daemon no log path";
disconnect(m_daemonFileTail, &FileTail::newLine, this, &CoreProcess::handleLogLines); return;
m_daemonFileTail->deleteLater(); }
}
qDebug() << "daemon log path:" << logPath; qDebug() << "daemon log path:" << logPath;
if (m_daemonFileTail) {
m_daemonFileTail->setWatchedFile(logPath);
} else {
m_daemonFileTail = new FileTail(logPath, this); m_daemonFileTail = new FileTail(logPath, this);
connect(m_daemonFileTail, &FileTail::newLine, this, &CoreProcess::handleLogLines); connect(m_daemonFileTail, &FileTail::newLine, this, &CoreProcess::handleLogLines);
} }