File indexing completed on 2024-04-28 04:00:49

0001 /*
0002     SPDX-FileCopyrightText: 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef ABSTRACT_INHIBITION_H
0008 #define ABSTRACT_INHIBITION_H
0009 
0010 #include <QObject>
0011 
0012 #include <solid/power/inhibition.h>
0013 
0014 namespace Solid
0015 {
0016 /**
0017  * Represents an inhibition, allows to stop and start it
0018  *
0019  * When implementing this class take into account that the
0020  * inhibition should be stopped upon object deletion, so
0021  * stateChanged should be emitted on it
0022  */
0023 class AbstractInhibition : public QObject
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit AbstractInhibition(QObject *parent = nullptr)
0028         : QObject(parent)
0029     {
0030     }
0031     virtual ~AbstractInhibition()
0032     {
0033     }
0034 
0035     virtual void start() = 0;
0036     virtual void stop() = 0;
0037     virtual Inhibition::State state() const = 0;
0038 
0039 Q_SIGNALS:
0040     void stateChanged(Inhibition::State state);
0041 };
0042 } // Solid nanmespace
0043 #endif // ABSTRACT_INHIBITION_H