• Skip to content
  • Skip to link menu
KDE 4.1 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 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License version 2 as published by the Free Software Foundation.
00007 
00008     This library 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 GNU
00011     Library General Public License for more details.
00012 
00013     You should have received a copy of the GNU Library General Public License
00014     along with this library; see the file COPYING.LIB.  If not, write to
00015     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016     Boston, MA 02110-1301, USA.
00017 
00018 */
00019 
00020 #ifndef HALPOWER_H
00021 #define HALPOWER_H
00022 
00023 #include <QtDBus/QDBusConnection>
00024 #include <QtDBus/QDBusInterface>
00025 
00026 #include <kdemacros.h>
00027 
00028 #include <solid/devicenotifier.h>
00029 #include <solid/device.h>
00030 #include <solid/button.h>
00031 
00032 #include <solid/control/ifaces/powermanager.h>
00033 
00034 class KDE_EXPORT HalPower : public Solid::Control::Ifaces::PowerManager
00035 {
00036     Q_OBJECT
00037 
00038 public:
00039     HalPower(QObject *parent, const QStringList &args);
00040     virtual ~HalPower();
00041 
00042     virtual QStringList supportedSchemes() const;
00043     virtual QString schemeDescription(const QString &schemeName) const;
00044     virtual QString scheme() const;
00045     virtual bool setScheme(const QString &name);
00046 
00047     virtual Solid::Control::PowerManager::BatteryState batteryState() const;
00048     virtual int batteryChargePercent() const;
00049     virtual Solid::Control::PowerManager::AcAdapterState acAdapterState() const;
00050 
00051     virtual Solid::Control::PowerManager::SuspendMethods supportedSuspendMethods() const;
00052     virtual KJob *suspend(Solid::Control::PowerManager::SuspendMethod method) const;
00053 
00054     virtual Solid::Control::PowerManager::CpuFreqPolicies supportedCpuFreqPolicies() const;
00055     virtual Solid::Control::PowerManager::CpuFreqPolicy cpuFreqPolicy() const;
00056     virtual bool setCpuFreqPolicy(Solid::Control::PowerManager::CpuFreqPolicy newPolicy);
00057     virtual bool canDisableCpu(int cpuNum) const;
00058     virtual bool setCpuEnabled(int cpuNum, bool enabled);
00059 
00060     virtual Solid::Control::PowerManager::BrightnessControlsList brightnessControlsAvailable();
00061     virtual float brightness(const QString &device);
00062     virtual bool setBrightness(float brightness, const QString &device);
00063 
00064 private:
00065     void computeAcAdapters();
00066     void computeBatteries();
00067     void computeButtons();
00068 
00069 private slots:
00070     void updateBatteryStats();
00071     void slotPlugStateChanged(bool newState);
00072     void slotButtonPressed(Solid::Button::ButtonType type);
00073     void slotDeviceAdded(const QString &udi);
00074     void slotDeviceRemoved(const QString &udi);
00075 
00076 private:
00077     QMap<QString, Solid::Device *> m_acAdapters;
00078     QMap<QString, Solid::Device *> m_batteries;
00079     QMap<QString, Solid::Device *> m_buttons;
00080 
00081     int m_pluggedAdapterCount;
00082 
00083     int m_currentBatteryCharge;
00084     int m_maxBatteryCharge;
00085     int m_warningBatteryCharge;
00086     int m_lowBatteryCharge;
00087     int m_criticalBatteryCharge;
00088 
00089     mutable QDBusInterface m_halComputer;
00090     mutable QDBusInterface m_halPowerManagement;
00091     mutable QDBusInterface m_halCpuFreq;
00092     mutable QDBusInterface m_halManager;
00093 };
00094 
00095 #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
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
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