Engines
devicesignalmapper.h
Go to the documentation of this file.00001 /* 00002 * Copyright (C) 2007 Christopher Blauvelt <cblauvelt@gmail.com> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License version 2 as 00006 * published by the Free Software Foundation 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details 00012 * 00013 * You should have received a copy of the GNU Library General Public 00014 * License along with this program; if not, write to the 00015 * Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef DEVICE_SIGNAL_MAPPER_H 00020 #define DEVICE_SIGNAL_MAPPER_H 00021 00022 #include <QObject> 00023 #include <QSignalMapper> 00024 #include <QMap> 00025 00026 #include <KDebug> 00027 00028 #include <solid/devicenotifier.h> 00029 #include <solid/device.h> 00030 #include <solid/processor.h> 00031 #include <solid/block.h> 00032 #include <solid/storageaccess.h> 00033 #include <solid/storagedrive.h> 00034 #include <solid/opticaldrive.h> 00035 #include <solid/storagevolume.h> 00036 #include <solid/opticaldisc.h> 00037 #include <solid/camera.h> 00038 #include <solid/portablemediaplayer.h> 00039 #include <solid/networkinterface.h> 00040 #include <solid/acadapter.h> 00041 #include <solid/battery.h> 00042 #include <solid/button.h> 00043 #include <solid/audiointerface.h> 00044 #include <solid/dvbinterface.h> 00045 #include <solid/video.h> 00046 00047 class DeviceSignalMapper : public QSignalMapper 00048 { 00049 Q_OBJECT 00050 00051 public: 00052 DeviceSignalMapper(QObject *parent=0); 00053 ~DeviceSignalMapper(); 00054 00055 void setMapping(QObject* device, const QString &udi); 00056 00057 Q_SIGNALS: 00058 void deviceChanged(const QString& udi, const QString &property, QVariant value); 00059 00060 protected: 00061 QMap<QObject*, QString> signalmap; 00062 }; 00063 00064 class AcAdapterSignalMapper : public DeviceSignalMapper 00065 { 00066 Q_OBJECT 00067 00068 public: 00069 AcAdapterSignalMapper(QObject *parent=0); 00070 ~AcAdapterSignalMapper(); 00071 00072 public Q_SLOTS: 00073 void plugStateChanged(bool newState); 00074 }; 00075 00076 class ButtonSignalMapper : public DeviceSignalMapper 00077 { 00078 Q_OBJECT 00079 00080 public: 00081 ButtonSignalMapper(QObject *parent=0); 00082 ~ButtonSignalMapper(); 00083 00084 public Q_SLOTS: 00085 void pressed(Solid::Button::ButtonType type); 00086 }; 00087 00088 class BatterySignalMapper : public DeviceSignalMapper 00089 { 00090 Q_OBJECT 00091 00092 public: 00093 BatterySignalMapper(QObject *parent=0); 00094 ~BatterySignalMapper(); 00095 00096 public Q_SLOTS: 00097 void chargePercentChanged(int value); 00098 void chargeStateChanged(int newState); 00099 void plugStateChanged(bool newState); 00100 }; 00101 00102 class StorageAccessSignalMapper : public DeviceSignalMapper 00103 { 00104 Q_OBJECT 00105 00106 public: 00107 StorageAccessSignalMapper(QObject *parent=0); 00108 ~StorageAccessSignalMapper(); 00109 00110 public Q_SLOTS: 00111 void accessibilityChanged(bool accessible); 00112 }; 00113 00114 #endif