File indexing completed on 2024-06-16 05:04:20
0001 /* 0002 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #pragma once 0007 0008 #include <QObject> 0009 0010 class QDBusServiceWatcher; 0011 0012 using InhibitionInfo = QPair<QString, QString>; 0013 0014 class PowerManagementInhibition : public QObject 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit PowerManagementInhibition(QObject *parent = nullptr); 0019 ~PowerManagementInhibition() override; 0020 0021 bool isInhibited() const 0022 { 0023 return m_inhibited; 0024 } 0025 0026 private Q_SLOTS: 0027 void inhibitionsChanged(const QList<InhibitionInfo> &added, const QStringList &removed); 0028 0029 private: 0030 void checkInhibition(); 0031 void update(); 0032 0033 QDBusServiceWatcher *m_solidPowerServiceWatcher; 0034 bool m_serviceRegistered = false; 0035 bool m_inhibited = false; 0036 };