View Single Post
Posts: 180 | Thanked: 76 times | Joined on May 2010
#3
PHP Code:
#include <mce/dbus-names.h>
#include <mce/mode-names.h>

static QDBusConnection dBusConnection QDBusConnection::systemBus();

MCE::MCE(QObject *parent)
    : 
QObject(parent)
{

    
dBusInterface = new QDBusInterface(MCE_SERVICEMCE_REQUEST_PATH,
                                       
MCE_REQUEST_IFdBusConnectionthis);

    
dBusConnection.connect(MCE_SERVICEMCE_SIGNAL_PATHMCE_SIGNAL_IF,
                           
MCE_DISPLAY_SIGthisSLOT(displayStateChanged(const QDBusMessage &)));

    
dBusInterface->callWithCallback(MCE_DISPLAY_STATUS_GETQList<QVariant>(), this,
                                      
SLOT(setDisplayState(QString)),
                                      
SLOT(displayStateError(QDBusError)));
}

void MCE::displayStateChanged(const QDBusMessage &message)
{
    
QString state message.arguments().at(0).toString();
    
setDisplayState(state);
}

void MCE::displayStateError(const QDBusError &error)
{

}

void MCE::setDisplayState(const QString &state)
{
    if (!
state.isEmpty()) {
        if (
state == MCE_DISPLAY_ON_STRING)
            ;   
//Display on
        
else if (state == MCE_DISPLAY_OFF_STRING)
            ;   
//Display off
    
}


Last edited by Diph; 2010-08-19 at 05:29.
 

The Following 3 Users Say Thank You to Diph For This Useful Post: