| 1 | /* |
| 2 | This file is part of the KDE Project |
| 3 | SPDX-FileCopyrightText: 2008 Sebastian Trueg <trueg@kde.org> |
| 4 | SPDX-FileCopyrightText: 2012-2015 Vishesh Handa <vhanda@kde.org> |
| 5 | |
| 6 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #ifndef BALOO_FILEINDEXER_POWER_STATE_MONITOR_H_ |
| 10 | #define BALOO_FILEINDEXER_POWER_STATE_MONITOR_H_ |
| 11 | |
| 12 | #include <QObject> |
| 13 | |
| 14 | namespace Baloo |
| 15 | { |
| 16 | |
| 17 | class PowerStateMonitor : public QObject |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | |
| 21 | public: |
| 22 | explicit PowerStateMonitor(QObject* parent = nullptr); |
| 23 | |
| 24 | bool isOnBattery() const { |
| 25 | return m_isOnBattery; |
| 26 | } |
| 27 | |
| 28 | Q_SIGNALS: |
| 29 | /** |
| 30 | * Emitted when the power management status changes. |
| 31 | * |
| 32 | * \param conserveResources true if you should conserve resources |
| 33 | */ |
| 34 | void powerManagementStatusChanged(bool conserveResources); |
| 35 | |
| 36 | private Q_SLOTS: |
| 37 | void slotPowerManagementStatusChanged(bool conserveResources); |
| 38 | |
| 39 | private: |
| 40 | bool m_enabled; |
| 41 | bool m_isOnBattery; |
| 42 | }; |
| 43 | } |
| 44 | |
| 45 | #endif |
| 46 | |