Solid

powerbackendloader.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 "powerbackendloader.h"
8#include "backends/abstractacpluggedjob.h"
9#include "backends/dummy/dummyacpluggedjob.h"
10#include "backends/dummy/dummyinhibitionjob.h"
11#include "backends/dummy/dummypowernotifier.h"
12#include "backends/dummy/dummyrequeststatejob.h"
13#include "backends/dummy/dummystatesjob.h"
14#include "backends/freedesktop/fdacpluggedjob.h"
15#include "backends/freedesktop/fdinhibitionjob.h"
16#include "backends/freedesktop/fdpowernotifier.h"
17
18using namespace Solid;
19
20AbstractAcPluggedJob *PowerBackendLoader::AcPluggedJob()
21{
22 if (qgetenv("SOLID_POWER_BACKEND") == "DUMMY") {
23 return new DummyAcPluggedJob();
24 }
25 return new FDAcPluggedJob();
26}
27
28AbstractInhibitionJob *PowerBackendLoader::addInhibitionJob(Power::InhibitionTypes inhibitions, const QString &description)
29{
30 if (qgetenv("SOLID_POWER_BACKEND") == "DUMMY") {
31 return new DummyInhibitionJob(inhibitions, description);
32 }
33 return new FdInhibitionJob(inhibitions, description);
34}
35
36AbstractStatesJob *PowerBackendLoader::statesJob()
37{
38 return new DummyStatesJob();
39}
40
41AbstractRequestStateJob *PowerBackendLoader::requestState()
42{
43 return new DummyRequestStateJob();
44}
45
46PowerNotifier *PowerBackendLoader::notifier()
47{
48 if (qgetenv("SOLID_POWER_BACKEND") == "DUMMY") {
49 return new DummyPowerNotifier();
50 }
51 return new FDPowerNotifier();
52}
The single responsibility of this class is to create arguments valid for logind Inhibit call.
Definition fakebattery.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:56:28 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.