Skip to content

Instantly share code, notes, and snippets.

@kimmoli

kimmoli/myclass.cpp

Last active Aug 29, 2015
Embed
What would you like to do?
Cover animation disable
#include <QDBusConnection>
...
QDBusConnection::sessionBus().connect("", "/com/jolla/lipstick", "com.jolla.lipstick", "coverstatus",
this, SLOT(handleCoverstatus(const QDBusMessage&)));
...
void myclass::handleCoverstatus(const QDBusMessage& msg)
{
QList<QVariant> args = msg.arguments();
m_coverStatus = args.at(0).toInt();
emit coverStatusChanged();
}
#include <QDBusMessage>
...
Q_PROPERTY(int coverStatus READ readCoverStatus NOTIFY coverStatusChanged())
...
public:
int readCoverStatus() { return m_coverStatus; }
public slots:
void handleCoverstatus(const QDBusMessage& msg);
signals:
void coverStatusChanged();
private:
int m_coverStatus;
QT += dbus
BuildRequires: pkgconfig(Qt5DBus)
Timer
{
id: coverRefreshTimer
interval: 500
running: myclass.coverStatus === 2
repeat: true
onTriggered: updateCover()
}
@xkr47

This comment has been minimized.

Copy link

@xkr47 xkr47 commented Jun 28, 2015

what other values can coverStatus have? 😄

@xkr47

This comment has been minimized.

Copy link

@xkr47 xkr47 commented Jun 30, 2015

Forked it, also disables timer when display is blanked 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment