• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

SolidModules

halpower.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
00003     Copyright (C) 2008 Dario Freddi <drf54321@gmail.com>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License version 2 as published by the Free Software Foundation.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 
00019 */
00020 
00021 #ifndef HALPOWER_H
00022 #define HALPOWER_H
00023 
00024 #include <QtDBus/QDBusConnection>
00025 #include <QtDBus/QDBusInterface>
00026 
00027 #include <kdemacros.h>
00028 
00029 #include <solid/devicenotifier.h>
00030 #include <solid/device.h>
00031 #include <solid/button.h>
00032 
00033 #include <solid/control/ifaces/powermanager.h>
00034 
00035 class KDE_EXPORT HalPower : public Solid::Control::Ifaces::PowerManager
00036 {
00037     Q_OBJECT
00038 
00039 public:
00040     HalPower(QObject *parent, const QStringList &args);
00041     virtual ~HalPower();
00042 
00043     virtual QStringList supportedSchemes() const;
00044     virtual QString schemeDescription(const QString &schemeName) const;
00045     virtual QString scheme() const;
00046     virtual bool setScheme(const QString &name);
00047 
00048     virtual Solid::Control::PowerManager::BatteryState batteryState() const;
00049     virtual int batteryChargePercent() const;
00050     virtual int batteryRemainingTime() const;
00051     virtual Solid::Control::PowerManager::AcAdapterState acAdapterState() const;
00052 
00053     virtual Solid::Control::PowerManager::SuspendMethods supportedSuspendMethods() const;
00054     virtual KJob *suspend(Solid::Control::PowerManager::SuspendMethod method) const;
00055 
00056     virtual Solid::Control::PowerManager::CpuFreqPolicies supportedCpuFreqPolicies() const;
00057     virtual Solid::Control::PowerManager::CpuFreqPolicy cpuFreqPolicy() const;
00058     virtual bool setCpuFreqPolicy(Solid::Control::PowerManager::CpuFreqPolicy newPolicy);
00059     virtual bool canDisableCpu(int cpuNum) const;
00060     virtual bool setCpuEnabled(int cpuNum, bool enabled);
00061 
00062     virtual Solid::Control::PowerManager::BrightnessControlsList brightnessControlsAvailable();
00063     virtual float brightness(const QString &device);
00064     virtual bool setBrightness(float brightness, const QString &device);
00065 
00066 private:
00067     void computeAcAdapters();
00068     void computeBatteries();
00069     void computeButtons();
00070 
00071 private slots:
00072     void updateBatteryStats();
00073     void slotPlugStateChanged(bool newState);
00074     void slotButtonPressed(Solid::Button::ButtonType type);
00075     void slotDeviceAdded(const QString &udi);
00076     void slotDeviceRemoved(const QString &udi);
00077     void slotBatteryPropertyChanged(const QMap<QString,int> &changes);
00078 
00079 private:
00080     QMap<QString, Solid::Device *> m_acAdapters;
00081     QMap<QString, Solid::Device *> m_batteries;
00082     QMap<QString, Solid::Device *> m_buttons;
00083 
00084     int m_pluggedAdapterCount;
00085 
00086     int m_currentBatteryCharge;
00087     int m_maxBatteryCharge;
00088     int m_warningBatteryCharge;
00089     int m_lowBatteryCharge;
00090     int m_criticalBatteryCharge;
00091     int m_estimatedBatteryTime;
00092 
00093     mutable QDBusInterface m_halComputer;
00094     mutable QDBusInterface m_halPowerManagement;
00095     mutable QDBusInterface m_halCpuFreq;
00096     mutable QDBusInterface m_halManager;
00097 };
00098 
00099 #endif

SolidModules

Skip menu "SolidModules"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal