File indexing completed on 2024-05-19 04:03:21

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 #include "powerbackendloader.h"
0008 #include "backends/abstractacpluggedjob.h"
0009 #include "backends/dummy/dummyacpluggedjob.h"
0010 #include "backends/dummy/dummyinhibitionjob.h"
0011 #include "backends/dummy/dummypowernotifier.h"
0012 #include "backends/dummy/dummyrequeststatejob.h"
0013 #include "backends/dummy/dummystatesjob.h"
0014 #include "backends/freedesktop/fdacpluggedjob.h"
0015 #include "backends/freedesktop/fdinhibitionjob.h"
0016 #include "backends/freedesktop/fdpowernotifier.h"
0017 
0018 using namespace Solid;
0019 
0020 AbstractAcPluggedJob *PowerBackendLoader::AcPluggedJob()
0021 {
0022     if (qgetenv("SOLID_POWER_BACKEND") == "DUMMY") {
0023         return new DummyAcPluggedJob();
0024     }
0025     return new FDAcPluggedJob();
0026 }
0027 
0028 AbstractInhibitionJob *PowerBackendLoader::addInhibitionJob(Power::InhibitionTypes inhibitions, const QString &description)
0029 {
0030     if (qgetenv("SOLID_POWER_BACKEND") == "DUMMY") {
0031         return new DummyInhibitionJob(inhibitions, description);
0032     }
0033     return new FdInhibitionJob(inhibitions, description);
0034 }
0035 
0036 AbstractStatesJob *PowerBackendLoader::statesJob()
0037 {
0038     return new DummyStatesJob();
0039 }
0040 
0041 AbstractRequestStateJob *PowerBackendLoader::requestState()
0042 {
0043     return new DummyRequestStateJob();
0044 }
0045 
0046 PowerNotifier *PowerBackendLoader::notifier()
0047 {
0048     if (qgetenv("SOLID_POWER_BACKEND") == "DUMMY") {
0049         return new DummyPowerNotifier();
0050     }
0051     return new FDPowerNotifier();
0052 }