Solid
devicemanager_p.h
Go to the documentation of this file.
00001 /* 00002 Copyright 2005-2007 Kevin Ottens <ervin@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) version 3, or any 00008 later version accepted by the membership of KDE e.V. (or its 00009 successor approved by the membership of KDE e.V.), which shall 00010 act as a proxy defined in Section 6 of version 3 of the license. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef SOLID_DEVICEMANAGER_P_H 00022 #define SOLID_DEVICEMANAGER_P_H 00023 00024 #include "managerbase_p.h" 00025 00026 #include "devicenotifier.h" 00027 00028 #include <QtCore/QMap> 00029 #include <QtCore/QWeakPointer> 00030 #include <QtCore/QSharedData> 00031 #include <QtCore/QThreadStorage> 00032 00033 namespace Solid 00034 { 00035 namespace Ifaces 00036 { 00037 class Device; 00038 } 00039 class DevicePrivate; 00040 00041 00042 class DeviceManagerPrivate : public DeviceNotifier, public ManagerBasePrivate 00043 { 00044 Q_OBJECT 00045 public: 00046 DeviceManagerPrivate(); 00047 ~DeviceManagerPrivate(); 00048 00049 DevicePrivate *findRegisteredDevice(const QString &udi); 00050 00051 private Q_SLOTS: 00052 void _k_deviceAdded(const QString &udi); 00053 void _k_deviceRemoved(const QString &udi); 00054 void _k_destroyed(QObject *object); 00055 00056 private: 00057 Ifaces::Device *createBackendObject(const QString &udi); 00058 00059 QExplicitlySharedDataPointer<DevicePrivate> m_nullDevice; 00060 QMap<QString, QWeakPointer<DevicePrivate> > m_devicesMap; 00061 QMap<QObject *, QString> m_reverseMap; 00062 }; 00063 00064 class DeviceManagerStorage 00065 { 00066 public: 00067 DeviceManagerStorage(); 00068 00069 QList<QObject*> managerBackends(); 00070 DeviceNotifier *notifier(); 00071 00072 private: 00073 void ensureManagerCreated(); 00074 00075 QThreadStorage<DeviceManagerPrivate*> m_storage; 00076 }; 00077 } 00078 00079 00080 #endif
KDE 4.6 API Reference