systemmonitor: Add Qt6 support

master
Simon Stürz 2025-08-08 16:46:02 +02:00
parent 5d06bdbac1
commit 09b0855045
3 changed files with 15 additions and 12 deletions

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -31,7 +31,11 @@
#include "integrationpluginsystemmonitor.h"
#include "plugininfo.h"
#include <plugintimer.h>
#include <QStorageInfo>
#include <QRegularExpression>
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <unistd.h>
@ -309,7 +313,7 @@ qint32 IntegrationPluginSystemMonitor::getPidByName(const QString &processName)
continue;
}
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);
// names in /proc/<pid>/status are trimmed to 15 characters...
if (processName.left(15) == line.left(15)) {

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -31,8 +31,7 @@
#ifndef INTEGRATIONPLUGINSYSTEMMONITOR_H
#define INTEGRATIONPLUGINSYSTEMMONITOR_H
#include "integrations/integrationplugin.h"
#include "plugintimer.h"
#include <integrations/integrationplugin.h>
#include <QDebug>
#include <QProcess>
@ -40,6 +39,8 @@
#include "extern-plugininfo.h"
class PluginTimer;
class IntegrationPluginSystemMonitor: public IntegrationPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationpluginsystemmonitor.json")
@ -66,9 +67,9 @@ private:
private:
PluginTimer *m_refreshTimer = nullptr;
QHash<Thing*, qulonglong> m_oldTotalJiffies;
QHash<Thing*, qulonglong> m_oldWorkJiffies;
QHash<Thing*, qulonglong> m_oldProcessWorkJiffies;
QHash<Thing *, qulonglong> m_oldTotalJiffies;
QHash<Thing *, qulonglong> m_oldWorkJiffies;
QHash<Thing *, qulonglong> m_oldProcessWorkJiffies;
};

View File

@ -1,9 +1,7 @@
include(../plugins.pri)
TARGET = $$qtLibraryTarget(nymea_integrationpluginsystemmonitor)
SOURCES += \
integrationpluginsystemmonitor.cpp \
integrationpluginsystemmonitor.cpp
HEADERS += \
integrationpluginsystemmonitor.h \
integrationpluginsystemmonitor.h