File indexing completed on 2024-05-12 17:00:14

0001 /*
0002     SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef DISKS_H
0008 #define DISKS_H
0009 
0010 #include <QObject>
0011 #include <QElapsedTimer>
0012 
0013 #include "systemstats/SensorPlugin.h"
0014 
0015 namespace Solid {
0016     class Device;
0017     class StorageVolume;
0018 }
0019 
0020 class VolumeObject;
0021 
0022 class DisksPlugin : public KSysGuard::SensorPlugin
0023 
0024 {
0025     Q_OBJECT
0026 public:
0027     DisksPlugin(QObject *parent, const QVariantList &args);
0028     QString providerName() const override
0029     {
0030         return QStringLiteral("disks");
0031     }
0032     ~DisksPlugin() override;
0033 
0034     void update() override;
0035 
0036 
0037 private:
0038     void addDevice(const Solid::Device &device);
0039     void addAggregateSensors();
0040     void createAccessibleVolumeObject(const Solid::Device &device);
0041 
0042     QHash<QString, VolumeObject*> m_volumesByDevice;
0043     QElapsedTimer m_elapsedTimer;
0044 };
0045 
0046 #endif