File indexing completed on 2024-04-28 16:45:08
0001 /* 0002 SPDX-FileCopyrightText: 2012 Alejandro Fiestas Olivares <afiestas@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDED_DEVICE_H 0008 #define KDED_DEVICE_H 0009 0010 #include <QObject> 0011 0012 class QDBusPendingCallWatcher; 0013 class QDBusInterface; 0014 class OrgFreedesktopDBusPropertiesInterface; 0015 0016 class Device : public QObject 0017 { 0018 Q_OBJECT 0019 public: 0020 static Device *self(); 0021 static void destroy(); 0022 0023 bool isReady() const; 0024 bool isLaptop() const; 0025 bool isLidClosed() const; 0026 0027 private Q_SLOTS: 0028 void changed(); 0029 void isLaptopFetched(QDBusPendingCallWatcher *watcher); 0030 void isLidClosedFetched(QDBusPendingCallWatcher *watcher); 0031 0032 Q_SIGNALS: 0033 void ready(); 0034 void lidClosedChanged(bool closed); 0035 void resumingFromSuspend(); 0036 void aboutToSuspend(); 0037 0038 private: 0039 explicit Device(QObject *parent = nullptr); 0040 ~Device() override; 0041 0042 void setReady(); 0043 void fetchIsLaptop(); 0044 void fetchLidIsClosed(); 0045 0046 bool m_isReady; 0047 bool m_isLaptop; 0048 bool m_isLidClosed; 0049 0050 static Device *m_instance; 0051 0052 OrgFreedesktopDBusPropertiesInterface *m_freedesktop; 0053 QDBusInterface *m_suspendSession; 0054 }; 0055 0056 #endif // KDED_DEVICE_H