[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/powerdevil/daemon
From:       Dario Freddi <drf () kde ! org>
Date:       2010-12-15 13:31:14
Message-ID: 20101215133114.B080BAC8AB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1206695 by dafre:

Add capabilities to the backend, and expose it to the bus

 M  +2 -0      backends/hal/powerdevilhalbackend.cpp  
 M  +3 -0      backends/upower/powerdevilupowerbackend.cpp  
 M  +3 -1      org.kde.Solid.PowerManagement.xml  
 M  +11 -0     powerdevilbackendinterface.cpp  
 M  +20 -0     powerdevilbackendinterface.h  
 M  +5 -0      powerdevilcore.cpp  
 M  +1 -0      powerdevilcore.h  


--- trunk/KDE/kdebase/workspace/powerdevil/daemon/backends/hal/powerdevilhalbackend.cpp \
#1206694:1206695 @@ -69,6 +69,8 @@
 
 void PowerDevilHALBackend::init()
 {
+    setCapabilities(NoCapabilities);
+
     connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(const QString \
&)),  this, SLOT(slotDeviceRemoved(const QString &)));
     connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(const QString &)),
--- trunk/KDE/kdebase/workspace/powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp \
#1206694:1206695 @@ -86,6 +86,9 @@
     m_kbdBacklight = new OrgFreedesktopUPowerKbdBacklightInterface(UPOWER_SERVICE, \
"/org/freedesktop/UPower/KbdBacklight", QDBusConnection::systemBus(), this);  \
m_brightNessControl = new XRandrBrightness();  
+    // Capabilities
+    setCapabilities(SignalResumeFromSuspend);
+
     // devices
     enumerateDevices();
     connect(m_upowerInterface, SIGNAL(Changed()), this, \
                SLOT(slotPropertyChanged()));
--- trunk/KDE/kdebase/workspace/powerdevil/daemon/org.kde.Solid.PowerManagement.xml \
#1206694:1206695 @@ -1,10 +1,12 @@
 <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" \
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">  <node>
   <interface name="org.kde.Solid.PowerManagement">
-    
     <method name="refreshStatus" />
     <method name="reloadCurrentProfile" />
     <method name="reparseConfiguration" />
+    <method name="backendCapabilities">
+      <arg type="u" direction="out" />
+    </method>
     <method name="loadProfile">
       <arg type="s" direction="in" />
     </method>
--- trunk/KDE/kdebase/workspace/powerdevil/daemon/powerdevilbackendinterface.cpp \
#1206694:1206695 @@ -33,6 +33,7 @@
     BatteryState batteryState;
     QHash< BrightnessControlType, float > brightness;
     BrightnessControlsList brightnessControlsAvailable;
+    Capabilities capabilities;
     SuspendMethods suspendMethods;
     QString errorString;
     bool isReady;
@@ -162,6 +163,16 @@
     emit resumeFromSuspend();
 }
 
+BackendInterface::Capabilities BackendInterface::capabilities() const
+{
+    return d->capabilities;
 }
 
+void BackendInterface::setCapabilities(BackendInterface::Capabilities capabilities)
+{
+    d->capabilities = capabilities;
+}
+
+}
+
 #include "powerdevilbackendinterface.moc"
--- trunk/KDE/kdebase/workspace/powerdevil/daemon/powerdevilbackendinterface.h \
#1206694:1206695 @@ -105,6 +105,15 @@
     enum BrightnessKeyType{ Increase, Decrease };
 
     /**
+     * This enum defines capabilities of the backend
+     *
+     * - SignalResumeFromSuspend: The backend is able to stream the @c \
resumeFromSuspend signal accurately +     */
+    enum Capability { NoCapabilities = 0, SignalResumeFromSuspend = 1 };
+
+    Q_DECLARE_FLAGS(Capabilities, Capability)
+
+    /**
      * This struct contains information for a recall notice from the vendor
      */
     struct RecallNotice {
@@ -126,6 +135,12 @@
     virtual void init() = 0;
 
     /**
+     * @returns the capabilities of the backend
+     * @see PowerDevil::BackendInterface::Capability
+     */
+    Capabilities capabilities() const;
+
+    /**
      * Retrieves the current state of the system battery.
      *
      * @return the current battery state
@@ -278,6 +293,8 @@
     void resumeFromSuspend();
 
 protected:
+    void setCapabilities(Capabilities capabilities);
+
     void onBrightnessChanged(BrightnessControlType device, float brightness);
     void setBatteryRemainingTime(qulonglong time);
     void setButtonPressed(PowerDevil::BackendInterface::ButtonType type);
@@ -303,4 +320,7 @@
 
 }
 
+Q_DECLARE_OPERATORS_FOR_FLAGS(PowerDevil::BackendInterface::Capabilities)
+Q_DECLARE_OPERATORS_FOR_FLAGS(PowerDevil::BackendInterface::SuspendMethods)
+
 #endif // POWERDEVIL_BACKENDINTERFACE_H
--- trunk/KDE/kdebase/workspace/powerdevil/daemon/powerdevilcore.cpp #1206694:1206695
@@ -648,6 +648,11 @@
     return m_currentProfile;
 }
 
+uint Core::backendCapabilities()
+{
+    return m_backend->capabilities();
+}
+
 void Core::setBrightness(int percent)
 {
     QVariantMap args;
--- trunk/KDE/kdebase/workspace/powerdevil/daemon/powerdevilcore.h #1206694:1206695
@@ -65,6 +65,7 @@
 public Q_SLOTS:
     void loadCore(PowerDevil::BackendInterface *backend);
     // Set of common action - useful for the DBus interface
+    uint backendCapabilities();
     void refreshStatus();
     void reloadProfile();
     void reloadCurrentProfile();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic