1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
/*
SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "memory.h"
#include "backend.h"
#if defined Q_OS_LINUX
#include "linuxbackend.h"
#elif defined Q_OS_FREEBSD
#include "freebsdbackend.h"
#endif
#include <systemstats/SensorContainer.h>
#include <KLocalizedString>
#include <KPluginFactory>
MemoryPlugin::MemoryPlugin(QObject *parent, const QVariantList &args)
: SensorPlugin(parent, args)
{
auto container = new KSysGuard::SensorContainer(QStringLiteral("memory"), i18nc("@title", "Memory"), this);
#if defined Q_OS_LINUX
m_backend = std::make_unique<LinuxMemoryBackend>(container);
#elif defined Q_OS_FREEBSD
m_backend = std::make_unique<FreeBsdMemoryBackend>(container);
#endif
m_backend->initSensors();
}
MemoryPlugin::~MemoryPlugin() = default;
void MemoryPlugin::update()
{
m_backend->update();
}
K_PLUGIN_CLASS_WITH_JSON(MemoryPlugin, "metadata.json")
#include "memory.moc"
#include "moc_memory.cpp"
|