Files
bottomdash/SystemInfo.h
T
2026-09-17 00:32:35 -05:00

42 lines
732 B
C++

#pragma once
#include <QObject>
#include <QTimer>
#include <QString>
class SystemInfo : public QObject
{
Q_OBJECT
Q_PROPERTY(int batteryPercent
READ batteryPercent
NOTIFY batteryPercentChanged)
Q_PROPERTY(bool charging
READ charging
NOTIFY chargingChanged)
public:
explicit SystemInfo(QObject *parent = nullptr);
int batteryPercent() const;
bool charging() const;
signals:
void batteryPercentChanged();
void chargingChanged();
private slots:
void updateBattery();
private:
QString findBatteryCapacityPath() const;
int m_batteryPercent = -1;
QString m_capacityPath;
QTimer m_batteryTimer;
bool m_charging = false;
};