#pragma once #include #include #include #include class PowerMonitor : public QObject { Q_OBJECT public: explicit PowerMonitor(QObject *parent = nullptr) : QObject(parent) { initLogin1Dbus(); } signals: /* * @brief 发送即将唤醒的信号 */ void aboutToWakeUp(); /* * @brief 发送即将进入睡眠的信号 */ void aboutToSleep(); private slots: /* * @brief 处理睡眠/唤醒信号的槽函数 * @param enteringSleep 是否进入睡眠状态 */ void onPrepareForSleep(bool enteringSleep); private: /* * @brief 初始化Login1 DBus接口 */ void initLogin1Dbus(); QDBusInterface *m_login1Interface = nullptr; };