mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 12:47:44 +00:00
Changes the PID parameter to qint64 to be consistent with KProcessList and QProcess. Also adds a QObject parent parameter.
25 lines
No EOL
693 B
C++
25 lines
No EOL
693 B
C++
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "processwatcher.h"
|
|
|
|
#include <KProcessList>
|
|
|
|
#include "moc_processwatcher.cpp"
|
|
|
|
ProcessWatcher::ProcessWatcher(const qint64 PID, QObject *parent)
|
|
: QObject(parent)
|
|
{
|
|
m_timer = new QTimer(this);
|
|
connect(m_timer, &QTimer::timeout, this, [this, PID] {
|
|
const auto info = KProcessList::processInfo(PID);
|
|
// If we can't find the PID, bail!
|
|
if (!info.isValid()) {
|
|
m_timer->stop();
|
|
deleteLater();
|
|
Q_EMIT finished();
|
|
}
|
|
});
|
|
m_timer->setInterval(std::chrono::seconds(5));
|
|
m_timer->start();
|
|
} |