systemmonitor: Add Qt6 support
This commit is contained in:
parent
5d06bdbac1
commit
09b0855045
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -31,7 +31,11 @@
|
|||||||
#include "integrationpluginsystemmonitor.h"
|
#include "integrationpluginsystemmonitor.h"
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
|
|
||||||
|
#include <plugintimer.h>
|
||||||
|
|
||||||
#include <QStorageInfo>
|
#include <QStorageInfo>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -309,7 +313,7 @@ qint32 IntegrationPluginSystemMonitor::getPidByName(const QString &processName)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QString line = statusFile.readLine().trimmed();
|
QString line = statusFile.readLine().trimmed();
|
||||||
line.remove(QRegExp("Name:(\\s)*"));
|
line.remove(QRegularExpression("Name:(\\s)*"));
|
||||||
// qCDebug(dcSystemMonitor()) << "Found process:" << line << "looking for" << processName.left(15);
|
// qCDebug(dcSystemMonitor()) << "Found process:" << line << "looking for" << processName.left(15);
|
||||||
// names in /proc/<pid>/status are trimmed to 15 characters...
|
// names in /proc/<pid>/status are trimmed to 15 characters...
|
||||||
if (processName.left(15) == line.left(15)) {
|
if (processName.left(15) == line.left(15)) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -31,8 +31,7 @@
|
|||||||
#ifndef INTEGRATIONPLUGINSYSTEMMONITOR_H
|
#ifndef INTEGRATIONPLUGINSYSTEMMONITOR_H
|
||||||
#define INTEGRATIONPLUGINSYSTEMMONITOR_H
|
#define INTEGRATIONPLUGINSYSTEMMONITOR_H
|
||||||
|
|
||||||
#include "integrations/integrationplugin.h"
|
#include <integrations/integrationplugin.h>
|
||||||
#include "plugintimer.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -40,6 +39,8 @@
|
|||||||
|
|
||||||
#include "extern-plugininfo.h"
|
#include "extern-plugininfo.h"
|
||||||
|
|
||||||
|
class PluginTimer;
|
||||||
|
|
||||||
class IntegrationPluginSystemMonitor: public IntegrationPlugin {
|
class IntegrationPluginSystemMonitor: public IntegrationPlugin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationpluginsystemmonitor.json")
|
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationpluginsystemmonitor.json")
|
||||||
@ -66,9 +67,9 @@ private:
|
|||||||
private:
|
private:
|
||||||
PluginTimer *m_refreshTimer = nullptr;
|
PluginTimer *m_refreshTimer = nullptr;
|
||||||
|
|
||||||
QHash<Thing*, qulonglong> m_oldTotalJiffies;
|
QHash<Thing *, qulonglong> m_oldTotalJiffies;
|
||||||
QHash<Thing*, qulonglong> m_oldWorkJiffies;
|
QHash<Thing *, qulonglong> m_oldWorkJiffies;
|
||||||
QHash<Thing*, qulonglong> m_oldProcessWorkJiffies;
|
QHash<Thing *, qulonglong> m_oldProcessWorkJiffies;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_integrationpluginsystemmonitor)
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrationpluginsystemmonitor.cpp \
|
integrationpluginsystemmonitor.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
integrationpluginsystemmonitor.h \
|
integrationpluginsystemmonitor.h
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user