Commit fbb35156 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Cleanup of imported systemstats files

- Use #pragma once for all headers
- Place everything in namespace KSysGuard
- Use the export define from the export header for all headers
parent 1dad4a88
......@@ -23,6 +23,8 @@
#include "SensorContainer.h"
#include <QTimer>
using namespace KSysGuard;
// Add two QVariants together.
//
// This will try to add two QVariants together based on the type of first. This
......
......@@ -18,8 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AGGREGATESENSOR_H
#define AGGREGATESENSOR_H
#pragma once
#include <functional>
......@@ -32,10 +31,15 @@
#include "SensorPlugin.h"
#include "SensorProperty.h"
#include "systemstats_export.h"
namespace KSysGuard
{
/**
* @todo write docs
*/
class Q_DECL_EXPORT AggregateSensor : public SensorProperty
class SYSTEMSTATS_EXPORT AggregateSensor : public SensorProperty
{
Q_OBJECT
......@@ -89,4 +93,4 @@ private:
SensorProperty *m_sensor;
};
#endif // AGGREGATESENSOR_H
} // namespace KSysGuard
......@@ -21,6 +21,8 @@
#include "SensorObject.h"
using namespace KSysGuard;
SensorContainer::SensorContainer(const QString &id, const QString &name, SensorPlugin *parent)
: QObject(parent)
, m_id(id)
......
......@@ -23,13 +23,18 @@
#include "SensorPlugin.h"
#include "systemstats_export.h"
namespace KSysGuard
{
class SensorObject;
/**
* Represents a collection of similar sensors.
* For example: a SensorContainer could represent all CPUs or represent all disks
*/
class Q_DECL_EXPORT SensorContainer : public QObject
class SYSTEMSTATS_EXPORT SensorContainer : public QObject
{
Q_OBJECT
public:
......@@ -83,3 +88,5 @@ private:
QHash<QString, SensorObject *> m_sensorObjects;
friend class SensorObject;
};
} // namespace KSysGuard
......@@ -21,6 +21,8 @@
#include "SensorContainer.h"
using namespace KSysGuard;
SensorObject::SensorObject(const QString &id, SensorContainer *parent)
: SensorObject(id, QString(), parent)
{
......
......@@ -24,6 +24,11 @@
#include "SensorPlugin.h"
#include "SensorProperty.h"
#include "systemstats_export.h"
namespace KSysGuard
{
class SensorContainer;
class SensorObject;
......@@ -31,7 +36,7 @@ class SensorObject;
* Represents a physical or virtual object for example
* A CPU core, or a disk
*/
class Q_DECL_EXPORT SensorObject : public QObject
class SYSTEMSTATS_EXPORT SensorObject : public QObject
{
Q_OBJECT
public:
......@@ -76,3 +81,5 @@ private:
QString m_name;
QHash<QString, SensorProperty *> m_sensors;
};
} // namespace KSysGuard
......@@ -19,6 +19,8 @@
#include "SensorPlugin.h"
using namespace KSysGuard;
SensorPlugin::SensorPlugin(QObject *parent, const QVariantList &args)
: QObject(parent)
{
......
......@@ -16,16 +16,16 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#pragma once
#include <QDateTime>
#include <QDebug>
#include <QObject>
#include <QVariant>
#include <QDBusArgument>
#include "systemstats_export.h"
#include "types.h"
namespace KSysGuard
{
class SensorPlugin;
class SensorContainer;
......@@ -33,7 +33,7 @@ class SensorContainer;
/**
* Base class for plugins
*/
class Q_DECL_EXPORT SensorPlugin : public QObject
class SYSTEMSTATS_EXPORT SensorPlugin : public QObject
{
Q_OBJECT
public:
......@@ -67,3 +67,5 @@ public:
private:
QList<SensorContainer *> m_containers;
};
} // namespace KSysGuard
......@@ -20,6 +20,8 @@
#include "SensorProperty.h"
#include "SensorObject.h"
using namespace KSysGuard;
SensorProperty::SensorProperty(const QString &id, SensorObject *parent)
: SensorProperty(id, QString(), parent)
{
......
......@@ -22,13 +22,18 @@
#include "types.h"
#include <QObject>
#include "systemstats_export.h"
namespace KSysGuard
{
class SensorObject;
/**
* Represents a given value source with attached metadata
* For example, current load for a given CPU core, or a disk capacity
*/
class Q_DECL_EXPORT SensorProperty : public QObject
class SYSTEMSTATS_EXPORT SensorProperty : public QObject
{
Q_OBJECT
public:
......@@ -126,3 +131,5 @@ private:
QVariant m_value;
int m_subscribers = 0;
};
} // namespace KSysGuard
......@@ -21,6 +21,8 @@
#include <QFile>
using namespace KSysGuard;
SysFsSensor::SysFsSensor(const QString& id, const QString& path, SensorObject* parent)
: SensorProperty(id, parent)
{
......
......@@ -22,11 +22,15 @@
#include <QObject>
#include "SensorProperty.h"
#include "systemstats_export.h"
namespace KSysGuard
{
/**
* Convenience subclass of SensorProperty that reads a sysfs file and uses the result as value.
*/
class Q_DECL_EXPORT SysFsSensor : public SensorProperty
class SYSTEMSTATS_EXPORT SysFsSensor : public SensorProperty
{
Q_OBJECT
......@@ -54,3 +58,5 @@ private:
QString m_path;
std::function<QVariant(const QByteArray&)> m_convertFunction;
};
} // namespace KSysGuard
......@@ -17,11 +17,13 @@
Boston, MA 02110-1301, USA.
*/
#ifndef SYSCTLSENSOR_H
#define SYSCTLSENSOR_H
#pragma once
#include <SensorProperty.h>
namespace KSysGuard
{
/**
* Convenience subclass of SensorProperty that reads a value of type T from FreeBSD's sysctl interface
*/
......@@ -87,4 +89,4 @@ void SysctlSensor<T>::update()
}
#endif
#endif
} // namespace KSysGuard
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment