File indexing completed on 2024-04-28 05:36:16
0001 /* 0002 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QObject> 0010 0011 #include "powerdevilcore_export.h" 0012 0013 namespace PowerDevil 0014 { 0015 class POWERDEVILCORE_EXPORT PowerManagement : public QObject 0016 { 0017 Q_OBJECT 0018 Q_PROPERTY(bool canSuspend READ canSuspend NOTIFY canSuspendChanged) 0019 Q_PROPERTY(bool canHibernate READ canHibernate NOTIFY canHibernateChanged) 0020 Q_PROPERTY(bool canHybridSuspend READ canHybridSuspend NOTIFY canHybridSuspendChanged) 0021 Q_PROPERTY(bool canSuspendThenHibernate READ canSuspendThenHibernate NOTIFY canSuspendThenHibernateChanged) 0022 public: 0023 ~PowerManagement() override; 0024 0025 bool isVirtualMachine(); 0026 bool canSuspend() const; 0027 bool canHibernate() const; 0028 bool canHybridSuspend() const; 0029 bool canSuspendThenHibernate() const; 0030 0031 static PowerManagement *instance(); 0032 0033 public Q_SLOTS: 0034 void suspend(); 0035 void hibernate(); 0036 void hybridSuspend(); 0037 void suspendThenHibernate(); 0038 0039 Q_SIGNALS: 0040 void canSuspendChanged(); 0041 void canSuspendThenHibernateChanged(); 0042 void canHibernateChanged(); 0043 void canHybridSuspendChanged(); 0044 0045 protected: 0046 explicit PowerManagement(); 0047 0048 private: 0049 class Private; 0050 QScopedPointer<Private> d; 0051 }; 0052 0053 } // namespace PowerDevil