Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for Free Space Monitor
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLTE, 2020-11-22
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/FreeSpace/fsp_gui_plugin_interface.h>
|
||||
#include <Plugins/AssetManagement/asm_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace LtsNotification { class LtsNotification; }
|
||||
|
||||
|
||||
namespace FreeSpace
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:fsp")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("FreeSpaceGuiPlugin"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType) const override { return true; }
|
||||
};
|
||||
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
bool availableInPartition(IDL::PartitionType) const override { return true; }
|
||||
|
||||
public slots:
|
||||
void onInitDone();
|
||||
|
||||
private:
|
||||
bool onStatusHDD(quint64 &freeSpaceBytes, double &usedSpacePercent);
|
||||
bool onStatusRAM(unsigned long &freeRamKbytes, double &usedRamPercent);
|
||||
QString readableSize(const quint64 bytes) const;
|
||||
|
||||
LtsNotification::LtsNotification *m_notiStatusRam{nullptr};
|
||||
LtsNotification::LtsNotification *m_notiStatusHdd{nullptr};
|
||||
|
||||
private:
|
||||
static const quint64 BYTE = 1;
|
||||
static const quint64 KB = 1024 * BYTE;
|
||||
static const quint64 MB = 1024 * KB;
|
||||
static const quint64 GB = 1024 * MB;
|
||||
static const quint64 TB = 1024 * GB;
|
||||
|
||||
private slots:
|
||||
void slotCheckFreeRamStatus();
|
||||
void slotCheckFreeSpaceStatus();
|
||||
};
|
||||
|
||||
} // namespace ExerciseManagement
|
||||
Reference in new issue
Block a user