mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-05-04 04:13:49 +00:00
59 lines
2.6 KiB
C++
59 lines
2.6 KiB
C++
/***************************************************************************
|
|
* This file is part of awesome-widgets *
|
|
* *
|
|
* awesome-widgets is free software: you can redistribute it and/or *
|
|
* modify it under the terms of the GNU General Public License as *
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
* License, or (at your option) any later version. *
|
|
* *
|
|
* awesome-widgets is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU General Public License *
|
|
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
|
***************************************************************************/
|
|
|
|
#include "awdataengineaggregator.h"
|
|
|
|
#include <QDBusConnection>
|
|
#include <ksysguard/systemstats/DBusInterface.h>
|
|
|
|
#include "awdebug.h"
|
|
|
|
|
|
AWDataEngineAggregator::AWDataEngineAggregator(QObject *_parent)
|
|
: QObject(_parent)
|
|
{
|
|
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
|
|
|
qDBusRegisterMetaType<KSysGuard::SensorData>();
|
|
qDBusRegisterMetaType<KSysGuard::SensorInfo>();
|
|
qDBusRegisterMetaType<KSysGuard::SensorDataList>();
|
|
qDBusRegisterMetaType<QHash<QString, KSysGuard::SensorInfo>>();
|
|
|
|
m_interface = new KSysGuard::SystemStats::DBusInterface(
|
|
KSysGuard::SystemStats::ServiceName, KSysGuard::SystemStats::ObjectPath, QDBusConnection::sessionBus(), this);
|
|
connect(m_interface, SIGNAL(newSensorData(KSysGuard::SensorDataList)), this,
|
|
SLOT(updateData(KSysGuard::SensorDataList)));
|
|
connect(m_interface, SIGNAL(sensorAdded(const QString &)), this, SLOT(sensorAdded(const QString &)));
|
|
connect(m_interface, SIGNAL(sensorMetaDataChanged(const QHash<QString, KSysGuard::SensorInfo> &)), this,
|
|
SLOT(updateSensor(const QHash<QString, KSysGuard::SensorInfo> &)));
|
|
connect(m_interface, SIGNAL(sensorRemoved(const QString &)), this, SLOT(sensorRemoved(const QString &)));
|
|
}
|
|
|
|
|
|
AWDataEngineAggregator::~AWDataEngineAggregator()
|
|
{
|
|
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
|
|
|
disconnectSources();
|
|
}
|
|
|
|
|
|
void AWDataEngineAggregator::disconnectSources()
|
|
{
|
|
m_interface->unsubscribe(m_sensors.values());
|
|
}
|