Solid

managerbase.cpp
1/*
2 SPDX-FileCopyrightText: 2006-2007 Kevin Ottens <ervin@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 "managerbase_p.h"
8
9#include <stdlib.h>
10
11#include <config-backends.h>
12
13// do *not* use other defines than BUILD_DEVICE_BACKEND_$backend to include
14// the managers, and keep an alphabetical order
15#ifdef BUILD_DEVICE_BACKEND_fakehw
16#include "backends/fakehw/fakemanager.h"
17#endif
18#ifdef BUILD_DEVICE_BACKEND_fstab
19#include "backends/fstab/fstabmanager.h"
20#endif
21#ifdef BUILD_DEVICE_BACKEND_imobile
22#include "backends/imobile/imobilemanager.h"
23#endif
24#ifdef BUILD_DEVICE_BACKEND_iokit
25#include "backends/iokit/iokitmanager.h"
26#endif
27#ifdef BUILD_DEVICE_BACKEND_udev
28#include "backends/udev/udevmanager.h"
29#endif
30#ifdef BUILD_DEVICE_BACKEND_udisks2
31#include "backends/udisks2/udisksmanager.h"
32#endif
33#ifdef BUILD_DEVICE_BACKEND_upower
34#include "backends/upower/upowermanager.h"
35#endif
36#ifdef BUILD_DEVICE_BACKEND_win
37#include "backends/win/windevicemanager.h"
38#endif
39
40Solid::ManagerBasePrivate::ManagerBasePrivate()
41{
42}
43
44Solid::ManagerBasePrivate::~ManagerBasePrivate()
45{
46 qDeleteAll(m_backends);
47}
48
49// do *not* use other defines than BUILD_DEVICE_BACKEND_$backend to add
50// the managers, and keep an alphabetical order
51void Solid::ManagerBasePrivate::loadBackends()
52{
53 QString solidFakeXml(QString::fromLocal8Bit(qgetenv("SOLID_FAKEHW")));
54
55 if (!solidFakeXml.isEmpty()) {
56#ifdef BUILD_DEVICE_BACKEND_fakehw
57 m_backends << new Solid::Backends::Fake::FakeManager(nullptr, solidFakeXml);
58#endif
59 } else {
60#ifdef BUILD_DEVICE_BACKEND_fstab
61 m_backends << new Solid::Backends::Fstab::FstabManager(nullptr);
62#endif
63#ifdef BUILD_DEVICE_BACKEND_imobile
64 m_backends << new Solid::Backends::IMobile::Manager(nullptr);
65#endif
66#ifdef BUILD_DEVICE_BACKEND_iokit
67 m_backends << new Solid::Backends::IOKit::IOKitManager(nullptr);
68#endif
69#ifdef BUILD_DEVICE_BACKEND_udev
70 m_backends << new Solid::Backends::UDev::UDevManager(nullptr);
71#endif
72#ifdef BUILD_DEVICE_BACKEND_udisks2
73 if (!qEnvironmentVariableIsSet("SOLID_DISABLE_UDISKS2")) {
74 m_backends << new Solid::Backends::UDisks2::Manager(nullptr);
75 }
76#endif
77#ifdef BUILD_DEVICE_BACKEND_upower
78 if (!qEnvironmentVariableIsSet("SOLID_DISABLE_UPOWER")) {
79 m_backends << new Solid::Backends::UPower::UPowerManager(nullptr);
80 }
81#endif
82#ifdef BUILD_DEVICE_BACKEND_win
83 m_backends << new Solid::Backends::Win::WinDeviceManager(nullptr);
84#endif
85 }
86}
87
88QList<QObject *> Solid::ManagerBasePrivate::managerBackends() const
89{
90 return m_backends;
91}
a Fake manager that read a device list from a XML file.
Definition fakemanager.h:31
QString fromLocal8Bit(QByteArrayView str)
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.