Solid

inhibition.cpp
1/*
2 SPDX-FileCopyrightText: 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "inhibition.h"
8#include "backends/abstractinhibition.h"
9
10using namespace Solid;
11
12class Solid::InhibitionPrivate
13{
14public:
15 AbstractInhibition *backendObject;
16};
17
19 : QObject(parent)
20 , d_ptr(new InhibitionPrivate)
21{
22 d_ptr->backendObject = backend;
23 connect(d_ptr->backendObject, &AbstractInhibition::stateChanged, this, &Inhibition::stateChanged);
24}
25
26Inhibition::~Inhibition()
27{
28 delete d_ptr->backendObject;
29 delete d_ptr;
30}
31
33{
34 d_ptr->backendObject->start();
35}
36
38{
39 d_ptr->backendObject->stop();
40}
41
42Inhibition::State Inhibition::state() const
43{
44 return d_ptr->backendObject->state();
45}
46
47#include "moc_inhibition.cpp"
Represents an inhibition, allows to stop and start it.
void stop()
Stops the inhibition.
void start()
Starts the inhibition.
Inhibition(AbstractInhibition *backend, QObject *parent=nullptr)
This is meant to be instantiated by backends only.
The single responsibility of this class is to create arguments valid for logind Inhibit call.
Definition fakebattery.h:16
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.