From 0d8b5446e880298d89511dd0bc0dbe328ccfce97 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 11 Sep 2011 03:31:14 +0200 Subject: Try to revert to previous state on SIGINT/SIGTERM. --- faker.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 faker.cpp (limited to 'faker.cpp') diff --git a/faker.cpp b/faker.cpp new file mode 100644 index 0000000..b512439 --- /dev/null +++ b/faker.cpp @@ -0,0 +1,25 @@ +#include "faker.h" + +#define SERVICE_NAME "com.javispedro.glol" + +Faker::Faker(const QString& val, QObject *parent) : + QObject(parent), _bus(QDBusConnection::sessionBus()), + _property(new FakeProperty("Screen.TopEdge")), + _adaptor(new FakePropertyAdaptor(_property)) +{ + _property->setValue(val); +} + +void Faker::start() +{ + _bus.registerObject(_adaptor->objectPath(), _property); + _bus.registerService(SERVICE_NAME); + _property->startFaking(); +} + +void Faker::stop() +{ + _property->stopFaking(); + _bus.unregisterService(SERVICE_NAME); + _bus.unregisterObject(_adaptor->objectPath()); +} -- cgit v1.2.3