70 lines
1.6 KiB
C++
Executable File
70 lines
1.6 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Gui Plugin for Battery Monitor
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
# Created by Mike Wille, NLE, 2019-01-21
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <PluginInterfaces/gui_plugin_interface.h>
|
|
#include <Plugins/Battery/bat_gui_plugin_interface.h>
|
|
|
|
#include <QTimer>
|
|
|
|
namespace LtsNotification { class LtsNotification; }
|
|
|
|
|
|
namespace Battery
|
|
{
|
|
|
|
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
|
{
|
|
Q_PLUGIN_METADATA(IID "gui:3:bat")
|
|
Q_INTERFACES(GuiPluginBase::Plugin)
|
|
|
|
Q_OBJECT
|
|
public:
|
|
explicit GuiPlugin() = default;
|
|
~GuiPlugin() = default;
|
|
|
|
QString pluginName() override { return QLatin1String("BatteryGuiPlugin"); }
|
|
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 getBatteryStatus(bool &hasAC, uint8_t &charge, int32_t &lifetime);
|
|
void checkWlanStatus();
|
|
void setWlanStatus(bool isConnected);
|
|
|
|
LtsNotification::LtsNotification *m_noti;
|
|
LtsNotification::LtsNotification *m_notiWlan;
|
|
|
|
bool m_warnedLow;
|
|
bool m_warnedCritical;
|
|
|
|
QString m_issi;
|
|
int m_signal;
|
|
QTimer m_timer;
|
|
|
|
private slots:
|
|
void slotCheckBatteryStatus();
|
|
|
|
};
|
|
|
|
} // namespace ExerciseManagement
|