Solid
battery.h
Go to the documentation of this file.
00001 /* 00002 Copyright 2006-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_BATTERY_H 00022 #define SOLID_BATTERY_H 00023 00024 #include <solid/solid_export.h> 00025 00026 #include <solid/deviceinterface.h> 00027 00028 namespace Solid 00029 { 00030 class BatteryPrivate; 00031 class Device; 00032 00036 class SOLID_EXPORT Battery : public DeviceInterface 00037 { 00038 Q_OBJECT 00039 Q_ENUMS(BatteryType ChargeState) 00040 Q_PROPERTY(bool plugged READ isPlugged) 00041 Q_PROPERTY(BatteryType type READ type) 00042 Q_PROPERTY(int chargePercent READ chargePercent) 00043 Q_PROPERTY(bool rechargeable READ isRechargeable) 00044 Q_PROPERTY(ChargeState chargeState READ chargeState) 00045 Q_DECLARE_PRIVATE(Battery) 00046 friend class Device; 00047 00048 public: 00063 enum BatteryType { UnknownBattery, PdaBattery, UpsBattery, 00064 PrimaryBattery, MouseBattery, KeyboardBattery, 00065 KeyboardMouseBattery, CameraBattery, 00066 PhoneBattery, MonitorBattery }; 00067 00076 enum ChargeState { NoCharge, Charging, Discharging }; 00077 00078 00079 private: 00088 explicit Battery(QObject *backendObject); 00089 00090 public: 00094 virtual ~Battery(); 00095 00096 00103 static Type deviceInterfaceType() { return DeviceInterface::Battery; } 00104 00110 bool isPlugged() const; 00111 00118 BatteryType type() const; 00119 00120 00121 00128 int chargePercent() const; 00129 00130 00131 00137 bool isRechargeable() const; 00138 00146 ChargeState chargeState() const; 00147 00148 Q_SIGNALS: 00156 void chargePercentChanged(int value, const QString &udi); 00157 00167 void chargeStateChanged(int newState, const QString &udi); 00168 00176 void plugStateChanged(bool newState, const QString &udi); 00177 }; 00178 } 00179 00180 #endif
KDE 4.6 API Reference